putComponentPolicy method
Applies a policy to a component. We recommend that you call the RAM API CreateResourceShare
to share resources. If you call the Image Builder API
PutComponentPolicy
, 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 componentArn
:
The Amazon Resource Name (ARN) of the component that this policy should be
applied to.
Parameter policy
:
The policy to apply.
Implementation
Future<PutComponentPolicyResponse> putComponentPolicy({
required String componentArn,
required String policy,
}) async {
ArgumentError.checkNotNull(componentArn, 'componentArn');
ArgumentError.checkNotNull(policy, 'policy');
_s.validateStringLength(
'policy',
policy,
1,
30000,
isRequired: true,
);
final $payload = <String, dynamic>{
'componentArn': componentArn,
'policy': policy,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/PutComponentPolicy',
exceptionFnMap: _exceptionFns,
);
return PutComponentPolicyResponse.fromJson(response);
}