GetOpenapiSpec
Returns the OpenAPI specification of specified API gateway.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const GetOpenapiSpecRequest =
cloudApi.serverless.apigateway_apigateway_service.GetOpenapiSpecRequest;
const GetOpenapiSpecRequest_Format =
cloudApi.serverless.apigateway_apigateway_service
.GetOpenapiSpecRequest_Format;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.ApiGatewayServiceClient);
const result = await client.getOpenapiSpec(
GetOpenapiSpecRequest.fromPartial({
apiGatewayId: "apiGatewayId",
// format: GetOpenapiSpecRequest_Format.JSON
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.serverless.apigateway.v1.apigateway_service_pb2_grpc import ApiGatewayServiceStub
from yandex.cloud.serverless.apigateway.v1.apigateway_service_pb2 import GetOpenapiSpecRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(ApiGatewayServiceStub)
response = service.GetOpenapiSpec(
GetOpenapiSpecRequest(
api_gateway_id="apiGatewayId",
# format = GetOpenapiSpecRequest.Format.JSON
)
)
print(response)
GetOpenapiSpecRequest
Format
FORMAT_UNSPECIFIED
JSON
YAML
apiGatewayId
: string
ID of the API gateway to get specification from.
format
: Format
Format of returned specification. Default is the original format used in CreateApiGatewayRequest.
GetOpenapiSpecResponse
apiGatewayId
: string
ID of the API gateway.
openapiSpec
: string
The text of specification, JSON or YAML.