setDefaultPolicyVersion method

Future<void> setDefaultPolicyVersion({
  1. required String policyName,
  2. required String policyVersionId,
})

Sets the specified version of the specified policy as the policy's default (operative) version. This action affects all certificates to which the policy is attached. To list the principals the policy is attached to, use the ListPrincipalPolicy API.

May throw ResourceNotFoundException. May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException.

Parameter policyName : The policy name.

Parameter policyVersionId : The policy version ID.

Implementation

Future<void> setDefaultPolicyVersion({
  required String policyName,
  required String policyVersionId,
}) async {
  ArgumentError.checkNotNull(policyName, 'policyName');
  _s.validateStringLength(
    'policyName',
    policyName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(policyVersionId, 'policyVersionId');
  await _protocol.send(
    payload: null,
    method: 'PATCH',
    requestUri:
        '/policies/${Uri.encodeComponent(policyName)}/version/${Uri.encodeComponent(policyVersionId)}',
    exceptionFnMap: _exceptionFns,
  );
}