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 SSO instance.

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

Parameter instanceArn : The ARN of the SSO instance under which the operation will be executed. For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS 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 {
  ArgumentError.checkNotNull(instanceArn, 'instanceArn');
  _s.validateStringLength(
    'instanceArn',
    instanceArn,
    10,
    1224,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    32,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    700,
  );
  _s.validateStringLength(
    'relayState',
    relayState,
    1,
    240,
  );
  _s.validateStringLength(
    'sessionDuration',
    sessionDuration,
    1,
    100,
  );
  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);
}