MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Run

Method Run

app/cli/pkg/action/org_update.go:49–82  ·  view source on GitHub ↗
(ctx context.Context, name string, opts *NewOrgUpdateOpts)

Source from the content-addressed store, hash-verified

47}
48
49func (action *OrgUpdate) Run(ctx context.Context, name string, opts *NewOrgUpdateOpts) (*OrgItem, error) {
50 client := pb.NewOrganizationServiceClient(action.cfg.CPConnection)
51
52 payload := &pb.OrganizationServiceUpdateRequest{
53 Name: name,
54 BlockOnPolicyViolation: opts.BlockOnPolicyViolation,
55 PreventImplicitWorkflowCreation: opts.PreventImplicitWorkflowCreation,
56 RestrictContractCreationToOrgAdmins: opts.RestrictContractCreation,
57 EnableAiAgentCollector: opts.EnableAIAgentCollector,
58 BlockAttestationsOnReleasedVersions: opts.BlockAttestationsOnReleasedVersions,
59 SkipRunnerEnvVars: opts.SkipRunnerEnvVars,
60 }
61
62 if opts.PoliciesAllowedHostnames != nil {
63 payload.PoliciesAllowedHostnames = *opts.PoliciesAllowedHostnames
64 payload.UpdatePoliciesAllowedHostnames = true
65 }
66
67 if opts.APITokenMaxDaysInactive != nil {
68 v := *opts.APITokenMaxDaysInactive
69 if v < 0 || v > 365 {
70 return nil, fmt.Errorf("api_token_max_days_inactive must be between 0 and 365")
71 }
72 days := int32(v)
73 payload.ApiTokenMaxDaysInactive = &days
74 }
75
76 resp, err := client.Update(ctx, payload)
77 if err != nil {
78 return nil, err
79 }
80
81 return pbOrgItemToAction(resp.Result), nil
82}

Callers

nothing calls this directly

Calls 2

UpdateMethod · 0.95
pbOrgItemToActionFunction · 0.85

Tested by

no test coverage detected