create_workspace_enforced_policy
¶
create_workspace_enforced_policy(
name: EnforcedPolicyName,
policy_body: EnforcedPolicyBody,
*,
config_overrides: Optional[WorkSpacesClientConfig] = 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.
>>> 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/work_spaces.py
2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 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 | |