resource_servers
Creates, updates, deletes, gets or lists a resource_servers resource.
Overview
| Name | resource_servers |
| Type | Resource |
| Id | aws.cognito_idp.resource_servers |
Fields
The following fields are returned by SELECT queries:
- describe_resource_server
| Name | Datatype | Description |
|---|---|---|
identifier | string | A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier. Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens. (pattern: <code>[\x21\x23-\x5B\x5D-\x7E]+</code>) |
name | string | The name of the resource server. (pattern: <code>[\w\s+=,.@-]+</code>) |
scopes | array | A list of scopes that are defined for the resource server. |
user_pool_id | string | The ID of the user pool that contains the resource server configuration. (pattern: <code>[\w-]+_[0-9a-zA-Z]+</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_resource_server | select | region | Describes a resource server. For more information about resource servers, see Access control with resource servers. | |
create_resource_server | insert | region, UserPoolId | Creates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints | |
update_resource_server | update | region, UserPoolId | Updates the name and scopes of a resource server. All other fields are read-only. For more information about resource servers, see Access control with resource servers. If you don't provide a value for an attribute, it is set to the default value. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints | |
delete_resource_server | delete | region | Deletes a resource server. After you delete a resource server, users can no longer generate access tokens with scopes that are associate with that resource server. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints | |
list_resource_servers | exec | region, UserPoolId | Given a user pool ID, returns all resource servers and their details. For more information about resource servers, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- describe_resource_server
Describes a resource server. For more information about resource servers, see Access control with resource servers.
SELECT
identifier,
name,
scopes,
user_pool_id
FROM aws.cognito_idp.resource_servers
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_resource_server
- Manifest
Creates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
INSERT INTO aws.cognito_idp.resource_servers (
UserPoolId,
Identifier,
Name,
Scopes,
region
)
SELECT
'{{ UserPoolId }}' /* required */,
'{{ Identifier }}',
'{{ Name }}',
'{{ Scopes }}',
'{{ region }}'
RETURNING
resource_server
;
# Description fields are for documentation purposes
- name: resource_servers
props:
- name: region
value: "{{ region }}"
description: Required parameter for the resource_servers resource.
- name: UserPoolId
value: "{{ UserPoolId }}"
description: |
The ID of the user pool where you want to create a resource server.
- name: Identifier
value: "{{ Identifier }}"
description: |
A unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https://solar-system-data-api.example.com as your identifier. Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens.
- name: Name
value: "{{ Name }}"
description: |
A friendly name for the resource server.
- name: Scopes
description: |
A list of custom scopes. Each scope is a key-value map with the keys ScopeName and ScopeDescription. The name of a custom scope is a combination of ScopeName and the resource server Name in this request, for example MyResourceServerName/MyScopeName.
value:
- ScopeName: "{{ ScopeName }}"
ScopeDescription: "{{ ScopeDescription }}"
UPDATE examples
- update_resource_server
Updates the name and scopes of a resource server. All other fields are read-only. For more information about resource servers, see Access control with resource servers. If you don't provide a value for an attribute, it is set to the default value. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
UPDATE aws.cognito_idp.resource_servers
SET
UserPoolId = '{{ UserPoolId }}',
Identifier = '{{ Identifier }}',
Name = '{{ Name }}',
Scopes = '{{ Scopes }}'
WHERE
region = '{{ region }}' --required
AND UserPoolId = '{{ UserPoolId }}' --required
RETURNING
resource_server;
DELETE examples
- delete_resource_server
Deletes a resource server. After you delete a resource server, users can no longer generate access tokens with scopes that are associate with that resource server. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
DELETE FROM aws.cognito_idp.resource_servers
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- list_resource_servers
Given a user pool ID, returns all resource servers and their details. For more information about resource servers, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
EXEC aws.cognito_idp.resource_servers.list_resource_servers
@region='{{ region }}' --required
@@json=
'{
"UserPoolId": "{{ UserPoolId }}",
"MaxResults": {{ MaxResults }},
"NextToken": "{{ NextToken }}"
}'
;