forked from JupiterOne-Archives/graph-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request JupiterOne-Archives#13 from DualbootPartnersLLC/fe…
…ature/ingest_deployments Feature/ingest deployments
- Loading branch information
Showing
48 changed files
with
1,554 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
338 changes: 338 additions & 0 deletions
338
src/converters/entities/DeploymentEntityConverter.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
DEPLOYMENT_ENTITY_CLASS, | ||
DEPLOYMENT_ENTITY_TYPE, | ||
DeploymentEntity, | ||
} from "../../jupiterone"; | ||
import { NamespaceData } from "../../openshift/types"; | ||
import { generateEntityKey } from "../../utils/generateKeys"; | ||
import getTime from "../../utils/getTime"; | ||
|
||
export function createDeploymentEntities( | ||
namespaces: NamespaceData[], | ||
): DeploymentEntity[] { | ||
const defaultEntities: DeploymentEntity[] = []; | ||
|
||
return namespaces.reduce((acc, namespace) => { | ||
const entities = namespace.deployments.reduce((deployments, item) => { | ||
const entity: DeploymentEntity = { | ||
_class: DEPLOYMENT_ENTITY_CLASS, | ||
_key: generateEntityKey(DEPLOYMENT_ENTITY_TYPE, item.metadata.uid), | ||
_type: DEPLOYMENT_ENTITY_TYPE, | ||
displayName: item.metadata.name, | ||
name: item.metadata.name, | ||
isActive: item.status.replicas > 0, | ||
createdOn: getTime(item.metadata.creationTimestamp)!, | ||
}; | ||
|
||
return [...deployments, entity]; | ||
}, defaultEntities); | ||
|
||
return [...acc, ...entities]; | ||
}, defaultEntities); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.