Adds a resouce policy to control access to a model group. For information about resoure policies, see Identity-based policies and resource-based policies in the Amazon Web Services Identity and Access Management User Guide..
Parameters:
-
model_package_group_name
(Optional[EntityName], default:
None
)
–
The name of the model group to add a resource policy to.
-
resource_policy
(Optional[PolicyString], default:
None
)
–
The resource policy for the model group.
Raises:
-
ConflictException
–
There was a conflict when you attempted to modify a SageMaker entity such as an Experiment or Artifact.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_sagemaker/_services/sage_maker.py
| def put_model_package_group_policy(
self,
*,
config_overrides: Optional[SageMakerClientConfig] = None,
model_package_group_name: Optional[
"capo_sagemaker.types.entity_name.EntityName"
] = None,
resource_policy: Optional[
"capo_sagemaker.types.policy_string.PolicyString"
] = None,
) -> "capo_sagemaker.types.put_model_package_group_policy_output.PutModelPackageGroupPolicyOutput":
"""<p>Adds a resouce policy to control access to a model group. For information about resoure policies, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html">Identity-based policies and resource-based policies</a> in the <i>Amazon Web Services Identity and Access Management User Guide.</i>.</p>
Args:
model_package_group_name: <p>The name of the model group to add a resource policy to.</p>
resource_policy: <p>The resource policy for the model group.</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.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_sagemaker.types.put_model_package_group_policy_input.PutModelPackageGroupPolicyInput]",
) -> OperationResponse[
"capo_sagemaker.types.put_model_package_group_policy_output.PutModelPackageGroupPolicyOutput"
]:
import capo_sagemaker._operations.sage_maker.put_model_package_group_policy
output, http_response = (
capo_sagemaker._operations.sage_maker.put_model_package_group_policy.put_model_package_group_policy(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutModelPackageGroupPolicy")
)
input_: capo_sagemaker.types.put_model_package_group_policy_input.PutModelPackageGroupPolicyInput = {}
if model_package_group_name is not None:
input_["model_package_group_name"] = model_package_group_name
if resource_policy is not None:
input_["resource_policy"] = resource_policy
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|