From 326716d2d1a27bd4766371b188c48c6544677900 Mon Sep 17 00:00:00 2001 From: priyanshishikha Date: Thu, 29 Aug 2024 11:47:05 +0530 Subject: [PATCH 1/2] translated to new integrators schema --- june2024v2july2024/integrators.go | 109 ++ june2024v2july2024/july2024/queries.graphql | 6 + .../july2024/schema-generated.go | 1391 +++++++++++++++++ june2024v2july2024/june2024v2/queries.graphql | 16 + .../june2024v2/schema-generated.go | 105 ++ june2024v2july2024/upgradeSteps.go | 4 + 6 files changed, 1631 insertions(+) create mode 100644 june2024v2july2024/integrators.go diff --git a/june2024v2july2024/integrators.go b/june2024v2july2024/integrators.go new file mode 100644 index 0000000..835dbab --- /dev/null +++ b/june2024v2july2024/integrators.go @@ -0,0 +1,109 @@ +package june2024v2july2024 + +import ( + "context" + "encoding/json" + "fmt" + "upgradationScript/june2024v2july2024/july2024" + "upgradationScript/june2024v2july2024/june2024v2" + "upgradationScript/logger" + + "github.com/Khan/genqlient/graphql" +) + +func performIntegratorsTransition(prodDgraphClient, expDgraphClient graphql.Client) error { + + ctx := context.Background() + + existingIntegrators, err := june2024v2.QueryExistingIntegrators(ctx, prodDgraphClient) + if err != nil { + return fmt.Errorf("performIntegratorsTransition: QueryExistingIntegrators: could'nt query old prod integrators to initiate transition error: %s", err.Error()) + } + + logger.Sl.Debugf("--------------Commencing scanned files transition iterations to complete %d -----------------", len(existingIntegrators.QueryIntegrator)) + + if len(existingIntegrators.QueryIntegrator) == 0 { + logger.Sl.Debugf("No Integrators Found while running performIntegratorsTransition") + } + + integratorTypeGrouping := make(map[string]july2024.AddIntegratorInput) + for iter, eachIntegrator := range existingIntegrators.QueryIntegrator { + logger.Logger.Debug("---------------------------------------------") + logger.Sl.Debugf("existing integrators Iteration %d to begin", iter) + + var existingIntegratorData map[string]string + if err := json.Unmarshal([]byte(eachIntegrator.Credentials.Data), &existingIntegratorData); err != nil { + logger.Sl.Errorf("error: performIntegratorsTransition: Unmarshal: %s for integrator type: %s", err.Error(), eachIntegrator.Type) + continue + } + + var configValues []*july2024.IntegratorKeyValuesRef + for key, eachConfigData := range existingIntegratorData { + encrypt := IsEncryptionRequired(key) + configValues = append(configValues, &july2024.IntegratorKeyValuesRef{ + Key: key, + Value: eachConfigData, + Encrypt: &encrypt, + }) + } + + configTemp := july2024.IntegratorConfigsRef{ + Name: eachIntegrator.Name, + Configs: configValues, + } + + if val, ok := integratorTypeGrouping[eachIntegrator.Type]; ok { + + val.IntegratorConfigs = append(val.IntegratorConfigs, &configTemp) + integratorTypeGrouping[eachIntegrator.Type] = val + + } else { + + integratorTypeGrouping[eachIntegrator.Type] = july2024.AddIntegratorInput{ + Organization: &july2024.OrganizationRef{ + Id: eachIntegrator.Organization.Id, + }, + Type: eachIntegrator.Type, + Category: eachIntegrator.Category, + Status: "not-connected", + IntegratorConfigs: []*july2024.IntegratorConfigsRef{&configTemp}, + } + } + logger.Sl.Debugf("existing integrators Iteration %d completed", iter) + } + + var translatedIntegators []*july2024.AddIntegratorInput + for _, val := range integratorTypeGrouping { + translatedIntegators = append(translatedIntegators, &val) + } + + logger.Sl.Debug("adding Integrators to the database") + + if _, err := july2024.AddIntegrator(ctx, expDgraphClient, translatedIntegators); err != nil { + return fmt.Errorf("error: performIntegratorsTransition: AddIntegrator error: %s", err.Error()) + } + logger.Sl.Debug("added Integrators to the database") + + logger.Logger.Info("------------Integrators upgrade complete-------------------------") + + return nil +} + +func IsEncryptionRequired(configKey string) (isRequired bool) { + + switch configKey { + case "token": + isRequired = true + case "password": + isRequired = true + case "awsAccessKey": + isRequired = true + case "awsSecretKey": + isRequired = true + case "key": + isRequired = true + default: + isRequired = false + } + return isRequired +} diff --git a/june2024v2july2024/july2024/queries.graphql b/june2024v2july2024/july2024/queries.graphql index 76968a2..80d09c4 100644 --- a/june2024v2july2024/july2024/queries.graphql +++ b/june2024v2july2024/july2024/queries.graphql @@ -23,4 +23,10 @@ mutation UpdateVulnScanState { updateArtifactScanData(input: { set: { vulnScanState: "done" }, filter: { } }) { numUids } +} + +mutation AddIntegrator($value: [AddIntegratorInput!]!) { + addIntegrator(input: $value) { + numUids + } } \ No newline at end of file diff --git a/june2024v2july2024/july2024/schema-generated.go b/june2024v2july2024/july2024/schema-generated.go index 7e5aa68..8bae31d 100644 --- a/june2024v2july2024/july2024/schema-generated.go +++ b/june2024v2july2024/july2024/schema-generated.go @@ -4,10 +4,695 @@ package july2024 import ( "context" + "time" "github.com/Khan/genqlient/graphql" ) +// AddIntegratorAddIntegratorAddIntegratorPayload includes the requested fields of the GraphQL type AddIntegratorPayload. +type AddIntegratorAddIntegratorAddIntegratorPayload struct { + NumUids *int `json:"numUids"` +} + +// GetNumUids returns AddIntegratorAddIntegratorAddIntegratorPayload.NumUids, and is useful for accessing the field via an interface. +func (v *AddIntegratorAddIntegratorAddIntegratorPayload) GetNumUids() *int { return v.NumUids } + +type AddIntegratorInput struct { + Id string `json:"id"` + Organization *OrganizationRef `json:"organization,omitempty"` + Type string `json:"type"` + Category string `json:"category"` + Status string `json:"status"` + IntegratorConfigs []*IntegratorConfigsRef `json:"integratorConfigs,omitempty"` + FeatureConfigs []*FeatureModeRef `json:"featureConfigs,omitempty"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// GetId returns AddIntegratorInput.Id, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetId() string { return v.Id } + +// GetOrganization returns AddIntegratorInput.Organization, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetOrganization() *OrganizationRef { return v.Organization } + +// GetType returns AddIntegratorInput.Type, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetType() string { return v.Type } + +// GetCategory returns AddIntegratorInput.Category, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetCategory() string { return v.Category } + +// GetStatus returns AddIntegratorInput.Status, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetStatus() string { return v.Status } + +// GetIntegratorConfigs returns AddIntegratorInput.IntegratorConfigs, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetIntegratorConfigs() []*IntegratorConfigsRef { + return v.IntegratorConfigs +} + +// GetFeatureConfigs returns AddIntegratorInput.FeatureConfigs, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetFeatureConfigs() []*FeatureModeRef { return v.FeatureConfigs } + +// GetCreatedAt returns AddIntegratorInput.CreatedAt, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns AddIntegratorInput.UpdatedAt, and is useful for accessing the field via an interface. +func (v *AddIntegratorInput) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// AddIntegratorResponse is returned by AddIntegrator on success. +type AddIntegratorResponse struct { + AddIntegrator *AddIntegratorAddIntegratorAddIntegratorPayload `json:"addIntegrator"` +} + +// GetAddIntegrator returns AddIntegratorResponse.AddIntegrator, and is useful for accessing the field via an interface. +func (v *AddIntegratorResponse) GetAddIntegrator() *AddIntegratorAddIntegratorAddIntegratorPayload { + return v.AddIntegrator +} + +type ApplicationDeploymentRef struct { + // id is randomly assigned + Id string `json:"id"` + Artifact []*ArtifactRef `json:"artifact,omitempty"` + ApplicationEnvironment *ApplicationEnvironmentRef `json:"applicationEnvironment,omitempty"` + DeployedAt *time.Time `json:"deployedAt"` + // deploymentStage is an enum and can be discovered, current, previous or blocked + DeploymentStage DeploymentStage `json:"deploymentStage"` + // source is argo, spinnaker etc + Source string `json:"source"` + // component would be a service + Component string `json:"component"` + // user who deployed the artifact + DeployedBy string `json:"deployedBy"` + ToolsUsed *ToolsUsedRef `json:"toolsUsed,omitempty"` + DeploymentRisk *ApplicationDeploymentRiskRef `json:"deploymentRisk,omitempty"` + PolicyRunHistory []*RunHistoryRef `json:"policyRunHistory,omitempty"` +} + +// GetId returns ApplicationDeploymentRef.Id, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetId() string { return v.Id } + +// GetArtifact returns ApplicationDeploymentRef.Artifact, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetArtifact() []*ArtifactRef { return v.Artifact } + +// GetApplicationEnvironment returns ApplicationDeploymentRef.ApplicationEnvironment, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetApplicationEnvironment() *ApplicationEnvironmentRef { + return v.ApplicationEnvironment +} + +// GetDeployedAt returns ApplicationDeploymentRef.DeployedAt, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetDeployedAt() *time.Time { return v.DeployedAt } + +// GetDeploymentStage returns ApplicationDeploymentRef.DeploymentStage, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetDeploymentStage() DeploymentStage { return v.DeploymentStage } + +// GetSource returns ApplicationDeploymentRef.Source, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetSource() string { return v.Source } + +// GetComponent returns ApplicationDeploymentRef.Component, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetComponent() string { return v.Component } + +// GetDeployedBy returns ApplicationDeploymentRef.DeployedBy, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetDeployedBy() string { return v.DeployedBy } + +// GetToolsUsed returns ApplicationDeploymentRef.ToolsUsed, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetToolsUsed() *ToolsUsedRef { return v.ToolsUsed } + +// GetDeploymentRisk returns ApplicationDeploymentRef.DeploymentRisk, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetDeploymentRisk() *ApplicationDeploymentRiskRef { + return v.DeploymentRisk +} + +// GetPolicyRunHistory returns ApplicationDeploymentRef.PolicyRunHistory, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRef) GetPolicyRunHistory() []*RunHistoryRef { return v.PolicyRunHistory } + +type ApplicationDeploymentRiskRef struct { + Id *string `json:"id"` + SourceCodeAlertsScore *int `json:"sourceCodeAlertsScore"` + BuildAlertsScore *int `json:"buildAlertsScore"` + ArtifactAlertsScore *int `json:"artifactAlertsScore"` + DeploymentAlertsScore *int `json:"deploymentAlertsScore"` + DeploymentRiskStatus RiskStatus `json:"deploymentRiskStatus"` + ApplicationDeployment *ApplicationDeploymentRef `json:"applicationDeployment,omitempty"` +} + +// GetId returns ApplicationDeploymentRiskRef.Id, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetId() *string { return v.Id } + +// GetSourceCodeAlertsScore returns ApplicationDeploymentRiskRef.SourceCodeAlertsScore, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetSourceCodeAlertsScore() *int { + return v.SourceCodeAlertsScore +} + +// GetBuildAlertsScore returns ApplicationDeploymentRiskRef.BuildAlertsScore, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetBuildAlertsScore() *int { return v.BuildAlertsScore } + +// GetArtifactAlertsScore returns ApplicationDeploymentRiskRef.ArtifactAlertsScore, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetArtifactAlertsScore() *int { return v.ArtifactAlertsScore } + +// GetDeploymentAlertsScore returns ApplicationDeploymentRiskRef.DeploymentAlertsScore, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetDeploymentAlertsScore() *int { + return v.DeploymentAlertsScore +} + +// GetDeploymentRiskStatus returns ApplicationDeploymentRiskRef.DeploymentRiskStatus, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetDeploymentRiskStatus() RiskStatus { + return v.DeploymentRiskStatus +} + +// GetApplicationDeployment returns ApplicationDeploymentRiskRef.ApplicationDeployment, and is useful for accessing the field via an interface. +func (v *ApplicationDeploymentRiskRef) GetApplicationDeployment() *ApplicationDeploymentRef { + return v.ApplicationDeployment +} + +type ApplicationEnvironmentRef struct { + // id is randomly assigned + Id string `json:"id"` + Environment *EnvironmentRef `json:"environment,omitempty"` + Application *ApplicationRef `json:"application,omitempty"` + DeploymentTarget *DeploymentTargetRef `json:"deploymentTarget,omitempty"` + Namespace string `json:"namespace"` + // toolsUsed is a comma-separated string that contains all the tools(source, build, artifact, deploy etc) for an app env + ToolsUsed []string `json:"toolsUsed"` + Deployments []*ApplicationDeploymentRef `json:"deployments,omitempty"` + RiskStatus *ApplicationRiskStatusRef `json:"riskStatus,omitempty"` + Metadata []*KeyValueRef `json:"metadata,omitempty"` +} + +// GetId returns ApplicationEnvironmentRef.Id, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetId() string { return v.Id } + +// GetEnvironment returns ApplicationEnvironmentRef.Environment, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetEnvironment() *EnvironmentRef { return v.Environment } + +// GetApplication returns ApplicationEnvironmentRef.Application, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetApplication() *ApplicationRef { return v.Application } + +// GetDeploymentTarget returns ApplicationEnvironmentRef.DeploymentTarget, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetDeploymentTarget() *DeploymentTargetRef { + return v.DeploymentTarget +} + +// GetNamespace returns ApplicationEnvironmentRef.Namespace, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetNamespace() string { return v.Namespace } + +// GetToolsUsed returns ApplicationEnvironmentRef.ToolsUsed, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetToolsUsed() []string { return v.ToolsUsed } + +// GetDeployments returns ApplicationEnvironmentRef.Deployments, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetDeployments() []*ApplicationDeploymentRef { + return v.Deployments +} + +// GetRiskStatus returns ApplicationEnvironmentRef.RiskStatus, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetRiskStatus() *ApplicationRiskStatusRef { return v.RiskStatus } + +// GetMetadata returns ApplicationEnvironmentRef.Metadata, and is useful for accessing the field via an interface. +func (v *ApplicationEnvironmentRef) GetMetadata() []*KeyValueRef { return v.Metadata } + +type ApplicationRef struct { + // id is randomly assigned + Id string `json:"id"` + Name string `json:"name"` + Roles []*RoleRef `json:"roles,omitempty"` + Environments []*ApplicationEnvironmentRef `json:"environments,omitempty"` + Team *TeamRef `json:"team,omitempty"` + Policies []*PolicyDefinitionRef `json:"policies,omitempty"` + PolicyEnforcements []*PolicyEnforcementRef `json:"policyEnforcements,omitempty"` + Metadata []*KeyValueRef `json:"metadata,omitempty"` +} + +// GetId returns ApplicationRef.Id, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetId() string { return v.Id } + +// GetName returns ApplicationRef.Name, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetName() string { return v.Name } + +// GetRoles returns ApplicationRef.Roles, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetRoles() []*RoleRef { return v.Roles } + +// GetEnvironments returns ApplicationRef.Environments, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetEnvironments() []*ApplicationEnvironmentRef { return v.Environments } + +// GetTeam returns ApplicationRef.Team, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetTeam() *TeamRef { return v.Team } + +// GetPolicies returns ApplicationRef.Policies, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetPolicies() []*PolicyDefinitionRef { return v.Policies } + +// GetPolicyEnforcements returns ApplicationRef.PolicyEnforcements, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetPolicyEnforcements() []*PolicyEnforcementRef { return v.PolicyEnforcements } + +// GetMetadata returns ApplicationRef.Metadata, and is useful for accessing the field via an interface. +func (v *ApplicationRef) GetMetadata() []*KeyValueRef { return v.Metadata } + +type ApplicationRiskStatusRef struct { + Id *string `json:"id"` + RiskStatus RiskStatus `json:"riskStatus"` + SourceCodeAlerts *int `json:"sourceCodeAlerts"` + BuildAlerts *int `json:"buildAlerts"` + ArtifactAlerts *int `json:"artifactAlerts"` + DeploymentAlerts *int `json:"deploymentAlerts"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` + ApplicationEnvironment *ApplicationEnvironmentRef `json:"applicationEnvironment,omitempty"` +} + +// GetId returns ApplicationRiskStatusRef.Id, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetId() *string { return v.Id } + +// GetRiskStatus returns ApplicationRiskStatusRef.RiskStatus, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetRiskStatus() RiskStatus { return v.RiskStatus } + +// GetSourceCodeAlerts returns ApplicationRiskStatusRef.SourceCodeAlerts, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetSourceCodeAlerts() *int { return v.SourceCodeAlerts } + +// GetBuildAlerts returns ApplicationRiskStatusRef.BuildAlerts, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetBuildAlerts() *int { return v.BuildAlerts } + +// GetArtifactAlerts returns ApplicationRiskStatusRef.ArtifactAlerts, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetArtifactAlerts() *int { return v.ArtifactAlerts } + +// GetDeploymentAlerts returns ApplicationRiskStatusRef.DeploymentAlerts, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetDeploymentAlerts() *int { return v.DeploymentAlerts } + +// GetCreatedAt returns ApplicationRiskStatusRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns ApplicationRiskStatusRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetApplicationEnvironment returns ApplicationRiskStatusRef.ApplicationEnvironment, and is useful for accessing the field via an interface. +func (v *ApplicationRiskStatusRef) GetApplicationEnvironment() *ApplicationEnvironmentRef { + return v.ApplicationEnvironment +} + +type ArtifactRef struct { + Id string `json:"id"` + ArtifactType string `json:"artifactType"` + ArtifactName string `json:"artifactName"` + ArtifactTag string `json:"artifactTag"` + ArtifactSha string `json:"artifactSha"` + ScanData []*ArtifactScanDataRef `json:"scanData,omitempty"` + ArtifactDeployment []*ApplicationDeploymentRef `json:"artifactDeployment,omitempty"` + BuildDetails *BuildToolRef `json:"buildDetails,omitempty"` +} + +// GetId returns ArtifactRef.Id, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetId() string { return v.Id } + +// GetArtifactType returns ArtifactRef.ArtifactType, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetArtifactType() string { return v.ArtifactType } + +// GetArtifactName returns ArtifactRef.ArtifactName, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetArtifactName() string { return v.ArtifactName } + +// GetArtifactTag returns ArtifactRef.ArtifactTag, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetArtifactTag() string { return v.ArtifactTag } + +// GetArtifactSha returns ArtifactRef.ArtifactSha, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetArtifactSha() string { return v.ArtifactSha } + +// GetScanData returns ArtifactRef.ScanData, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetScanData() []*ArtifactScanDataRef { return v.ScanData } + +// GetArtifactDeployment returns ArtifactRef.ArtifactDeployment, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetArtifactDeployment() []*ApplicationDeploymentRef { + return v.ArtifactDeployment +} + +// GetBuildDetails returns ArtifactRef.BuildDetails, and is useful for accessing the field via an interface. +func (v *ArtifactRef) GetBuildDetails() *BuildToolRef { return v.BuildDetails } + +type ArtifactScanDataRef struct { + Id string `json:"id"` + ArtifactSha string `json:"artifactSha"` + Tool string `json:"tool"` + ArtifactDetails *ArtifactRef `json:"artifactDetails,omitempty"` + LastScannedAt *time.Time `json:"lastScannedAt"` + CreatedAt *time.Time `json:"createdAt"` + VulnTrackingId string `json:"vulnTrackingId"` + VulnScanState string `json:"vulnScanState"` + Components []*ComponentRef `json:"components,omitempty"` + VulnCriticalCount *int `json:"vulnCriticalCount"` + VulnHighCount *int `json:"vulnHighCount"` + VulnMediumCount *int `json:"vulnMediumCount"` + VulnLowCount *int `json:"vulnLowCount"` + VulnInfoCount *int `json:"vulnInfoCount"` + VulnUnknownCount *int `json:"vulnUnknownCount"` + VulnNoneCount *int `json:"vulnNoneCount"` + VulnTotalCount *int `json:"vulnTotalCount"` + ScanFile []*ScanFileResultRef `json:"scanFile,omitempty"` + RiskStatus RiskStatus `json:"riskStatus"` + ArtifactRunHistory []*RunHistoryRef `json:"artifactRunHistory,omitempty"` +} + +// GetId returns ArtifactScanDataRef.Id, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetId() string { return v.Id } + +// GetArtifactSha returns ArtifactScanDataRef.ArtifactSha, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetArtifactSha() string { return v.ArtifactSha } + +// GetTool returns ArtifactScanDataRef.Tool, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetTool() string { return v.Tool } + +// GetArtifactDetails returns ArtifactScanDataRef.ArtifactDetails, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetArtifactDetails() *ArtifactRef { return v.ArtifactDetails } + +// GetLastScannedAt returns ArtifactScanDataRef.LastScannedAt, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetLastScannedAt() *time.Time { return v.LastScannedAt } + +// GetCreatedAt returns ArtifactScanDataRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetVulnTrackingId returns ArtifactScanDataRef.VulnTrackingId, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnTrackingId() string { return v.VulnTrackingId } + +// GetVulnScanState returns ArtifactScanDataRef.VulnScanState, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnScanState() string { return v.VulnScanState } + +// GetComponents returns ArtifactScanDataRef.Components, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetComponents() []*ComponentRef { return v.Components } + +// GetVulnCriticalCount returns ArtifactScanDataRef.VulnCriticalCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnCriticalCount() *int { return v.VulnCriticalCount } + +// GetVulnHighCount returns ArtifactScanDataRef.VulnHighCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnHighCount() *int { return v.VulnHighCount } + +// GetVulnMediumCount returns ArtifactScanDataRef.VulnMediumCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnMediumCount() *int { return v.VulnMediumCount } + +// GetVulnLowCount returns ArtifactScanDataRef.VulnLowCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnLowCount() *int { return v.VulnLowCount } + +// GetVulnInfoCount returns ArtifactScanDataRef.VulnInfoCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnInfoCount() *int { return v.VulnInfoCount } + +// GetVulnUnknownCount returns ArtifactScanDataRef.VulnUnknownCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnUnknownCount() *int { return v.VulnUnknownCount } + +// GetVulnNoneCount returns ArtifactScanDataRef.VulnNoneCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnNoneCount() *int { return v.VulnNoneCount } + +// GetVulnTotalCount returns ArtifactScanDataRef.VulnTotalCount, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetVulnTotalCount() *int { return v.VulnTotalCount } + +// GetScanFile returns ArtifactScanDataRef.ScanFile, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetScanFile() []*ScanFileResultRef { return v.ScanFile } + +// GetRiskStatus returns ArtifactScanDataRef.RiskStatus, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetRiskStatus() RiskStatus { return v.RiskStatus } + +// GetArtifactRunHistory returns ArtifactScanDataRef.ArtifactRunHistory, and is useful for accessing the field via an interface. +func (v *ArtifactScanDataRef) GetArtifactRunHistory() []*RunHistoryRef { return v.ArtifactRunHistory } + +type BuildToolRef struct { + // id is randomly assigned + Id string `json:"id"` + // buildId is a unique job id, run id for a job/pipeline/action + BuildId string `json:"buildId"` + // tool is jenkins etc + Tool string `json:"tool"` + // buildName is the name of the job/pipeline/action + BuildName string `json:"buildName"` + BuildUrl string `json:"buildUrl"` + ArtifactType string `json:"artifactType"` + // artifact would be something like nginx without the tag + Artifact string `json:"artifact"` + // artifactTag would be the tag of the artifact + ArtifactTag string `json:"artifactTag"` + // digest is the sha of the artifact + Digest string `json:"digest"` + // buildDigest is the sha of the artifact as sent from the build tool + BuildDigest string `json:"buildDigest"` + ArtifactNode *ArtifactRef `json:"artifactNode,omitempty"` + // buildTime is the time at which the artifact was built + BuildTime *time.Time `json:"buildTime"` + // buildUser is the user that built the artifact + BuildUser string `json:"buildUser"` + SourceCodeTool *SourceCodeToolRef `json:"sourceCodeTool,omitempty"` + CommitMetaData []*CommitMetaDataRef `json:"commitMetaData,omitempty"` + CreatedAt *time.Time `json:"createdAt"` +} + +// GetId returns BuildToolRef.Id, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetId() string { return v.Id } + +// GetBuildId returns BuildToolRef.BuildId, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetBuildId() string { return v.BuildId } + +// GetTool returns BuildToolRef.Tool, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetTool() string { return v.Tool } + +// GetBuildName returns BuildToolRef.BuildName, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetBuildName() string { return v.BuildName } + +// GetBuildUrl returns BuildToolRef.BuildUrl, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetBuildUrl() string { return v.BuildUrl } + +// GetArtifactType returns BuildToolRef.ArtifactType, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetArtifactType() string { return v.ArtifactType } + +// GetArtifact returns BuildToolRef.Artifact, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetArtifact() string { return v.Artifact } + +// GetArtifactTag returns BuildToolRef.ArtifactTag, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetArtifactTag() string { return v.ArtifactTag } + +// GetDigest returns BuildToolRef.Digest, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetDigest() string { return v.Digest } + +// GetBuildDigest returns BuildToolRef.BuildDigest, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetBuildDigest() string { return v.BuildDigest } + +// GetArtifactNode returns BuildToolRef.ArtifactNode, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetArtifactNode() *ArtifactRef { return v.ArtifactNode } + +// GetBuildTime returns BuildToolRef.BuildTime, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetBuildTime() *time.Time { return v.BuildTime } + +// GetBuildUser returns BuildToolRef.BuildUser, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetBuildUser() string { return v.BuildUser } + +// GetSourceCodeTool returns BuildToolRef.SourceCodeTool, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetSourceCodeTool() *SourceCodeToolRef { return v.SourceCodeTool } + +// GetCommitMetaData returns BuildToolRef.CommitMetaData, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetCommitMetaData() []*CommitMetaDataRef { return v.CommitMetaData } + +// GetCreatedAt returns BuildToolRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *BuildToolRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +type CWERef struct { + Id string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` +} + +// GetId returns CWERef.Id, and is useful for accessing the field via an interface. +func (v *CWERef) GetId() string { return v.Id } + +// GetName returns CWERef.Name, and is useful for accessing the field via an interface. +func (v *CWERef) GetName() string { return v.Name } + +// GetDescription returns CWERef.Description, and is useful for accessing the field via an interface. +func (v *CWERef) GetDescription() string { return v.Description } + +type CommitMetaDataRef struct { + // id is randomly assigned + Id *string `json:"id"` + // commit is a git commit that was used to build an artifact + Commit string `json:"commit"` + Repository string `json:"repository"` + // commitSign tells us whether the commit is signed + CommitSign *bool `json:"commitSign"` + NoOfReviewersConf *int `json:"noOfReviewersConf"` + ReviewerList []string `json:"reviewerList"` + ApproverList []string `json:"approverList"` + BuildTool *BuildToolRef `json:"buildTool,omitempty"` +} + +// GetId returns CommitMetaDataRef.Id, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetId() *string { return v.Id } + +// GetCommit returns CommitMetaDataRef.Commit, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetCommit() string { return v.Commit } + +// GetRepository returns CommitMetaDataRef.Repository, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetRepository() string { return v.Repository } + +// GetCommitSign returns CommitMetaDataRef.CommitSign, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetCommitSign() *bool { return v.CommitSign } + +// GetNoOfReviewersConf returns CommitMetaDataRef.NoOfReviewersConf, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetNoOfReviewersConf() *int { return v.NoOfReviewersConf } + +// GetReviewerList returns CommitMetaDataRef.ReviewerList, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetReviewerList() []string { return v.ReviewerList } + +// GetApproverList returns CommitMetaDataRef.ApproverList, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetApproverList() []string { return v.ApproverList } + +// GetBuildTool returns CommitMetaDataRef.BuildTool, and is useful for accessing the field via an interface. +func (v *CommitMetaDataRef) GetBuildTool() *BuildToolRef { return v.BuildTool } + +type ComponentRef struct { + Id string `json:"id"` + Type string `json:"type"` + Name string `json:"name"` + Version string `json:"version"` + Licenses []string `json:"licenses"` + Purl string `json:"purl"` + Cpe string `json:"cpe"` + ScannedAt *time.Time `json:"scannedAt"` + Vulnerabilities []*VulnerabilityRef `json:"vulnerabilities,omitempty"` + Artifacts []*ArtifactScanDataRef `json:"artifacts,omitempty"` +} + +// GetId returns ComponentRef.Id, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetId() string { return v.Id } + +// GetType returns ComponentRef.Type, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetType() string { return v.Type } + +// GetName returns ComponentRef.Name, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetName() string { return v.Name } + +// GetVersion returns ComponentRef.Version, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetVersion() string { return v.Version } + +// GetLicenses returns ComponentRef.Licenses, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetLicenses() []string { return v.Licenses } + +// GetPurl returns ComponentRef.Purl, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetPurl() string { return v.Purl } + +// GetCpe returns ComponentRef.Cpe, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetCpe() string { return v.Cpe } + +// GetScannedAt returns ComponentRef.ScannedAt, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetScannedAt() *time.Time { return v.ScannedAt } + +// GetVulnerabilities returns ComponentRef.Vulnerabilities, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetVulnerabilities() []*VulnerabilityRef { return v.Vulnerabilities } + +// GetArtifacts returns ComponentRef.Artifacts, and is useful for accessing the field via an interface. +func (v *ComponentRef) GetArtifacts() []*ArtifactScanDataRef { return v.Artifacts } + +// DeploymentStage is an enum denoting the stage of the deployment. . +type DeploymentStage string + +const ( + // deployment is discovered from the events + DeploymentStageDiscovered DeploymentStage = "discovered" + // scanning is under process + DeploymentStageScanning DeploymentStage = "scanning" + // deployment is known to have passed the deployment firewall and the deployment(ie the artifact) is live + DeploymentStageCurrent DeploymentStage = "current" + // deployment becomes a past deployment because another fresh deployment has happened + DeploymentStagePrevious DeploymentStage = "previous" + // deployment is blocked by the firewall + DeploymentStageBlocked DeploymentStage = "blocked" +) + +type DeploymentTargetRef struct { + // id is randomly assigned + Id string `json:"id"` + Name string `json:"name"` + // this would be the ip/server address of the target environment + Ip string `json:"ip"` + Account string `json:"account"` + // this would be something like aws, gcp etc + TargetType string `json:"targetType"` + // this would be something like us-east-1 etc + Region string `json:"region"` + KubescapeServiceConnected string `json:"kubescapeServiceConnected"` + IsFirewall *bool `json:"isFirewall"` + Organization *OrganizationRef `json:"organization,omitempty"` + DefaultEnvironment *EnvironmentRef `json:"defaultEnvironment,omitempty"` +} + +// GetId returns DeploymentTargetRef.Id, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetId() string { return v.Id } + +// GetName returns DeploymentTargetRef.Name, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetName() string { return v.Name } + +// GetIp returns DeploymentTargetRef.Ip, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetIp() string { return v.Ip } + +// GetAccount returns DeploymentTargetRef.Account, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetAccount() string { return v.Account } + +// GetTargetType returns DeploymentTargetRef.TargetType, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetTargetType() string { return v.TargetType } + +// GetRegion returns DeploymentTargetRef.Region, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetRegion() string { return v.Region } + +// GetKubescapeServiceConnected returns DeploymentTargetRef.KubescapeServiceConnected, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetKubescapeServiceConnected() string { + return v.KubescapeServiceConnected +} + +// GetIsFirewall returns DeploymentTargetRef.IsFirewall, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetIsFirewall() *bool { return v.IsFirewall } + +// GetOrganization returns DeploymentTargetRef.Organization, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetOrganization() *OrganizationRef { return v.Organization } + +// GetDefaultEnvironment returns DeploymentTargetRef.DefaultEnvironment, and is useful for accessing the field via an interface. +func (v *DeploymentTargetRef) GetDefaultEnvironment() *EnvironmentRef { return v.DefaultEnvironment } + +type EnvironmentRef struct { + Id string `json:"id"` + Organization *OrganizationRef `json:"organization,omitempty"` + Purpose string `json:"purpose"` +} + +// GetId returns EnvironmentRef.Id, and is useful for accessing the field via an interface. +func (v *EnvironmentRef) GetId() string { return v.Id } + +// GetOrganization returns EnvironmentRef.Organization, and is useful for accessing the field via an interface. +func (v *EnvironmentRef) GetOrganization() *OrganizationRef { return v.Organization } + +// GetPurpose returns EnvironmentRef.Purpose, and is useful for accessing the field via an interface. +func (v *EnvironmentRef) GetPurpose() string { return v.Purpose } + +type FeatureModeRef struct { + Id string `json:"id"` + Organization *OrganizationRef `json:"organization,omitempty"` + Key string `json:"key"` + Value string `json:"value"` + Category string `json:"category"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` + Integrator *IntegratorRef `json:"integrator,omitempty"` +} + +// GetId returns FeatureModeRef.Id, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetId() string { return v.Id } + +// GetOrganization returns FeatureModeRef.Organization, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetOrganization() *OrganizationRef { return v.Organization } + +// GetKey returns FeatureModeRef.Key, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetKey() string { return v.Key } + +// GetValue returns FeatureModeRef.Value, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetValue() string { return v.Value } + +// GetCategory returns FeatureModeRef.Category, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetCategory() string { return v.Category } + +// GetCreatedAt returns FeatureModeRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns FeatureModeRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetIntegrator returns FeatureModeRef.Integrator, and is useful for accessing the field via an interface. +func (v *FeatureModeRef) GetIntegrator() *IntegratorRef { return v.Integrator } + // GetSeverityFromSecurityIssueQuerySecurityIssue includes the requested fields of the GraphQL type SecurityIssue. type GetSeverityFromSecurityIssueQuerySecurityIssue struct { Severity Severity `json:"Severity"` @@ -30,6 +715,391 @@ func (v *GetSeverityFromSecurityIssueResponse) GetQuerySecurityIssue() []*GetSev return v.QuerySecurityIssue } +type IntegratorConfigsRef struct { + Id *string `json:"id"` + Name string `json:"name"` + Configs []*IntegratorKeyValuesRef `json:"configs,omitempty"` + Integrator *IntegratorRef `json:"integrator,omitempty"` +} + +// GetId returns IntegratorConfigsRef.Id, and is useful for accessing the field via an interface. +func (v *IntegratorConfigsRef) GetId() *string { return v.Id } + +// GetName returns IntegratorConfigsRef.Name, and is useful for accessing the field via an interface. +func (v *IntegratorConfigsRef) GetName() string { return v.Name } + +// GetConfigs returns IntegratorConfigsRef.Configs, and is useful for accessing the field via an interface. +func (v *IntegratorConfigsRef) GetConfigs() []*IntegratorKeyValuesRef { return v.Configs } + +// GetIntegrator returns IntegratorConfigsRef.Integrator, and is useful for accessing the field via an interface. +func (v *IntegratorConfigsRef) GetIntegrator() *IntegratorRef { return v.Integrator } + +type IntegratorKeyValuesRef struct { + Key string `json:"key"` + Value string `json:"value"` + Encrypt *bool `json:"encrypt"` +} + +// GetKey returns IntegratorKeyValuesRef.Key, and is useful for accessing the field via an interface. +func (v *IntegratorKeyValuesRef) GetKey() string { return v.Key } + +// GetValue returns IntegratorKeyValuesRef.Value, and is useful for accessing the field via an interface. +func (v *IntegratorKeyValuesRef) GetValue() string { return v.Value } + +// GetEncrypt returns IntegratorKeyValuesRef.Encrypt, and is useful for accessing the field via an interface. +func (v *IntegratorKeyValuesRef) GetEncrypt() *bool { return v.Encrypt } + +type IntegratorRef struct { + Id string `json:"id"` + Organization *OrganizationRef `json:"organization,omitempty"` + Type string `json:"type"` + Category string `json:"category"` + Status string `json:"status"` + IntegratorConfigs []*IntegratorConfigsRef `json:"integratorConfigs,omitempty"` + FeatureConfigs []*FeatureModeRef `json:"featureConfigs,omitempty"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// GetId returns IntegratorRef.Id, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetId() string { return v.Id } + +// GetOrganization returns IntegratorRef.Organization, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetOrganization() *OrganizationRef { return v.Organization } + +// GetType returns IntegratorRef.Type, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetType() string { return v.Type } + +// GetCategory returns IntegratorRef.Category, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetCategory() string { return v.Category } + +// GetStatus returns IntegratorRef.Status, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetStatus() string { return v.Status } + +// GetIntegratorConfigs returns IntegratorRef.IntegratorConfigs, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetIntegratorConfigs() []*IntegratorConfigsRef { return v.IntegratorConfigs } + +// GetFeatureConfigs returns IntegratorRef.FeatureConfigs, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetFeatureConfigs() []*FeatureModeRef { return v.FeatureConfigs } + +// GetCreatedAt returns IntegratorRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns IntegratorRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *IntegratorRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +type KeyValueRef struct { + Id string `json:"id"` + Name string `json:"name"` + Value string `json:"value"` +} + +// GetId returns KeyValueRef.Id, and is useful for accessing the field via an interface. +func (v *KeyValueRef) GetId() string { return v.Id } + +// GetName returns KeyValueRef.Name, and is useful for accessing the field via an interface. +func (v *KeyValueRef) GetName() string { return v.Name } + +// GetValue returns KeyValueRef.Value, and is useful for accessing the field via an interface. +func (v *KeyValueRef) GetValue() string { return v.Value } + +type OrganizationRef struct { + // id is randomly assigned + Id string `json:"id"` + Name string `json:"name"` + Roles []*RoleRef `json:"roles,omitempty"` + Teams []*TeamRef `json:"teams,omitempty"` + Environments []*DeploymentTargetRef `json:"environments,omitempty"` + Policies []*PolicyDefinitionRef `json:"policies,omitempty"` + PolicyEnforcements []*PolicyEnforcementRef `json:"policyEnforcements,omitempty"` + Integrators []*IntegratorRef `json:"integrators,omitempty"` + FeatureModes []*FeatureModeRef `json:"featureModes,omitempty"` +} + +// GetId returns OrganizationRef.Id, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetId() string { return v.Id } + +// GetName returns OrganizationRef.Name, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetName() string { return v.Name } + +// GetRoles returns OrganizationRef.Roles, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetRoles() []*RoleRef { return v.Roles } + +// GetTeams returns OrganizationRef.Teams, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetTeams() []*TeamRef { return v.Teams } + +// GetEnvironments returns OrganizationRef.Environments, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetEnvironments() []*DeploymentTargetRef { return v.Environments } + +// GetPolicies returns OrganizationRef.Policies, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetPolicies() []*PolicyDefinitionRef { return v.Policies } + +// GetPolicyEnforcements returns OrganizationRef.PolicyEnforcements, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetPolicyEnforcements() []*PolicyEnforcementRef { + return v.PolicyEnforcements +} + +// GetIntegrators returns OrganizationRef.Integrators, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetIntegrators() []*IntegratorRef { return v.Integrators } + +// GetFeatureModes returns OrganizationRef.FeatureModes, and is useful for accessing the field via an interface. +func (v *OrganizationRef) GetFeatureModes() []*FeatureModeRef { return v.FeatureModes } + +type PolicyDefinitionRef struct { + Id string `json:"id"` + OwnerOrg *OrganizationRef `json:"ownerOrg,omitempty"` + OwnerTeam *TeamRef `json:"ownerTeam,omitempty"` + OwnerApplication *ApplicationRef `json:"ownerApplication,omitempty"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` + PolicyName string `json:"policyName"` + Category string `json:"category"` + Stage string `json:"stage"` + Description string `json:"description"` + ScheduledPolicy *bool `json:"scheduledPolicy"` + Script string `json:"script"` + Variables string `json:"variables"` + ConditionName string `json:"conditionName"` + Suggestion string `json:"suggestion"` +} + +// GetId returns PolicyDefinitionRef.Id, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetId() string { return v.Id } + +// GetOwnerOrg returns PolicyDefinitionRef.OwnerOrg, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetOwnerOrg() *OrganizationRef { return v.OwnerOrg } + +// GetOwnerTeam returns PolicyDefinitionRef.OwnerTeam, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetOwnerTeam() *TeamRef { return v.OwnerTeam } + +// GetOwnerApplication returns PolicyDefinitionRef.OwnerApplication, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetOwnerApplication() *ApplicationRef { return v.OwnerApplication } + +// GetCreatedAt returns PolicyDefinitionRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns PolicyDefinitionRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetPolicyName returns PolicyDefinitionRef.PolicyName, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetPolicyName() string { return v.PolicyName } + +// GetCategory returns PolicyDefinitionRef.Category, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetCategory() string { return v.Category } + +// GetStage returns PolicyDefinitionRef.Stage, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetStage() string { return v.Stage } + +// GetDescription returns PolicyDefinitionRef.Description, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetDescription() string { return v.Description } + +// GetScheduledPolicy returns PolicyDefinitionRef.ScheduledPolicy, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetScheduledPolicy() *bool { return v.ScheduledPolicy } + +// GetScript returns PolicyDefinitionRef.Script, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetScript() string { return v.Script } + +// GetVariables returns PolicyDefinitionRef.Variables, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetVariables() string { return v.Variables } + +// GetConditionName returns PolicyDefinitionRef.ConditionName, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetConditionName() string { return v.ConditionName } + +// GetSuggestion returns PolicyDefinitionRef.Suggestion, and is useful for accessing the field via an interface. +func (v *PolicyDefinitionRef) GetSuggestion() string { return v.Suggestion } + +type PolicyEnforcementRef struct { + Id *string `json:"id"` + Policy *PolicyDefinitionRef `json:"policy,omitempty"` + EnforcedOrg *OrganizationRef `json:"enforcedOrg,omitempty"` + EnforcedTeam *TeamRef `json:"enforcedTeam,omitempty"` + EnforcedApplication *ApplicationRef `json:"enforcedApplication,omitempty"` + Status *bool `json:"status"` + ForceApply *bool `json:"forceApply"` + Severity Severity `json:"severity"` + DatasourceTool string `json:"datasourceTool"` + Action string `json:"action"` + ConditionValue string `json:"conditionValue"` + Environments []*EnvironmentRef `json:"environments,omitempty"` + Tags []*TagRef `json:"tags,omitempty"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// GetId returns PolicyEnforcementRef.Id, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetId() *string { return v.Id } + +// GetPolicy returns PolicyEnforcementRef.Policy, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetPolicy() *PolicyDefinitionRef { return v.Policy } + +// GetEnforcedOrg returns PolicyEnforcementRef.EnforcedOrg, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetEnforcedOrg() *OrganizationRef { return v.EnforcedOrg } + +// GetEnforcedTeam returns PolicyEnforcementRef.EnforcedTeam, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetEnforcedTeam() *TeamRef { return v.EnforcedTeam } + +// GetEnforcedApplication returns PolicyEnforcementRef.EnforcedApplication, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetEnforcedApplication() *ApplicationRef { return v.EnforcedApplication } + +// GetStatus returns PolicyEnforcementRef.Status, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetStatus() *bool { return v.Status } + +// GetForceApply returns PolicyEnforcementRef.ForceApply, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetForceApply() *bool { return v.ForceApply } + +// GetSeverity returns PolicyEnforcementRef.Severity, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetSeverity() Severity { return v.Severity } + +// GetDatasourceTool returns PolicyEnforcementRef.DatasourceTool, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetDatasourceTool() string { return v.DatasourceTool } + +// GetAction returns PolicyEnforcementRef.Action, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetAction() string { return v.Action } + +// GetConditionValue returns PolicyEnforcementRef.ConditionValue, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetConditionValue() string { return v.ConditionValue } + +// GetEnvironments returns PolicyEnforcementRef.Environments, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetEnvironments() []*EnvironmentRef { return v.Environments } + +// GetTags returns PolicyEnforcementRef.Tags, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetTags() []*TagRef { return v.Tags } + +// GetCreatedAt returns PolicyEnforcementRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns PolicyEnforcementRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *PolicyEnforcementRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// RiskStatus tells us what risk a current application instance or a deployment is at. +type RiskStatus string + +const ( + RiskStatusLowrisk RiskStatus = "lowrisk" + RiskStatusMediumrisk RiskStatus = "mediumrisk" + RiskStatusHighrisk RiskStatus = "highrisk" + RiskStatusApocalypserisk RiskStatus = "apocalypserisk" + RiskStatusScanning RiskStatus = "scanning" +) + +type RolePermission string + +const ( + RolePermissionAdmin RolePermission = "admin" + RolePermissionWrite RolePermission = "write" + RolePermissionRead RolePermission = "read" +) + +type RoleRef struct { + // id is randomly assigned + Id string `json:"id"` + // group should be a URI format that includes a scope or realm + Group string `json:"group"` + Permission RolePermission `json:"permission"` +} + +// GetId returns RoleRef.Id, and is useful for accessing the field via an interface. +func (v *RoleRef) GetId() string { return v.Id } + +// GetGroup returns RoleRef.Group, and is useful for accessing the field via an interface. +func (v *RoleRef) GetGroup() string { return v.Group } + +// GetPermission returns RoleRef.Permission, and is useful for accessing the field via an interface. +func (v *RoleRef) GetPermission() RolePermission { return v.Permission } + +type RunHistoryRef struct { + Id *string `json:"id"` + PolicyId string `json:"policyId"` + ApplicationDeployment *ApplicationDeploymentRef `json:"applicationDeployment,omitempty"` + ArtifactScan *ArtifactScanDataRef `json:"artifactScan,omitempty"` + PolicyName string `json:"PolicyName"` + Stage string `json:"Stage"` + Artifact string `json:"Artifact"` + ArtifactTag string `json:"ArtifactTag"` + ArtifactSha string `json:"ArtifactSha"` + ArtifactNameTag string `json:"ArtifactNameTag"` + DatasourceTool string `json:"DatasourceTool"` + CreatedAt *time.Time `json:"CreatedAt"` + UpdatedAt *time.Time `json:"UpdatedAt"` + DeployedAt *time.Time `json:"DeployedAt"` + Hash string `json:"Hash"` + Pass *bool `json:"Pass"` + MetaData string `json:"MetaData"` + FileApi string `json:"FileApi"` + JiraUrl string `json:"JiraUrl"` + ScheduledPolicy *bool `json:"scheduledPolicy"` + PolicyEnforcements *PolicyEnforcementRef `json:"policyEnforcements,omitempty"` + SecurityIssue *SecurityIssueRef `json:"securityIssue,omitempty"` +} + +// GetId returns RunHistoryRef.Id, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetId() *string { return v.Id } + +// GetPolicyId returns RunHistoryRef.PolicyId, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetPolicyId() string { return v.PolicyId } + +// GetApplicationDeployment returns RunHistoryRef.ApplicationDeployment, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetApplicationDeployment() *ApplicationDeploymentRef { + return v.ApplicationDeployment +} + +// GetArtifactScan returns RunHistoryRef.ArtifactScan, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetArtifactScan() *ArtifactScanDataRef { return v.ArtifactScan } + +// GetPolicyName returns RunHistoryRef.PolicyName, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetPolicyName() string { return v.PolicyName } + +// GetStage returns RunHistoryRef.Stage, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetStage() string { return v.Stage } + +// GetArtifact returns RunHistoryRef.Artifact, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetArtifact() string { return v.Artifact } + +// GetArtifactTag returns RunHistoryRef.ArtifactTag, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetArtifactTag() string { return v.ArtifactTag } + +// GetArtifactSha returns RunHistoryRef.ArtifactSha, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetArtifactSha() string { return v.ArtifactSha } + +// GetArtifactNameTag returns RunHistoryRef.ArtifactNameTag, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetArtifactNameTag() string { return v.ArtifactNameTag } + +// GetDatasourceTool returns RunHistoryRef.DatasourceTool, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetDatasourceTool() string { return v.DatasourceTool } + +// GetCreatedAt returns RunHistoryRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns RunHistoryRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetDeployedAt returns RunHistoryRef.DeployedAt, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetDeployedAt() *time.Time { return v.DeployedAt } + +// GetHash returns RunHistoryRef.Hash, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetHash() string { return v.Hash } + +// GetPass returns RunHistoryRef.Pass, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetPass() *bool { return v.Pass } + +// GetMetaData returns RunHistoryRef.MetaData, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetMetaData() string { return v.MetaData } + +// GetFileApi returns RunHistoryRef.FileApi, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetFileApi() string { return v.FileApi } + +// GetJiraUrl returns RunHistoryRef.JiraUrl, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetJiraUrl() string { return v.JiraUrl } + +// GetScheduledPolicy returns RunHistoryRef.ScheduledPolicy, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetScheduledPolicy() *bool { return v.ScheduledPolicy } + +// GetPolicyEnforcements returns RunHistoryRef.PolicyEnforcements, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetPolicyEnforcements() *PolicyEnforcementRef { return v.PolicyEnforcements } + +// GetSecurityIssue returns RunHistoryRef.SecurityIssue, and is useful for accessing the field via an interface. +func (v *RunHistoryRef) GetSecurityIssue() *SecurityIssueRef { return v.SecurityIssue } + type ScanFileResultRef struct { Id *string `json:"id"` Name string `json:"name"` @@ -45,6 +1115,61 @@ func (v *ScanFileResultRef) GetName() string { return v.Name } // GetUrl returns ScanFileResultRef.Url, and is useful for accessing the field via an interface. func (v *ScanFileResultRef) GetUrl() string { return v.Url } +type SecurityIssueRef struct { + Id *string `json:"id"` + AlertTitle string `json:"AlertTitle"` + AlertMessage string `json:"AlertMessage"` + Suggestions string `json:"Suggestions"` + Severity Severity `json:"Severity"` + SeverityInt *int `json:"SeverityInt"` + CreatedAt *time.Time `json:"CreatedAt"` + UpdatedAt *time.Time `json:"UpdatedAt"` + Action string `json:"Action"` + Status string `json:"Status"` + Reason string `json:"Reason"` + Error string `json:"Error"` + Affects []*RunHistoryRef `json:"Affects,omitempty"` +} + +// GetId returns SecurityIssueRef.Id, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetId() *string { return v.Id } + +// GetAlertTitle returns SecurityIssueRef.AlertTitle, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetAlertTitle() string { return v.AlertTitle } + +// GetAlertMessage returns SecurityIssueRef.AlertMessage, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetAlertMessage() string { return v.AlertMessage } + +// GetSuggestions returns SecurityIssueRef.Suggestions, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetSuggestions() string { return v.Suggestions } + +// GetSeverity returns SecurityIssueRef.Severity, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetSeverity() Severity { return v.Severity } + +// GetSeverityInt returns SecurityIssueRef.SeverityInt, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetSeverityInt() *int { return v.SeverityInt } + +// GetCreatedAt returns SecurityIssueRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns SecurityIssueRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetAction returns SecurityIssueRef.Action, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetAction() string { return v.Action } + +// GetStatus returns SecurityIssueRef.Status, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetStatus() string { return v.Status } + +// GetReason returns SecurityIssueRef.Reason, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetReason() string { return v.Reason } + +// GetError returns SecurityIssueRef.Error, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetError() string { return v.Error } + +// GetAffects returns SecurityIssueRef.Affects, and is useful for accessing the field via an interface. +func (v *SecurityIssueRef) GetAffects() []*RunHistoryRef { return v.Affects } + type Severity string const ( @@ -57,6 +1182,166 @@ const ( SeverityUnknown Severity = "unknown" ) +type SourceCodeToolRef struct { + // id is randomly assigned + Id string `json:"id"` + CreatedAt *time.Time `json:"createdAt"` + // scm is the scm tool github/gitlab etc + Scm string `json:"scm"` + // repository is the git remote repository + Repository string `json:"repository"` + // branch is the git branch on which the artifact was built + Branch string `json:"branch"` + // headCommit is the checkout out head commit + HeadCommit string `json:"headCommit"` + // diffCommits is a comma separated string of the commits between the previous built artifact and the current + DiffCommits string `json:"diffCommits"` + LicenseName string `json:"licenseName"` + Visibility string `json:"visibility"` + WorkflowName string `json:"workflowName"` + // parentRepo is populated in case the git repo is a fork + ParentRepo string `json:"parentRepo"` + BuildTool *BuildToolRef `json:"buildTool,omitempty"` +} + +// GetId returns SourceCodeToolRef.Id, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetId() string { return v.Id } + +// GetCreatedAt returns SourceCodeToolRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetScm returns SourceCodeToolRef.Scm, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetScm() string { return v.Scm } + +// GetRepository returns SourceCodeToolRef.Repository, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetRepository() string { return v.Repository } + +// GetBranch returns SourceCodeToolRef.Branch, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetBranch() string { return v.Branch } + +// GetHeadCommit returns SourceCodeToolRef.HeadCommit, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetHeadCommit() string { return v.HeadCommit } + +// GetDiffCommits returns SourceCodeToolRef.DiffCommits, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetDiffCommits() string { return v.DiffCommits } + +// GetLicenseName returns SourceCodeToolRef.LicenseName, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetLicenseName() string { return v.LicenseName } + +// GetVisibility returns SourceCodeToolRef.Visibility, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetVisibility() string { return v.Visibility } + +// GetWorkflowName returns SourceCodeToolRef.WorkflowName, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetWorkflowName() string { return v.WorkflowName } + +// GetParentRepo returns SourceCodeToolRef.ParentRepo, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetParentRepo() string { return v.ParentRepo } + +// GetBuildTool returns SourceCodeToolRef.BuildTool, and is useful for accessing the field via an interface. +func (v *SourceCodeToolRef) GetBuildTool() *BuildToolRef { return v.BuildTool } + +type TagRef struct { + Id string `json:"id"` + TagName string `json:"tagName"` + TagValue string `json:"tagValue"` + TagDescription string `json:"tagDescription"` + CreatedBy string `json:"createdBy"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` + Policies []*PolicyEnforcementRef `json:"policies,omitempty"` +} + +// GetId returns TagRef.Id, and is useful for accessing the field via an interface. +func (v *TagRef) GetId() string { return v.Id } + +// GetTagName returns TagRef.TagName, and is useful for accessing the field via an interface. +func (v *TagRef) GetTagName() string { return v.TagName } + +// GetTagValue returns TagRef.TagValue, and is useful for accessing the field via an interface. +func (v *TagRef) GetTagValue() string { return v.TagValue } + +// GetTagDescription returns TagRef.TagDescription, and is useful for accessing the field via an interface. +func (v *TagRef) GetTagDescription() string { return v.TagDescription } + +// GetCreatedBy returns TagRef.CreatedBy, and is useful for accessing the field via an interface. +func (v *TagRef) GetCreatedBy() string { return v.CreatedBy } + +// GetCreatedAt returns TagRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *TagRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns TagRef.UpdatedAt, and is useful for accessing the field via an interface. +func (v *TagRef) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetPolicies returns TagRef.Policies, and is useful for accessing the field via an interface. +func (v *TagRef) GetPolicies() []*PolicyEnforcementRef { return v.Policies } + +type TeamRef struct { + // id is randomly assigned + Id string `json:"id"` + Name string `json:"name"` + Roles []*RoleRef `json:"roles,omitempty"` + Organization *OrganizationRef `json:"organization,omitempty"` + Applications []*ApplicationRef `json:"applications,omitempty"` + Labels []*KeyValueRef `json:"labels,omitempty"` + Policies []*PolicyDefinitionRef `json:"policies,omitempty"` + PolicyEnforcements []*PolicyEnforcementRef `json:"policyEnforcements,omitempty"` +} + +// GetId returns TeamRef.Id, and is useful for accessing the field via an interface. +func (v *TeamRef) GetId() string { return v.Id } + +// GetName returns TeamRef.Name, and is useful for accessing the field via an interface. +func (v *TeamRef) GetName() string { return v.Name } + +// GetRoles returns TeamRef.Roles, and is useful for accessing the field via an interface. +func (v *TeamRef) GetRoles() []*RoleRef { return v.Roles } + +// GetOrganization returns TeamRef.Organization, and is useful for accessing the field via an interface. +func (v *TeamRef) GetOrganization() *OrganizationRef { return v.Organization } + +// GetApplications returns TeamRef.Applications, and is useful for accessing the field via an interface. +func (v *TeamRef) GetApplications() []*ApplicationRef { return v.Applications } + +// GetLabels returns TeamRef.Labels, and is useful for accessing the field via an interface. +func (v *TeamRef) GetLabels() []*KeyValueRef { return v.Labels } + +// GetPolicies returns TeamRef.Policies, and is useful for accessing the field via an interface. +func (v *TeamRef) GetPolicies() []*PolicyDefinitionRef { return v.Policies } + +// GetPolicyEnforcements returns TeamRef.PolicyEnforcements, and is useful for accessing the field via an interface. +func (v *TeamRef) GetPolicyEnforcements() []*PolicyEnforcementRef { return v.PolicyEnforcements } + +type ToolsUsedRef struct { + Id *string `json:"id"` + Source string `json:"source"` + Build string `json:"build"` + Artifact string `json:"artifact"` + Deploy string `json:"deploy"` + Sbom string `json:"sbom"` + Misc []string `json:"misc"` +} + +// GetId returns ToolsUsedRef.Id, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetId() *string { return v.Id } + +// GetSource returns ToolsUsedRef.Source, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetSource() string { return v.Source } + +// GetBuild returns ToolsUsedRef.Build, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetBuild() string { return v.Build } + +// GetArtifact returns ToolsUsedRef.Artifact, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetArtifact() string { return v.Artifact } + +// GetDeploy returns ToolsUsedRef.Deploy, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetDeploy() string { return v.Deploy } + +// GetSbom returns ToolsUsedRef.Sbom, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetSbom() string { return v.Sbom } + +// GetMisc returns ToolsUsedRef.Misc, and is useful for accessing the field via an interface. +func (v *ToolsUsedRef) GetMisc() []string { return v.Misc } + // UpdateScannedFilesInArtifactScanDataResponse is returned by UpdateScannedFilesInArtifactScanData on success. type UpdateScannedFilesInArtifactScanDataResponse struct { UpdateArtifactScanData *UpdateScannedFilesInArtifactScanDataUpdateArtifactScanDataUpdateArtifactScanDataPayload `json:"updateArtifactScanData"` @@ -117,6 +1402,77 @@ func (v *UpdateVulnScanStateUpdateArtifactScanDataUpdateArtifactScanDataPayload) return v.NumUids } +type VulnerabilityRef struct { + Id string `json:"id"` + Parent string `json:"parent"` + Ratings Severity `json:"ratings"` + Cwes []*CWERef `json:"cwes,omitempty"` + Summary string `json:"summary"` + Detail string `json:"detail"` + Recommendation string `json:"recommendation"` + Published *time.Time `json:"published"` + Modified *time.Time `json:"modified"` + CreatedAt *time.Time `json:"createdAt"` + Cvss float64 `json:"cvss"` + Priority string `json:"priority"` + Epss float64 `json:"epss"` + Cisa_kev string `json:"cisa_kev"` + Affects []*ComponentRef `json:"affects,omitempty"` +} + +// GetId returns VulnerabilityRef.Id, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetId() string { return v.Id } + +// GetParent returns VulnerabilityRef.Parent, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetParent() string { return v.Parent } + +// GetRatings returns VulnerabilityRef.Ratings, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetRatings() Severity { return v.Ratings } + +// GetCwes returns VulnerabilityRef.Cwes, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetCwes() []*CWERef { return v.Cwes } + +// GetSummary returns VulnerabilityRef.Summary, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetSummary() string { return v.Summary } + +// GetDetail returns VulnerabilityRef.Detail, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetDetail() string { return v.Detail } + +// GetRecommendation returns VulnerabilityRef.Recommendation, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetRecommendation() string { return v.Recommendation } + +// GetPublished returns VulnerabilityRef.Published, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetPublished() *time.Time { return v.Published } + +// GetModified returns VulnerabilityRef.Modified, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetModified() *time.Time { return v.Modified } + +// GetCreatedAt returns VulnerabilityRef.CreatedAt, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetCvss returns VulnerabilityRef.Cvss, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetCvss() float64 { return v.Cvss } + +// GetPriority returns VulnerabilityRef.Priority, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetPriority() string { return v.Priority } + +// GetEpss returns VulnerabilityRef.Epss, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetEpss() float64 { return v.Epss } + +// GetCisa_kev returns VulnerabilityRef.Cisa_kev, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetCisa_kev() string { return v.Cisa_kev } + +// GetAffects returns VulnerabilityRef.Affects, and is useful for accessing the field via an interface. +func (v *VulnerabilityRef) GetAffects() []*ComponentRef { return v.Affects } + +// __AddIntegratorInput is used internally by genqlient +type __AddIntegratorInput struct { + Value []*AddIntegratorInput `json:"value,omitempty"` +} + +// GetValue returns __AddIntegratorInput.Value, and is useful for accessing the field via an interface. +func (v *__AddIntegratorInput) GetValue() []*AddIntegratorInput { return v.Value } + // __UpdateScannedFilesInArtifactScanDataInput is used internally by genqlient type __UpdateScannedFilesInArtifactScanDataInput struct { Files []*ScanFileResultRef `json:"files,omitempty"` @@ -141,6 +1497,41 @@ func (v *__UpdateSeverityIntInSecurityIssuesInput) GetIds() []*string { return v // GetSeverityInt returns __UpdateSeverityIntInSecurityIssuesInput.SeverityInt, and is useful for accessing the field via an interface. func (v *__UpdateSeverityIntInSecurityIssuesInput) GetSeverityInt() *int { return v.SeverityInt } +// The query or mutation executed by AddIntegrator. +const AddIntegrator_Operation = ` +mutation AddIntegrator ($value: [AddIntegratorInput!]!) { + addIntegrator(input: $value) { + numUids + } +} +` + +func AddIntegrator( + ctx_ context.Context, + client_ graphql.Client, + value []*AddIntegratorInput, +) (*AddIntegratorResponse, error) { + req_ := &graphql.Request{ + OpName: "AddIntegrator", + Query: AddIntegrator_Operation, + Variables: &__AddIntegratorInput{ + Value: value, + }, + } + var err_ error + + var data_ AddIntegratorResponse + resp_ := &graphql.Response{Data: &data_} + + err_ = client_.MakeRequest( + ctx_, + req_, + resp_, + ) + + return &data_, err_ +} + // The query or mutation executed by GetSeverityFromSecurityIssue. const GetSeverityFromSecurityIssue_Operation = ` query GetSeverityFromSecurityIssue { diff --git a/june2024v2july2024/june2024v2/queries.graphql b/june2024v2july2024/june2024v2/queries.graphql index 471a044..e49fca5 100644 --- a/june2024v2july2024/june2024v2/queries.graphql +++ b/june2024v2july2024/june2024v2/queries.graphql @@ -13,4 +13,20 @@ query QueryAllArtifactScanData { virusTotalUrlScan id } +} + +query QueryExistingIntegrators { + queryIntegrator { + organization { + id + } + category + credentials { + data + } + createdAt + updatedAt + type + name + } } \ No newline at end of file diff --git a/june2024v2july2024/june2024v2/schema-generated.go b/june2024v2july2024/june2024v2/schema-generated.go index a16d52e..f56551d 100644 --- a/june2024v2july2024/june2024v2/schema-generated.go +++ b/june2024v2july2024/june2024v2/schema-generated.go @@ -4,6 +4,7 @@ package june2024v2 import ( "context" + "time" "github.com/Khan/genqlient/graphql" ) @@ -90,6 +91,69 @@ func (v *QueryAllArtifactScanDataResponse) GetQueryArtifactScanData() []*QueryAl return v.QueryArtifactScanData } +// QueryExistingIntegratorsQueryIntegrator includes the requested fields of the GraphQL type Integrator. +type QueryExistingIntegratorsQueryIntegrator struct { + Organization *QueryExistingIntegratorsQueryIntegratorOrganization `json:"organization"` + Category string `json:"category"` + Credentials *QueryExistingIntegratorsQueryIntegratorCredentials `json:"credentials"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` + Type string `json:"type"` + Name string `json:"name"` +} + +// GetOrganization returns QueryExistingIntegratorsQueryIntegrator.Organization, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetOrganization() *QueryExistingIntegratorsQueryIntegratorOrganization { + return v.Organization +} + +// GetCategory returns QueryExistingIntegratorsQueryIntegrator.Category, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetCategory() string { return v.Category } + +// GetCredentials returns QueryExistingIntegratorsQueryIntegrator.Credentials, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetCredentials() *QueryExistingIntegratorsQueryIntegratorCredentials { + return v.Credentials +} + +// GetCreatedAt returns QueryExistingIntegratorsQueryIntegrator.CreatedAt, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetCreatedAt() *time.Time { return v.CreatedAt } + +// GetUpdatedAt returns QueryExistingIntegratorsQueryIntegrator.UpdatedAt, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetUpdatedAt() *time.Time { return v.UpdatedAt } + +// GetType returns QueryExistingIntegratorsQueryIntegrator.Type, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetType() string { return v.Type } + +// GetName returns QueryExistingIntegratorsQueryIntegrator.Name, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegrator) GetName() string { return v.Name } + +// QueryExistingIntegratorsQueryIntegratorCredentials includes the requested fields of the GraphQL type Credentials. +type QueryExistingIntegratorsQueryIntegratorCredentials struct { + Data string `json:"data"` +} + +// GetData returns QueryExistingIntegratorsQueryIntegratorCredentials.Data, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegratorCredentials) GetData() string { return v.Data } + +// QueryExistingIntegratorsQueryIntegratorOrganization includes the requested fields of the GraphQL type Organization. +type QueryExistingIntegratorsQueryIntegratorOrganization struct { + // id is randomly assigned + Id string `json:"id"` +} + +// GetId returns QueryExistingIntegratorsQueryIntegratorOrganization.Id, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsQueryIntegratorOrganization) GetId() string { return v.Id } + +// QueryExistingIntegratorsResponse is returned by QueryExistingIntegrators on success. +type QueryExistingIntegratorsResponse struct { + QueryIntegrator []*QueryExistingIntegratorsQueryIntegrator `json:"queryIntegrator"` +} + +// GetQueryIntegrator returns QueryExistingIntegratorsResponse.QueryIntegrator, and is useful for accessing the field via an interface. +func (v *QueryExistingIntegratorsResponse) GetQueryIntegrator() []*QueryExistingIntegratorsQueryIntegrator { + return v.QueryIntegrator +} + // The query or mutation executed by QueryAllArtifactScanData. const QueryAllArtifactScanData_Operation = ` query QueryAllArtifactScanData { @@ -131,3 +195,44 @@ func QueryAllArtifactScanData( return &data_, err_ } + +// The query or mutation executed by QueryExistingIntegrators. +const QueryExistingIntegrators_Operation = ` +query QueryExistingIntegrators { + queryIntegrator { + organization { + id + } + category + credentials { + data + } + createdAt + updatedAt + type + name + } +} +` + +func QueryExistingIntegrators( + ctx_ context.Context, + client_ graphql.Client, +) (*QueryExistingIntegratorsResponse, error) { + req_ := &graphql.Request{ + OpName: "QueryExistingIntegrators", + Query: QueryExistingIntegrators_Operation, + } + var err_ error + + var data_ QueryExistingIntegratorsResponse + resp_ := &graphql.Response{Data: &data_} + + err_ = client_.MakeRequest( + ctx_, + req_, + resp_, + ) + + return &data_, err_ +} diff --git a/june2024v2july2024/upgradeSteps.go b/june2024v2july2024/upgradeSteps.go index d13beed..670f121 100644 --- a/june2024v2july2024/upgradeSteps.go +++ b/june2024v2july2024/upgradeSteps.go @@ -18,6 +18,10 @@ func UpgradeToJuly2024(prodGraphUrl, prodToken, expDgraphUrl, restoreServiceUrl return fmt.Errorf("UpgradeToJuly2024: %s", err.Error()) } + if err := performIntegratorsTransition(prodDgraphClient, expDgraphClient); err != nil { + return fmt.Errorf("UpgradeToJuly2024: %s", err.Error()) + } + if err := graphqlfunc.BackupAndRestoreDgraph(expDgraphUrl, restoreServiceUrl); err != nil { return fmt.Errorf("UpgradeToJuly2024: BackupAndRestoreDgraph: %s", err.Error()) } From ce18c616d030f2a58ddd7ba53ebabec89260299f Mon Sep 17 00:00:00 2001 From: priyanshishikha Date: Thu, 29 Aug 2024 12:40:40 +0530 Subject: [PATCH 2/2] added time fileds --- june2024v2july2024/integrators.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/june2024v2july2024/integrators.go b/june2024v2july2024/integrators.go index 835dbab..9ddaf32 100644 --- a/june2024v2july2024/integrators.go +++ b/june2024v2july2024/integrators.go @@ -65,7 +65,9 @@ func performIntegratorsTransition(prodDgraphClient, expDgraphClient graphql.Clie }, Type: eachIntegrator.Type, Category: eachIntegrator.Category, - Status: "not-connected", + Status: "disabled", + CreatedAt: eachIntegrator.CreatedAt, + UpdatedAt: eachIntegrator.UpdatedAt, IntegratorConfigs: []*july2024.IntegratorConfigsRef{&configTemp}, } }