From 0007fa8bfcfaa8a9f3e147874690edb83934682f Mon Sep 17 00:00:00 2001 From: Paul Buser Date: Thu, 4 May 2017 14:21:41 -0700 Subject: [PATCH 1/3] Create openapi-appengine.yaml --- .../getting-started/openapi-appengine.yaml | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 endpoints/getting-started/openapi-appengine.yaml diff --git a/endpoints/getting-started/openapi-appengine.yaml b/endpoints/getting-started/openapi-appengine.yaml new file mode 100644 index 0000000000..79125d1c54 --- /dev/null +++ b/endpoints/getting-started/openapi-appengine.yaml @@ -0,0 +1,106 @@ +# [START swagger] +swagger: "2.0" +info: + description: "A simple Google Cloud Endpoints API example." + title: "Endpoints Example" + version: "1.0.0" +host: "[YOUR-PROJECT-ID].appspot.com" +# [END swagger] +basePath: "/" +consumes: +- "application/json" +produces: +- "application/json" +schemes: +- "https" +paths: + "/echo": + post: + description: "Echo back a given message." + operationId: "echo" + produces: + - "application/json" + responses: + 200: + description: "Echo" + schema: + $ref: "#/definitions/echoMessage" + parameters: + - description: "Message to echo" + in: body + name: message + required: true + schema: + $ref: "#/definitions/echoMessage" + "/auth/info/googlejwt": + get: + description: "Returns the requests' authentication information." + operationId: "auth_info_google_jwt" + produces: + - "application/json" + responses: + 200: + description: "Authenication info." + schema: + $ref: "#/definitions/authInfoResponse" + security: + - google_jwt: [] + "/auth/info/googleidtoken": + get: + description: "Returns the requests' authentication information." + operationId: "authInfoGoogleIdToken" + produces: + - "application/json" + responses: + 200: + description: "Authenication info." + schema: + $ref: "#/definitions/authInfoResponse" + security: + - google_id_token: [] +definitions: + echoMessage: + properties: + message: + type: "string" + authInfoResponse: + properties: + id: + type: "string" + email: + type: "string" +# This section requires all requests to any path to require an API key. +security: +- api_key: [] +securityDefinitions: + # This section configures basic authentication with an API key. + api_key: + type: "apiKey" + name: "key" + in: "query" + # This section configures authentication using Google API Service Accounts + # to sign a json web token. This is mostly used for server-to-server + # communication. + google_jwt: + authorizationUrl: "" + flow: "implicit" + type: "oauth2" + # This must match the 'iss' field in the JWT. + x-google-issuer: "jwt-client.endpoints.sample.google.com" + # Update this with your service account's email address. + x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/jwk/YOUR-SERVICE-ACCOUNT-EMAIL" + # This must match the "aud" field in the JWT. You can add multiple + # audiences to accept JWTs from multiple clients. + x-google-audiences: "echo.endpoints.sample.google.com" + # This section configures authentication using Google OAuth2 ID Tokens. + # ID Tokens can be obtained using OAuth2 clients, and can be used to access + # your API on behalf of a particular user. + google_id_token: + authorizationUrl: "" + flow: "implicit" + type: "oauth2" + x-google-issuer: "https://accounts.google.com" + x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs" + # Your OAuth2 client's Client ID must be added here. You can add + # multiple client IDs to accept tokens from multiple clients. + x-google-audiences: "YOUR-CLIENT-ID" From ff46e0545f3c2d8366115a102e50d8839157f278 Mon Sep 17 00:00:00 2001 From: Paul Buser Date: Tue, 9 May 2017 14:08:58 -0700 Subject: [PATCH 2/3] Add comment to openapi.yaml about deploying on App Engine. Remove openapi-appengine.yaml. --- .../getting-started/openapi-appengine.yaml | 106 ------------------ endpoints/getting-started/openapi.yaml | 3 + 2 files changed, 3 insertions(+), 106 deletions(-) delete mode 100644 endpoints/getting-started/openapi-appengine.yaml diff --git a/endpoints/getting-started/openapi-appengine.yaml b/endpoints/getting-started/openapi-appengine.yaml deleted file mode 100644 index 79125d1c54..0000000000 --- a/endpoints/getting-started/openapi-appengine.yaml +++ /dev/null @@ -1,106 +0,0 @@ -# [START swagger] -swagger: "2.0" -info: - description: "A simple Google Cloud Endpoints API example." - title: "Endpoints Example" - version: "1.0.0" -host: "[YOUR-PROJECT-ID].appspot.com" -# [END swagger] -basePath: "/" -consumes: -- "application/json" -produces: -- "application/json" -schemes: -- "https" -paths: - "/echo": - post: - description: "Echo back a given message." - operationId: "echo" - produces: - - "application/json" - responses: - 200: - description: "Echo" - schema: - $ref: "#/definitions/echoMessage" - parameters: - - description: "Message to echo" - in: body - name: message - required: true - schema: - $ref: "#/definitions/echoMessage" - "/auth/info/googlejwt": - get: - description: "Returns the requests' authentication information." - operationId: "auth_info_google_jwt" - produces: - - "application/json" - responses: - 200: - description: "Authenication info." - schema: - $ref: "#/definitions/authInfoResponse" - security: - - google_jwt: [] - "/auth/info/googleidtoken": - get: - description: "Returns the requests' authentication information." - operationId: "authInfoGoogleIdToken" - produces: - - "application/json" - responses: - 200: - description: "Authenication info." - schema: - $ref: "#/definitions/authInfoResponse" - security: - - google_id_token: [] -definitions: - echoMessage: - properties: - message: - type: "string" - authInfoResponse: - properties: - id: - type: "string" - email: - type: "string" -# This section requires all requests to any path to require an API key. -security: -- api_key: [] -securityDefinitions: - # This section configures basic authentication with an API key. - api_key: - type: "apiKey" - name: "key" - in: "query" - # This section configures authentication using Google API Service Accounts - # to sign a json web token. This is mostly used for server-to-server - # communication. - google_jwt: - authorizationUrl: "" - flow: "implicit" - type: "oauth2" - # This must match the 'iss' field in the JWT. - x-google-issuer: "jwt-client.endpoints.sample.google.com" - # Update this with your service account's email address. - x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/jwk/YOUR-SERVICE-ACCOUNT-EMAIL" - # This must match the "aud" field in the JWT. You can add multiple - # audiences to accept JWTs from multiple clients. - x-google-audiences: "echo.endpoints.sample.google.com" - # This section configures authentication using Google OAuth2 ID Tokens. - # ID Tokens can be obtained using OAuth2 clients, and can be used to access - # your API on behalf of a particular user. - google_id_token: - authorizationUrl: "" - flow: "implicit" - type: "oauth2" - x-google-issuer: "https://accounts.google.com" - x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs" - # Your OAuth2 client's Client ID must be added here. You can add - # multiple client IDs to accept tokens from multiple clients. - x-google-audiences: "YOUR-CLIENT-ID" diff --git a/endpoints/getting-started/openapi.yaml b/endpoints/getting-started/openapi.yaml index 840f2bd290..ac50b8d19c 100644 --- a/endpoints/getting-started/openapi.yaml +++ b/endpoints/getting-started/openapi.yaml @@ -6,6 +6,9 @@ info: version: "1.0.0" host: "echo-api.endpoints.YOUR-PROJECT-ID.cloud.goog" # [END swagger] +# For App Engine deployments, delete the above "host:" line and remove the "# " +# from the following line. Then change YOUR-PROJECT-ID to your project id. +# host: "YOUR-PROJECT-ID.appspot.com" basePath: "/" consumes: - "application/json" From 72761040aec58c8f75a0b894af00044338c47d10 Mon Sep 17 00:00:00 2001 From: Paul Buser Date: Mon, 24 Jul 2017 12:32:48 -0700 Subject: [PATCH 3/3] Add openapi-appengine.yaml file for App Engine deployments. --- endpoints/getting-started/openapi-appengine.yaml | 3 ++- endpoints/getting-started/openapi.yaml | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/endpoints/getting-started/openapi-appengine.yaml b/endpoints/getting-started/openapi-appengine.yaml index 79125d1c54..9aea095092 100644 --- a/endpoints/getting-started/openapi-appengine.yaml +++ b/endpoints/getting-started/openapi-appengine.yaml @@ -4,7 +4,7 @@ info: description: "A simple Google Cloud Endpoints API example." title: "Endpoints Example" version: "1.0.0" -host: "[YOUR-PROJECT-ID].appspot.com" +host: "YOUR-PROJECT-ID.appspot.com" # [END swagger] basePath: "/" consumes: @@ -104,3 +104,4 @@ securityDefinitions: # Your OAuth2 client's Client ID must be added here. You can add # multiple client IDs to accept tokens from multiple clients. x-google-audiences: "YOUR-CLIENT-ID" + diff --git a/endpoints/getting-started/openapi.yaml b/endpoints/getting-started/openapi.yaml index ac50b8d19c..840f2bd290 100644 --- a/endpoints/getting-started/openapi.yaml +++ b/endpoints/getting-started/openapi.yaml @@ -6,9 +6,6 @@ info: version: "1.0.0" host: "echo-api.endpoints.YOUR-PROJECT-ID.cloud.goog" # [END swagger] -# For App Engine deployments, delete the above "host:" line and remove the "# " -# from the following line. Then change YOUR-PROJECT-ID to your project id. -# host: "YOUR-PROJECT-ID.appspot.com" basePath: "/" consumes: - "application/json"