Skip to content

create_workspace_image

create_workspace_image(
    name: WorkspaceImageName,
    description: WorkspaceImageDescription,
    workspace_id: WorkspaceId,
    *,
    config_overrides: Optional[WorkSpacesClientConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateWorkspaceImageResult

Creates a new WorkSpace image from an existing WorkSpace.

Parameters:

  • name (WorkspaceImageName) –

    The name of the new WorkSpace image.

  • description (WorkspaceImageDescription) –

    The description of the new WorkSpace image.

  • workspace_id (WorkspaceId) –

    The identifier of the source WorkSpace

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

    The tags that you want to add to the new WorkSpace image. To add tags when you're creating the image, you must create an IAM policy that grants your IAM user permission to use workspaces:CreateTags.

Raises:

Source code in docs_src/capo_workspaces/_services/work_spaces.py
def create_workspace_image(
    self,
    name: "capo_workspaces.types.workspace_image_name.WorkspaceImageName",
    description: "capo_workspaces.types.workspace_image_description.WorkspaceImageDescription",
    workspace_id: "capo_workspaces.types.workspace_id.WorkspaceId",
    *,
    config_overrides: Optional[WorkSpacesClientConfig] = None,
    tags: Optional["capo_workspaces.types.tag_list.TagList"] = None,
) -> (
    "capo_workspaces.types.create_workspace_image_result.CreateWorkspaceImageResult"
):
    """<p>Creates a new WorkSpace image from an existing WorkSpace.</p>

    Args:
        name: <p>The name of the new WorkSpace image.</p>
        description: <p>The description of the new WorkSpace image.</p>
        workspace_id: <p>The identifier of the source WorkSpace</p>
        tags: <p>The tags that you want to add to the new WorkSpace image. To add tags when you're creating the image, you must create an IAM policy that grants your IAM user permission to use <code>workspaces:CreateTags</code>.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.invalid_parameter_values_exception.InvalidParameterValuesException: <p>One or more parameter values are not valid.</p>
        capo_workspaces.errors.invalid_resource_state_exception.InvalidResourceStateException: <p>The state of the resource is not valid for this operation.</p>
        capo_workspaces.errors.operation_not_supported_exception.OperationNotSupportedException: <p>This operation is not supported.</p>
        capo_workspaces.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_workspaces.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>Your resource limits have been exceeded.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workspaces.types.create_workspace_image_request.CreateWorkspaceImageRequest]",
    ) -> OperationResponse[
        "capo_workspaces.types.create_workspace_image_result.CreateWorkspaceImageResult"
    ]:
        import capo_workspaces._operations.workspaces_service.create_workspace_image

        output, http_response = (
            capo_workspaces._operations.workspaces_service.create_workspace_image.create_workspace_image(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateWorkspaceImage")
    )
    input_: capo_workspaces.types.create_workspace_image_request.CreateWorkspaceImageRequest = {
        "name": name,
        "description": description,
        "workspace_id": workspace_id,
    }
    if tags is not None:
        input_["tags"] = tags

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