Bumps the go-dependencies group with 21 updates: | Package | From | To | | --- | --- | --- | | codeberg.org/miekg/dns | `0.6.81` | `0.6.83` | | [github.com/99designs/gqlgen](https://github.com/99designs/gqlgen) | `0.17.90` | `0.17.93` | | [github.com/anthropics/anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go) | `1.48.0` | `1.55.0` | | [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) | `1.42.0` | `1.42.1` | | [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) | `1.32.23` | `1.32.27` | | [github.com/aws/aws-sdk-go-v2/credentials](https://github.com/aws/aws-sdk-go-v2) | `1.19.22` | `1.19.26` | | [github.com/aws/aws-sdk-go-v2/service/bedrockruntime](https://github.com/aws/aws-sdk-go-v2) | `1.53.4` | `1.54.2` | | [github.com/aws/aws-sdk-go-v2/service/s3](https://github.com/aws/aws-sdk-go-v2) | `1.103.2` | `1.104.2` | | [github.com/aws/aws-sdk-go-v2/service/secretsmanager](https://github.com/aws/aws-sdk-go-v2) | `1.42.3` | `1.42.5` | | [github.com/aws/aws-sdk-go-v2/service/ssm](https://github.com/aws/aws-sdk-go-v2) | `1.69.3` | `1.69.5` | | [github.com/pdfcpu/pdfcpu](https://github.com/pdfcpu/pdfcpu) | `0.12.1` | `0.13.0` | | [github.com/pires/go-proxyproto](https://github.com/pires/go-proxyproto) | `0.12.0` | `0.13.0` | | [github.com/sigstore/sigstore-go](https://github.com/sigstore/sigstore-go) | `1.2.0` | `1.2.1` | | [github.com/vektah/gqlparser/v2](https://github.com/vektah/gqlparser) | `2.5.33` | `2.5.35` | | [golang.org/x/crypto](https://github.com/golang/crypto) | `0.52.0` | `0.53.0` | | [google.golang.org/api](https://github.com/googleapis/google-api-go-client) | `0.283.0` | `0.287.0` | | gopkg.in/dnaeon/go-vcr.v4 | `4.0.6` | `4.0.7` | | [github.com/aws/smithy-go](https://github.com/aws/smithy-go) | `1.27.1` | `1.27.3` | | [golang.org/x/mod](https://github.com/golang/mod) | `0.36.0` | `0.37.0` | | [golang.org/x/net](https://github.com/golang/net) | `0.55.0` | `0.56.0` | | [golang.org/x/term](https://github.com/golang/term) | `0.43.0` | `0.44.0` | Updates `codeberg.org/miekg/dns` from 0.6.81 to 0.6.83 Updates `github.com/99designs/gqlgen` from 0.17.90 to 0.17.93 - [Release notes](https://github.com/99designs/gqlgen/releases) - [Changelog](https://github.com/99designs/gqlgen/blob/master/CHANGELOG.md) - [Commits](https://github.com/99designs/gqlgen/compare/v0.17.90...v0.17.93) Updates `github.com/anthropics/anthropic-sdk-go` from 1.48.0 to 1.55.0 - [Release notes](https://github.com/anthropics/anthropic-sdk-go/releases) - [Changelog](https://github.com/anthropics/anthropic-sdk-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/anthropics/anthropic-sdk-go/compare/v1.48.0...v1.55.0) Updates `github.com/aws/aws-sdk-go-v2` from 1.42.0 to 1.42.1 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.42.0...v1.42.1) Updates `github.com/aws/aws-sdk-go-v2/config` from 1.32.23 to 1.32.27 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/config/v1.32.23...config/v1.32.27) Updates `github.com/aws/aws-sdk-go-v2/credentials` from 1.19.22 to 1.19.26 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/credentials/v1.19.22...credentials/v1.19.26) Updates `github.com/aws/aws-sdk-go-v2/service/bedrockruntime` from 1.53.4 to 1.54.2 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/kms/v1.53.4...service/s3/v1.54.2) Updates `github.com/aws/aws-sdk-go-v2/service/s3` from 1.103.2 to 1.104.2 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.103.2...service/s3/v1.104.2) Updates `github.com/aws/aws-sdk-go-v2/service/secretsmanager` from 1.42.3 to 1.42.5 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/amp/v1.42.3...service/amp/v1.42.5) Updates `github.com/aws/aws-sdk-go-v2/service/ssm` from 1.69.3 to 1.69.5 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/ecs/v1.69.3...service/ecs/v1.69.5) Updates `github.com/pdfcpu/pdfcpu` from 0.12.1 to 0.13.0 - [Release notes](https://github.com/pdfcpu/pdfcpu/releases) - [Commits](https://github.com/pdfcpu/pdfcpu/compare/v0.12.1...v0.13.0) Updates `github.com/pires/go-proxyproto` from 0.12.0 to 0.13.0 - [Release notes](https://github.com/pires/go-proxyproto/releases) - [Commits](https://github.com/pires/go-proxyproto/compare/v0.12.0...v0.13.0) Updates `github.com/sigstore/sigstore-go` from 1.2.0 to 1.2.1 - [Release notes](https://github.com/sigstore/sigstore-go/releases) - [Commits](https://github.com/sigstore/sigstore-go/compare/v1.2.0...v1.2.1) Updates `github.com/vektah/gqlparser/v2` from 2.5.33 to 2.5.35 - [Release notes](https://github.com/vektah/gqlparser/releases) - [Commits](https://github.com/vektah/gqlparser/compare/v2.5.33...v2.5.35) Updates `golang.org/x/crypto` from 0.52.0 to 0.53.0 - [Commits](https://github.com/golang/crypto/compare/v0.52.0...v0.53.0) Updates `google.golang.org/api` from 0.283.0 to 0.287.0 - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.283.0...v0.287.0) Updates `gopkg.in/dnaeon/go-vcr.v4` from 4.0.6 to 4.0.7 Updates `github.com/aws/smithy-go` from 1.27.1 to 1.27.3 - [Release notes](https://github.com/aws/smithy-go/releases) - [Changelog](https://github.com/aws/smithy-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws/smithy-go/compare/v1.27.1...v1.27.3) Updates `golang.org/x/mod` from 0.36.0 to 0.37.0 - [Commits](https://github.com/golang/mod/compare/v0.36.0...v0.37.0) Updates `golang.org/x/net` from 0.55.0 to 0.56.0 - [Commits](https://github.com/golang/net/compare/v0.55.0...v0.56.0) Updates `golang.org/x/term` from 0.43.0 to 0.44.0 - [Commits](https://github.com/golang/term/compare/v0.43.0...v0.44.0) --- updated-dependencies: - dependency-name: codeberg.org/miekg/dns dependency-version: 0.6.83 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/99designs/gqlgen dependency-version: 0.17.93 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/anthropics/anthropic-sdk-go dependency-version: 1.55.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2 dependency-version: 1.42.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/config dependency-version: 1.32.27 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/credentials dependency-version: 1.19.26 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/service/bedrockruntime dependency-version: 1.54.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/service/s3 dependency-version: 1.104.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/service/secretsmanager dependency-version: 1.42.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/aws/aws-sdk-go-v2/service/ssm dependency-version: 1.69.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/pdfcpu/pdfcpu dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: github.com/pires/go-proxyproto dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: github.com/sigstore/sigstore-go dependency-version: 1.2.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/vektah/gqlparser/v2 dependency-version: 2.5.35 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: golang.org/x/crypto dependency-version: 0.53.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: google.golang.org/api dependency-version: 0.287.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: gopkg.in/dnaeon/go-vcr.v4 dependency-version: 4.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: github.com/aws/smithy-go dependency-version: 1.27.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-dependencies - dependency-name: golang.org/x/mod dependency-version: 0.37.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: golang.org/x/net dependency-version: 0.56.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies - dependency-name: golang.org/x/term dependency-version: 0.44.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
622 lines
20 KiB
Go
622 lines
20 KiB
Go
package console_v1
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver
|
|
// implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
// Code generated by github.com/99designs/gqlgen version v0.17.93
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"slices"
|
|
"strings"
|
|
|
|
"go.gearno.de/kit/log"
|
|
"go.probo.inc/probo/pkg/accessreview"
|
|
"go.probo.inc/probo/pkg/agentrun"
|
|
"go.probo.inc/probo/pkg/coredata"
|
|
"go.probo.inc/probo/pkg/gid"
|
|
"go.probo.inc/probo/pkg/probo"
|
|
"go.probo.inc/probo/pkg/server/api/authn"
|
|
"go.probo.inc/probo/pkg/server/api/console/v1/schema"
|
|
"go.probo.inc/probo/pkg/server/api/console/v1/types"
|
|
"go.probo.inc/probo/pkg/server/gqlutils"
|
|
)
|
|
|
|
// Node is the resolver for the node field.
|
|
func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) {
|
|
var (
|
|
loadNode func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error)
|
|
action string
|
|
)
|
|
|
|
switch id.EntityType() {
|
|
case coredata.OrganizationEntityType:
|
|
action = probo.ActionOrganizationGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
organization, err := r.probo.Organizations.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewOrganization(organization), nil
|
|
}
|
|
case coredata.ThirdPartyEntityType:
|
|
action = probo.ActionThirdPartyGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
thirdParty, err := r.probo.ThirdParties.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewThirdParty(thirdParty), nil
|
|
}
|
|
case coredata.FrameworkEntityType:
|
|
action = probo.ActionFrameworkGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
framework, err := r.probo.Frameworks.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewFramework(framework), nil
|
|
}
|
|
case coredata.MeasureEntityType:
|
|
action = probo.ActionMeasureGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
measure, err := r.probo.Measures.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewMeasure(measure), nil
|
|
}
|
|
case coredata.TaskEntityType:
|
|
action = probo.ActionTaskGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
task, err := r.probo.Tasks.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewTask(task), nil
|
|
}
|
|
case coredata.EvidenceEntityType:
|
|
action = probo.ActionEvidenceList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
evidence, err := r.probo.Evidences.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewEvidence(evidence), nil
|
|
}
|
|
case coredata.DocumentEntityType:
|
|
action = probo.ActionDocumentGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
document, err := r.probo.Documents.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewDocument(document), nil
|
|
}
|
|
case coredata.ControlEntityType:
|
|
action = probo.ActionControlList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
control, err := r.probo.Controls.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewControl(control), nil
|
|
}
|
|
case coredata.RiskEntityType:
|
|
action = probo.ActionRiskGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
risk, err := r.probo.Risks.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRisk(risk), nil
|
|
}
|
|
case coredata.RiskAssessmentEntityType:
|
|
action = probo.ActionRiskAssessmentGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
ra, err := r.riskManagement.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessment(ra), nil
|
|
}
|
|
case coredata.RiskAssessmentNodeEntityType:
|
|
action = probo.ActionRiskAssessmentNodeGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
n, err := r.riskManagement.GetNode(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessmentNode(n), nil
|
|
}
|
|
case coredata.RiskAssessmentProcessEntityType:
|
|
action = probo.ActionRiskAssessmentProcessGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
p, err := r.riskManagement.GetProcess(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessmentProcess(p), nil
|
|
}
|
|
case coredata.RiskAssessmentThreatEntityType:
|
|
action = probo.ActionRiskAssessmentThreatGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
t, err := r.riskManagement.GetThreat(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessmentThreat(t), nil
|
|
}
|
|
case coredata.RiskAssessmentScopeEntityType:
|
|
action = probo.ActionRiskAssessmentScopeGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
s, err := r.riskManagement.GetScope(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessmentScope(s), nil
|
|
}
|
|
case coredata.RiskAssessmentBoundaryEntityType:
|
|
action = probo.ActionRiskAssessmentBoundaryGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
b, err := r.riskManagement.GetBoundary(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessmentBoundary(b), nil
|
|
}
|
|
case coredata.RiskAssessmentScenarioEntityType:
|
|
action = probo.ActionRiskAssessmentScenarioGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
s, err := r.riskManagement.GetScenario(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRiskAssessmentScenario(s), nil
|
|
}
|
|
case coredata.ThirdPartyComplianceReportEntityType:
|
|
action = probo.ActionThirdPartyComplianceReportGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
thirdPartyComplianceReport, err := r.probo.ThirdPartyComplianceReports.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewThirdPartyComplianceReport(thirdPartyComplianceReport), nil
|
|
}
|
|
case coredata.ThirdPartyContactEntityType:
|
|
action = probo.ActionThirdPartyContactGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
thirdPartyContact, err := r.probo.ThirdPartyContacts.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewThirdPartyContact(thirdPartyContact), nil
|
|
}
|
|
case coredata.ThirdPartyServiceEntityType:
|
|
action = probo.ActionThirdPartyServiceGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
thirdPartyService, err := r.probo.ThirdPartyServices.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewThirdPartyService(thirdPartyService), nil
|
|
}
|
|
case coredata.DocumentVersionEntityType:
|
|
action = probo.ActionDocumentVersionList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
documentVersion, err := r.probo.Documents.GetVersion(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewDocumentVersion(documentVersion), nil
|
|
}
|
|
case coredata.DocumentVersionSignatureEntityType:
|
|
action = probo.ActionDocumentVersionSignatureList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
documentVersionSignature, err := r.probo.Documents.GetVersionSignature(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewDocumentVersionSignature(documentVersionSignature), nil
|
|
}
|
|
case coredata.AssetEntityType:
|
|
action = probo.ActionAssetList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
asset, err := r.probo.Assets.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAsset(asset), nil
|
|
}
|
|
case coredata.DatumEntityType:
|
|
action = probo.ActionDatumList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
datum, err := r.probo.Data.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewDatum(datum), nil
|
|
}
|
|
case coredata.AuditEntityType:
|
|
action = probo.ActionAuditList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
audit, err := r.probo.Audits.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAudit(audit), nil
|
|
}
|
|
case coredata.FindingEntityType:
|
|
action = probo.ActionFindingList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
finding, err := r.probo.Findings.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewFinding(finding), nil
|
|
}
|
|
case coredata.ObligationEntityType:
|
|
action = probo.ActionObligationList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
obligation, err := r.probo.Obligations.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewObligation(obligation), nil
|
|
}
|
|
case coredata.ProcessingActivityEntityType:
|
|
action = probo.ActionProcessingActivityList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
processingActivity, err := r.probo.ProcessingActivities.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewProcessingActivity(processingActivity), nil
|
|
}
|
|
case coredata.DataProtectionImpactAssessmentEntityType:
|
|
// TODO: add action
|
|
// action = probo.ActionDataProtectionImpactAssessmentGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
dpia, err := r.probo.DataProtectionImpactAssessments.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewDataProtectionImpactAssessment(dpia), nil
|
|
}
|
|
case coredata.TransferImpactAssessmentEntityType:
|
|
// TODO: add action
|
|
//action = probo.ActionTransferImpactAssessmentGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
tia, err := r.probo.TransferImpactAssessments.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewTransferImpactAssessment(tia), nil
|
|
}
|
|
case coredata.TrustCenterEntityType:
|
|
action = probo.ActionTrustCenterGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
trustCenter, err := r.probo.TrustCenters.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewTrustCenter(trustCenter), nil
|
|
}
|
|
case coredata.TrustCenterAccessEntityType:
|
|
action = probo.ActionTrustCenterAccessGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
trustCenterAccess, err := r.probo.TrustCenterAccesses.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewTrustCenterAccess(trustCenterAccess), nil
|
|
}
|
|
case coredata.RightsRequestEntityType:
|
|
action = probo.ActionRightsRequestGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
rightsRequest, err := r.probo.RightsRequests.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewRightsRequest(rightsRequest), nil
|
|
}
|
|
case coredata.StatementOfApplicabilityEntityType:
|
|
action = probo.ActionStatementOfApplicabilityGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
statementOfApplicability, err := r.probo.StatementsOfApplicability.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewStatementOfApplicability(statementOfApplicability), nil
|
|
}
|
|
case coredata.WebhookSubscriptionEntityType:
|
|
action = probo.ActionWebhookSubscriptionGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
wc, err := r.probo.WebhookSubscriptions.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewWebhookSubscription(wc), nil
|
|
}
|
|
case coredata.AgentRunEntityType:
|
|
action = agentrun.ActionAgentRunGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
run, err := r.agentRun.Get(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAgentRun(run), nil
|
|
}
|
|
case coredata.AccessReviewCampaignEntityType:
|
|
action = accessreview.ActionCampaignGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
campaign, err := r.accessReview.GetCampaign(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAccessReviewCampaign(campaign), nil
|
|
}
|
|
case coredata.AccessReviewCampaignSourceEntityType:
|
|
action = accessreview.ActionCampaignGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
campaignSource, err := r.accessReview.GetCampaignSource(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAccessReviewCampaignSource(campaignSource), nil
|
|
}
|
|
case coredata.AccessReviewSourceEntityType:
|
|
action = accessreview.ActionSourceGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
source, err := r.accessReview.GetSource(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAccessReviewSource(source), nil
|
|
}
|
|
case coredata.AccessReviewEntryEntityType:
|
|
action = accessreview.ActionEntryGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
entry, err := r.accessReview.GetEntry(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewAccessReviewEntry(entry), nil
|
|
}
|
|
case coredata.CookieBannerEntityType:
|
|
action = probo.ActionCookieBannerGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
banner, err := r.cookieBanner.GetCookieBanner(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewCookieBanner(banner), nil
|
|
}
|
|
case coredata.CookieCategoryEntityType:
|
|
action = probo.ActionCookieCategoryGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
category, err := r.cookieBanner.GetCookieCategory(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewCookieCategory(category), nil
|
|
}
|
|
case coredata.CookieConsentRecordEntityType:
|
|
action = probo.ActionCookieConsentRecordList
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
record, err := r.cookieBanner.GetCookieConsentRecord(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewCookieConsentRecord(record), nil
|
|
}
|
|
case coredata.TrackerPatternEntityType:
|
|
action = probo.ActionTrackerPatternGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
pattern, err := r.cookieBanner.GetTrackerPattern(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return types.NewTrackerPatternNode(pattern), nil
|
|
}
|
|
case coredata.CookieBannerVersionEntityType:
|
|
action = probo.ActionCookieBannerVersionGet
|
|
loadNode = func(ctx context.Context, scope *coredata.Scope, id gid.GID) (types.Node, error) {
|
|
version, err := r.cookieBanner.GetCookieBannerVersion(ctx, scope, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &types.CookieBannerVersion{
|
|
ID: version.ID,
|
|
Version: version.Version,
|
|
State: string(version.State),
|
|
CreatedAt: version.CreatedAt,
|
|
UpdatedAt: version.UpdatedAt,
|
|
}, nil
|
|
}
|
|
default:
|
|
}
|
|
|
|
scope, err := r.authorize(ctx, id, action)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
node, err := loadNode(ctx, scope, id)
|
|
if err != nil {
|
|
if errors.Is(err, coredata.ErrResourceNotFound) {
|
|
return nil, gqlutils.NotFound(ctx, err)
|
|
}
|
|
|
|
r.logger.ErrorCtx(ctx, "cannot load node", log.Error(err))
|
|
|
|
return nil, gqlutils.Internal(ctx)
|
|
}
|
|
|
|
return node, nil
|
|
}
|
|
|
|
// Viewer is the resolver for the viewer field.
|
|
func (r *queryResolver) Viewer(ctx context.Context) (*types.Viewer, error) {
|
|
identity := authn.IdentityFromContext(ctx)
|
|
|
|
session := authn.SessionFromContext(ctx)
|
|
apiKey := authn.APIKeyFromContext(ctx)
|
|
|
|
var viewerID gid.GID
|
|
if session != nil {
|
|
viewerID = session.ID
|
|
} else if apiKey != nil {
|
|
viewerID = apiKey.ID
|
|
} else {
|
|
viewerID = identity.ID
|
|
}
|
|
|
|
return &types.Viewer{ID: viewerID}, nil
|
|
}
|
|
|
|
// CommonThirdParties is the resolver for the commonThirdParties field.
|
|
func (r *queryResolver) CommonThirdParties(ctx context.Context, name string) ([]*types.CommonThirdParty, error) {
|
|
identity := authn.IdentityFromContext(ctx)
|
|
|
|
if _, err := r.authorize(ctx, identity.ID, probo.ActionCommonThirdPartyList); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
parties, err := r.thirdParty.Search(ctx, name)
|
|
if err != nil {
|
|
r.logger.ErrorCtx(ctx, "cannot search common third parties", log.Error(err))
|
|
return nil, gqlutils.Internal(ctx)
|
|
}
|
|
|
|
result := make([]*types.CommonThirdParty, len(parties))
|
|
for i, p := range parties {
|
|
result[i] = types.NewCommonThirdParty(p)
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
// AccessReviewDrivers is the resolver for the accessReviewDrivers field.
|
|
func (r *queryResolver) AccessReviewDrivers(ctx context.Context) ([]*types.ConnectorProviderInfo, error) {
|
|
identity := authn.IdentityFromContext(ctx)
|
|
|
|
if _, err := r.authorize(ctx, identity.ID, accessreview.ActionDriverCatalogList); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
registrations := r.providerRegistry.All()
|
|
infos := make([]*types.ConnectorProviderInfo, 0, len(registrations))
|
|
|
|
for _, reg := range registrations {
|
|
if reg == nil || reg.NewDriver == nil {
|
|
continue
|
|
}
|
|
|
|
provider := reg.Provider
|
|
_, oauthErr := r.connectorRegistry.Get(string(provider))
|
|
oauthConfigured := oauthErr == nil
|
|
apiKeySupported := reg.SupportsAPIKey
|
|
clientCredentialsSupported := reg.SupportsClientCredentials
|
|
|
|
// Skip providers that cannot be connected in this deployment: no
|
|
// OAuth client credentials configured and no key-based fallback
|
|
// (API key or client credentials) supported.
|
|
if !oauthConfigured && !apiKeySupported && !clientCredentialsSupported {
|
|
continue
|
|
}
|
|
|
|
scopes := r.providerRegistry.ProviderOAuth2Scopes(provider)
|
|
if scopes == nil {
|
|
scopes = []string{}
|
|
}
|
|
|
|
extraSettings := make([]*types.ConnectorProviderSettingInfo, 0, len(reg.ExtraSettings))
|
|
for _, setting := range reg.ExtraSettings {
|
|
extraSettings = append(
|
|
extraSettings,
|
|
&types.ConnectorProviderSettingInfo{
|
|
Key: setting.Key,
|
|
Label: setting.Label,
|
|
Required: setting.Required,
|
|
},
|
|
)
|
|
}
|
|
|
|
infos = append(infos, &types.ConnectorProviderInfo{
|
|
Provider: provider,
|
|
DisplayName: reg.DisplayName,
|
|
OauthConfigured: oauthConfigured,
|
|
APIKeySupported: apiKeySupported,
|
|
ClientCredentialsSupported: clientCredentialsSupported,
|
|
Oauth2Scopes: scopes,
|
|
ExtraSettings: extraSettings,
|
|
})
|
|
}
|
|
|
|
slices.SortFunc(
|
|
infos,
|
|
func(a, b *types.ConnectorProviderInfo) int {
|
|
return strings.Compare(a.DisplayName, b.DisplayName)
|
|
},
|
|
)
|
|
|
|
return infos, nil
|
|
}
|
|
|
|
// Mutation returns schema.MutationResolver implementation.
|
|
func (r *Resolver) Mutation() schema.MutationResolver { return &mutationResolver{r} }
|
|
|
|
// Query returns schema.QueryResolver implementation.
|
|
func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} }
|
|
|
|
type (
|
|
mutationResolver struct{ *Resolver }
|
|
queryResolver struct{ *Resolver }
|
|
)
|