(ctx context.Context, name string, opts *NewOrgUpdateOpts)
| 47 | } |
| 48 | |
| 49 | func (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 | } |
nothing calls this directly
no test coverage detected