Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allow_self_lockout to documentation #2338

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 15:18:22.861274",
"spec_repo_commit": "bc53c28f"
"regenerated": "2025-01-02 17:32:10.022066",
"spec_repo_commit": "733cf3ea"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-02 15:18:22.882795",
"spec_repo_commit": "bc53c28f"
"regenerated": "2025-01-02 17:32:10.039540",
"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
18 changes: 17 additions & 1 deletion src/datadog_api_client/v2/api/restriction_policies_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, Dict
from typing import Any, Dict, Union

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.model_utils import (
UnsetType,
unset,
)
from datadog_api_client.v2.model.restriction_policy_response import RestrictionPolicyResponse
from datadog_api_client.v2.model.restriction_policy_update_request import RestrictionPolicyUpdateRequest

Expand Down Expand Up @@ -85,6 +89,11 @@ def __init__(self, api_client=None):
"attribute": "resource_id",
"location": "path",
},
"allow_self_lockout": {
"openapi_types": (str,),
"attribute": "allow_self_lockout",
"location": "query",
},
"body": {
"required": True,
"openapi_types": (RestrictionPolicyUpdateRequest,),
Expand Down Expand Up @@ -133,6 +142,8 @@ def update_restriction_policy(
self,
resource_id: str,
body: RestrictionPolicyUpdateRequest,
*,
allow_self_lockout: Union[str, UnsetType] = unset,
) -> RestrictionPolicyResponse:
"""Update a restriction policy.

Expand Down Expand Up @@ -186,11 +197,16 @@ def update_restriction_policy(
:type resource_id: str
:param body: Restriction policy payload
:type body: RestrictionPolicyUpdateRequest
:param allow_self_lockout: 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.
:type allow_self_lockout: str, optional
:rtype: RestrictionPolicyResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["resource_id"] = resource_id

if allow_self_lockout is not unset:
kwargs["allow_self_lockout"] = allow_self_lockout

kwargs["body"] = body

return self._update_restriction_policy_endpoint.call_with_http_info(**kwargs)
Loading