createPermissionSet method

Future<CreatePermissionSetResponse> createPermissionSet({
  1. required String instanceArn,
  2. required String name,
  3. String? description,
  4. String? relayState,
  5. String? sessionDuration,
  6. List<Tag>? tags,
})

Creates a permission set within a specified IAM Identity Center instance.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter instanceArn : The ARN of the IAM Identity Center instance under which the operation will be executed. For more information about ARNs, see Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces in the Amazon Web Services General Reference.

Parameter name : The name of the PermissionSet.

Parameter description : The description of the PermissionSet.

Parameter relayState : Used to redirect users within the application during the federation authentication process.

Parameter sessionDuration : The length of time that the application user sessions are valid in the ISO-8601 standard.

Parameter tags : The tags to attach to the new PermissionSet.

Implementation

Future<CreatePermissionSetResponse> createPermissionSet({
  required String instanceArn,
  required String name,
  String? description,
  String? relayState,
  String? sessionDuration,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SWBExternalService.CreatePermissionSet'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceArn': instanceArn,
      'Name': name,
      if (description != null) 'Description': description,
      if (relayState != null) 'RelayState': relayState,
      if (sessionDuration != null) 'SessionDuration': sessionDuration,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreatePermissionSetResponse.fromJson(jsonResponse.body);
}