putResourcePolicy method
Sets the Data Catalog resource policy for access control.
May throw ConditionCheckFailureException.
May throw EntityNotFoundException.
May throw InternalServiceException.
May throw InvalidInputException.
May throw OperationTimeoutException.
Parameter policyInJson :
Contains the policy document to set, in JSON format.
Parameter enableHybrid :
If 'TRUE', indicates that you are using both methods to grant
cross-account access to Data Catalog resources:
-
By directly updating the resource policy with
PutResourePolicy - By using the Grant permissions command on the Amazon Web Services Management Console.
'TRUE' if you have already used the Management
Console to grant cross-account access, otherwise the call fails. Default
is 'FALSE'.
Parameter policyExistsCondition :
A value of MUST_EXIST is used to update a policy. A value of
NOT_EXIST is used to create a new policy. If a value of
NONE or a null value is used, the call does not depend on the
existence of a policy.
Parameter policyHashCondition :
The hash value returned when the previous policy was set using
PutResourcePolicy. Its purpose is to prevent concurrent
modifications of a policy. Do not use this parameter if no previous policy
has been set.
Parameter resourceArn :
Do not use. For internal use only.
Implementation
Future<PutResourcePolicyResponse> putResourcePolicy({
required String policyInJson,
EnableHybridValues? enableHybrid,
ExistCondition? policyExistsCondition,
String? policyHashCondition,
String? resourceArn,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.PutResourcePolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'PolicyInJson': policyInJson,
if (enableHybrid != null) 'EnableHybrid': enableHybrid.value,
if (policyExistsCondition != null)
'PolicyExistsCondition': policyExistsCondition.value,
if (policyHashCondition != null)
'PolicyHashCondition': policyHashCondition,
if (resourceArn != null) 'ResourceArn': resourceArn,
},
);
return PutResourcePolicyResponse.fromJson(jsonResponse.body);
}