putResourcePolicy method
Stores a resource policy for the ARN of a Project
or
ReportGroup
object.
May throw ResourceNotFoundException. May throw InvalidInputException.
Parameter policy
:
A JSON-formatted resource policy. For more information, see Sharing
a Project and Sharing
a Report Group in the AWS CodeBuild User Guide.
Parameter resourceArn
:
The ARN of the Project
or ReportGroup
resource
you want to associate with a resource policy.
Implementation
Future<PutResourcePolicyOutput> putResourcePolicy({
required String policy,
required String resourceArn,
}) async {
ArgumentError.checkNotNull(policy, 'policy');
_s.validateStringLength(
'policy',
policy,
1,
1152921504606846976,
isRequired: true,
);
ArgumentError.checkNotNull(resourceArn, 'resourceArn');
_s.validateStringLength(
'resourceArn',
resourceArn,
1,
1152921504606846976,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeBuild_20161006.PutResourcePolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'policy': policy,
'resourceArn': resourceArn,
},
);
return PutResourcePolicyOutput.fromJson(jsonResponse.body);
}