create_agent_enforced_policy
¶
create_agent_enforced_policy(
name: EnforcedPolicyName,
policy_body: EnforcedPolicyBody,
*,
config_overrides: Optional[WorkSpacesClientConfig] = 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.
>>> 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/work_spaces.py
1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 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 | |