Skip to content

create_environment

create_environment(
    desktop_arn: Arn,
    *,
    config_overrides: Optional[WorkSpacesThinClientClientConfig] = None,
    name: Optional[EnvironmentName] = None,
    desktop_endpoint: Optional[DesktopEndpoint] = None,
    software_set_update_schedule: Optional[SoftwareSetUpdateSchedule] = None,
    maintenance_window: Optional[MaintenanceWindow] = None,
    software_set_update_mode: Optional[SoftwareSetUpdateMode] = None,
    desired_software_set_id: Optional[SoftwareSetId] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagsMap] = None,
    device_creation_tags: Optional[DeviceCreationTagsMap] = None,
) -> CreateEnvironmentResponse

Creates an environment for your thin client devices.

Parameters:

  • name (Optional[EnvironmentName], default: None ) –

    The name for the environment.

  • desktop_arn (Arn) –

    The Amazon Resource Name (ARN) of the desktop to stream from Amazon WorkSpaces, WorkSpaces Secure Browser, or AppStream 2.0.

  • desktop_endpoint (Optional[DesktopEndpoint], default: None ) –

    The URL for the identity provider login (only for environments that use AppStream 2.0).

  • software_set_update_schedule (Optional[SoftwareSetUpdateSchedule], default: None ) –

    An option to define if software updates should be applied within a maintenance window.

  • maintenance_window (Optional[MaintenanceWindow], default: None ) –

    A specification for a time window to apply software updates.

  • software_set_update_mode (Optional[SoftwareSetUpdateMode], default: None ) –

    An option to define which software updates to apply.

  • desired_software_set_id (Optional[SoftwareSetId], default: None ) –

    The ID of the software set to apply.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The Amazon Resource Name (ARN) of the Key Management Service key to use to encrypt the environment.

  • client_token (Optional[ClientToken], default: None ) –

    Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.

    If you don't provide this value, then Amazon Web Services generates a random one for you.

    If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

  • tags (Optional[TagsMap], default: None ) –

    A map of the key-value pairs of the tag or tags to assign to the resource.

  • device_creation_tags (Optional[DeviceCreationTagsMap], default: None ) –

    A map of the key-value pairs of the tag or tags to assign to the newly created devices for this environment.

Raises:

Source code in docs_src/capo_workspaces_thin_client/_services/work_spaces_thin_client.py
def create_environment(
    self,
    desktop_arn: "capo_workspaces_thin_client.types.arn.Arn",
    *,
    config_overrides: Optional[WorkSpacesThinClientClientConfig] = None,
    name: Optional[
        "capo_workspaces_thin_client.types.environment_name.EnvironmentName"
    ] = None,
    desktop_endpoint: Optional[
        "capo_workspaces_thin_client.types.desktop_endpoint.DesktopEndpoint"
    ] = None,
    software_set_update_schedule: Optional[
        "capo_workspaces_thin_client.types.software_set_update_schedule.SoftwareSetUpdateSchedule"
    ] = None,
    maintenance_window: Optional[
        "capo_workspaces_thin_client.types.maintenance_window.MaintenanceWindow"
    ] = None,
    software_set_update_mode: Optional[
        "capo_workspaces_thin_client.types.software_set_update_mode.SoftwareSetUpdateMode"
    ] = None,
    desired_software_set_id: Optional[
        "capo_workspaces_thin_client.types.software_set_id.SoftwareSetId"
    ] = None,
    kms_key_arn: Optional[
        "capo_workspaces_thin_client.types.kms_key_arn.KmsKeyArn"
    ] = None,
    client_token: Optional[
        "capo_workspaces_thin_client.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_workspaces_thin_client.types.tags_map.TagsMap"] = None,
    device_creation_tags: Optional[
        "capo_workspaces_thin_client.types.device_creation_tags_map.DeviceCreationTagsMap"
    ] = None,
) -> "capo_workspaces_thin_client.types.create_environment_response.CreateEnvironmentResponse":
    """<p>Creates an environment for your thin client devices.</p>

    Args:
        name: <p>The name for the environment.</p>
        desktop_arn: <p>The Amazon Resource Name (ARN) of the desktop to stream from Amazon WorkSpaces, WorkSpaces Secure Browser, or AppStream 2.0.</p>
        desktop_endpoint: <p>The URL for the identity provider login (only for environments that use AppStream 2.0).</p>
        software_set_update_schedule: <p>An option to define if software updates should be applied within a maintenance window.</p>
        maintenance_window: <p>A specification for a time window to apply software updates.</p>
        software_set_update_mode: <p>An option to define which software updates to apply.</p>
        desired_software_set_id: <p>The ID of the software set to apply.</p>
        kms_key_arn: <p>The Amazon Resource Name (ARN) of the Key Management Service key to use to encrypt the environment.</p>
        client_token: <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value</a>.</p> <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p> <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
        tags: <p>A map of the key-value pairs of the tag or tags to assign to the resource.</p>
        device_creation_tags: <p>A map of the key-value pairs of the tag or tags to assign to the newly created devices for this environment.</p>

    Raises:
        capo_workspaces_thin_client.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_workspaces_thin_client.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
        capo_workspaces_thin_client.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_workspaces_thin_client.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
        capo_workspaces_thin_client.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Your request exceeds a service quota.</p>
        capo_workspaces_thin_client.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_workspaces_thin_client.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
        capo_workspaces_thin_client.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workspaces_thin_client.types.create_environment_request.CreateEnvironmentRequest]",
    ) -> OperationResponse[
        "capo_workspaces_thin_client.types.create_environment_response.CreateEnvironmentResponse"
    ]:
        import capo_workspaces_thin_client._operations.thin_client.create_environment

        output, http_response = (
            capo_workspaces_thin_client._operations.thin_client.create_environment.create_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workspaces_thin_client.types.create_environment_request.CreateEnvironmentRequest",
    ) -> dict[str, Any]:
        import capo_workspaces_thin_client.types.create_environment_request

        return capo_workspaces_thin_client.types.create_environment_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_workspaces_thin_client.types.create_environment_response.CreateEnvironmentResponse",
    ) -> dict[str, Any]:
        import capo_workspaces_thin_client.types.create_environment_response

        return capo_workspaces_thin_client.types.create_environment_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateEnvironment",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_workspaces_thin_client.types.create_environment_request.CreateEnvironmentRequest = {
        "desktop_arn": desktop_arn
    }
    if name is not None:
        input_["name"] = name
    if desktop_endpoint is not None:
        input_["desktop_endpoint"] = desktop_endpoint
    if software_set_update_schedule is not None:
        input_["software_set_update_schedule"] = software_set_update_schedule
    if maintenance_window is not None:
        input_["maintenance_window"] = maintenance_window
    if software_set_update_mode is not None:
        input_["software_set_update_mode"] = software_set_update_mode
    if desired_software_set_id is not None:
        input_["desired_software_set_id"] = desired_software_set_id
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags
    if device_creation_tags is not None:
        input_["device_creation_tags"] = device_creation_tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output