updateResourceServer method

Future<UpdateResourceServerResponse> updateResourceServer({
  1. required String identifier,
  2. required String name,
  3. required String userPoolId,
  4. List<ResourceServerScopeType>? scopes,
})

Updates the name and scopes of resource server. All other fields are read-only.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw NotAuthorizedException. May throw TooManyRequestsException. May throw InternalErrorException.

Parameter identifier : The identifier for the resource server.

Parameter name : The name of the resource server.

Parameter userPoolId : The user pool ID for the user pool.

Parameter scopes : The scope values to be set for the resource server.

Implementation

Future<UpdateResourceServerResponse> updateResourceServer({
  required String identifier,
  required String name,
  required String userPoolId,
  List<ResourceServerScopeType>? scopes,
}) async {
  ArgumentError.checkNotNull(identifier, 'identifier');
  _s.validateStringLength(
    'identifier',
    identifier,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.UpdateResourceServer'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Identifier': identifier,
      'Name': name,
      'UserPoolId': userPoolId,
      if (scopes != null) 'Scopes': scopes,
    },
  );

  return UpdateResourceServerResponse.fromJson(jsonResponse.body);
}