create_workspace_enforced_policy
async
¶
create_workspace_enforced_policy(
name: EnforcedPolicyName,
policy_body: EnforcedPolicyBody,
*,
config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
client_token: Optional[IdempotencyToken] = None,
tags: Optional[TagList] = None,
) -> CreateWorkspaceEnforcedPolicyResult
Creates a WorkSpace-enforced policy, which the WorkSpace applies. The name must be unique among the WorkSpace-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 WorkSpace-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 WorkSpace-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 WorkSpace-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 WorkSpace-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 a WorkSpace-enforced policy The following example creates a WorkSpace-enforced policy that keeps internet access on.
>>> await client.create_workspace_enforced_policy(client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='default-network', policy_body='{"disableInternetAccess":false,"deniedPaths":[]}')
Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 | |