putContainerRecipePolicy method
Applies a policy to a container image. We recommend that you call the RAM
API CreateResourceShare
(https://docs.aws.amazon.com/ram/latest/APIReference/API_CreateResourceShare.html)
to share resources. If you call the Image Builder API
PutContainerImagePolicy
, you must also call the RAM API
PromoteResourceShareCreatedFromPolicy
(https://docs.aws.amazon.com/ram/latest/APIReference/API_PromoteResourceShareCreatedFromPolicy.html)
in order for the resource to be visible to all principals with whom the
resource is shared.
May throw ServiceException. May throw ClientException. May throw ServiceUnavailableException. May throw InvalidRequestException. May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw ForbiddenException. May throw CallRateLimitExceededException.
Parameter containerRecipeArn
:
The Amazon Resource Name (ARN) of the container recipe that this policy
should be applied to.
Parameter policy
:
The policy to apply to the container recipe.
Implementation
Future<PutContainerRecipePolicyResponse> putContainerRecipePolicy({
required String containerRecipeArn,
required String policy,
}) async {
ArgumentError.checkNotNull(containerRecipeArn, 'containerRecipeArn');
ArgumentError.checkNotNull(policy, 'policy');
_s.validateStringLength(
'policy',
policy,
1,
30000,
isRequired: true,
);
final $payload = <String, dynamic>{
'containerRecipeArn': containerRecipeArn,
'policy': policy,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/PutContainerRecipePolicy',
exceptionFnMap: _exceptionFns,
);
return PutContainerRecipePolicyResponse.fromJson(response);
}