Describes the content, creation time, and security configuration of an Amazon SageMaker Model Card.
To retrieve only metadata about a model card without requiring kms:Decrypt permission on the associated customer-managed Amazon Web Services KMS key, set IncludedData to MetadataOnly. The default is AllData, which returns the full model card Content and requires kms:Decrypt permission when a customer-managed key is configured.
Parameters:
-
model_card_name
(Optional[ModelCardNameOrArn], default:
None
)
–
The name or Amazon Resource Name (ARN) of the model card to describe.
-
model_card_version
(Optional[Integer], default:
None
)
–
The version of the model card to describe. If a version is not provided, then the latest version of the model card is described.
-
included_data
(Optional[IncludedData], default:
None
)
–
Specifies the level of model card data to include in the response. Use this parameter to call DescribeModelCard without requiring kms:Decrypt permission on the customer-managed Amazon Web Services KMS key.
-
AllData: Returns the full model card Content. This option requires kms:Decrypt permission on the customer-managed key, if one is associated with the model card. This is the default.
-
MetadataOnly: Returns the model card with sanitized Content that includes only a small set of unencrypted metadata fields. This option does not require kms:Decrypt permission. For the list of fields preserved in the response, see Content.
If you don't specify a value, SageMaker returns AllData.
Raises:
Source code in docs_src/capo_sagemaker/_services/sage_maker.py
| def describe_model_card(
self,
*,
config_overrides: Optional[SageMakerClientConfig] = None,
model_card_name: Optional[
"capo_sagemaker.types.model_card_name_or_arn.ModelCardNameOrArn"
] = None,
model_card_version: Optional["capo_sagemaker.types.integer.Integer"] = None,
included_data: Optional[
"capo_sagemaker.types.included_data.IncludedData"
] = None,
) -> "capo_sagemaker.types.describe_model_card_response.DescribeModelCardResponse":
"""<p>Describes the content, creation time, and security configuration of an Amazon SageMaker Model Card.</p> <important> <p>To retrieve only metadata about a model card without requiring <code>kms:Decrypt</code> permission on the associated customer-managed Amazon Web Services KMS key, set <code>IncludedData</code> to <code>MetadataOnly</code>. The default is <code>AllData</code>, which returns the full model card <code>Content</code> and requires <code>kms:Decrypt</code> permission when a customer-managed key is configured.</p> </important>
Args:
model_card_name: <p>The name or Amazon Resource Name (ARN) of the model card to describe.</p>
model_card_version: <p>The version of the model card to describe. If a version is not provided, then the latest version of the model card is described.</p>
included_data: <p>Specifies the level of model card data to include in the response. Use this parameter to call <code>DescribeModelCard</code> without requiring <code>kms:Decrypt</code> permission on the customer-managed Amazon Web Services KMS key.</p> <ul> <li> <p> <code>AllData</code>: Returns the full model card <code>Content</code>. This option requires <code>kms:Decrypt</code> permission on the customer-managed key, if one is associated with the model card. This is the default.</p> </li> <li> <p> <code>MetadataOnly</code>: Returns the model card with sanitized <code>Content</code> that includes only a small set of unencrypted metadata fields. This option does not require <code>kms:Decrypt</code> permission. For the list of fields preserved in the response, see <code>Content</code>.</p> </li> </ul> <p>If you don't specify a value, SageMaker returns <code>AllData</code>.</p>
Raises:
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.
"""
def _handler(
req: "OperationRequest[capo_sagemaker.types.describe_model_card_request.DescribeModelCardRequest]",
) -> OperationResponse[
"capo_sagemaker.types.describe_model_card_response.DescribeModelCardResponse"
]:
import capo_sagemaker._operations.sage_maker.describe_model_card
output, http_response = (
capo_sagemaker._operations.sage_maker.describe_model_card.describe_model_card(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_sagemaker.types.describe_model_card_response.DescribeModelCardResponse",
) -> dict[str, Any]:
import capo_sagemaker.types.describe_model_card_response
return capo_sagemaker.types.describe_model_card_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("DescribeModelCard", redact_output=_redact_output),
)
input_: capo_sagemaker.types.describe_model_card_request.DescribeModelCardRequest = {}
if model_card_name is not None:
input_["model_card_name"] = model_card_name
if model_card_version is not None:
input_["model_card_version"] = model_card_version
if included_data is not None:
input_["included_data"] = included_data
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|