updateSecurityPolicy method
Updates an OpenSearch Serverless security policy. For more information, see Network access for Amazon OpenSearch Serverless and Encryption at rest for Amazon OpenSearch Serverless.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter name :
The name of the policy.
Parameter policyVersion :
The version of the policy being updated.
Parameter type :
The type of access policy.
Parameter clientToken :
Unique, case-sensitive identifier to ensure idempotency of the request.
Parameter description :
A description of the policy. Typically used to store information about the
permissions defined in the policy.
Parameter policy :
The JSON policy document to use as the content for the new policy.
Implementation
Future<UpdateSecurityPolicyResponse> updateSecurityPolicy({
required String name,
required String policyVersion,
required SecurityPolicyType type,
String? clientToken,
String? description,
String? policy,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'OpenSearchServerless.UpdateSecurityPolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'name': name,
'policyVersion': policyVersion,
'type': type.value,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (policy != null) 'policy': policy,
},
);
return UpdateSecurityPolicyResponse.fromJson(jsonResponse.body);
}