Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Tutorial: creazione di un'API REST ConnectionType e di una connessione
Connessione all'API REST di Foo
Creeremo un'API AWS Glue REST ConnectionType e una AWS Glue connessione corrispondente per l'API REST di Foo. Questa API ha le seguenti proprietà (che possono essere recuperate dalla documentazione dell'API REST).
-
URL dell'istanza: https://foo.cloud.com/rest/ v1.
-
Tipo di autenticazione: OAuth2 (credenziali del cliente).
-
Metodo REST: GET.
-
Tipo di impaginazione: Offset con le proprietà «limit» e «offset» inserite nel parametro di query della richiesta.
-
Entità supportate:
-
Barra: percorso relativo [/bar.json].
-
Baz: percorso relativo [/baz.json].
-
Una volta ottenuti tutti i dettagli, possiamo iniziare a creare la AWS Glue connessione all'API REST di Foo.
Per creare una connessione API REST:
-
Crea il tipo di connessione API REST AWS Glue chiamando l' RegisterConnectionType API tramite AWS API, CLI o SDK. Questo creerà una nuova ConnectionType risorsa in. AWS Glue
{ "ConnectionType": "REST-FOO-CONNECTOR", "IntegrationType": "REST", "Description": "AWS Glue Connection Type for the FOO REST API", "ConnectionProperties": { "Url": { "Name": "Url", "Required": true, "DefaultValue": "https://foo.cloud.com/rest/v1", "PropertyType": "USER_INPUT" } }, "ConnectorAuthenticationConfiguration": { "AuthenticationTypes": ["OAUTH2"], "OAuth2Properties": { "OAuth2GrantType": "CLIENT_CREDENTIALS" } }, "RestConfiguration": { "GlobalSourceConfiguration": { "RequestMethod": "GET", "ResponseConfiguration": { "ResultPath": "$.result", "ErrorPath": "$.error.message" }, "PaginationConfiguration": { "OffsetConfiguration": { "OffsetParameter": { "Key": "offset", "PropertyLocation": "QUERY_PARAM" }, "LimitParameter": { "Key": "limit", "PropertyLocation": "QUERY_PARAM", "DefaultValue": "50" } } } }, "ValidationEndpointConfiguration": { "RequestMethod": "GET", "RequestPath": "/bar.json?offset=1&limit=10" }, "EntityConfigurations": { "bar": { "SourceConfiguration": { "RequestMethod": "GET", "RequestPath": "/bar.json", "ResponseConfiguration": { "ResultPath": "$.result", "ErrorPath": "$.error.message" } }, "Schema": { "name": { "Name": "name", "FieldDataType": "STRING" }, "description": { "Name": "description", "FieldDataType": "STRING" }, "id": { "Name": "id", "FieldDataType": "STRING" }, "status": { "Name": "status", "FieldDataType": "STRING" } } } } } } -
In AWS Secrets Manager, crea un segreto. Il segreto deve contenere l'app connessa Consumer Secret con
USER_MANAGED_CLIENT_APPLICATION_CLIENT_SECRETcome chiave.Nota
È necessario creare un segreto per ogni connessione in AWS Glue
-
Crea la AWS Glue connessione chiamando l' CreateConnection API utilizzando l' AWS API, la CLI o l'SDK.
-
Fai riferimento al nome del tipo di connessione REST del passaggio 1 come «»ConnectionType.
-
Fornisci il InstanceUrl e tutti gli altri ConnectionProperties che sono stati definiti durante il processo di AWS Glue ConnectionType registrazione.
-
Scegli tra i tipi di autenticazione configurati. L'API REST utilizzata da Foo OAuth2 con il tipo di ClientCredentials concessione.
-
Fornisci SecretArne altri AuthenticationPropertiesche sono configurati. Ad esempio, abbiamo configurato
OAUTH2come tale, AuthenticationType quindi imposteremo le «OAuth2Proprietà» in CreateConnectionInput. Ciò richiederà proprietà come «OAuth2GrantType», «TokenUrl» e «OAuth2ClientApplication».
-
-
Effettua la CreateConnection richiesta che creerà la AWS Glue connessione.
{ "ConnectionInput": { "Name": "ConnectionFooREST", "ConnectionType": "REST-FOO-CONNECTOR", "ConnectionProperties": {}, "ValidateCredentials": true, "AuthenticationConfiguration": { "AuthenticationType": "OAUTH2", "SecretArn": "arn:aws:secretsmanager:<region>:<accountId>:secret:<secretId>", "OAuth2Properties": { "OAuth2GrantType": "CLIENT_CREDENTIALS", "TokenUrl": "https://foo.cloud.com/oauth/token", "OAuth2ClientApplication": { "UserManagedClientApplicationClientId": "your-managed-client-id" } } } } }