Skip to content

create_custom_metadata async

create_custom_metadata(
    resource_id: ResourceIdType,
    custom_metadata: CustomMetadataMap,
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    authentication_token: Optional[AuthenticationHeaderType] = None,
    version_id: Optional[DocumentVersionIdType] = None,
) -> CreateCustomMetadataResponse

Adds one or more custom properties to the specified resource (a folder, document, or version).

Parameters:

  • authentication_token (Optional[AuthenticationHeaderType], default: None ) –

    Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.

  • resource_id (ResourceIdType) –

    The ID of the resource.

  • version_id (Optional[DocumentVersionIdType], default: None ) –

    The ID of the version, if the custom metadata is being added to a document version.

  • custom_metadata (CustomMetadataMap) –

    Custom metadata in the form of name-value pairs.

Raises:

Source code in docs_src/capo_workdocs/_services/async_work_docs.py
async def create_custom_metadata(
    self,
    resource_id: "capo_workdocs.types.resource_id_type.ResourceIdType",
    custom_metadata: "capo_workdocs.types.custom_metadata_map.CustomMetadataMap",
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    authentication_token: Optional[
        "capo_workdocs.types.authentication_header_type.AuthenticationHeaderType"
    ] = None,
    version_id: Optional[
        "capo_workdocs.types.document_version_id_type.DocumentVersionIdType"
    ] = None,
) -> "capo_workdocs.types.create_custom_metadata_response.CreateCustomMetadataResponse":
    """<p>Adds one or more custom properties to the specified resource (a folder, document, or version).</p>

    Args:
        authentication_token: <p>Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.</p>
        resource_id: <p>The ID of the resource.</p>
        version_id: <p>The ID of the version, if the custom metadata is being added to a document version.</p>
        custom_metadata: <p>Custom metadata in the form of name-value pairs.</p>

    Raises:
        capo_workdocs.errors.custom_metadata_limit_exceeded_exception.CustomMetadataLimitExceededException: <p>The limit has been reached on the number of custom properties for the specified resource.</p>
        capo_workdocs.errors.entity_not_exists_exception.EntityNotExistsException: <p>The resource does not exist.</p>
        capo_workdocs.errors.failed_dependency_exception.FailedDependencyException: <p>The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.</p>
        capo_workdocs.errors.prohibited_state_exception.ProhibitedStateException: <p>The specified document version is not in the INITIALIZED state.</p>
        capo_workdocs.errors.service_unavailable_exception.ServiceUnavailableException: <p>One or more of the dependencies is unavailable.</p>
        capo_workdocs.errors.unauthorized_operation_exception.UnauthorizedOperationException: <p>The operation is not permitted.</p>
        capo_workdocs.errors.unauthorized_resource_access_exception.UnauthorizedResourceAccessException: <p>The caller does not have access to perform the action on the resource.</p>
        capo_workdocs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workdocs.types.create_custom_metadata_request.CreateCustomMetadataRequest]",
    ) -> AsyncOperationResponse[
        "capo_workdocs.types.create_custom_metadata_response.CreateCustomMetadataResponse"
    ]:
        import capo_workdocs._operations.aws_gorilla_boy_service.create_custom_metadata

        (
            output,
            http_response,
        ) = await capo_workdocs._operations.aws_gorilla_boy_service.create_custom_metadata.async_create_custom_metadata(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workdocs.types.create_custom_metadata_request.CreateCustomMetadataRequest",
    ) -> dict[str, Any]:
        import capo_workdocs.types.create_custom_metadata_request

        return capo_workdocs.types.create_custom_metadata_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCustomMetadata", redact_input=_redact_input),
    )
    input_: capo_workdocs.types.create_custom_metadata_request.CreateCustomMetadataRequest = {
        "resource_id": resource_id,
        "custom_metadata": custom_metadata,
    }
    if authentication_token is not None:
        input_["authentication_token"] = authentication_token
    if version_id is not None:
        input_["version_id"] = version_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output