Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Implement requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RPGPH committed Jan 24, 2023
1 parent 9177c9e commit 63bfdf6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/steps/account/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export function createAccountEntity(
return createIntegrationEntity({
entityData: {
source: {
id,
name,
},
assign: {
Expand Down
15 changes: 6 additions & 9 deletions src/steps/user-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Entity,
IntegrationStep,
IntegrationStepExecutionContext,
Relationship,
RelationshipClass,
} from '@jupiterone/integration-sdk-core';

Expand All @@ -24,21 +23,19 @@ export async function fetchUserGroups({
const accountEntity = (await jobState.getData(ACCOUNT_ENTITY_KEY)) as Entity;
const client = createSonarqubeClient(instance.config);

const convertedUserGroups: Entity[] = [];
const relationships: Relationship[] = [];
await client.iterateUserGroups((userGroup) => {
const userGroupEntity = createUserGroupEntity(userGroup);
convertedUserGroups.push(userGroupEntity);
relationships.push(
await client.iterateUserGroups(async (userGroup) => {
const userGroupEntity = await jobState.addEntity(
createUserGroupEntity(userGroup),
);

await jobState.addRelationship(
createDirectRelationship({
_class: RelationshipClass.HAS,
from: accountEntity,
to: userGroupEntity,
}),
);
});
await jobState.addEntities(convertedUserGroups);
await jobState.addRelationships(relationships);
}

export const userGroupSteps: IntegrationStep<SonarqubeIntegrationConfig>[] = [
Expand Down

0 comments on commit 63bfdf6

Please sign in to comment.