Attaches a resource-based policy to an entity. Examples of an entity include: AmiProduct and ContainerProduct.
Parameters:
-
resource_arn
(ResourceARN)
–
The Amazon Resource Name (ARN) of the entity resource you want to associate with a resource policy.
-
policy
(ResourcePolicyJson)
–
The policy document to set; formatted in JSON.
Raises:
Source code in docs_src/capo_marketplace_catalog/_services/marketplace_catalog.py
| def put_resource_policy(
self,
resource_arn: "capo_marketplace_catalog.types.resource_arn.ResourceARN",
policy: "capo_marketplace_catalog.types.resource_policy_json.ResourcePolicyJson",
*,
config_overrides: Optional[MarketplaceCatalogClientConfig] = None,
) -> "capo_marketplace_catalog.types.put_resource_policy_response.PutResourcePolicyResponse":
"""<p>Attaches a resource-based policy to an entity. Examples of an entity include: <code>AmiProduct</code> and <code>ContainerProduct</code>.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the entity resource you want to associate with a resource policy.</p>
policy: <p>The policy document to set; formatted in JSON.</p>
Raises:
capo_marketplace_catalog.errors.access_denied_exception.AccessDeniedException: <p>Access is denied.</p> <p>HTTP status code: 403</p>
capo_marketplace_catalog.errors.internal_service_exception.InternalServiceException: <p>There was an internal service exception.</p> <p>HTTP status code: 500</p>
capo_marketplace_catalog.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource wasn't found.</p> <p>HTTP status code: 404</p>
capo_marketplace_catalog.errors.throttling_exception.ThrottlingException: <p>Too many requests.</p> <p>HTTP status code: 429</p>
capo_marketplace_catalog.errors.validation_exception.ValidationException: <p>An error occurred during validation.</p> <p>HTTP status code: 422</p>
capo_marketplace_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_marketplace_catalog.types.put_resource_policy_request.PutResourcePolicyRequest]",
) -> OperationResponse[
"capo_marketplace_catalog.types.put_resource_policy_response.PutResourcePolicyResponse"
]:
import capo_marketplace_catalog._operations.awsmp_seymour.put_resource_policy
output, http_response = (
capo_marketplace_catalog._operations.awsmp_seymour.put_resource_policy.put_resource_policy(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutResourcePolicy")
)
input_: capo_marketplace_catalog.types.put_resource_policy_request.PutResourcePolicyRequest = {
"resource_arn": resource_arn,
"policy": policy,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|