Skip to content

Commit

Permalink
Regenerate client from commit 733cf3ea of spec repo (#2858)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Jan 2, 2025
1 parent c8baa15 commit 0d0ac7f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
8 changes: 8 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 29 additions & 1 deletion api/datadogV2/api_restriction_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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()}
Expand All @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0d0ac7f

Please sign in to comment.