create_agent_enforced_policy
async
¶
create_agent_enforced_policy(
name: EnforcedPolicyName,
policy_body: EnforcedPolicyBody,
*,
config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
client_token: Optional[IdempotencyToken] = None,
tags: Optional[TagList] = None,
) -> CreateAgentEnforcedPolicyResult
Creates an agent-enforced policy, which the agent on the WorkSpace applies. The name must be unique among the agent-enforced policies in your account. If it isn't, the operation returns ConflictException, and its ResourceId identifies the existing policy. If your account would exceed its maximum number of agent-enforced policies, the operation returns ServiceQuotaExceededException.
Parameters:
-
client_token(Optional[IdempotencyToken], default:None) –A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request with the same parameters, the service returns the result of that request and doesn't create another agent-enforced policy.
If you reuse the token with different parameters, the operation returns
ValidationException. If you deleted the policy created with this token, the operation returnsConflictException. -
name(EnforcedPolicyName) –The name of the agent-enforced policy.
-
policy_body(EnforcedPolicyBody) –Specifies the policy document, in JSON format, that defines the enforced policy. It can be up to 65,536 characters long and can't contain control characters other than tab, line feed, and carriage return.
-
tags(Optional[TagList], default:None) –The tags to add to the agent-enforced policy. Each tag key can appear only once.
Raises:
-
AccessDeniedException–The user is not authorized to access a resource.
-
ConflictException–The request conflicts with the current state of a resource, for example because a name is already in use or the resource is still in use. Resolve the conflict, and then retry your request.
-
ServiceQuotaExceededException–The request would exceed a service quota. Request a quota increase or reduce the number of resources in your request.
-
ThrottlingException–The request was throttled. Retry the request with exponential backoff.
-
ValidationException–Your request failed validation. Check the error message for the parameter that isn't valid.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Example – Creating an agent-enforced policy The following example creates an agent-enforced policy that blocks user-installed extensions.
>>> await client.create_agent_enforced_policy(client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='no-user-extensions', policy_body='{"allowUserExtensions":false}')
Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 | |