From 0d0ac7f8b63941b5e34caa8f12ad6783cd17fc22 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:46:11 -0600 Subject: [PATCH] Regenerate client from commit 733cf3ea of spec repo (#2858) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 ++--- .generator/schemas/v2/openapi.yaml | 8 +++++ api/datadogV2/api_restriction_policies.go | 30 ++++++++++++++++++- .../UpdateRestrictionPolicy.go | 2 +- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 6378aacea16..2dd991410df 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-02 16:27:42.139825", - "spec_repo_commit": "bc53c28f" + "regenerated": "2025-01-02 17:32:10.001031", + "spec_repo_commit": "733cf3ea" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-02 16:27:42.155313", - "spec_repo_commit": "bc53c28f" + "regenerated": "2025-01-02 17:32:10.016325", + "spec_repo_commit": "733cf3ea" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 941ec65aef2..76195d0bb3d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -40985,6 +40985,14 @@ paths: operationId: UpdateRestrictionPolicy parameters: - $ref: '#/components/parameters/ResourceID' + - description: Allows admins (users with the `user_access_manage` permission) + to remove their own access from the resource if set to `true`. By default, + this is set to `false`, preventing admins from locking themselves out. + in: query + name: allow_self_lockout + required: false + schema: + type: string requestBody: content: application/json: diff --git a/api/datadogV2/api_restriction_policies.go b/api/datadogV2/api_restriction_policies.go index 38b3bb385e7..5ba97a16db8 100644 --- a/api/datadogV2/api_restriction_policies.go +++ b/api/datadogV2/api_restriction_policies.go @@ -147,6 +147,23 @@ func (a *RestrictionPoliciesApi) GetRestrictionPolicy(ctx _context.Context, reso return localVarReturnValue, localVarHTTPResponse, nil } +// UpdateRestrictionPolicyOptionalParameters holds optional parameters for UpdateRestrictionPolicy. +type UpdateRestrictionPolicyOptionalParameters struct { + AllowSelfLockout *string +} + +// NewUpdateRestrictionPolicyOptionalParameters creates an empty struct for parameters. +func NewUpdateRestrictionPolicyOptionalParameters() *UpdateRestrictionPolicyOptionalParameters { + this := UpdateRestrictionPolicyOptionalParameters{} + return &this +} + +// WithAllowSelfLockout sets the corresponding parameter name and returns the struct. +func (r *UpdateRestrictionPolicyOptionalParameters) WithAllowSelfLockout(allowSelfLockout string) *UpdateRestrictionPolicyOptionalParameters { + r.AllowSelfLockout = &allowSelfLockout + return r +} + // UpdateRestrictionPolicy Update a restriction policy. // Updates the restriction policy associated with a resource. // @@ -176,13 +193,21 @@ func (a *RestrictionPoliciesApi) GetRestrictionPolicy(ctx _context.Context, reso // Synthetic Private Locations | `viewer`, `editor` // Monitors | `viewer`, `editor` // Reference Tables | `viewer`, `editor` -func (a *RestrictionPoliciesApi) UpdateRestrictionPolicy(ctx _context.Context, resourceId string, body RestrictionPolicyUpdateRequest) (RestrictionPolicyResponse, *_nethttp.Response, error) { +func (a *RestrictionPoliciesApi) UpdateRestrictionPolicy(ctx _context.Context, resourceId string, body RestrictionPolicyUpdateRequest, o ...UpdateRestrictionPolicyOptionalParameters) (RestrictionPolicyResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarReturnValue RestrictionPolicyResponse + optionalParams UpdateRestrictionPolicyOptionalParameters ) + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateRestrictionPolicyOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.RestrictionPoliciesApi.UpdateRestrictionPolicy") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} @@ -194,6 +219,9 @@ func (a *RestrictionPoliciesApi) UpdateRestrictionPolicy(ctx _context.Context, r localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.AllowSelfLockout != nil { + localVarQueryParams.Add("allow_self_lockout", datadog.ParameterToString(*optionalParams.AllowSelfLockout, "")) + } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" diff --git a/examples/v2/restriction-policies/UpdateRestrictionPolicy.go b/examples/v2/restriction-policies/UpdateRestrictionPolicy.go index 52b10dbc466..5aabc5a44be 100644 --- a/examples/v2/restriction-policies/UpdateRestrictionPolicy.go +++ b/examples/v2/restriction-policies/UpdateRestrictionPolicy.go @@ -35,7 +35,7 @@ func main() { configuration := datadog.NewConfiguration() apiClient := datadog.NewAPIClient(configuration) api := datadogV2.NewRestrictionPoliciesApi(apiClient) - resp, r, err := api.UpdateRestrictionPolicy(ctx, "dashboard:test-update", body) + resp, r, err := api.UpdateRestrictionPolicy(ctx, "dashboard:test-update", body, *datadogV2.NewUpdateRestrictionPolicyOptionalParameters()) if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `RestrictionPoliciesApi.UpdateRestrictionPolicy`: %v\n", err)