Skip to content

Commit

Permalink
refactor(service-account): remove unsupported service account feature (
Browse files Browse the repository at this point in the history
  • Loading branch information
BugGambit authored Sep 18, 2024
1 parent e7cd2c3 commit 2219cf9
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 167 deletions.
55 changes: 0 additions & 55 deletions packages/stable/src/api/groups/groupsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { BaseResourceAPI } from '@cognite/sdk-core';
import type {
CogniteInternalId,
Group,
GroupServiceAccount,
GroupSpec,
ItemsWrapper,
ListGroups,
Expand Down Expand Up @@ -62,58 +61,4 @@ export class GroupsAPI extends BaseResourceAPI<Group> {
public delete = (ids: CogniteInternalId[]): Promise<object> => {
return super.deleteEndpoint(ids);
};

/**
* [List service accounts in a group](https://doc.cognitedata.com/api/v1/#operation/getMembersOfGroups)
*
* ```js
* const serviceAccounts = await client.groups.listServiceAccounts(921923342342323);
* ```
*/
public listServiceAccounts = async (
groupId: CogniteInternalId
): Promise<GroupServiceAccount[]> => {
const path = this.encodeServiceAccountUrl(groupId);
const response = await this.get<ItemsWrapper<GroupServiceAccount[]>>(path);
return this.addToMapAndReturn(response.data.items, response);
};

/**
* [Add service accounts to a group](https://doc.cognitedata.com/api/v1/#operation/addServiceAccountsToGroup)
*
* ```js
* await client.groups.addServiceAccounts(921923342342323, [123312763989213, 23232789217132]);
* ```
*/
public addServiceAccounts = async (
groupId: CogniteInternalId,
serviceAccountIds: CogniteInternalId[]
): Promise<object> => {
const path = this.encodeServiceAccountUrl(groupId);
const response = await this.post<object>(path, {
data: { items: serviceAccountIds },
});
return this.addToMapAndReturn({}, response);
};

/**
* [Remove service accounts from a group](https://doc.cognitedata.com/api/v1/#operation/removeServiceAccountsFromGroup)
*
* ```js
* await client.groups.removeServiceAccounts(921923342342323, [123312763989213, 23232789217132]);
* ```
*/
public removeServiceAccounts = async (
groupId: CogniteInternalId,
serviceAccountIds: CogniteInternalId[]
): Promise<object> => {
const path = `${this.encodeServiceAccountUrl(groupId)}/remove`;
const response = await this.post<object>(path, {
data: { items: serviceAccountIds },
});
return this.addToMapAndReturn({}, response);
};

private encodeServiceAccountUrl = (groupId: number) =>
this.url(`${groupId}/serviceaccounts`);
}
57 changes: 0 additions & 57 deletions packages/stable/src/api/serviceAccounts/serviceAccountsApi.ts

This file was deleted.

9 changes: 0 additions & 9 deletions packages/stable/src/cogniteClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { RawAPI } from './api/raw/rawApi';
import { RelationshipsApi } from './api/relationships/relationshipsApi';
import { SecurityCategoriesAPI } from './api/securityCategories/securityCategoriesApi';
import { SequencesAPI } from './api/sequences/sequencesApi';
import { ServiceAccountsAPI } from './api/serviceAccounts/serviceAccountsApi';
import { SpacesAPI } from './api/spaces/spacesApi';
import {
TemplateGraphQlApi,
Expand Down Expand Up @@ -80,9 +79,6 @@ export default class CogniteClient extends BaseCogniteClient {
public get securityCategories() {
return accessApi(this.securityCategoriesApi);
}
public get serviceAccounts() {
return accessApi(this.serviceAccountsApi);
}
public get models3D() {
return accessApi(this.models3DApi);
}
Expand Down Expand Up @@ -190,7 +186,6 @@ export default class CogniteClient extends BaseCogniteClient {
private projectsApi?: ProjectsAPI;
private groupsApi?: GroupsAPI;
private securityCategoriesApi?: SecurityCategoriesAPI;
private serviceAccountsApi?: ServiceAccountsAPI;
private models3DApi?: Models3DAPI;
private relationshipsApi?: RelationshipsApi;
private entityMatchingApi?: EntityMatchingApi;
Expand Down Expand Up @@ -239,10 +234,6 @@ export default class CogniteClient extends BaseCogniteClient {
SecurityCategoriesAPI,
'securitycategories'
);
this.serviceAccountsApi = this.apiFactory(
ServiceAccountsAPI,
'serviceaccounts'
);
this.models3DApi = this.apiFactory(Models3DAPI, models3DPath);
this.relationshipsApi = this.apiFactory(RelationshipsApi, 'relationships');
this.entityMatchingApi = this.apiFactory(
Expand Down
1 change: 0 additions & 1 deletion packages/stable/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export { RelationshipsApi } from './api/relationships/relationshipsApi';
export { SecurityCategoriesAPI } from './api/securityCategories/securityCategoriesApi';
export { SequenceRowsAPI } from './api/sequences/sequenceRowsApi';
export { SequencesAPI } from './api/sequences/sequencesApi';
export { ServiceAccountsAPI } from './api/serviceAccounts/serviceAccountsApi';
export { SyntheticTimeSeriesAPI } from './api/timeSeries/syntheticTimeSeriesApi';
export { TimeSeriesAPI } from './api/timeSeries/timeSeriesApi';
export * from './api/templates';
Expand Down
45 changes: 0 additions & 45 deletions packages/stable/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1374,27 +1374,6 @@ export function isManagedExternallyGroup(
*/
export type GroupName = string;

export interface GroupServiceAccount {
/**
* Unique name of the service account
* @example [email protected]
*/
name: string;
id: CogniteInternalId;
/**
* List of group ids
*/
groups: CogniteInternalId[];
/**
* If this service account has been logically deleted
*/
isDeleted: boolean;
/**
* Time of deletion
*/
deletedTime?: Date;
}

/**
* ID of the group in the source. If this is the same ID as a group in the IDP, a user in that group will implicitly be a part of this group as well.
* @example b7c9a5a4-99c2-4785-bed3-5e6ad9a78603
Expand Down Expand Up @@ -2273,30 +2252,6 @@ export const SequenceValueType = {
*/
export type SequenceValueType = 'STRING' | 'DOUBLE' | 'LONG';

export interface ServiceAccount {
name: ServiceAccountName;
groups?: Groups;
id: CogniteInternalId;
/**
* If this service account has been logically deleted
*/
isDeleted?: boolean;
/**
* Time of deletion
*/
deletedTime?: Date;
}

export interface ServiceAccountInput {
name: ServiceAccountName;
groups?: Groups;
}

/**
* Unique name of the service account
*/
export type ServiceAccountName = string;

export interface SetField<T> {
set: T;
}
Expand Down

0 comments on commit 2219cf9

Please sign in to comment.