Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Contoh API Gateway menggunakan AWS CLI
Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface dengan API Gateway.
Tindakan merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.
Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakancreate-api-key.
- AWS CLI
-
Untuk membuat kunci API yang diaktifkan untuk API dan Stage yang ada
Perintah:
aws apigateway create-api-key --name 'Dev API Key' --description 'Used for development' --enabled --stage-keys restApiId='a1b2c3d4e5',stageName='dev'-
Untuk detail API, lihat CreateApiKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-authorizer.
- AWS CLI
-
Contoh 1: Untuk membuat API Gateway Custom Authorizer berbasis token untuk API
create-authorizerContoh berikut membuat otorisasi berbasis token.aws apigateway create-authorizer \ --rest-api-id1234123412\ --name 'First_Token_Custom_Authorizer' \ --typeTOKEN\ --authorizer-uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations' \ --identity-source 'method.request.header.Authorization' \ --authorizer-result-ttl-in-seconds300Output:
{ "authType": "custom", "name": "First_Token_Custom_Authorizer", "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations", "authorizerResultTtlInSeconds": 300, "identitySource": "method.request.header.Authorization", "type": "TOKEN", "id": "z40xj0" }Contoh 2: Untuk membuat Otorisasi Kustom Gateway API berbasis Cognito User Pools untuk API
create-authorizerContoh berikut membuat Pengatur Kustom Gateway API berbasis Cognito User Pools.aws apigateway create-authorizer \ --rest-api-id1234123412\ --name 'First_Cognito_Custom_Authorizer' \ --typeCOGNITO_USER_POOLS\ --provider-arns 'arn:aws:cognito-idp:us-east-1:123412341234:userpool/us-east-1_aWcZeQbuD' \ --identity-source 'method.request.header.Authorization'Output:
{ "authType": "cognito_user_pools", "identitySource": "method.request.header.Authorization", "name": "First_Cognito_Custom_Authorizer", "providerARNs": [ "arn:aws:cognito-idp:us-east-1:342398297714:userpool/us-east-1_qWbZzQhzE" ], "type": "COGNITO_USER_POOLS", "id": "5yid1t" }Contoh 3: Untuk membuat API Gateway Custom Authorizer berbasis permintaan untuk API
create-authorizerContoh berikut membuat otorisasi berbasis permintaan.aws apigateway create-authorizer \ --rest-api-id1234123412\ --name 'First_Request_Custom_Authorizer' \ --typeREQUEST\ --authorizer-uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations' \ --identity-source 'method.request.header.Authorization,context.accountId' \ --authorizer-result-ttl-in-seconds300Output:
{ "id": "z40xj0", "name": "First_Request_Custom_Authorizer", "type": "REQUEST", "authType": "custom", "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations", "identitySource": "method.request.header.Authorization,context.accountId", "authorizerResultTtlInSeconds": 300 }-
Untuk detail API, lihat CreateAuthorizer
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-base-path-mapping.
- AWS CLI
-
Untuk membuat pemetaan jalur dasar untuk nama domain kustom
Perintah:
aws apigateway create-base-path-mapping --domain-namesubdomain.domain.tld--rest-api-id1234123412--stageprod--base-pathv1-
Untuk detail API, lihat CreateBasePathMapping
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-deployment.
- AWS CLI
-
Untuk menyebarkan sumber daya yang dikonfigurasi untuk API ke Tahap baru
Perintah:
aws apigateway create-deployment --rest-api-id1234123412--stage-namedev--stage-description 'Development Stage' --description 'First deployment to the dev stage'Untuk menyebarkan sumber daya yang dikonfigurasi untuk API ke tahap yang ada
Perintah:
aws apigateway create-deployment --rest-api-id1234123412--stage-namedev--description 'Second deployment to the dev stage'Untuk menyebarkan sumber daya yang dikonfigurasi untuk API ke tahap yang ada dengan Variabel Tahap
aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev --description 'Penerapan ketiga ke tahap pengembang' --variable key='nilai', otherKey='nilai lain'
-
Untuk detail API, lihat CreateDeployment
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-domain-name-access-association.
- AWS CLI
-
Untuk membuat asosiasi akses nama domain
create-domain-name-access-associationContoh berikut membuat asosiasi akses nama domain antara nama domain kustom pribadi dan titik akhir VPC.aws apigateway create-domain-name-access-association \ --domain-name-arnarn:aws:apigateway:us-west-2:111122223333:/domainnames/my.private.domain.tld+abcd1234\ --access-association-sourcevpce-abcd1234efg\ --access-association-source-typeVPCEOutput:
{ "domainNameAccessAssociationArn": "arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg "accessAssociationSource": "vpce-abcd1234efg", "accessAssociationSourceType": "VPCE", "domainNameArn" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com+abcd1234" }Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat CreateDomainNameAccessAssociation
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-domain-name.
- AWS CLI
-
Contoh 1: Untuk membuat nama domain kustom publik
create-domain-nameContoh berikut membuat nama domain kustom publik.aws apigateway create-domain-name \ --domain-name 'my.domain.tld' \ --certificate-name 'my.domain.tld cert'\ --certificate-arn 'arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3'Output:
{ "domainName": "my.domain.tld", "certificateName": "my.domain.tld cert", "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3", "certificateUploadDate": "2024-10-08T11:29:49-07:00", "distributionDomainName": "abcd1234.cloudfront.net", "distributionHostedZoneId": "Z2FDTNDATAQYW2", "endpointConfiguration": { "types": [ "EDGE" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2" }Untuk informasi selengkapnya, lihat Nama domain khusus untuk REST API publik di API Gateway di Panduan Pengembang Amazon API Gateway.
Contoh 2: Untuk membuat nama domain kustom pribadi
create-domain-nameContoh berikut membuat nama domain kustom pribadi.aws apigateway create-domain-name \ --domain-name 'my.private.domain.tld' \ --certificate-name 'my.domain.tld cert' \ --certificate-arn 'arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3' \ --endpoint-configuration '{"types": ["PRIVATE"]}' \ --security-policy 'TLS_1_2' \ --policyfile://policy.jsonIsi dari
policy.json:{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ], "Condition" : { "StringNotEquals": { "aws:SourceVpce": "vpce-abcd1234efg" } } } ] }Output:
{ "domainName": "my.private.domain.tld", "domainNameId": "abcd1234", "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234", "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3", "certificateUploadDate": "2024-09-10T10:31:20-07:00", "endpointConfiguration": { "types": [ "PRIVATE" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2", "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\"},{\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\",\"Condition\":{\"StringNotEquals\":{\"aws:SourceVpc\":\"vpc-1a2b3c4d\"}}}]}" }Untuk informasi selengkapnya, lihat Nama domain khusus untuk REST API publik di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat CreateDomainName
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-model.
- AWS CLI
-
Untuk membuat model untuk API
Perintah:
aws apigateway create-model --rest-api-id1234123412--name 'firstModel' --description 'The First Model' --content-type 'application/json' --schema '{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "firstModel", "type": "object", "properties": { "firstProperty" : { "type": "object", "properties": { "key": { "type": "string" } } } } }'Output:
{ "contentType": "application/json", "description": "The First Model", "name": "firstModel", "id": "2rzg0l", "schema": "{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\": \"firstModel\", \"type\": \"object\", \"properties\": { \"firstProperty\" : { \"type\": \"object\", \"properties\": { \"key\": { \"type\": \"string\" } } } } }" }-
Untuk detail API, lihat CreateModel
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-resource.
- AWS CLI
-
Untuk membuat sumber daya di API
Perintah:
aws apigateway create-resource --rest-api-id1234123412--parent-ida1b2c3--path-part 'new-resource'-
Untuk detail API, lihat CreateResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-rest-api.
- AWS CLI
-
Untuk membuat API
Perintah:
aws apigateway create-rest-api --name 'My First API' --description 'This is my first API'Untuk membuat API duplikat dari API yang ada
Perintah:
aws apigateway create-rest-api --name 'Copy of My First API' --description 'This is a copy of my first API' --clone-from1234123412-
Untuk detail API, lihat CreateRestApi
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-stage.
- AWS CLI
-
Untuk membuat tahap dalam API yang akan berisi penerapan yang ada
Perintah:
aws apigateway create-stage --rest-api-id1234123412--stage-name 'dev' --description 'Development stage' --deployment-ida1b2c3Untuk membuat panggung dalam API yang akan berisi penerapan yang ada dan Variabel Tahap kustom
Perintah:
aws apigateway create-stage --rest-api-id1234123412--stage-name 'dev' --description 'Development stage' --deployment-ida1b2c3--variables key='value',otherKey='otherValue'-
Untuk detail API, lihat CreateStage
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-usage-plan-key.
- AWS CLI
-
Mengaitkan kunci API yang ada dengan Rencana Penggunaan
Perintah:
aws apigateway create-usage-plan-key --usage-plan-ida1b2c3--key-type"API_KEY"--key-id4vq3yryqm5-
Untuk detail API, lihat CreateUsagePlanKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-usage-plan.
- AWS CLI
-
Untuk membuat paket penggunaan dengan batas throttle dan kuota yang disetel ulang di awal bulan
Perintah:
aws apigateway create-usage-plan --name"New Usage Plan"--description"A new usage plan"--throttleburstLimit=10,rateLimit=5--quotalimit=500,offset=0,period=MONTH-
Untuk detail API, lihat CreateUsagePlan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-api-key.
- AWS CLI
-
Untuk menghapus kunci API
Perintah:
aws apigateway delete-api-key --api-key8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk-
Untuk detail API, lihat DeleteApiKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-authorizer.
- AWS CLI
-
Untuk menghapus Otorisasi Kustom di API
Perintah:
aws apigateway delete-authorizer --rest-api-id1234123412--authorizer-id7gkfbo-
Untuk detail API, lihat DeleteAuthorizer
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-base-path-mapping.
- AWS CLI
-
Untuk menghapus pemetaan jalur dasar untuk nama domain kustom
Perintah:
aws apigateway delete-base-path-mapping --domain-name 'api.domain.tld' --base-path 'dev'-
Untuk detail API, lihat DeleteBasePathMapping
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-client-certificate.
- AWS CLI
-
Untuk menghapus sertifikat klien
Perintah:
aws apigateway delete-client-certificate --client-certificate-ida1b2c3-
Untuk detail API, lihat DeleteClientCertificate
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-deployment.
- AWS CLI
-
Untuk menghapus penerapan di API
Perintah:
aws apigateway delete-deployment --rest-api-id1234123412--deployment-ida1b2c3-
Untuk detail API, lihat DeleteDeployment
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-domain-name-access-association.
- AWS CLI
-
Untuk menghapus asosiasi akses nama domain
delete-domain-name-access-associationContoh berikut menghapus asosiasi akses nama domain antara nama domain kustom pribadi dan titik akhir VPC.aws apigateway delete-domain-name-access-association \ --domain-name-access-association-arnarn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efgPerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat DeleteDomainNameAccessAssociation
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-domain-name.
- AWS CLI
-
Untuk menghapus nama domain khusus
Perintah:
aws apigateway delete-domain-name --domain-name 'api.domain.tld'-
Untuk detail API, lihat DeleteDomainName
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-integration-response.
- AWS CLI
-
Untuk menghapus respons integrasi untuk sumber daya, metode, dan kode status tertentu di API
Perintah:
aws apigateway delete-integration-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code200-
Untuk detail API, lihat DeleteIntegrationResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-integration.
- AWS CLI
-
Untuk menghapus integrasi untuk sumber daya dan metode tertentu dalam API
Perintah:
aws apigateway delete-integration --rest-api-id1234123412--resource-ida1b2c3--http-methodGET-
Untuk detail API, lihat DeleteIntegration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-method-response.
- AWS CLI
-
Untuk menghapus respons metode untuk sumber daya, metode, dan kode status yang diberikan di API
Perintah:
aws apigateway delete-method-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code200-
Untuk detail API, lihat DeleteMethodResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-method.
- AWS CLI
-
Untuk menghapus metode untuk sumber daya yang diberikan dalam API
Perintah:
aws apigateway delete-method --rest-api-id1234123412--resource-ida1b2c3--http-methodGET-
Untuk detail API, lihat DeleteMethod
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-model.
- AWS CLI
-
Untuk menghapus model di API yang diberikan
Perintah:
aws apigateway delete-model --rest-api-id1234123412--model-name 'customModel'-
Untuk detail API, lihat DeleteModel
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-resource.
- AWS CLI
-
Untuk menghapus sumber daya di API
Perintah:
aws apigateway delete-resource --rest-api-id1234123412--resource-ida1b2c3-
Untuk detail API, lihat DeleteResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-rest-api.
- AWS CLI
-
Untuk menghapus API
Perintah:
aws apigateway delete-rest-api --rest-api-id1234123412-
Untuk detail API, lihat DeleteRestApi
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-stage.
- AWS CLI
-
Untuk menghapus panggung di API
Perintah:
aws apigateway delete-stage --rest-api-id1234123412--stage-name 'dev'-
Untuk detail API, lihat DeleteStage
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-usage-plan-key.
- AWS CLI
-
Untuk menghapus kunci API dari Rencana Penggunaan
Perintah:
aws apigateway delete-usage-plan-key --usage-plan-ida1b2c3--key-id1NbjQzMReAkeEQPNAW8r3dXsU2rDD7fc7f2Sipnu-
Untuk detail API, lihat DeleteUsagePlanKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-usage-plan.
- AWS CLI
-
Untuk menghapus Paket Penggunaan
Perintah:
aws apigateway delete-usage-plan --usage-plan-ida1b2c3-
Untuk detail API, lihat DeleteUsagePlan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanflush-stage-authorizers-cache.
- AWS CLI
-
Untuk menghapus semua entri cache otorizer pada panggung
Perintah:
aws apigateway flush-stage-authorizers-cache --rest-api-id1234123412--stage-namedev-
Untuk detail API, lihat FlushStageAuthorizersCache
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanflush-stage-cache.
- AWS CLI
-
Untuk menghapus cache untuk tahap API
flush-stage-cacheContoh berikut membersihkan cache tahap.aws apigateway flush-stage-cache \ --rest-api-id1234123412\ --stage-namedevPerintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Membersihkan cache tahap API di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat FlushStageCache
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakangenerate-client-certificate.
- AWS CLI
-
Untuk membuat Sertifikat Client-Side SSL
Perintah:
aws apigateway generate-client-certificate --description 'My First Client Certificate'-
Untuk detail API, lihat GenerateClientCertificate
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-account.
- AWS CLI
-
Untuk mendapatkan pengaturan akun API Gateway
Perintah:
aws apigateway get-accountOutput:
{ "cloudwatchRoleArn": "arn:aws:iam::123412341234:role/APIGatewayToCloudWatchLogsRole", "throttleSettings": { "rateLimit": 500.0, "burstLimit": 1000 } }-
Untuk detail API, lihat GetAccount
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-api-key.
- AWS CLI
-
Untuk mendapatkan informasi tentang kunci API tertentu
Perintah:
aws apigateway get-api-key --api-key8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blkOutput:
{ "description": "My first key", "enabled": true, "stageKeys": [ "a1b2c3d4e5/dev", "e5d4c3b2a1/dev" ], "lastUpdatedDate": 1456184515, "createdDate": 1456184452, "id": "8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk", "name": "My key" }-
Untuk detail API, lihat GetApiKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-api-keys.
- AWS CLI
-
Untuk mendapatkan daftar kunci API
Perintah:
aws apigateway get-api-keysOutput:
{ "items": [ { "description": "My first key", "enabled": true, "stageKeys": [ "a1b2c3d4e5/dev", "e5d4c3b2a1/dev" ], "lastUpdatedDate": 1456184515, "createdDate": 1456184452, "id": "8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk", "name": "My key" } ] }-
Untuk detail API, lihat GetApiKeys
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-authorizer.
- AWS CLI
-
Untuk mendapatkan pengaturan API Gateway Per-API Authorizer
Perintah:
aws apigateway get-authorizer --rest-api-id1234123412--authorizer-idgfi4n3Output:
{ "authorizerResultTtlInSeconds": 300, "name": "MyAuthorizer", "type": "TOKEN", "identitySource": "method.request.header.Authorization", "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:authorizer_function/invocations", "id": "gfi4n3" }-
Untuk detail API, lihat GetAuthorizer
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-authorizers.
- AWS CLI
-
Untuk mendapatkan daftar otorisasi untuk REST API
Perintah:
aws apigateway get-authorizers --rest-api-id1234123412Output:
{ "items": [ { "name": "MyAuthorizer", "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:My_Authorizer_Function/invocations", "authorizerResultTtlInSeconds": 300, "identitySource": "method.request.header.Authorization", "type": "TOKEN", "id": "gfi4n3" } ] }-
Untuk detail API, lihat GetAuthorizers
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-base-path-mapping.
- AWS CLI
-
Untuk mendapatkan pemetaan jalur dasar untuk nama domain kustom
Perintah:
aws apigateway get-base-path-mapping --domain-namesubdomain.domain.tld--base-pathv1Output:
{ "basePath": "v1", "restApiId": "1234w4321e", "stage": "api" }-
Untuk detail API, lihat GetBasePathMapping
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-base-path-mappings.
- AWS CLI
-
Untuk mendapatkan pemetaan jalur dasar untuk nama domain kustom
Perintah:
aws apigateway get-base-path-mappings --domain-namesubdomain.domain.tldOutput:
{ "items": [ { "basePath": "(none)", "restApiId": "1234w4321e", "stage": "dev" }, { "basePath": "v1", "restApiId": "1234w4321e", "stage": "api" } ] }-
Untuk detail API, lihat GetBasePathMappings
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-client-certificate.
- AWS CLI
-
Untuk mendapatkan sertifikat klien
Perintah:
aws apigateway get-client-certificate --client-certificate-ida1b2c3-
Untuk detail API, lihat GetClientCertificate
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-client-certificates.
- AWS CLI
-
Untuk mendapatkan daftar sertifikat klien
Perintah:
aws apigateway get-client-certificatesOutput:
{ "items": [ { "pemEncodedCertificate": "-----BEGIN CERTIFICATE----- <certificate content> -----END CERTIFICATE-----", "clientCertificateId": "a1b2c3", "expirationDate": 1483556561, "description": "My Client Certificate", "createdDate": 1452020561 } ] }-
Untuk detail API, lihat GetClientCertificates
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-deployment.
- AWS CLI
-
Untuk mendapatkan informasi tentang penerapan
Perintah:
aws apigateway get-deployment --rest-api-id1234123412--deployment-idztt4m2Output:
{ "description": "myDeployment", "id": "ztt4m2", "createdDate": 1455218022 }-
Untuk detail API, lihat GetDeployment
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-deployments.
- AWS CLI
-
Untuk mendapatkan daftar penerapan untuk REST API
Perintah:
aws apigateway get-deployments --rest-api-id1234123412Output:
{ "items": [ { "createdDate": 1453797217, "id": "0a2b4c", "description": "Deployed my API for the first time" } ] }-
Untuk detail API, lihat GetDeployments
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-domain-name-access-associations.
- AWS CLI
-
Contoh 1: Untuk membuat daftar semua asosiasi akses nama domain
get-domain-name-access-associationsContoh berikut mencantumkan semua asosiasi akses nama domain.aws apigateway get-domain-name-access-associationsOutput:
{ "items": [ { "domainNameAccessAssociationArn": "arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg "accessAssociationSource": "vpce-abcd1234efg", "accessAssociationSourceType": "VPCE", "domainNameArn" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com+abcd1234" } ] }Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
Contoh 2: Untuk membuat daftar semua asosiasi akses nama domain yang dimiliki oleh AWS akun ini
get-domain-name-access-associationsContoh berikut mencantumkan semua asosiasi akses nama domain yang dimiliki oleh AWS akun saat ini.aws apigateway get-domain-name-access-associations \ --resource-ownerSELFOutput:
{ "items": [ { "domainNameAccessAssociationArn": "arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg "accessAssociationSource": "vpce-abcd1234efg", "accessAssociationSourceType": "VPCE", "domainNameArn" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com+abcd1234" } ] }Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat GetDomainNameAccessAssociations
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-domain-name.
- AWS CLI
-
Contoh 1: Untuk mendapatkan informasi tentang nama domain kustom publik
get-domain-nameContoh berikut mendapatkan informasi tentang nama domain kustom publik.aws apigateway get-domain-name \ --domain-nameapi.domain.tldOutput:
{ "domainName": "api.domain.tld", "distributionDomainName": "d1a2f3a4c5o6d.cloudfront.net", "certificateName": "uploadedCertificate", "certificateUploadDate": 1462565487 }Untuk informasi selengkapnya, lihat Nama domain khusus untuk REST API publik di API Gateway di Panduan Pengembang Amazon API Gateway.
Contoh 2: Untuk mendapatkan informasi tentang nama domain kustom pribadi
get-domain-nameContoh berikut mendapatkan informasi tentang nama domain kustom pribadi.aws apigateway get-domain-name \ --domain-nameapi.private.domain.tld\ --domain-name-idabcd1234Output:
{ "domainName": "my.private.domain.tld", "domainNameId": "abcd1234", "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234", "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3", "certificateUploadDate": "2024-09-10T10:31:20-07:00", "endpointConfiguration": { "types": [ "PRIVATE" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2", "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\"},{\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\",\"Condition\":{\"StringNotEquals\":{\"aws:SourceVpc\":\"vpc-1a2b3c4d\"}}}]}" }Untuk informasi selengkapnya, lihat Nama domain khusus untuk REST API publik di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat GetDomainName
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-domain-names.
- AWS CLI
-
Contoh 1: Untuk mendapatkan daftar nama domain khusus
Per
get-domain-namesintah berikut mendapatkan daftar nama domain.aws apigateway get-domain-namesOutput:
{ "items": [ { "distributionDomainName": "d9511k3l09bkd.cloudfront.net", "certificateUploadDate": 1452812505, "certificateName": "my_custom_domain-certificate", "domainName": "subdomain.domain.tld" } ] }Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
Contoh 2: Untuk mendapatkan daftar nama domain khusus yang dimiliki oleh AWS akun ini
Per
get-domain-namesintah berikut mendapatkan daftar nama domain yang dimiliki oleh AWS akun ini.aws apigateway get-domain-names \ --resource-ownerSELFOutput:
{ "items": [ { "domainName": "my.domain.tld", "domainNameArn": "arn:aws:apigateway:us-east-1::/domainnames/my.private.domain.tld", "certificateUploadDate": "2024-08-15T17:02:55-07:00", "regionalDomainName": "d-abcd1234.execute-api.us-east-1.amazonaws.com", "regionalHostedZoneId": "Z1UJRXOUMOOFQ8", "regionalCertificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3", "endpointConfiguration": { "types": [ "REGIONAL" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2" }, { "domainName": "my.private.domain.tld", "domainNameId": "abcd1234", "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234", "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3", "certificateUploadDate": "2024-11-26T11:44:40-08:00", "endpointConfiguration": { "types": [ "PRIVATE" ] }, "domainNameStatus": "AVAILABLE", "securityPolicy": "TLS_1_2" } ] }Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
Contoh 3: Untuk mendapatkan daftar nama domain khusus yang dimiliki oleh AWS akun lain yang dapat Anda buat asosiasi akses nama domain.
Per
get-domain-namesintah berikut mendapatkan daftar nama domain yang dimiliki oleh AWS akun lain yang memiliki akses untuk membuat asosiasi akses nama domain.aws apigateway get-domain-names \ --resource-ownerOTHER_ACCOUNTSOutput:
{ "items": [ { "domainName": "my.private.domain.tld", "domainNameId": "abcd1234", "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234" } ] }Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat GetDomainNames
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-export.
- AWS CLI
-
Untuk mendapatkan template JSON Swagger untuk panggung
Perintah:
aws apigateway get-export --rest-api-ida1b2c3d4e5--stage-namedev--export-typeswagger/path/to/filename.jsonUntuk mendapatkan template JSON Swagger+Ekstensi Gateway API untuk tahap
Perintah:
aws apigateway get-export --parameters extensions='integrations' --rest-api-ida1b2c3d4e5--stage-namedev--export-typeswagger/path/to/filename.jsonUntuk mendapatkan template JSON Swagger+Ekstensi Postman untuk panggung
Perintah:
aws apigateway get-export --parameters extensions='postman' --rest-api-ida1b2c3d4e5--stage-namedev--export-typeswagger/path/to/filename.json-
Untuk detail API, lihat GetExport
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-integration-response.
- AWS CLI
-
Untuk mendapatkan konfigurasi respons integrasi untuk metode HTTP yang ditentukan di bawah sumber daya REST API
Perintah:
aws apigateway get-integration-response --rest-api-id1234123412--resource-idy9h6rt--http-methodGET--status-code200Output:
{ "statusCode": "200", "responseTemplates": { "application/json": null } }-
Untuk detail API, lihat GetIntegrationResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-integration.
- AWS CLI
-
Untuk mendapatkan konfigurasi integrasi untuk metode HTTP yang ditentukan di bawah sumber daya REST API
Perintah:
aws apigateway get-integration --rest-api-id1234123412--resource-idy9h6rt--http-methodGETOutput:
{ "httpMethod": "POST", "integrationResponses": { "200": { "responseTemplates": { "application/json": null }, "statusCode": "200" } }, "cacheKeyParameters": [], "type": "AWS", "uri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:My_Function/invocations", "cacheNamespace": "y9h6rt" }-
Untuk detail API, lihat GetIntegration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-method-response.
- AWS CLI
-
Untuk mendapatkan konfigurasi sumber daya respons metode untuk metode HTTP yang ditentukan di bawah sumber daya REST API
Perintah:
aws apigateway get-method-response --rest-api-id1234123412--resource-idy9h6rt--http-methodGET--status-code200Output:
{ "responseModels": { "application/json": "Empty" }, "statusCode": "200" }-
Untuk detail API, lihat GetMethodResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-method.
- AWS CLI
-
Untuk mendapatkan konfigurasi sumber daya metode untuk metode HTTP yang ditentukan di bawah sumber daya REST API
Perintah:
aws apigateway get-method --rest-api-id1234123412--resource-idy9h6rt--http-methodGETOutput:
{ "apiKeyRequired": false, "httpMethod": "GET", "methodIntegration": { "integrationResponses": { "200": { "responseTemplates": { "application/json": null }, "statusCode": "200" } }, "cacheKeyParameters": [], "uri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:My_Function/invocations", "httpMethod": "POST", "cacheNamespace": "y9h6rt", "type": "AWS" }, "requestParameters": {}, "methodResponses": { "200": { "responseModels": { "application/json": "Empty" }, "statusCode": "200" } }, "authorizationType": "NONE" }-
Untuk detail API, lihat GetMethod
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-model-template.
- AWS CLI
-
Untuk mendapatkan template pemetaan untuk model yang ditentukan di bawah REST API
Perintah:
aws apigateway get-model-template --rest-api-id1234123412--model-nameEmptyOutput:
{ "value": "#set($inputRoot = $input.path('$'))\n{ }" }-
Untuk detail API, lihat GetModelTemplate
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-model.
- AWS CLI
-
Untuk mendapatkan konfigurasi untuk model yang ditentukan di bawah REST API
Perintah:
aws apigateway get-model --rest-api-id1234123412--model-nameEmptyOutput:
{ "contentType": "application/json", "description": "This is a default empty schema model", "name": "Empty", "id": "etd5w5", "schema": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"title\" : \"Empty Schema\",\n \"type\" : \"object\"\n}" }-
Untuk detail API, lihat GetModel
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-models.
- AWS CLI
-
Untuk mendapatkan daftar model untuk REST API
Perintah:
aws apigateway get-models --rest-api-id1234123412Output:
{ "items": [ { "description": "This is a default error schema model", "schema": "{\n \"$schema\" : \"http://json-schema.org/draft-04/schema#\",\n \"title\" : \"Error Schema\",\n \"type\" : \"object\",\n \"properties\" : {\n \"message\" : { \"type\" : \"string\" }\n }\n}", "contentType": "application/json", "id": "7tpbze", "name": "Error" }, { "description": "This is a default empty schema model", "schema": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"title\" : \"Empty Schema\",\n \"type\" : \"object\"\n}", "contentType": "application/json", "id": "etd5w5", "name": "Empty" } ] }-
Untuk detail API, lihat GetModels
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-resource.
- AWS CLI
-
Untuk mendapatkan informasi tentang sumber daya
Perintah:
aws apigateway get-resource --rest-api-id1234123412--resource-idzwo0y3Output:
{ "path": "/path", "pathPart": "path", "id": "zwo0y3", "parentId": "uyokt6ij2g" }-
Untuk detail API, lihat GetResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-resources.
- AWS CLI
-
Untuk mendapatkan daftar sumber daya untuk REST API
Perintah:
aws apigateway get-resources --rest-api-id1234123412Output:
{ "items": [ { "path": "/resource/subresource", "resourceMethods": { "POST": {} }, "id": "024ace", "pathPart": "subresource", "parentId": "ai5b02" } ] }-
Untuk detail API, lihat GetResources
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-rest-api.
- AWS CLI
-
Untuk mendapatkan informasi tentang API
Perintah:
aws apigateway get-rest-api --rest-api-id1234123412Output:
{ "name": "myAPI", "id": "o1y243m4f5", "createdDate": 1453416433 }-
Untuk detail API, lihat GetRestApi
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-rest-apis.
- AWS CLI
-
Untuk mendapatkan daftar REST API
Perintah:
aws apigateway get-rest-apisOutput:
{ "items": [ { "createdDate": 1438884790, "id": "12s44z21rb", "name": "My First API" } ] }-
Untuk detail API, lihat GetRestApis
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-sdk.
- AWS CLI
-
Untuk mendapatkan Android SDK untuk tahap REST API
Perintah:
aws apigateway get-sdk --rest-api-id1234123412--stage-namedev--sdk-typeandroid--parameters groupId='com.mycompany',invokerPackage='com.mycompany.clientsdk',artifactId='Mycompany-client',artifactVersion='1.0.0'/path/to/android_sdk.zipOutput:
{ "contentType": "application/octet-stream", "contentDisposition": "attachment; filename=\"android_2016-02-22_23-52Z.zip\"" }Untuk mendapatkan SDK IOS untuk tahap REST API
Perintah:
aws apigateway get-sdk --rest-api-id1234123412--stage-namedev--sdk-typeobjectivec--parameters classPrefix='myprefix'/path/to/iOS_sdk.zipOutput:
{ "contentType": "application/octet-stream", "contentDisposition": "attachment; filename=\"objectivec_2016-02-22_23-52Z.zip\"" }Untuk mendapatkan Javascript SDK untuk tahap REST API
Perintah:
aws apigateway get-sdk --rest-api-id1234123412--stage-namedev--sdk-typejavascript/path/to/javascript_sdk.zipOutput:
{ "contentType": "application/octet-stream", "contentDisposition": "attachment; filename=\"javascript_2016-02-22_23-52Z.zip\"" }-
Untuk detail API, lihat GetSdk
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-stage.
- AWS CLI
-
Untuk mendapatkan informasi tentang tahap API
Perintah:
aws apigateway get-stage --rest-api-id1234123412--stage-namedevOutput:
{ "stageName": "dev", "cacheClusterSize": "0.5", "cacheClusterEnabled": false, "cacheClusterStatus": "NOT_AVAILABLE", "deploymentId": "rbh1fj", "lastUpdatedDate": 1466802961, "createdDate": 1460682074, "methodSettings": { "*/*": { "cacheTtlInSeconds": 300, "loggingLevel": "INFO", "dataTraceEnabled": false, "metricsEnabled": true, "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER", "throttlingRateLimit": 500.0, "cacheDataEncrypted": false, "cachingEnabled": false, "throttlingBurstLimit": 1000, "requireAuthorizationForCacheControl": true }, "~1resource/GET": { "cacheTtlInSeconds": 300, "loggingLevel": "INFO", "dataTraceEnabled": false, "metricsEnabled": true, "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER", "throttlingRateLimit": 500.0, "cacheDataEncrypted": false, "cachingEnabled": false, "throttlingBurstLimit": 1000, "requireAuthorizationForCacheControl": true } } }-
Untuk detail API, lihat GetStage
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-stages.
- AWS CLI
-
Untuk mendapatkan daftar tahapan untuk REST API
Perintah:
aws apigateway get-stages --rest-api-id1234123412Output:
{ "item": [ { "stageName": "dev", "cacheClusterSize": "0.5", "cacheClusterEnabled": true, "cacheClusterStatus": "AVAILABLE", "deploymentId": "123h64", "lastUpdatedDate": 1456185138, "createdDate": 1453589092, "methodSettings": { "~1resource~1subresource/POST": { "cacheTtlInSeconds": 300, "loggingLevel": "INFO", "dataTraceEnabled": true, "metricsEnabled": true, "throttlingRateLimit": 500.0, "cacheDataEncrypted": false, "cachingEnabled": false, "throttlingBurstLimit": 1000 } } } ] }-
Untuk detail API, lihat GetStages
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-usage-plan-key.
- AWS CLI
-
Untuk mendapatkan detail kunci API yang terkait dengan Rencana Penggunaan
Perintah:
aws apigateway get-usage-plan-key --usage-plan-ida1b2c3--key-id1NbjQzMReAkeEQPNAW8r3dXsU2rDD7fc7f2Sipnu-
Untuk detail API, lihat GetUsagePlanKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-usage-plan-keys.
- AWS CLI
-
Untuk mendapatkan daftar kunci API yang terkait dengan Rencana Penggunaan
Perintah:
aws apigateway get-usage-plan-keys --usage-plan-ida1b2c3-
Untuk detail API, lihat GetUsagePlanKeys
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-usage-plan.
- AWS CLI
-
Untuk mendapatkan rincian Rencana Penggunaan
Perintah:
aws apigateway get-usage-plan --usage-plan-ida1b2c3-
Untuk detail API, lihat GetUsagePlan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-usage-plans.
- AWS CLI
-
Untuk mendapatkan detail dari semua Paket Penggunaan
Perintah:
aws apigateway get-usage-plans-
Untuk detail API, lihat GetUsagePlans
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-usage.
- AWS CLI
-
Untuk mendapatkan detail penggunaan untuk Paket Penggunaan
Perintah:
aws apigateway get-usage --usage-plan-ida1b2c3--start-date"2016-08-16"--end-date"2016-08-17"-
Untuk detail API, lihat GetUsage
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanimport-rest-api.
- AWS CLI
-
Untuk mengimpor template Swagger dan membuat API
Perintah:
aws apigateway import-rest-api --body 'file:///path/to/API_Swagger_template.json'-
Untuk detail API, lihat ImportRestApi
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-integration-response.
- AWS CLI
-
Untuk membuat respons integrasi sebagai respons default dengan template pemetaan yang ditentukan
Perintah:
aws apigateway put-integration-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code200--selection-pattern "" --response-templates '{"application/json": "{\"json\": \"template\"}"}'Untuk membuat respons integrasi dengan regex 400 dan nilai header yang ditentukan secara statis
Perintah:
aws apigateway put-integration-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code400--selection-pattern400--response-parameters '{"method.response.header.custom-header": "'"'"'custom-value'"'"'"}'-
Untuk detail API, lihat PutIntegrationResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-integration.
- AWS CLI
-
Untuk membuat permintaan integrasi MOCK
Perintah:
aws apigateway put-integration --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--typeMOCK--request-templates '{ "application/json": "{\"statusCode\": 200}" }'Untuk membuat permintaan integrasi HTTP
Perintah:
aws apigateway put-integration --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--typeHTTP--integration-http-methodGET--uri 'https://domain.tld/path'Untuk membuat permintaan AWS integrasi dengan titik akhir Fungsi Lambda
Perintah:
aws apigateway put-integration --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--typeAWS--integration-http-methodPOST--uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:function_name/invocations'-
Untuk detail API, lihat PutIntegration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-method-response.
- AWS CLI
-
Untuk membuat respons metode di bawah kode status yang ditentukan dengan header respons metode khusus
Perintah:
aws apigateway put-method-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code400--response-parameters"method.response.header.custom-header=false"-
Untuk detail API, lihat PutMethodResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-method.
- AWS CLI
-
Untuk membuat metode untuk sumber daya di API tanpa otorisasi, tanpa kunci API, dan header permintaan metode khusus
Perintah:
aws apigateway put-method --rest-api-id1234123412--resource-ida1b2c3--http-methodPUT--authorization-type"NONE"--no-api-key-required --request-parameters"method.request.header.custom-header=false"-
Untuk detail API, lihat PutMethod
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-rest-api.
- AWS CLI
-
Untuk mengganti API yang ada menggunakan template Swagger
Perintah:
aws apigateway put-rest-api --rest-api-id1234123412--modeoverwrite--body 'fileb:///path/to/API_Swagger_template.json'Untuk menggabungkan template Swagger ke API yang ada
Perintah:
aws apigateway put-rest-api --rest-api-id1234123412--modemerge--body 'fileb:///path/to/API_Swagger_template.json'-
Untuk detail API, lihat PutRestApi
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanreject-domain-name-access-association.
- AWS CLI
-
Untuk menolak asosiasi akses nama domain
reject-domain-name-access-associationContoh berikut menolak asosiasi akses nama domain antara nama domain kustom pribadi dan titik akhir VPC.aws apigateway reject-domain-name-access-association \ --domain-name-access-association-arnarn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg\ --domain-name-arnarn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234Perintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Nama domain khusus untuk API pribadi di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat RejectDomainNameAccessAssociation
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantest-invoke-authorizer.
- AWS CLI
-
Untuk menguji, panggil permintaan ke Custom Authorizer termasuk header dan nilai yang diperlukan
Perintah:
aws apigateway test-invoke-authorizer --rest-api-id1234123412--authorizer-id5yid1t--headers Authorization='Value'-
Untuk detail API, lihat TestInvokeAuthorizer
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantest-invoke-method.
- AWS CLI
-
Untuk menguji, panggil sumber daya root di API dengan membuat permintaan GET
Perintah:
aws apigateway test-invoke-method --rest-api-id1234123412--resource-idavl5sg8fw8--http-methodGET--path-with-query-string '/'Untuk menguji, panggil sub-sumber daya di API dengan membuat permintaan GET dengan nilai parameter jalur yang ditentukan
Perintah:
aws apigateway test-invoke-method --rest-api-id1234123412--resource-id3gapai--http-methodGET--path-with-query-string '/pets/1'-
Untuk detail API, lihat TestInvokeMethod
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-account.
- AWS CLI
-
Untuk mengubah ARN Peran IAM untuk logging ke Log CloudWatch
Perintah:
aws apigateway update-account --patch-operations op='replace',path='/cloudwatchRoleArn',value='arn:aws:iam::123412341234:role/APIGatewayToCloudWatchLogs'Output:
{ "cloudwatchRoleArn": "arn:aws:iam::123412341234:role/APIGatewayToCloudWatchLogs", "throttleSettings": { "rateLimit": 1000.0, "burstLimit": 2000 } }-
Untuk detail API, lihat UpdateAccount
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-api-key.
- AWS CLI
-
Untuk mengubah nama untuk Kunci API
Perintah:
aws apigateway update-api-key --api-keysNvjQDMReA1eEQPNAW8r37XsU2rDD7fc7m2SiMnu--patch-operations op='replace',path='/name',value='newName'Output:
{ "description": "currentDescription", "enabled": true, "stageKeys": [ "41t2j324r5/dev" ], "lastUpdatedDate": 1470086052, "createdDate": 1445460347, "id": "sNvjQDMReA1vEQPNzW8r3dXsU2rrD7fcjm2SiMnu", "name": "newName" }Untuk menonaktifkan Kunci API
Perintah:
aws apigateway update-api-key --api-keysNvjQDMReA1eEQPNAW8r37XsU2rDD7fc7m2SiMnu--patch-operations op='replace',path='/enabled',value='false'Output:
{ "description": "currentDescription", "enabled": false, "stageKeys": [ "41t2j324r5/dev" ], "lastUpdatedDate": 1470086052, "createdDate": 1445460347, "id": "sNvjQDMReA1vEQPNzW8r3dXsU2rrD7fcjm2SiMnu", "name": "newName" }-
Untuk detail API, lihat UpdateApiKey
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-authorizer.
- AWS CLI
-
Untuk mengubah nama Pengotorisasi Kustom
Perintah:
aws apigateway update-authorizer --rest-api-id1234123412--authorizer-idgfi4n3--patch-operations op='replace',path='/name',value='testAuthorizer'Output:
{ "authType": "custom", "name": "testAuthorizer", "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthorizer/invocations", "authorizerResultTtlInSeconds": 300, "identitySource": "method.request.header.Authorization", "type": "TOKEN", "id": "gfi4n3" }Untuk mengubah Fungsi Lambda yang dipanggil oleh Custom Authorizer
Perintah:
aws apigateway update-authorizer --rest-api-id1234123412--authorizer-idgfi4n3--patch-operations op='replace',path='/authorizerUri',value='arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:newAuthorizer/invocations'Output:
{ "authType": "custom", "name": "testAuthorizer", "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:newAuthorizer/invocations", "authorizerResultTtlInSeconds": 300, "identitySource": "method.request.header.Authorization", "type": "TOKEN", "id": "gfi4n3" }-
Untuk detail API, lihat UpdateAuthorizer
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-base-path-mapping.
- AWS CLI
-
Untuk mengubah jalur dasar untuk nama domain kustom
Perintah:
aws apigateway update-base-path-mapping --domain-nameapi.domain.tld--base-pathprod--patch-operations op='replace',path='/basePath',value='v1'Output:
{ "basePath": "v1", "restApiId": "1234123412", "stage": "api" }-
Untuk detail API, lihat UpdateBasePathMapping
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-client-certificate.
- AWS CLI
-
Untuk memperbarui deskripsi sertifikat klien
Perintah:
aws apigateway update-client-certificate --client-certificate-ida1b2c3--patch-operations op='replace',path='/description',value='My new description'-
Untuk detail API, lihat UpdateClientCertificate
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-deployment.
- AWS CLI
-
Untuk mengubah deskripsi penerapan
Perintah:
aws apigateway update-deployment --rest-api-id1234123412--deployment-idztt4m2--patch-operations op='replace',path='/description',value='newDescription'Output:
{ "description": "newDescription", "id": "ztt4m2", "createdDate": 1455218022 }-
Untuk detail API, lihat UpdateDeployment
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-domain-name.
- AWS CLI
-
Untuk mengubah nama sertifikat untuk nama domain khusus
update-domain-nameContoh berikut mengubah nama sertifikat untuk domain kustom.aws apigateway update-domain-name \ --domain-nameapi.domain.tld\ --patch-operations op='replace',path='/certificateArn',value='arn:aws:acm:us-west-2:111122223333:certificate/CERTEXAMPLE123EXAMPLE'Output:
{ "domainName": "api.domain.tld", "distributionDomainName": "d123456789012.cloudfront.net", "certificateArn": "arn:aws:acm:us-west-2:111122223333:certificate/CERTEXAMPLE123EXAMPLE", "certificateUploadDate": 1462565487 }Untuk informasi selengkapnya, lihat Menyiapkan Nama Domain Kustom untuk API di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat UpdateDomainName
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-integration-response.
- AWS CLI
-
Untuk mengubah header respons integrasi menjadi memiliki pemetaan statis '*'
Perintah:
aws apigateway update-integration-response --rest-api-id1234123412--resource-id3gapai--http-methodGET--status-code200--patch-operations op='replace',path='/responseParameters/method.response.header.Access-Control-Allow-Origin',value='"'"'*'"'"'Output:
{ "statusCode": "200", "responseParameters": { "method.response.header.Access-Control-Allow-Origin": "'*'" } }Untuk menghapus header respons integrasi
Perintah:
aws apigateway update-integration-response --rest-api-id1234123412--resource-id3gapai--http-methodGET--status-code200--patch-operations op='remove',path='/responseParameters/method.response.header.Access-Control-Allow-Origin'-
Untuk detail API, lihat UpdateIntegrationResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-integration.
- AWS CLI
-
Untuk menambahkan Template Pemetaan 'Content-Type: application/json' yang dikonfigurasi dengan Input Passthrough
Perintah:
aws apigateway update-integration \ --rest-api-ida1b2c3d4e5\ --resource-ida1b2c3\ --http-methodPOST\ --patch-operations"op='add',path='/requestTemplates/application~1json'"Untuk memperbarui (mengganti) Template Pemetaan application/json 'Content-Type:' dikonfigurasi dengan template khusus
Perintah:
aws apigateway update-integration \ --rest-api-ida1b2c3d4e5\ --resource-ida1b2c3\ --http-methodPOST\ --patch-operations "op='replace',path='/requestTemplates/application~1json',value='{"example": "json"}'"Untuk memperbarui (mengganti) template khusus yang terkait dengan 'Content-Type: application/json' dengan Input Passthrough
Perintah:
aws apigateway update-integration \ --rest-api-ida1b2c3d4e5\ --resource-ida1b2c3\ --http-methodPOST\ --patch-operations"op='replace',path='requestTemplates/application~1json'"Untuk menghapus Template Pemetaan application/json 'Content-Type:'
Perintah:
aws apigateway update-integration \ --rest-api-ida1b2c3d4e5\ --resource-ida1b2c3\ --http-methodPOST\ --patch-operations"op='remove',path='/requestTemplates/application~1json'"-
Untuk detail API, lihat UpdateIntegration
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-method-response.
- AWS CLI
-
Untuk membuat header respons metode baru untuk respons 200 dalam metode dan mendefinisikannya sebagai tidak diperlukan (default)
Perintah:
aws apigateway update-method-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code200--patch-operations op="add",path="/responseParameters/method.response.header.custom-header",value="false"Untuk menghapus model respons untuk respons 200 dalam suatu metode
Perintah:
aws apigateway update-method-response --rest-api-id1234123412--resource-ida1b2c3--http-methodGET--status-code200--patch-operations op="remove",path="/responseModels/application~1json"-
Untuk detail API, lihat UpdateMethodResponse
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-method.
- AWS CLI
-
Contoh 1: Untuk memodifikasi metode agar memerlukan kunci API
update-methodContoh berikut memodifikasi metode untuk memerlukan kunci API.aws apigateway update-method \ --rest-api-id1234123412\ --resource-ida1b2c3\ --http-methodGET\ --patch-operations op="replace",path="/apiKeyRequired",value="true"Output:
{ "httpMethod": "GET", "authorizationType": "NONE", "apiKeyRequired": true, "methodResponses": { "200": { "statusCode": "200", "responseModels": {} } }, "methodIntegration": { "type": "AWS", "httpMethod": "POST", "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789111:function:hello-world/invocations", "passthroughBehavior": "WHEN_NO_MATCH", "contentHandling": "CONVERT_TO_TEXT", "timeoutInMillis": 29000, "cacheNamespace": "h7i8j9", "cacheKeyParameters": [], "integrationResponses": { "200": { "statusCode": "200", "responseTemplates": {} } } } }Contoh 2: Untuk memodifikasi metode agar memerlukan otorisasi IAM
update-methodContoh berikut memodifikasi metode untuk memerlukan otorisasi IAM.aws apigateway update-method \ --rest-api-id1234123412\ --resource-ida1b2c3\ --http-methodGET\ --patch-operations op="replace",path="/authorizationType",value="AWS_IAM"Output:
{ "httpMethod": "GET", "authorizationType": "AWS_IAM", "apiKeyRequired": false, "methodResponses": { "200": { "statusCode": "200", "responseModels": {} } }, "methodIntegration": { "type": "AWS", "httpMethod": "POST", "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789111:function:hello-world/invocations", "passthroughBehavior": "WHEN_NO_MATCH", "contentHandling": "CONVERT_TO_TEXT", "timeoutInMillis": 29000, "cacheNamespace": "h7i8j9", "cacheKeyParameters": [], "integrationResponses": { "200": { "statusCode": "200", "responseTemplates": {} } } } }Contoh 3: Untuk memodifikasi metode untuk memerlukan otorisasi Lambda
update-methodContoh berikut memodifikasi metode untuk otorisasi Lambda yang diperlukan.aws apigateway update-method --rest-api-id1234123412\ --resource-ida1b2c3\ --http-methodGET\ --patch-operations op="replace",path="/authorizationType",value="CUSTOM" op="replace",path="/authorizerId",value="e4f5g6"Output:
{ "httpMethod": "GET", "authorizationType": "CUSTOM", "authorizerId" : "e4f5g6", "apiKeyRequired": false, "methodResponses": { "200": { "statusCode": "200", "responseModels": {} } }, "methodIntegration": { "type": "AWS", "httpMethod": "POST", "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789111:function:hello-world/invocations", "passthroughBehavior": "WHEN_NO_MATCH", "contentHandling": "CONVERT_TO_TEXT", "timeoutInMillis": 29000, "cacheNamespace": "h7i8j9", "cacheKeyParameters": [], "integrationResponses": { "200": { "statusCode": "200", "responseTemplates": {} } } } }Untuk informasi selengkapnya, lihat Membuat, mengonfigurasi, dan menguji rencana penggunaan menggunakan API Gateway CLI dan REST API dan Mengon trol dan mengelola akses ke REST API di API Gateway di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat UpdateMethod
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-model.
- AWS CLI
-
Untuk mengubah deskripsi model di API
Perintah:
aws apigateway update-model --rest-api-id1234123412--model-name 'Empty' --patch-operations op=replace,path=/description,value='New Description'Untuk mengubah skema model di API
Perintah:
aws apigateway update-model --rest-api-id1234123412--model-name 'Empty' --patch-operations op=replace,path=/schema,value='"{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\" : \"Empty Schema\", \"type\" : \"object\" }"'-
Untuk detail API, lihat UpdateModel
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-resource.
- AWS CLI
-
Untuk memindahkan sumber daya dan menempatkannya di bawah sumber daya induk yang berbeda di API
Perintah:
aws apigateway update-resource --rest-api-id1234123412--resource-id1a2b3c--patch-operations op=replace,path=/parentId,value='3c2b1a'Output:
{ "path": "/resource", "pathPart": "resource", "id": "1a2b3c", "parentId": "3c2b1a" }Untuk mengganti nama sumber daya (PathPart) di API
Perintah:
aws apigateway update-resource --rest-api-id1234123412--resource-id1a2b3c--patch-operationsop=replace,path=/pathPart,value=newresourcenameOutput:
{ "path": "/newresourcename", "pathPart": "newresourcename", "id": "1a2b3c", "parentId": "3c2b1a" }-
Untuk detail API, lihat UpdateResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-rest-api.
- AWS CLI
-
Untuk mengubah nama API
Perintah:
aws apigateway update-rest-api --rest-api-id1234123412--patch-operations op=replace,path=/name,value='New Name'Untuk mengubah deskripsi API
Perintah:
aws apigateway update-rest-api --rest-api-id1234123412--patch-operations op=replace,path=/description,value='New Description'-
Untuk detail API, lihat UpdateRestApi
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-stage.
- AWS CLI
-
Contoh 1: Untuk mengganti setelan panggung untuk sumber daya dan metode
update-stageContoh berikut mengesampingkan pengaturan tahap dan mematikan pencatatan penuh request/response untuk sumber daya dan metode tertentu.aws apigateway update-stage \ --rest-api-id1234123412\ --stage-name 'dev' \ --patch-operationsop=replace,path=/~1resourceName/GET/logging/dataTrace,value=falseOutput:
{ "deploymentId": "5ubd17", "stageName": "dev", "cacheClusterEnabled": false, "cacheClusterStatus": "NOT_AVAILABLE", "methodSettings": { "~1resourceName/GET": { "metricsEnabled": false, "dataTraceEnabled": false, "throttlingBurstLimit": 5000, "throttlingRateLimit": 10000.0, "cachingEnabled": false, "cacheTtlInSeconds": 300, "cacheDataEncrypted": false, "requireAuthorizationForCacheControl": true, "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER" } }, "tracingEnabled": false, "createdDate": "2022-07-18T10:11:18-07:00", "lastUpdatedDate": "2022-07-18T10:19:04-07:00" }Untuk informasi selengkapnya, lihat Men yiapkan tahap untuk REST API di Panduan Pengembang Amazon API Gateway.
Contoh 2: Untuk memperbarui pengaturan tahap untuk semua sumber daya dan metode tahap API
update-stageContoh berikut mengaktifkan pencatatan request/response penuh untuk semua sumber daya dan metode tahap API.aws apigateway update-stage \ --rest-api-id1234123412\ --stage-name 'dev' \ --patch-operations 'op=replace,path=/*/*/logging/dataTrace,value=true'Output:
{ "deploymentId": "5ubd17", "stageName": "dev", "cacheClusterEnabled": false, "cacheClusterStatus": "NOT_AVAILABLE", "methodSettings": { "*/*": { "metricsEnabled": false, "dataTraceEnabled": true, "throttlingBurstLimit": 5000, "throttlingRateLimit": 10000.0, "cachingEnabled": false, "cacheTtlInSeconds": 300, "cacheDataEncrypted": false, "requireAuthorizationForCacheControl": true, "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER" } }, "tracingEnabled": false, "createdDate": "2022-07-18T10:11:18-07:00", "lastUpdatedDate": "2022-07-18T10:31:04-07:00" }Untuk informasi selengkapnya, lihat Men yiapkan tahap untuk REST API di Panduan Pengembang Amazon API Gateway.
-
Untuk detail API, lihat UpdateStage
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-usage-plan.
- AWS CLI
-
Untuk mengubah periode yang ditentukan dalam Rencana Penggunaan
Perintah:
aws apigateway update-usage-plan --usage-plan-ida1b2c3--patch-operations op="replace",path="/quota/period",value="MONTH"Untuk mengubah batas kuota yang ditentukan dalam Paket Penggunaan
Perintah:
aws apigateway update-usage-plan --usage-plan-ida1b2c3--patch-operations op="replace",path="/quota/limit",value="500"Untuk mengubah batas kecepatan throttle yang ditentukan dalam Rencana Penggunaan
Perintah:
aws apigateway update-usage-plan --usage-plan-ida1b2c3--patch-operations op="replace",path="/throttle/rateLimit",value="10"Untuk mengubah batas semburan throttle yang ditentukan dalam Rencana Penggunaan
Perintah:
aws apigateway update-usage-plan --usage-plan-ida1b2c3--patch-operations op="replace",path="/throttle/burstLimit",value="20"-
Untuk detail API, lihat UpdateUsagePlan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-usage.
- AWS CLI
-
Untuk mengubah sementara kuota pada kunci API untuk periode saat ini yang ditentukan dalam Rencana Penggunaan
Perintah:
aws apigateway update-usage --usage-plan-ida1b2c3--key-id1NbjQzMReAkeEQPNAW8r3dXsU2rDD7fc7f2Sipnu--patch-operations op="replace",path="/remaining",value="50"-
Untuk detail API, lihat UpdateUsage
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-vpc-link.
- AWS CLI
-
Contoh 1: Untuk memperbarui nama tautan VPC yang ada
update-vpc-linkContoh berikut memperbarui nama tautan VPC yang ditentukan.aws apigateway update-vpc-link \ --vpc-link-idab3de6\ --patch-operationsop=replace,path=/name,value=my-vpc-linkOutput:
{ "id": "ab3de6", "name": "my-vpc-link", "targetArns": [ "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/my-lb/12a456s89aaa12345" ], "status": "AVAILABLE", "statusMessage": "Your vpc link is ready for use", "tags": {} }Untuk informasi selengkapnya, lihat Memper barui tautan VPC yang ada di Referensi Per AWS intah CLI.
Contoh 2: Untuk memperbarui nama dan deskripsi tautan VPC yang ada
update-vpc-linkContoh berikut memperbarui nama tautan VPC yang ditentukan.aws apigateway update-vpc-link \ --vpc-link-idab3de6\ --patch-operationsop=replace,path=/name,value=my-vpc-linkop=replace,path=/description,value="My custom description"Output:
{ "id": "ab3de6", "name": "my-vpc-link", "description": "My custom description", "targetArns": [ "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/my-lb/12a456s89aaa12345" ], "status": "AVAILABLE", "statusMessage": "Your vpc link is ready for use", "tags": {} }Untuk informasi selengkapnya, lihat Memper barui tautan VPC yang ada di Referensi Per AWS intah CLI.
-
Untuk detail API, lihat UpdateVpcLink
di Refer AWS CLI ensi Perintah.
-