Skip to content

update_model_card async

update_model_card(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_card_name: Optional[ModelCardNameOrArn] = None,
    content: Optional[ModelCardContent] = None,
    model_card_status: Optional[ModelCardStatus] = None,
) -> UpdateModelCardResponse

Update an Amazon SageMaker Model Card.

You cannot update both model card content and model card status in a single call.

Parameters:

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

    The name or Amazon Resource Name (ARN) of the model card to update.

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

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

    When updating model card content, be sure to include the full content and not just updated content.

  • 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.

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.

  • ResourceNotFound –

    Resource being access is not found.

  • 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 update_model_card(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    model_card_name: Optional[
        "capo_sagemaker.types.model_card_name_or_arn.ModelCardNameOrArn"
    ] = None,
    content: Optional[
        "capo_sagemaker.types.model_card_content.ModelCardContent"
    ] = None,
    model_card_status: Optional[
        "capo_sagemaker.types.model_card_status.ModelCardStatus"
    ] = None,
) -> "capo_sagemaker.types.update_model_card_response.UpdateModelCardResponse":
    """<p>Update an Amazon SageMaker Model Card.</p> <important> <p>You cannot update both model card content and model card status in a single call.</p> </important>

    Args:
        model_card_name: <p>The name or Amazon Resource Name (ARN) of the model card to update.</p>
        content: <p>The updated model card content. 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> <p>When updating model card content, be sure to include the full content and not just updated content.</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>

    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.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.update_model_card_request.UpdateModelCardRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.update_model_card_response.UpdateModelCardResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.update_model_card

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

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

        return capo_sagemaker.types.update_model_card_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateModelCard", redact_input=_redact_input),
    )
    input_: capo_sagemaker.types.update_model_card_request.UpdateModelCardRequest = {}
    if model_card_name is not None:
        input_["model_card_name"] = model_card_name
    if content is not None:
        input_["content"] = content
    if model_card_status is not None:
        input_["model_card_status"] = model_card_status

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