putImagePolicy method

Future<PutImagePolicyResponse> putImagePolicy({
  1. required String imageArn,
  2. required String policy,
})

Applies a policy to an image. We recommend that you call the RAM API CreateResourceShare to share resources. If you call the Image Builder API PutImagePolicy, you must also call the RAM API PromoteResourceShareCreatedFromPolicy 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 imageArn : The Amazon Resource Name (ARN) of the image that this policy should be applied to.

Parameter policy : The policy to apply.

Implementation

Future<PutImagePolicyResponse> putImagePolicy({
  required String imageArn,
  required String policy,
}) async {
  ArgumentError.checkNotNull(imageArn, 'imageArn');
  ArgumentError.checkNotNull(policy, 'policy');
  _s.validateStringLength(
    'policy',
    policy,
    1,
    30000,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'imageArn': imageArn,
    'policy': policy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/PutImagePolicy',
    exceptionFnMap: _exceptionFns,
  );
  return PutImagePolicyResponse.fromJson(response);
}