Skip to content

create_model_card async

create_model_card(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_card_name: Optional[EntityName] = None,
    security_config: Optional[ModelCardSecurityConfig] = None,
    content: Optional[ModelCardContent] = None,
    model_card_status: Optional[ModelCardStatus] = None,
    tags: Optional[TagList] = None,
) -> CreateModelCardResponse

Creates an Amazon SageMaker Model Card.

For information about how to use model cards, see Amazon SageMaker Model Card.

Parameters:

  • model_card_name (Optional[EntityName], default: None ) –

    The unique name of the model card.

  • security_config (Optional[ModelCardSecurityConfig], default: None ) –

    An optional Key Management Service key to encrypt, decrypt, and re-encrypt model card content for regulated workloads with highly sensitive data.

  • content (Optional[ModelCardContent], default: None ) –

    The content of the model card. Content must be in model card JSON schema and provided as a string.

  • model_card_status (Optional[ModelCardStatus], default: None ) –

    The approval status of the model card within your organization. Different organizations might have different criteria for model card review and approval.

    • Draft: The model card is a work in progress.

    • PendingReview: The model card is pending review.

    • Approved: The model card is approved.

    • Archived: The model card is archived. No more updates should be made to the model card, but it can still be exported.

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

    Key-value pairs used to manage metadata for model cards.

Raises:

  • ConflictException –

    There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_model_card(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_card_name: Optional["capo_sagemaker.types.entity_name.EntityName"] = None,
    security_config: Optional[
        "capo_sagemaker.types.model_card_security_config.ModelCardSecurityConfig"
    ] = None,
    content: Optional[
        "capo_sagemaker.types.model_card_content.ModelCardContent"
    ] = None,
    model_card_status: Optional[
        "capo_sagemaker.types.model_card_status.ModelCardStatus"
    ] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> "capo_sagemaker.types.create_model_card_response.CreateModelCardResponse":
    """<p>Creates an Amazon SageMaker Model Card.</p> <p>For information about how to use model cards, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-cards.html">Amazon SageMaker Model Card</a>.</p>

    Args:
        model_card_name: <p>The unique name of the model card.</p>
        security_config: <p>An optional Key Management Service key to encrypt, decrypt, and re-encrypt model card content for regulated workloads with highly sensitive data.</p>
        content: <p>The content of the model card. Content must be in <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-cards.html#model-cards-json-schema">model card JSON schema</a> and provided as a string.</p>
        model_card_status: <p>The approval status of the model card within your organization. Different organizations might have different criteria for model card review and approval.</p> <ul> <li> <p> <code>Draft</code>: The model card is a work in progress.</p> </li> <li> <p> <code>PendingReview</code>: The model card is pending review.</p> </li> <li> <p> <code>Approved</code>: The model card is approved.</p> </li> <li> <p> <code>Archived</code>: The model card is archived. No more updates should be made to the model card, but it can still be exported.</p> </li> </ul>
        tags: <p>Key-value pairs used to manage metadata for model cards.</p>

    Raises:
        capo_sagemaker.errors.conflict_exception.ConflictException: <p>There was a conflict when you attempted to modify a SageMaker entity such as an <code>Experiment</code> or <code>Artifact</code>.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_model_card_request.CreateModelCardRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_model_card_response.CreateModelCardResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_model_card

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_model_card.async_create_model_card(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sagemaker.types.create_model_card_request.CreateModelCardRequest",
    ) -> dict[str, Any]:
        import capo_sagemaker.types.create_model_card_request

        return capo_sagemaker.types.create_model_card_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateModelCard", redact_input=_redact_input),
    )
    input_: capo_sagemaker.types.create_model_card_request.CreateModelCardRequest = {}
    if model_card_name is not None:
        input_["model_card_name"] = model_card_name
    if security_config is not None:
        input_["security_config"] = security_config
    if content is not None:
        input_["content"] = content
    if model_card_status is not None:
        input_["model_card_status"] = model_card_status
    if tags is not None:
        input_["tags"] = tags

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