diff --git a/packages/cli/api-importers/openapi/openapi-ir-parser/package.json b/packages/cli/api-importers/openapi/openapi-ir-parser/package.json index c92e0f330ee..d458abf630b 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-parser/package.json +++ b/packages/cli/api-importers/openapi/openapi-ir-parser/package.json @@ -35,12 +35,10 @@ "@redocly/openapi-core": "^1.4.1", "lodash-es": "^4.17.21", "openapi-types": "^12.1.3", - "swagger2openapi": "7.0.8", "zod": "^3.22.3" }, "devDependencies": { "@types/lodash-es": "^4.17.12", - "@types/swagger2openapi": "^7.0.4", "depcheck": "^1.4.6", "eslint": "^8.56.0", "organize-imports-cli": "^0.10.0", diff --git a/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v2/generateIr.ts b/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v2/generateIr.ts deleted file mode 100644 index 71d3da556ab..00000000000 --- a/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v2/generateIr.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { OpenApiIntermediateRepresentation, Source } from "@fern-api/openapi-ir"; -import { TaskContext } from "@fern-api/task-context"; -import { OpenAPIV2 } from "openapi-types"; -import { ParseOpenAPIOptions } from "../../options"; -import { generateIr as generateIrFromV3 } from "../v3/generateIr"; - -const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; - -export async function generateIr({ - openApi, - taskContext, - options, - source, - namespace -}: { - openApi: OpenAPIV2.Document; - taskContext: TaskContext; - options: ParseOpenAPIOptions; - source: Source; - namespace: string | undefined; -}): Promise { - if (isBrowser) { - throw new Error("Swagger 2.0 is not supported in the browser"); - } - const swagger2openapi = await import("swagger2openapi"); - const conversionResult = await swagger2openapi.convertObj(openApi, {}); - return generateIrFromV3({ - openApi: conversionResult.openapi, - taskContext, - options, - source, - namespace - }); -} diff --git a/packages/cli/api-importers/openapi/openapi-ir-parser/src/parse.ts b/packages/cli/api-importers/openapi/openapi-ir-parser/src/parse.ts index bd84f2f5012..54b5ffac3e7 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-parser/src/parse.ts +++ b/packages/cli/api-importers/openapi/openapi-ir-parser/src/parse.ts @@ -1,11 +1,10 @@ import { assertNever } from "@fern-api/core-utils"; import { OpenApiIntermediateRepresentation, Schemas, Source as OpenApiIrSource } from "@fern-api/openapi-ir"; import { TaskContext } from "@fern-api/task-context"; -import { OpenAPI, OpenAPIV2, OpenAPIV3 } from "openapi-types"; +import { OpenAPIV3 } from "openapi-types"; import { DEFAULT_PARSE_ASYNCAPI_SETTINGS, ParseAsyncAPIOptions } from "./asyncapi/options"; import { parseAsyncAPI } from "./asyncapi/parse"; import { AsyncAPIV2 } from "./asyncapi/v2"; -import { generateIr as generateIrFromV2 } from "./openapi/v2/generateIr"; import { generateIr as generateIrFromV3 } from "./openapi/v3/generateIr"; import { getParseOptions, ParseOpenAPIOptions } from "./options"; @@ -13,7 +12,7 @@ export type Document = OpenAPIDocument | AsyncAPIDocument; export interface OpenAPIDocument { type: "openapi"; - value: OpenAPI.Document; + value: OpenAPIV3.Document; source?: OpenApiIrSource; namespace?: string; settings?: ParseOpenAPIOptions; @@ -65,25 +64,14 @@ export async function parse({ const source = document.source != null ? document.source : OpenApiIrSource.openapi({ file: "" }); switch (document.type) { case "openapi": { - if (isOpenApiV3(document.value)) { - const openapiIr = generateIrFromV3({ - taskContext: context, - openApi: document.value, - options: getParseOptions({ options: document.settings, overrides: options }), - source, - namespace: document.namespace - }); - ir = merge(ir, openapiIr); - } else if (isOpenApiV2(document.value)) { - const openapiIr = await generateIrFromV2({ - taskContext: context, - openApi: document.value, - options: getParseOptions({ options: document.settings, overrides: options }), - source, - namespace: document.namespace - }); - ir = merge(ir, openapiIr); - } + const openapiIr = generateIrFromV3({ + taskContext: context, + openApi: document.value, + options: getParseOptions({ options: document.settings, overrides: options }), + source, + namespace: document.namespace + }); + ir = merge(ir, openapiIr); break; } case "asyncapi": { @@ -184,13 +172,3 @@ function mergeSchemaMaps(schemas1: Schemas, schemas2: Schemas): Schemas { return schemas1; } - -function isOpenApiV3(openApi: OpenAPI.Document): openApi is OpenAPIV3.Document { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - return (openApi as OpenAPIV3.Document).openapi != null; -} - -function isOpenApiV2(openApi: OpenAPI.Document): openApi is OpenAPIV2.Document { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - return (openApi as OpenAPIV2.Document).swagger != null; -} diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/suger.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/suger.json index 05c6ab42e5c..2a9ebc66d50 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/suger.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/suger.json @@ -1,8161 +1 @@ -{ - "type": "openapi", - "value": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "swagger": "2.0", - "info": { - "description": "CRUD operations on a set of resources, including organizations, products, offers, entitlements, usage record groups for meterting, etc.", - "title": "Suger API", - "contact": { - "name": "Suger Support", - "url": "https://www.suger.io/support", - "email": "support@suger.io" - }, - "version": "1.0" - }, - "host": "https://api.suger.cloud", - "paths": { - "/org/{orgId}/buyer": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list all buyers by the given organization", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Buyer" - ], - "summary": "list buyers by organization", - "operationId": "ListBuyersByOrganization", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.IdentityBuyer" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/buyer/{buyerId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "get buyer by the given organization and buyer id", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Buyer" - ], - "summary": "get buyer", - "operationId": "GetBuyer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Buyer ID", - "name": "buyerId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.IdentityBuyer" - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "patch": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "update buyer name and description by the given organization and buyer id", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Buyer" - ], - "summary": "update buyer name and description", - "operationId": "UpdateBuyerNameDescription", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Buyer ID", - "name": "buyerId", - "in": "path", - "required": true - }, - { - "description": "UpdateBuyerNameDescriptionParams", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.UpdateBuyerNameDescriptionParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.IdentityBuyer" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/buyer/{buyerId}/entitlement": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all entitlements of the given buyer", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "list entitlements by buyer", - "operationId": "ListEntitlementsByBuyer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Buyer ID", - "name": "buyerId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/draftOffer": { - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Create a new draft offer or update the existing draft offer. When updating draft offer, the offer.ID is required.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "create or update draft offer", - "operationId": "CreateOrUpdateDraftOffer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "description": "the draft offer to create", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/entitlement": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all entitlements under the organization", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "list entitlements", - "operationId": "ListEntitlements", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Get the entitlement by ID", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "get entitlement", - "operationId": "GetEntitlement", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}/addCredit": { - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Add the credit amount to the given Entitlement. The credit amount is accumulated & saved in the current Entitlement Term of the gvien Entitlement.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "add entitlement credit", - "operationId": "AddEntitlementCredit", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - }, - { - "description": "RequestBody", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.AddEntitlementCreditParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.AddEntitlementCreditResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}/entitlementName": { - "patch": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Update the name of the given Entitlement", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "update entitlement name", - "operationId": "UpdateEntitlementName", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - }, - { - "description": "UpdateEntitlementNameParams", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.UpdateEntitlementNameParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}/entitlementTerm": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all Entitlement Terms of the given Entitlement", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement Term" - ], - "summary": "list entitlement terms", - "operationId": "ListEntitlementTerms", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadEntitlementTerm" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}/entitlementTerm/{entitlementTermId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Get the entitlement term by ID", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement Term" - ], - "summary": "get entitlement term", - "operationId": "GetEntitlementTerm", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement Term ID", - "name": "entitlementTermId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadEntitlementTerm" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}/usageRecordGroup": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list UsageRecordGroups for the given organization and entitlement", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "list usageRecordGroups by entitlement", - "operationId": "ListUsageRecordGroupsByEntitlement", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListUsageRecordGroupsResponse" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "It is recommended to provide the ID in the request body CreateUsageRecordGroupParams, so the report can be deduplicated. All duplicate report will return error code 409.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "report usageRecordGroup", - "operationId": "ReportUsageRecordGroup", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - }, - { - "description": "RequestBody", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.CreateUsageRecordGroupParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.MeteringUsageRecordGroup" - } - }, - "400": { - "description": "all the quantity of usage records are zero", - "schema": { - "type": "string" - } - }, - "409": { - "description": "Conflict request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/entitlement/{entitlementId}/usageRecordReport": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List usageRecordReports for the given organization and entitlement. Filter by entitlementTermId if it is given.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "list usageRecordReports by entitlement", - "operationId": "ListUsageRecordReportsByEntitlement", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Entitlement ID", - "name": "entitlementId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "The Entitlement Term ID, if not given, return the UsageRecordReports under the Entitlement", - "name": "entitlementTermId", - "in": "query" - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListUsageRecordReportsResponse" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/integration": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all integrations for the given organization.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Integration" - ], - "summary": "list integrations by organization", - "operationId": "ListIntegrationsByOrganization", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.IdentityIntegration" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "For each organization, partner & service, there should be at most one integration.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Integration" - ], - "summary": "create integration", - "operationId": "CreateIntegration", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "description": "Create Integration Params", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.CreateIntegrationParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.IdentityIntegration" - } - }, - "400": { - "description": "Bad request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/integration/{partner}/{service}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Get the integration for the given organization, partner & service.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Integration" - ], - "summary": "get integration", - "operationId": "GetIntegration", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - }, - { - "enum": [ - "MARKETPLACE", - "CRM" - ], - "type": "string", - "description": "Partner Service", - "name": "service", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.IdentityIntegration" - } - }, - "404": { - "description": "Integration not found", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "delete": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "delete the integration for the given orgId, partner and service.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Integration" - ], - "summary": "delete integration", - "operationId": "DeleteIntegration", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - }, - { - "enum": [ - "MARKETPLACE", - "CRM" - ], - "type": "string", - "description": "Partner Service", - "name": "service", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Empty string if deletion is successful", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "patch": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Update the given integration.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Integration" - ], - "summary": "update integration", - "operationId": "UpdateIntegration", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - }, - { - "enum": [ - "MARKETPLACE", - "CRM" - ], - "type": "string", - "description": "Partner Service", - "name": "service", - "in": "path", - "required": true - }, - { - "description": "Update Integration Params", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.UpdateIntegrationParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.IdentityIntegration" - } - }, - "400": { - "description": "Bad request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/integration/{partner}/{service}/verify": { - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Verify the given integration, check whether it works correctly.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Integration" - ], - "summary": "verify integration", - "operationId": "VerifyIntegration", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - }, - { - "enum": [ - "MARKETPLACE", - "CRM" - ], - "type": "string", - "description": "Partner Service", - "name": "service", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "whether it is verified or not", - "schema": { - "type": "boolean" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/offer": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all offers under the given organization.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "list offers by organization", - "operationId": "ListOffersByOrganization", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Create a private offer under the given organization.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "create offer", - "operationId": "CreateOffer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "description": "Offer to create", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/offer/{offerId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Get the offer by the given offer ID.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "get offer", - "operationId": "GetOffer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Offer ID", - "name": "offerId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "delete": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Only the offer with status = \"DRAFT\" or \"CREATE_FAILED\" is allowed to be deleted.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "delete offer", - "operationId": "DeleteOffer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Offer ID", - "name": "offerId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Empty string if deletion is successful", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/offer/{offerId}/cancel": { - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Only the offer with status = \"PENDING_ACCEPTANCE\" or \"PENDING_CANCEL\" is allowed to cancel.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "cancel offer", - "operationId": "CancelOffer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Offer ID", - "name": "offerId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Empty string if cancellation is successful", - "schema": { - "type": "string" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/offer/{offerId}/entitlement": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all entitlements under the given offer", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "list entitlements by offer", - "operationId": "ListEntitlementsByOffer", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Offer ID", - "name": "offerId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/operation": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all long running operations under the given organization, offer, entitlement, crmOpportunity or partnerOpportunity. Only provide one filter on a request.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Operation" - ], - "summary": "list operations", - "operationId": "ListOperations", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "filter by offerId", - "name": "offerId", - "in": "query" - }, - { - "type": "string", - "description": "filter by entitlementId", - "name": "entitlementId", - "in": "query" - }, - { - "type": "string", - "description": "filter by crmOpportunityId", - "name": "crmOpportunityId", - "in": "query" - }, - { - "type": "string", - "description": "filter by partnerOpportunityId", - "name": "partnerOpportunityId", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.Operation" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/partner/{partner}/entitlement": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all entitlements under the given partner", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "list entitlements by partner", - "operationId": "ListEntitlementsByPartner", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/partner/{partner}/offer": { - "get": { - "description": "List all offers under the given organization & cloud partner.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "list offers by partner", - "operationId": "ListOffersByPartner", - "parameters": [ - { - "type": "string", - "example": "Bearer ", - "description": "Bearer Access Token", - "name": "Authorization", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/partner/{partner}/product": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list all products under the given organization and cloud partner", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Product" - ], - "summary": "list products by partner", - "operationId": "ListProductsByPartner", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadProduct" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/partner/{partner}/revenueRecord": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list the revenue records for the given organization, product, entitlement, or buyer.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Report" - ], - "summary": "list revenue records", - "operationId": "ListRevenueRecords", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Filter revenue record details by the given product ID", - "name": "productId", - "in": "query" - }, - { - "type": "string", - "description": "Filter revenue record details by the given entitlement ID", - "name": "entitlementId", - "in": "query" - }, - { - "type": "string", - "description": "Filter revenue record details by the given buyer ID", - "name": "buyerId", - "in": "query" - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListRevenueRecordsResponse" - } - }, - "400": { - "description": "Bad request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/partner/{partner}/revenueRecordDetail": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list the raw revenue record details for the given organization, product, entitlement, or buyer.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Report" - ], - "summary": "list revenue record details", - "operationId": "ListRevenueRecordDetails", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "enum": [ - "AWS", - "AZURE", - "GCP" - ], - "type": "string", - "description": "Cloud Partner", - "name": "partner", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Filter revenue record details by the given product ID", - "name": "productId", - "in": "query" - }, - { - "type": "string", - "description": "Filter revenue record details by the given entitlement ID", - "name": "entitlementId", - "in": "query" - }, - { - "type": "string", - "description": "Filter revenue record details by the given buyer ID", - "name": "buyerId", - "in": "query" - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListRevenueRecordDetailsResponse" - } - }, - "400": { - "description": "Bad request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/product": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list all products under the given organization", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Product" - ], - "summary": "list products by organization", - "operationId": "ListProductsByOrganization", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadProduct" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/product/{productId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "get product by product id", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Product" - ], - "summary": "get product", - "operationId": "GetProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadProduct" - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "delete": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "only the product with status = \"CREATE_FAILED\" is allowed to be deleted.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Product" - ], - "summary": "delete product", - "operationId": "DeleteProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "Empty string if deletion is successful", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal Server Error" - } - } - }, - "patch": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "currently only the Fulfillment URL is allowed to update via this API.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Product" - ], - "summary": "update product", - "operationId": "UpdateProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - }, - { - "description": "Update Product Params", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.UpdateProductParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.WorkloadProduct" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/product/{productId}/dimension": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list all metering dimensions of the given product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Product" - ], - "summary": "list metering dimensions of product", - "operationId": "ListProductMeteringDimensions", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.AwsSaasProductDimension" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/product/{productId}/entitlement": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all entitlements under the given product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Entitlement" - ], - "summary": "list entitlements by product", - "operationId": "ListEntitlementsByProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadEntitlement" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/product/{productId}/offer": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List all offers under the given organization & product.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Offer" - ], - "summary": "list offers by product", - "operationId": "ListOffersByProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.WorkloadOffer" - } - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/product/{productId}/usageRecordGroup": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list UsageRecordGroups for the given organization and product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "list usageRecordGroups by product", - "operationId": "ListUsageRecordGroupsByProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListUsageRecordGroupsResponse" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/product/{productId}/usageRecordReport": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List usageRecordReports for the given organization and product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "list usageRecordReports by product", - "operationId": "ListUsageRecordReportsByProduct", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "Product ID", - "name": "productId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListUsageRecordReportsResponse" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/revenueReport": { - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "Get the revenue report of the given organization, product, entitlement, or buyer.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Report" - ], - "summary": "get revenue report", - "operationId": "GetRevenueReport", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "description": "Get Revenue Report Params", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.GetRevenueReportParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.RevenueReport" - } - }, - "400": { - "description": "Bad request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/org/{orgId}/usageRecordGroup": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "list UsageRecordGroups under the given organization.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "list usageRecordGroups by organization", - "operationId": "ListUsageRecordGroupsByOrganization", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListUsageRecordGroupsResponse" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/usageRecordGroup/{usageRecordGroupId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "get UsageRecordGroup for the given organization and usageRecordGroup ID", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "get usageRecordGroup", - "operationId": "GetUsageRecordGroup", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "UsageRecordGroup ID", - "name": "usageRecordGroupId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.MeteringUsageRecordGroup" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/usageRecordReport": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "List usageRecordReports under the given organization", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "list usageRecordReports by organization", - "operationId": "ListUsageRecordReportsByOrganization", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "start date (UTC) in YYYY-MM-DD format, default is 30 days before the endDate", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "description": "end date (UTC) in YYYY-MM-DD format, default is today", - "name": "endDate", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination size, default 20, max value is 1000", - "name": "limit", - "in": "query" - }, - { - "type": "integer", - "description": "List pagination offset, default 0", - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ListUsageRecordReportsResponse" - } - }, - "400": { - "description": "Bad Request" - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/usageRecordReport/{usageRecordReportId}": { - "get": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "get the usageRecordReport for a given organization and usageRecordReport ID.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Metering" - ], - "summary": "get usageRecordReport", - "operationId": "GetUsageRecordReport", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "UsageRecordReport ID", - "name": "usageRecordReportId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.MeteringUsageRecordReport" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - }, - "/org/{orgId}/usageReport": { - "post": { - "security": [ - { - "BearerTokenAuth": [] - } - ], - "description": "get the daily usage report of the given entitlement, the default timespan is lifetime.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Report" - ], - "summary": "get usage report", - "operationId": "GetUsageReport", - "parameters": [ - { - "type": "string", - "description": "Organization ID", - "name": "orgId", - "in": "path", - "required": true - }, - { - "description": "Get Usage Report Params", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.GetUsageReportParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.UsageReport" - } - }, - "400": { - "description": "Bad request error description", - "schema": { - "type": "string" - } - }, - "500": { - "description": "internal error description", - "schema": { - "type": "string" - } - } - } - } - }, - "/public/apiClient/accessToken": { - "post": { - "description": "Get the Bearer Access Token by giving the Suger API Client ID & Client Secret.", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "API" - ], - "summary": "get api access token", - "operationId": "GetApiClientAccessToken", - "parameters": [ - { - "description": "Suger API Client", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/shared.GetApiClientAccessTokenParams" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/shared.ApiClientAccessToken" - } - }, - "500": { - "description": "Internal Server Error" - } - } - } - } - }, - "definitions": { - "AzureAudience": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "id": { - "type": "string" - } - } - }, - "AzureGovernmentCertification": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "uri": { - "type": "string" - }, - "validationResults": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureValidationResult" - } - } - } - }, - "AzureIncludedBaseQuantity": { - "type": "object", - "properties": { - "isInfinite": { - "type": "boolean" - }, - "quantity": { - "type": "number" - }, - "recurringUnit": { - "type": "string", - "enum": [ - "Monthly", - "Annual" - ] - } - } - }, - "AzureListingContact": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "phone": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "CustomerSupport", - "Engineering", - "ChannelManager" - ] - }, - "uri": { - "type": "string" - } - } - }, - "AzureListingUri": { - "type": "object", - "properties": { - "displayText": { - "type": "string" - }, - "subtype": { - "type": "string" - }, - "type": { - "type": "string" - }, - "uri": { - "type": "string" - } - } - }, - "AzureLocalizedDateTime": { - "type": "object", - "properties": { - "dateTimeInUtc": { - "type": "string" - }, - "localizePerMarket": { - "type": "boolean" - } - } - }, - "AzureLocalizedTimeRange": { - "type": "object", - "properties": { - "endAt": { - "$ref": "#/definitions/AzureLocalizedDateTime" - }, - "startAt": { - "$ref": "#/definitions/AzureLocalizedDateTime" - } - } - }, - "AzureMarket": { - "type": "object", - "properties": { - "friendlyName": { - "type": "string" - }, - "marketCode": { - "description": "ISO Country Code", - "type": "string" - } - } - }, - "AzureMarketState": { - "type": "object", - "properties": { - "marketCode": { - "description": "ISO Country Code", - "type": "string" - }, - "state": { - "type": "string", - "enum": [ - "Disabled", - "Enabled", - "StopSelling", - "Terminated" - ] - } - } - }, - "AzureMarketplacePrice": { - "type": "object", - "properties": { - "currency": { - "description": "ISO 4217 currency code", - "type": "string" - }, - "markets": { - "type": "array", - "items": { - "type": "string" - } - }, - "price": { - "description": "default 0", - "type": "number" - }, - "prices": {} - } - }, - "AzureMarketplacePrivateOffer": { - "type": "object", - "properties": { - "$schema": { - "type": "string" - }, - "acceptBy": { - "description": "in format YYYY-MM-DD", - "type": "string", - "format": "date-time" - }, - "acceptanceLinks": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplacePrivateOfferAcceptanceLink" - } - }, - "beneficiaries": { - "description": "array of email addresses.", - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplacePrivateOfferBeneficiary" - } - }, - "eTag": { - "type": "string" - }, - "end": { - "description": "in format YYYY-MM-DD", - "type": "string", - "format": "date-time" - }, - "id": { - "description": "in format of \"private-offer/private-offer-durable-id\"", - "type": "string" - }, - "lastModified": { - "description": "in format YYYY-MM-DD", - "type": "string", - "format": "date-time" - }, - "name": { - "type": "string" - }, - "notificationContacts": { - "description": "array of email addresses of the users to be notified of any changes in the private offer status.", - "type": "array", - "items": { - "type": "string" - } - }, - "preparedBy": { - "type": "string" - }, - "pricing": { - "description": "Up to 10 pricing entries are allowed.", - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplacePrivateOfferPricing" - } - }, - "privateOfferType": { - "type": "string", - "enum": [ - "customerPromotion", - "cspPromotion" - ] - }, - "resourceName": { - "type": "string" - }, - "start": { - "description": "in format YYYY-MM-DD, if VariableStartDate = true, this field should be empty.", - "type": "string", - "format": "date-time" - }, - "state": { - "type": "string", - "enum": [ - "draft", - "live", - "withdrawn", - "deleted" - ] - }, - "subState": { - "type": "string", - "enum": [ - "pendingAcceptance", - "accepted" - ] - }, - "termsAndConditionsDocSasUrl": { - "type": "string" - }, - "upgradedFrom": { - "$ref": "#/definitions/AzureMarketplacePrivateOfferPromotionReference" - }, - "validations": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplaceValidation" - } - }, - "variableStartDate": { - "type": "boolean" - } - } - }, - "AzureMarketplacePrivateOfferAcceptanceLink": { - "type": "object", - "properties": { - "beneficiaryId": { - "description": "The Customer Billing Account ID.", - "type": "string" - }, - "link": { - "type": "string" - } - } - }, - "AzureMarketplacePrivateOfferBeneficiary": { - "type": "object", - "properties": { - "beneficiaryRecipients": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplacePrivateOfferBeneficiaryRecipient" - } - }, - "description": { - "type": "string" - }, - "id": { - "description": "the customer billing account id.", - "type": "string" - } - } - }, - "AzureMarketplacePrivateOfferBeneficiaryRecipient": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "recipientType": { - "type": "string", - "enum": [ - "cspCustomer", - "billingGroup" - ] - } - } - }, - "AzureMarketplacePrivateOfferPricing": { - "type": "object", - "properties": { - "discountPercentage": { - "description": "between 0 and 100", - "type": "number" - }, - "discountType": { - "type": "string", - "enum": [ - "percentage", - "absolute" - ] - }, - "originalPlan": { - "description": "the pricing plan of the original plan.", - "allOf": [ - { - "$ref": "#/definitions/AzurePriceAndAvailabilityPrivateOfferPlan" - } - ] - }, - "plan": { - "description": "in format of \"plan/product-durable-id/plan-durable-id\"", - "type": "string" - }, - "planName": { - "type": "string" - }, - "planType": { - "description": "The type of the plan, FLAT_RATE or PER_USER.", - "type": "string", - "enum": [ - "FLAT_RATE", - "PER_USER" - ] - }, - "priceDetails": { - "type": "string" - }, - "privateOfferPlan": { - "description": "the pricing plan of the private offer", - "allOf": [ - { - "$ref": "#/definitions/AzurePriceAndAvailabilityPrivateOfferPlan" - } - ] - }, - "product": { - "description": "in format of \"product/product-durable-id\"", - "type": "string" - }, - "sugerOfferId": { - "type": "string" - } - } - }, - "AzureMarketplacePrivateOfferPromotionReference": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "AzureMarketplaceTerm": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "day", - "week", - "month", - "year" - ] - }, - "value": { - "description": "default 0", - "type": "number" - } - } - }, - "AzureMarketplaceValidation": { - "type": "object", - "properties": { - "$schema": { - "type": "string" - }, - "code": { - "type": "string", - "enum": [ - "businessValidationError", - "collectionLimitExceeded", - "invalidId", - "invalidEntityStatus", - "invalidRequest", - "invalidResource", - "invalidState", - "notDeployed", - "notSupported", - "operationCanceled", - "productLocked", - "resourceNotFound", - "schemaValidationError" - ] - }, - "level": { - "type": "string", - "enum": [ - "informational", - "warning" - ] - }, - "message": { - "type": "string" - }, - "resourceId": { - "type": "string" - } - } - }, - "AzurePendingUpdateInfo": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "updateType": { - "type": "string" - } - } - }, - "AzurePrice": { - "type": "object", - "properties": { - "currencyCode": { - "description": "ISO currency code, Three characters", - "type": "string" - }, - "openPrice": { - "type": "number" - }, - "priceTierID": { - "type": "string" - } - } - }, - "AzurePriceAndAvailabilityPrivateOfferCustomMeters": { - "type": "object", - "properties": { - "meters": { - "description": "One of PriceAndAvailabilityCustomMeter_USD or PriceAndAvailabilityCustomMeter_PerMarket" - }, - "priceInputOption": { - "description": "default \"usd\"", - "type": "string", - "enum": [ - "perMarket", - "usd" - ] - } - } - }, - "AzurePriceAndAvailabilityPrivateOfferPlan": { - "type": "object", - "properties": { - "$schema": { - "type": "string" - }, - "id": { - "type": "string" - }, - "plan": { - "type": "string" - }, - "pricing": { - "$ref": "#/definitions/AzurePriceAndAvailabilityPrivateOfferPrice" - }, - "product": { - "type": "string" - }, - "resourceName": { - "type": "string" - }, - "validations": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplaceValidation" - } - } - } - }, - "AzurePriceAndAvailabilityPrivateOfferPrice": { - "type": "object", - "properties": { - "customMeters": { - "$ref": "#/definitions/AzurePriceAndAvailabilityPrivateOfferCustomMeters" - }, - "recurrentPrice": { - "$ref": "#/definitions/AzurePriceAndAvailabilityRecurrentPrice" - } - } - }, - "AzurePriceAndAvailabilityRecurrentPrice": { - "type": "object", - "properties": { - "priceInputOption": { - "description": "default \"usd\"", - "type": "string", - "enum": [ - "perMarket", - "usd" - ] - }, - "prices": { - "type": "array", - "items": { - "$ref": "#/definitions/AzurePriceAndAvailabilityRecurrentPriceItem" - } - } - } - }, - "AzurePriceAndAvailabilityRecurrentPriceItem": { - "type": "object", - "properties": { - "billingTerm": { - "$ref": "#/definitions/AzureMarketplaceTerm" - }, - "paymentOption": { - "$ref": "#/definitions/AzureMarketplaceTerm" - }, - "pricePerPaymentInUsd": { - "type": "number" - }, - "prices": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketplacePrice" - } - } - } - }, - "AzurePriceCadence": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "Month", - "Year" - ] - }, - "value": { - "type": "integer" - } - } - }, - "AzurePriceSchedule": { - "type": "object", - "properties": { - "priceCadence": { - "$ref": "#/definitions/AzurePriceCadence" - }, - "pricingModel": { - "type": "string", - "enum": [ - "Flat", - "Recurring", - "Usage" - ] - }, - "pricingUnits": { - "type": "array", - "items": { - "$ref": "#/definitions/AzurePricingUnit" - } - }, - "retailPrice": { - "$ref": "#/definitions/AzurePrice" - } - } - }, - "AzurePricingUnit": { - "type": "object", - "properties": { - "isUnlimitedUnit": { - "type": "boolean" - }, - "lowerUnit": { - "type": "integer" - }, - "name": { - "type": "string", - "enum": [ - "sharedcore", - "transactions" - ] - }, - "unitType": { - "type": "string" - }, - "upperUnit": { - "type": "integer" - } - } - }, - "AzureProduct": { - "type": "object", - "properties": { - "availabilities": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductAvailability" - } - }, - "branches": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductBranch" - } - }, - "externalIDs": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "id": { - "type": "string" - }, - "isModularPublishing": { - "type": "boolean" - }, - "listings": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductListing" - } - }, - "name": { - "type": "string" - }, - "packageConfigurations": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductPackageConfiguration" - } - }, - "properties": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductProperty" - } - }, - "resourceType": { - "type": "string" - }, - "setup": { - "description": "Not original fields. They are populated by other API calls", - "allOf": [ - { - "$ref": "#/definitions/AzureProductSetup" - } - ] - }, - "submissions": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductSubmission" - } - }, - "variants": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductVariant" - } - } - } - }, - "AzureProductAvailability": { - "type": "object", - "properties": { - "emailAudiences": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureAudience" - } - }, - "enterpriseLicensing": { - "type": "string" - }, - "id": { - "type": "string" - }, - "resourceType": { - "type": "string" - }, - "subscriptionAudiences": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureAudience" - } - }, - "visibility": { - "type": "string" - } - } - }, - "AzureProductBranch": { - "type": "object", - "properties": { - "currentDraftInstanceID": { - "type": "string" - }, - "friendlyName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "module": { - "type": "string" - }, - "resourceType": { - "type": "string" - }, - "type": { - "type": "string" - }, - "variantID": { - "type": "string" - } - } - }, - "AzureProductFeatureAvailability": { - "type": "object", - "properties": { - "customMeters": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductVariantCustomMeter" - } - }, - "id": { - "type": "string" - }, - "isHidden": { - "type": "boolean" - }, - "marketStates": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarketState" - } - }, - "markets": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureMarket" - } - }, - "priceSchedules": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductVariantPriceSchedule" - } - }, - "properties": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "resourceType": { - "description": "ResourceType = FeatureAvailability", - "type": "string" - }, - "subscriptionAudiences": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureAudience" - } - }, - "tenantAudiences": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureAudience" - } - }, - "trial": { - "$ref": "#/definitions/AzureProductVariantTrial" - }, - "visibility": { - "type": "string", - "enum": [ - "Public", - "Private" - ] - } - } - }, - "AzureProductListing": { - "type": "object", - "properties": { - "accessInformation": { - "type": "string" - }, - "assets": { - "description": "Not original fields. They are populated by other API calls", - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductListingAsset" - } - }, - "compatibleProducts": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": { - "type": "string" - }, - "gettingStartedInstructions": { - "type": "string" - }, - "id": { - "type": "string" - }, - "keywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "languageCode": { - "type": "string" - }, - "listingContacts": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureListingContact" - } - }, - "listingUris": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureListingUri" - } - }, - "productDisplayName": { - "type": "string" - }, - "publisherName": { - "type": "string" - }, - "resourceType": { - "type": "string", - "enum": [ - "AzureListing" - ] - }, - "shortDescription": { - "type": "string" - }, - "summary": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "AzureProductListingAsset": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "fileName": { - "type": "string" - }, - "fileSasUri": { - "type": "string" - }, - "friendlyName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "order": { - "type": "integer" - }, - "publisherDefinedSasUri": { - "type": "string" - }, - "resourceType": { - "type": "string", - "enum": [ - "ListingAsset", - "ListingImage", - "ListingVideo" - ] - }, - "state": { - "type": "string", - "enum": [ - "PendingUpload", - "Uploaded", - "InProcessing", - "Processed", - "ProcessFailed" - ] - }, - "type": { - "type": "string" - } - } - }, - "AzureProductPackageConfiguration": { - "type": "object", - "properties": { - "azureActiveDirectoryApplicationID": { - "type": "string" - }, - "azureActiveDirectoryTenantID": { - "type": "string" - }, - "connectionWebhook": { - "type": "string" - }, - "id": { - "type": "string" - }, - "landingPageUri": { - "type": "string" - }, - "resourceType": { - "type": "string", - "enum": [ - "AzureSoftwareAsAServicePackageConfiguration" - ] - } - } - }, - "AzureProductProperty": { - "type": "object", - "properties": { - "additionalCategories": { - "type": "array", - "items": { - "type": "string" - } - }, - "appVersion": { - "type": "string" - }, - "applicableProducts": { - "type": "array", - "items": { - "type": "string" - } - }, - "categories": { - "type": "array", - "items": { - "type": "string" - } - }, - "customAmendments": { - "type": "array", - "items": { - "type": "string" - } - }, - "extendedProperties": { - "type": "array", - "items": { - "type": "string" - } - }, - "globalAmendmentTerms": { - "type": "string" - }, - "hideKeys": { - "type": "array", - "items": { - "type": "string" - } - }, - "id": { - "type": "string" - }, - "industries": { - "type": "array", - "items": { - "type": "string" - } - }, - "leveledCategories": { - "type": "object", - "additionalProperties": true - }, - "leveledIndustries": { - "type": "object", - "additionalProperties": true - }, - "marketingOnlyChange": { - "type": "boolean" - }, - "productTags": { - "type": "array", - "items": { - "type": "string" - } - }, - "resourceType": { - "type": "string" - }, - "submissionVersion": { - "type": "string" - }, - "termsOfUse": { - "type": "string" - }, - "useEnterpriseContract": { - "type": "boolean" - } - } - }, - "AzureProductSetup": { - "type": "object", - "properties": { - "callToAction": { - "type": "string", - "enum": [ - "free", - "free-trial", - "contact-me" - ] - }, - "channelStates": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "enableTestDrive": { - "type": "boolean" - }, - "resourceType": { - "type": "string", - "enum": [ - "AzureProductSetup" - ] - }, - "sellingOption": { - "type": "string", - "enum": [ - "ListingOnly", - "ListAndSell" - ] - }, - "testDriveType": { - "type": "string" - }, - "trialUri": { - "type": "string" - } - } - }, - "AzureProductSubmission": { - "type": "object", - "properties": { - "areResourcesReady": { - "type": "boolean" - }, - "friendlyName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "pendingUpdateInfo": { - "$ref": "#/definitions/AzurePendingUpdateInfo" - }, - "publishedTimeInUtc": { - "type": "string", - "format": "date-time" - }, - "releaseNumber": { - "type": "integer" - }, - "resourceType": { - "type": "string", - "enum": [ - "Submission" - ] - }, - "resources": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "state": { - "type": "string", - "enum": [ - "Inprogress", - "Published" - ] - }, - "subState": { - "type": "string", - "enum": [ - "InDraft", - "Submitted", - "Failed", - "FailedInCertification", - "ReadyToPublish", - "Publishing", - "Published", - "InStore" - ] - }, - "targets": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "variantResources": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureVariantResource" - } - } - } - }, - "AzureProductVariant": { - "type": "object", - "properties": { - "azureGovernmentCertifications": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureGovernmentCertification" - } - }, - "cloudAvailabilities": { - "type": "array", - "items": { - "type": "string" - } - }, - "conversionPaths": { - "type": "string" - }, - "extendedProperties": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "externalID": { - "type": "string" - }, - "featureAvailabilities": { - "description": "Not original fields. They are populated by other API calls", - "type": "array", - "items": { - "$ref": "#/definitions/AzureProductFeatureAvailability" - } - }, - "friendlyName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "leadGenID": { - "type": "string" - }, - "referenceVariantID": { - "type": "string" - }, - "resourceType": { - "type": "string", - "enum": [ - "AzureSkuVariant", - "AzureTestDriveVariant" - ] - }, - "state": { - "type": "string", - "enum": [ - "InActive", - "Active" - ] - } - } - }, - "AzureProductVariantCustomMeter": { - "type": "object", - "properties": { - "displayName": { - "type": "string" - }, - "id": { - "type": "string" - }, - "includedBaseQuantities": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureIncludedBaseQuantity" - } - }, - "isEnabled": { - "type": "boolean" - }, - "priceInUsd": { - "type": "number" - }, - "uniqueID": { - "type": "string" - }, - "unitOfMeasure": { - "type": "string" - } - } - }, - "AzureProductVariantPriceSchedule": { - "type": "object", - "properties": { - "dateTimeRange": { - "$ref": "#/definitions/AzureLocalizedTimeRange" - }, - "friendlyName": { - "type": "string" - }, - "isBaseSchedule": { - "description": "There is only one base schedule.", - "type": "boolean" - }, - "marketCodes": { - "description": "ISO country code", - "type": "array", - "items": { - "type": "string" - } - }, - "schedules": { - "type": "array", - "items": { - "$ref": "#/definitions/AzurePriceSchedule" - } - } - } - }, - "AzureProductVariantTrial": { - "type": "object", - "properties": { - "dateTimeRange": { - "$ref": "#/definitions/AzureLocalizedTimeRange" - }, - "duration": { - "type": "integer" - }, - "durationType": { - "type": "string", - "enum": [ - "Minute", - "Days", - "Months" - ] - }, - "type": { - "type": "string", - "enum": [ - "NoTrial", - "TimedAccess", - "TimedUsage", - "Unlimited" - ] - } - } - }, - "AzureTypeValue": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "AzureValidationResult": { - "type": "object", - "properties": { - "errorMessage": { - "type": "string" - }, - "memberNames": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "AzureVariantResource": { - "type": "object", - "properties": { - "resources": { - "type": "array", - "items": { - "$ref": "#/definitions/AzureTypeValue" - } - }, - "variantID": { - "type": "string" - } - } - }, - "github_com_aws_aws-sdk-go-v2_service_marketplacemetering_types.Tag": { - "type": "object", - "properties": { - "key": { - "description": "One part of a key-value pair that makes up a tag. A key is a label that acts\nlike a category for the specific tag values.\n\nThis member is required.", - "type": "string" - }, - "value": { - "description": "One part of a key-value pair that makes up a tag. A value acts as a descriptor\nwithin a tag category (key). The value can be empty or null.\n\nThis member is required.", - "type": "string" - } - } - }, - "github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.BatchUsageEventOkResponse": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "result": { - "type": "array", - "items": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageBatchEventOkMessage" - } - } - } - }, - "github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageBatchEventOkMessage": { - "type": "object", - "properties": { - "dimension": { - "description": "Dimension identifier", - "type": "string" - }, - "effectiveStartTime": { - "description": "Time in UTC when the usage event occurred", - "type": "string" - }, - "error": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventConflictResponse" - }, - "messageTime": { - "description": "Time this message was created in UTC", - "type": "string" - }, - "planId": { - "description": "Plan associated with the purchased offer", - "type": "string" - }, - "quantity": { - "description": "Number of units consumed", - "type": "number" - }, - "resourceId": { - "description": "Identifier of the resource against which usage is emitted", - "type": "string" - }, - "resourceUri": { - "description": "Identifier of the managed app resource against which usage is emitted", - "type": "string" - }, - "status": { - "description": "Status of the operation.", - "allOf": [ - { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventStatusEnum" - } - ] - }, - "usageEventId": { - "description": "Unique identifier associated with the usage event", - "type": "string" - } - } - }, - "github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventConflictResponse": { - "type": "object", - "properties": { - "additionalInfo": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventConflictResponseAdditionalInfo" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - } - } - }, - "github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventConflictResponseAdditionalInfo": { - "type": "object", - "properties": { - "acceptedMessage": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventOkResponse" - } - } - }, - "github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventOkResponse": { - "type": "object", - "properties": { - "dimension": { - "description": "Dimension identifier", - "type": "string" - }, - "effectiveStartTime": { - "description": "Time in UTC when the usage event occurred", - "type": "string" - }, - "messageTime": { - "description": "Time this message was created in UTC", - "type": "string" - }, - "planId": { - "description": "Plan associated with the purchased offer", - "type": "string" - }, - "quantity": { - "description": "Number of units consumed", - "type": "number" - }, - "resourceId": { - "description": "Identifier of the resource against which usage is emitted", - "type": "string" - }, - "resourceUri": { - "description": "Identifier of the managed app resource against which usage is emitted", - "type": "string" - }, - "status": { - "description": "Status of the operation.", - "allOf": [ - { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventStatusEnum" - } - ] - }, - "usageEventId": { - "description": "Unique identifier associated with the usage event", - "type": "string" - } - } - }, - "github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.UsageEventStatusEnum": { - "type": "string", - "enum": [ - "Accepted", - "Expired", - "Duplicate", - "Error", - "ResourceNotFound", - "ResourceNotAuthorized", - "InvalidDimension", - "InvalidQuantity", - "BadArgument" - ], - "x-enum-varnames": [ - "UsageEventStatusEnumAccepted", - "UsageEventStatusEnumExpired", - "UsageEventStatusEnumDuplicate", - "UsageEventStatusEnumError", - "UsageEventStatusEnumResourceNotFound", - "UsageEventStatusEnumResourceNotAuthorized", - "UsageEventStatusEnumInvalidDimension", - "UsageEventStatusEnumInvalidQuantity", - "UsageEventStatusEnumBadArgument" - ] - }, - "github_com_sugerio_marketplace-service_rds-db_lib.BillingAwsBillingEvent": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "agreementID": { - "type": "string" - }, - "amount": { - "type": "number" - }, - "balanceImpacting": { - "type": "integer" - }, - "bankTraceID": { - "type": "string" - }, - "billingAddressID": { - "type": "string" - }, - "brokerID": { - "type": "string" - }, - "buyerID": { - "type": "string" - }, - "currency": { - "type": "string" - }, - "dataFeedProductID": { - "type": "string" - }, - "disbursementBillingEventID": { - "type": "string" - }, - "endUserAccountID": { - "type": "string" - }, - "entitlementID": { - "type": "string" - }, - "fromAccountID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "insertDate": { - "$ref": "#/definitions/sql.NullTime" - }, - "invoiceDate": { - "$ref": "#/definitions/sql.NullTime" - }, - "invoiceID": { - "type": "string" - }, - "offerID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "parentBillingEventID": { - "type": "string" - }, - "paymentDueDate": { - "$ref": "#/definitions/sql.NullTime" - }, - "productID": { - "type": "string" - }, - "toAccountID": { - "type": "string" - }, - "transactionReferenceID": { - "type": "string" - }, - "transactionType": { - "type": "string" - }, - "usagePeriodEndDate": { - "$ref": "#/definitions/sql.NullTime" - }, - "usagePeriodStartDate": { - "$ref": "#/definitions/sql.NullTime" - } - } - }, - "github_com_sugerio_marketplace-service_rds-db_lib.BillingAzureCmaRevenue": { - "type": "object", - "properties": { - "azureAssetID": { - "type": "string" - }, - "azureBillingAccountID": { - "type": "string" - }, - "azureCustomerID": { - "type": "string" - }, - "azureOfferID": { - "type": "string" - }, - "azurePlanID": { - "type": "string" - }, - "billingModel": { - "type": "string" - }, - "buyerID": { - "type": "string" - }, - "earningUsd": { - "type": "number" - }, - "entitlementID": { - "type": "string" - }, - "offerID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "payoutStatus": { - "type": "string" - }, - "productID": { - "type": "string" - }, - "purchaseRecordID": { - "type": "string" - }, - "revenueUsd": { - "type": "number" - }, - "termEndDate": { - "type": "string" - }, - "termStartDate": { - "type": "string" - } - } - }, - "github_com_sugerio_marketplace-service_rds-db_lib.BillingGcpChargeUsage": { - "type": "object", - "properties": { - "abandoned": { - "type": "number" - }, - "accountID": { - "type": "string" - }, - "buyerID": { - "type": "string" - }, - "charges": { - "type": "number" - }, - "currency": { - "type": "string" - }, - "dueVendor": { - "type": "number" - }, - "entitlementID": { - "type": "string" - }, - "googleEntity": { - "type": "string" - }, - "insightAccountID": { - "type": "string" - }, - "offerID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "paymentSchedule": { - "type": "string" - }, - "paymentType": { - "type": "string" - }, - "prepayCredits": { - "type": "number" - }, - "productID": { - "type": "string" - }, - "refundBalanceDeductedThisMonth": { - "type": "number" - }, - "refundBalanceOutstanding": { - "type": "number" - }, - "refundReason": { - "type": "string" - }, - "released": { - "type": "number" - }, - "reportDate": { - "type": "string" - }, - "resource": { - "type": "string" - }, - "sku": { - "type": "string" - }, - "trialUse": { - "type": "number" - }, - "unit": { - "type": "string" - }, - "usage": { - "type": "number" - }, - "usedBy": { - "type": "string" - }, - "withheld": { - "type": "number" - } - } - }, - "github_com_sugerio_marketplace-service_rds-db_lib.UpdateBuyerNameDescriptionParams": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organizationID": { - "type": "string" - } - } - }, - "github_com_sugerio_marketplace-service_rds-db_lib.UpdateEntitlementNameParams": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organizationID": { - "type": "string" - } - } - }, - "marketplacemetering.BatchMeterUsageOutput": { - "type": "object", - "properties": { - "resultMetadata": { - "description": "Metadata pertaining to the operation's result.", - "allOf": [ - { - "$ref": "#/definitions/middleware.Metadata" - } - ] - }, - "results": { - "description": "Contains all UsageRecords processed by BatchMeterUsage. These records were\neither honored by AWS Marketplace Metering Service or were invalid. Invalid\nrecords should be fixed before being resubmitted.", - "type": "array", - "items": { - "$ref": "#/definitions/types.UsageRecordResult" - } - }, - "unprocessedRecords": { - "description": "Contains all UsageRecords that were not processed by BatchMeterUsage. This is a\nlist of UsageRecords. You can retry the failed request by making another\nBatchMeterUsage call with this list as input in the BatchMeterUsageRequest.", - "type": "array", - "items": { - "$ref": "#/definitions/types.UsageRecord" - } - } - } - }, - "middleware.Metadata": { - "type": "object" - }, - "servicecontrol.ReportError": { - "type": "object", - "properties": { - "operationId": { - "description": "OperationId: The Operation.operation_id value from the request.", - "type": "string" - }, - "status": { - "description": "Status: Details of the error when processing the Operation.", - "allOf": [ - { - "$ref": "#/definitions/servicecontrol.Status" - } - ] - } - } - }, - "servicecontrol.ReportResponse": { - "type": "object", - "properties": { - "reportErrors": { - "description": "ReportErrors: Partial failures, one for each `Operation` in the\nrequest that failed processing. There are three possible combinations\nof the RPC status: 1. The combination of a successful RPC status and\nan empty `report_errors` list indicates a complete success where all\n`Operations` in the request are processed successfully. 2. The\ncombination of a successful RPC status and a non-empty\n`report_errors` list indicates a partial success where some\n`Operations` in the request succeeded. Each `Operation` that failed\nprocessing has a corresponding item in this list. 3. A failed RPC\nstatus indicates a general non-deterministic failure. When this\nhappens, it's impossible to know which of the 'Operations' in the\nrequest succeeded or failed.", - "type": "array", - "items": { - "$ref": "#/definitions/servicecontrol.ReportError" - } - }, - "serviceConfigId": { - "description": "ServiceConfigId: The actual config id used to process the request.", - "type": "string" - }, - "serviceRolloutId": { - "description": "ServiceRolloutId: The current service rollout id used to process the\nrequest.", - "type": "string" - } - } - }, - "servicecontrol.Status": { - "type": "object", - "properties": { - "code": { - "description": "Code: The status code, which should be an enum value of\ngoogle.rpc.Code.", - "type": "integer" - }, - "details": { - "description": "Details: A list of messages that carry the error details. There is a\ncommon set of message types for APIs to use.", - "type": "array", - "items": { - "type": "array", - "items": { - "type": "integer" - } - } - }, - "message": { - "description": "Message: A developer-facing error message, which should be in\nEnglish. Any user-facing error message should be localized and sent\nin the google.rpc.Status.details field, or localized by the client.", - "type": "string" - } - } - }, - "shared.AddEntitlementCreditParams": { - "type": "object", - "required": [ - "creditAmountIncrement", - "entitlementID", - "organizationID" - ], - "properties": { - "creditAmountIncrement": { - "description": "The amount to be added to the credit amount.", - "type": "number" - }, - "entitlementID": { - "type": "string" - }, - "organizationID": { - "type": "string" - } - } - }, - "shared.AddEntitlementCreditResponse": { - "type": "object", - "properties": { - "creditAmountIncrement": { - "description": "The amount to be added to the credit amount.", - "type": "number" - }, - "entitlementID": { - "type": "string" - }, - "entitlementTermID": { - "type": "string" - }, - "newCreditAmount": { - "description": "The new credit amount after the increment.", - "type": "number" - }, - "organizationID": { - "type": "string" - } - } - }, - "shared.ApiClientAccessToken": { - "type": "object", - "properties": { - "access_token": { - "type": "string" - }, - "expires_in": { - "description": "The token expires in 1 hour", - "type": "integer", - "default": 3600 - }, - "token_type": { - "type": "string", - "default": "Bearer" - } - } - }, - "shared.AwsAccountIdentifier": { - "type": "object", - "properties": { - "awsAccountID": { - "description": "The AWS Account ID of the buyer in AWS Marketplace", - "type": "string" - }, - "awsCustomerID": { - "description": "The AWS Customer ID of the buyer in AWS Marketplace", - "type": "string" - }, - "companyInfo": { - "$ref": "#/definitions/shared.CompanyInfo" - }, - "dataFeedAccountID": { - "description": "The Account ID in AWS Marketplace Data Feed service", - "type": "string" - } - } - }, - "shared.AwsAceIntegration": { - "type": "object", - "properties": { - "credential": { - "$ref": "#/definitions/shared.AwsIntegrationCredential" - }, - "partnerId": { - "description": "The partner ID of the ISV/Seller in AWS Partner Network.", - "type": "string" - }, - "s3BucketName": { - "description": "The Name of the S3 bucket for AWS APN Customer Engagement Program (ACE) to sync the leads & opportunities.", - "type": "string" - }, - "s3BucketRegion": { - "description": "The region of the S3 bucket for AWS APN Customer Engagement Program (ACE) to sync the leads & opportunities.", - "type": "string" - }, - "secretKey": { - "description": "The secret key used to store the AzureIntegrationCredential in AWS Secret manager. for internal usage only.", - "type": "string" - } - } - }, - "shared.AwsIntegrationCredential": { - "type": "object", - "properties": { - "accessKeyId": { - "description": "The access key ID of the IAM user for Suger service to access the client's AWS services.", - "type": "string" - }, - "iamUserArn": { - "description": "The ARN of the IAM user for Suger service to access the client's AWS services.", - "type": "string" - }, - "secretAccessKey": { - "description": "The secret access key of the IAM user for Suger service to access the client's AWS services.", - "type": "string" - } - } - }, - "shared.AwsMarketplaceIntegration": { - "description": "The data struct to store integration info for Suger service to access the client's AWS services.", - "type": "object", - "properties": { - "externalID": { - "description": "The external ID for assuming IAM role. If empty, means no external ID set or needed. Otherwise, it should be auth_id in table identity.organization.", - "type": "string" - }, - "iamRoleArn": { - "description": "The AWS IAM role for Suger service to assume to access the client's AWS services.", - "type": "string" - }, - "marketplaceStartDate": { - "description": "AWS Marketplace start date which comes from MDFS Full-Sync.", - "type": "string", - "format": "date-time" - }, - "mcasFullSyncDone": { - "description": "Is AWS Marketplace Commerce Analytics Service (MCAS) full-sync done.", - "type": "boolean" - }, - "mcasIamRoleArn": { - "description": "IAM role ARN to allow AWS Marketplace to write to the S3 bucket and publish notifications to the SNS topic.", - "type": "string" - }, - "mcasS3Bucket": { - "description": "S3 bucket for AWS Marketplace Commerce Analytics Service (MCAS)", - "type": "string" - }, - "mcasSnsTopic": { - "description": "SNS topic ARN for AWS Marketplace Commerce Analytics Service (MCAS)", - "type": "string" - }, - "mdfsFullSyncDone": { - "description": "Is AWS Marketplace Data Feeds Service (MDFS) full-sync done.", - "type": "boolean" - }, - "mdfsKmsKeyArn": { - "description": "KMS Key ARN for the S3 bucket of AWS Marketplace Data Feeds Service (MDFS)", - "type": "string" - }, - "mdfsS3BucketArn": { - "description": "S3 bucket ARN for AWS Marketplace Data Feeds Service (MDFS)", - "type": "string" - }, - "policyArns": { - "description": "The policy ARNs in the IAM role.", - "type": "array", - "items": { - "type": "string" - } - }, - "revenueRecordFullSyncDone": { - "description": "Is AWS Marketplace Revenue Record full-sync done.", - "type": "boolean" - } - } - }, - "shared.AwsSaasProduct": { - "type": "object", - "properties": { - "Description": { - "$ref": "#/definitions/shared.AwsSaasProductDescription" - }, - "Dimensions": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.AwsSaasProductDimension" - } - }, - "PromotionalResources": { - "$ref": "#/definitions/shared.AwsSaasProductPromotionalResources" - }, - "SupportInformation": { - "$ref": "#/definitions/shared.AwsSaasProductSupportInformation" - }, - "Versions": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.AwsSaasProductVersion" - } - }, - "dataFeedProductId": { - "description": "The product Id in AWS Marketplace Data Feed Service.", - "type": "string" - }, - "productId": { - "type": "string" - } - } - }, - "shared.AwsSaasProductAdditionalResource": { - "type": "object", - "properties": { - "Text": { - "type": "string" - }, - "Type": { - "type": "string" - }, - "Url": { - "type": "string" - } - } - }, - "shared.AwsSaasProductDeliveryOption": { - "type": "object", - "properties": { - "FulfillmentUrl": { - "type": "string" - }, - "Id": { - "type": "string" - }, - "Type": { - "type": "string" - } - } - }, - "shared.AwsSaasProductDescription": { - "type": "object", - "properties": { - "AssociatedProducts": { - "type": "string" - }, - "Categories": { - "type": "array", - "items": { - "type": "string" - } - }, - "EuW8Submitted": { - "type": "boolean" - }, - "Highlights": { - "type": "array", - "items": { - "type": "string" - } - }, - "LongDescription": { - "type": "string" - }, - "Manufacturer": { - "type": "string" - }, - "ProductCode": { - "type": "string" - }, - "ProductTitle": { - "type": "string" - }, - "Registered": { - "type": "boolean" - }, - "SearchKeywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "ShortDescription": { - "type": "string" - }, - "Sku": { - "type": "string" - }, - "UsW9Submitted": { - "type": "boolean" - }, - "Visibility": { - "type": "string" - } - } - }, - "shared.AwsSaasProductDimension": { - "type": "object", - "properties": { - "Description": { - "type": "string" - }, - "Key": { - "type": "string" - }, - "Name": { - "type": "string" - }, - "Types": { - "type": "array", - "items": { - "type": "string" - } - }, - "Unit": { - "type": "string" - } - } - }, - "shared.AwsSaasProductPromotionalResources": { - "type": "object", - "properties": { - "AdditionalResources": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.AwsSaasProductAdditionalResource" - } - }, - "LogoUrl": { - "type": "string" - } - } - }, - "shared.AwsSaasProductSupportInformation": { - "type": "object", - "properties": { - "Description": { - "type": "string" - } - } - }, - "shared.AwsSaasProductVersion": { - "type": "object", - "properties": { - "DeliveryOptions": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.AwsSaasProductDeliveryOption" - } - }, - "Id": { - "type": "string" - } - } - }, - "shared.AwsSnsSubscription": { - "type": "object", - "properties": { - "Endpoint": { - "type": "string" - }, - "Protocol": { - "type": "string" - }, - "Status": { - "$ref": "#/definitions/shared.AwsSnsSubscriptionStatus" - }, - "SubscriptionArn": { - "type": "string" - }, - "TopicArn": { - "type": "string" - } - } - }, - "shared.AwsSnsSubscriptionStatus": { - "type": "string", - "enum": [ - "UNKNOWN", - "CONFIRMED", - "PENDING_CONFIRMATION" - ], - "x-enum-varnames": [ - "AwsSnsSubscriptionStatus_UNKNOWN", - "AwsSnsSubscriptionStatus_CONFIRMED", - "AwsSnsSubscriptionStatus_PENDING_CONFIRMATION" - ] - }, - "shared.AzureADIdentifier": { - "type": "object", - "properties": { - "buyerInfo": { - "$ref": "#/definitions/shared.AzureBuyerInfo" - }, - "companyInfo": { - "$ref": "#/definitions/shared.CompanyInfo" - }, - "emailId": { - "description": "Email address", - "type": "string" - }, - "objectId": { - "type": "string" - }, - "puid": { - "description": "ID of the user, used as External ID of suger IdentityBuyer.", - "type": "string" - }, - "tenantId": { - "type": "string" - } - } - }, - "shared.AzureBuyerInfo": { - "type": "object", - "properties": { - "billingAccountId": { - "type": "string" - }, - "customerId": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - }, - "shared.AzureIntegration": { - "type": "object", - "properties": { - "cmaFullSyncDone": { - "description": "Is Azure Commercial Marketplace Analytics (CMA) full-sync done.", - "type": "boolean" - }, - "credential": { - "$ref": "#/definitions/shared.AzureIntegrationCredential" - }, - "secretKey": { - "description": "The secret key used to store the AzureIntegrationCredential in AWS Secret manager. for internal usage only.", - "type": "string" - } - } - }, - "shared.AzureIntegrationCredential": { - "type": "object", - "properties": { - "accessToken": { - "type": "string" - }, - "clientID": { - "type": "string" - }, - "clientSecret": { - "type": "string" - }, - "expiresOn": { - "description": "The time when the access token expires.", - "type": "string" - }, - "refreshToken": { - "description": "The refresh token used to refresh the access token.", - "type": "string" - }, - "tenantID": { - "type": "string" - }, - "tokenScope": { - "type": "string" - }, - "tokenType": { - "type": "string" - } - } - }, - "shared.AzureMarketplaceSubscription": { - "type": "object", - "properties": { - "allowedCustomerOperations": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "Read", - "Update", - "Delete" - ] - } - }, - "autoRenew": { - "type": "boolean" - }, - "beneficiary": { - "$ref": "#/definitions/shared.AzureADIdentifier" - }, - "created": { - "type": "string", - "format": "date-time" - }, - "fulfillmentId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "isFreeTrial": { - "type": "boolean" - }, - "isTest": { - "type": "boolean" - }, - "lastModified": { - "type": "string" - }, - "name": { - "type": "string" - }, - "offerId": { - "type": "string" - }, - "planId": { - "type": "string" - }, - "publisherId": { - "type": "string" - }, - "purchaser": { - "$ref": "#/definitions/shared.AzureADIdentifier" - }, - "quantity": { - "type": "integer" - }, - "saasSubscriptionStatus": { - "$ref": "#/definitions/shared.AzureMarketplaceSubscriptionStatus" - }, - "sandboxType": { - "type": "string", - "enum": [ - "None", - "Csp" - ] - }, - "sessionId": { - "type": "string" - }, - "sessionMode": { - "type": "string", - "enum": [ - "None", - "DryRun" - ] - }, - "storeFront": { - "type": "string" - }, - "term": { - "$ref": "#/definitions/shared.AzureTerm" - } - } - }, - "shared.AzureMarketplaceSubscriptionStatus": { - "type": "string", - "enum": [ - "NotStarted", - "PendingFulfillmentStart", - "Subscribed", - "Suspended", - "Unsubscribed" - ], - "x-enum-varnames": [ - "AzureMarketplaceSubscriptionStatus_NotStarted", - "AzureMarketplaceSubscriptionStatus_PendingFulfillmentStart", - "AzureMarketplaceSubscriptionStatus_Subscribed", - "AzureMarketplaceSubscriptionStatus_Suspended", - "AzureMarketplaceSubscriptionStatus_Unsubscribed" - ] - }, - "shared.AzureTerm": { - "type": "object", - "properties": { - "chargeDuration": { - "type": "string" - }, - "endDate": { - "type": "string", - "format": "date-time" - }, - "startDate": { - "type": "string", - "format": "date-time" - }, - "termUnit": { - "type": "string" - } - } - }, - "shared.BuyerInfo": { - "type": "object", - "properties": { - "awsBuyer": { - "description": "Buyer from AWS Marketplace", - "allOf": [ - { - "$ref": "#/definitions/shared.AwsAccountIdentifier" - } - ] - }, - "azureBuyer": { - "description": "Buyer from Azure Marketplace", - "allOf": [ - { - "$ref": "#/definitions/shared.AzureADIdentifier" - } - ] - }, - "collectableAmount": { - "description": "The amount that the seller can collect. It excludes the marketplace commision fee.", - "type": "number" - }, - "disbursedAmount": { - "description": "The amount that has been disbursed to the seller account.", - "type": "number" - }, - "gcpBuyer": { - "description": "Buyer from GCP Marketplace", - "allOf": [ - { - "$ref": "#/definitions/shared.GcpMarketplaceUserAccount" - } - ] - }, - "invoicedAmount": { - "description": "The amount that the buyer has got invoiced.", - "type": "number" - } - } - }, - "shared.CommitDimension": { - "description": "The commit dimension. There may be one or more commit dimensions defined in single product, offer or entitlement.", - "type": "object", - "properties": { - "category": { - "type": "string" - }, - "description": { - "type": "string" - }, - "isUserCreated": { - "description": "Whether this commit dimension is newly created by user when creating AWS Marketplace Contract private offer.", - "type": "boolean" - }, - "key": { - "description": "API name of the dimension", - "type": "string" - }, - "length": { - "description": "The term length for the commit amount, such as 6 months, or 1 year. length is used together with timeUnit", - "type": "integer" - }, - "maximumUsers": { - "description": "The maximum number of users for PER_USER commit", - "type": "integer", - "default": 1000000, - "maximum": 1000000, - "minimum": 1 - }, - "minimumUsers": { - "description": "The minimum number of users for PER_USER commit", - "type": "integer", - "default": 1, - "maximum": 1000000, - "minimum": 1 - }, - "name": { - "description": "Display name of the dimension", - "type": "string" - }, - "quantity": { - "description": "The quantity of this commit.", - "type": "integer" - }, - "rate": { - "description": "The commit amount.", - "type": "number" - }, - "timeUnit": { - "description": "The term unit for the commit amount.", - "allOf": [ - { - "$ref": "#/definitions/shared.CommitDimensionTimeUnit" - } - ] - }, - "type": { - "$ref": "#/definitions/shared.CommitDimensionType" - }, - "types": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "shared.CommitDimensionTimeUnit": { - "type": "string", - "enum": [ - "DAY", - "MONTH", - "YEAR" - ], - "x-enum-varnames": [ - "CommitDimensionTimeUnit_DAY", - "CommitDimensionTimeUnit_MONTH", - "CommitDimensionTimeUnit_YEAR" - ] - }, - "shared.CommitDimensionType": { - "type": "string", - "enum": [ - "FLAT_RATE", - "PER_USER" - ], - "x-enum-varnames": [ - "CommitDimensionType_FLAT_RATE", - "CommitDimensionType_PER_USER" - ] - }, - "shared.CompanyInfo": { - "type": "object", - "properties": { - "addressLine1": { - "type": "string" - }, - "addressLine2": { - "type": "string" - }, - "city": { - "type": "string" - }, - "country": { - "type": "string" - }, - "emailDomain": { - "type": "string" - }, - "name": { - "type": "string" - }, - "postalCode": { - "type": "string" - }, - "state": { - "type": "string" - } - } - }, - "shared.Contact": { - "type": "object", - "properties": { - "company": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "shared.CreateIntegrationParams": { - "type": "object", - "required": [ - "info", - "organizationID", - "partner", - "service" - ], - "properties": { - "createdBy": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.IntegrationInfo" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - } - } - }, - "shared.CreateUsageRecordGroupParams": { - "type": "object", - "required": [ - "entitlementID", - "organizationID", - "records" - ], - "properties": { - "entitlementID": { - "type": "string" - }, - "id": { - "description": "uuid of the UsageRecordGroup (the size is up to 36 characters), if not provided, suger will generate one.", - "type": "string" - }, - "metaInfo": { - "description": "read-only, don't set it when reporting the usage record group.", - "allOf": [ - { - "$ref": "#/definitions/shared.MeteringUsageRecordGroupMetaInfo" - } - ] - }, - "organizationID": { - "type": "string" - }, - "records": { - "type": "object", - "additionalProperties": { - "type": "number" - } - } - } - }, - "shared.EntitlementInfo": { - "type": "object", - "properties": { - "autoRenew": { - "description": "Is this Entitlement Auto Renew enabled.", - "type": "boolean" - }, - "awsEntitlements": { - "description": "Nullable. AWS Entitlements from AWS Marketplace.", - "type": "array", - "items": { - "$ref": "#/definitions/types.Entitlement" - } - }, - "azureSubscriptions": { - "description": "Nullable. Azure Subscriptions from Azure Marketplace.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.AzureMarketplaceSubscription" - } - }, - "collectableAmount": { - "description": "The amount that the seller can collect. It excludes the marketplace commision fee.", - "type": "number" - }, - "commitAmount": { - "description": "The amount that the buyer has committed to pay. It can be the sum of payment installments if applicable.", - "type": "number" - }, - "commits": { - "description": "The dimensions for commit.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.CommitDimension" - } - }, - "currency": { - "description": "The default Currency is USD.", - "type": "string" - }, - "dimensions": { - "description": "The dimensions for usage-based metering.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.MeteringDimension" - } - }, - "disbursedAmount": { - "description": "The amount that has been disbursed to the seller account.", - "type": "number" - }, - "discount": { - "description": "The rate of discount (0 ~ 1.0), such as 0.1 which is 10% off. 0 which is no discount.", - "type": "number" - }, - "eulaType": { - "$ref": "#/definitions/shared.EulaType" - }, - "eulaUrl": { - "type": "string" - }, - "gcpEntitlements": { - "description": "Nullable. GCP Entitlements from GCP Marketplace.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpMarketplaceEntitlement" - } - }, - "gcpPlans": { - "description": "Only applicable for GCP Marketplace Entitlements.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpPurchasePlan" - } - }, - "invoicedAmount": { - "description": "The amount that the buyer has got invoiced.", - "type": "number" - }, - "paymentInstallments": { - "description": "For flexible payment schedules", - "type": "array", - "items": { - "$ref": "#/definitions/shared.PaymentInstallment" - } - }, - "refundCancelationPolicy": { - "type": "string" - }, - "sellerNotes": { - "type": "string" - } - } - }, - "shared.EntitlementTermInfo": { - "type": "object", - "properties": { - "type": { - "$ref": "#/definitions/shared.EntitlementTermType" - } - } - }, - "shared.EntitlementTermType": { - "type": "string", - "enum": [ - "", - "AutoRenew", - "ManualRenew", - "PlanChange", - "QuantityChange", - "Signup" - ], - "x-enum-comments": { - "EntitlementTermType_ManualRenew": "also for Upsell" - }, - "x-enum-varnames": [ - "EntitlementTermType_Unknown", - "EntitlementTermType_AutoRenew", - "EntitlementTermType_ManualRenew", - "EntitlementTermType_PlanChange", - "EntitlementTermType_QuantityChange", - "EntitlementTermType_Signup" - ] - }, - "shared.EntitlementUsageRecord": { - "type": "object", - "properties": { - "amounts": { - "type": "array", - "items": { - "type": "number" - } - }, - "date": { - "type": "string", - "format": "date-time" - }, - "keys": { - "type": "array", - "items": { - "type": "string" - } - }, - "quantities": { - "type": "array", - "items": { - "type": "number" - } - } - } - }, - "shared.EntityType": { - "type": "string", - "enum": [ - "ORGANIZATION", - "PRODUCT", - "OFFER", - "ENTITLEMENT", - "ENTITLEMENT_TERM", - "INTEGRATION" - ], - "x-enum-varnames": [ - "EntityType_ORGANIZATION", - "EntityType_PRODUCT", - "EntityType_OFFER", - "EntityType_ENTITLEMENT", - "EntityType_ENTITLEMENT_TERM", - "EntityType_INTEGRATION" - ] - }, - "shared.EulaType": { - "type": "string", - "enum": [ - "", - "SCMP", - "ECMP", - "CUSTOM", - "ISV", - "CURRENT" - ], - "x-enum-comments": { - "EulaType_CURRENT": "Current EULA, used for existing entitlement.", - "EulaType_CUSTOM": "Custom EULA", - "EulaType_ECMP": "AWS Enterprise Contract EULA", - "EulaType_ISV": "ISV default EULA", - "EulaType_SCMP": "AWS Standard Contract EULA" - }, - "x-enum-varnames": [ - "EulaType_UNKNOWN", - "EulaType_SCMP", - "EulaType_ECMP", - "EulaType_CUSTOM", - "EulaType_ISV", - "EulaType_CURRENT" - ] - }, - "shared.GcpCommerceProducerExternalAccountSpec": { - "type": "object", - "properties": { - "loginUri": { - "type": "string" - }, - "signupUri": { - "type": "string" - }, - "singleSignOnUri": { - "type": "string" - } - } - }, - "shared.GcpCommerceProducerListingSpec": { - "type": "object", - "properties": { - "externalAccountSpec": { - "$ref": "#/definitions/shared.GcpCommerceProducerExternalAccountSpec" - }, - "listingType": { - "type": "string", - "enum": [ - "BillingIntegratedManagedService" - ] - }, - "marketingSpec": { - "$ref": "#/definitions/shared.GcpCommerceProducerMarketingSpec" - }, - "purchaseSpec": { - "$ref": "#/definitions/shared.GcpCommerceProducerPurchaseSpec" - } - } - }, - "shared.GcpCommerceProducerMarketingSpec": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "displayNames": { - "description": "In format of \"{provider-id}/{product-name}\"", - "type": "array", - "items": { - "type": "string" - } - }, - "eulaUrl": { - "type": "string" - }, - "externalMarketingUrl": { - "type": "string" - }, - "icon": { - "description": "In format of \"base64://...\"", - "type": "string" - }, - "searchCategories": { - "type": "array", - "items": { - "type": "string" - } - }, - "searchDescription": { - "type": "string" - }, - "searchKeywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "shortTitle": { - "type": "string" - }, - "supportSpec": { - "$ref": "#/definitions/shared.GcpCommerceProducerSupportSpec" - }, - "title": { - "description": "The product title.", - "type": "string" - } - } - }, - "shared.GcpCommerceProducerPrice": { - "type": "object", - "properties": { - "currencyCode": { - "description": "ISO currency code, Three UPPER_CASE characters", - "type": "string" - }, - "nanos": { - "description": "Decimal part of the price. For example, 2000000 = 0.002, 200000000 = 0.2", - "type": "integer" - }, - "units": { - "description": "Integer part of the price.", - "type": "integer" - } - } - }, - "shared.GcpCommerceProducerPriceInfo": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "priceModel": { - "$ref": "#/definitions/shared.GcpCommerceProducerPriceModel" - }, - "subscriptionPlans": { - "description": "Commit price plan, when priceModel = SUBSCRIPTION or SUBSCRIPTION_PLUS_USAGE.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpCommerceProducerPriceSubscription" - } - }, - "usageFees": { - "description": "Usage based metering plan, when priceModel = USAGE or SUBSCRIPTION_PLUS_USAGE", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpCommerceProducerPriceUsage" - } - } - } - }, - "shared.GcpCommerceProducerPriceModel": { - "type": "string", - "enum": [ - "FREE", - "SUBSCRIPTION", - "USAGE", - "SUBSCRIPTION_PLUS_USAGE" - ], - "x-enum-varnames": [ - "GcpCommerceProducerPriceModel_FREE", - "GcpCommerceProducerPriceModel_SUBSCRIPTION", - "GcpCommerceProducerPriceModel_USAGE", - "GcpCommerceProducerPriceModel_SUBSCRIPTION_PLUS_USAGE" - ] - }, - "shared.GcpCommerceProducerPriceSubscription": { - "type": "object", - "properties": { - "period": { - "type": "string", - "enum": [ - "ONE_YEAR" - ] - }, - "price": { - "description": "the Monthly subscription fee as commit.", - "allOf": [ - { - "$ref": "#/definitions/shared.GcpCommerceProducerPrice" - } - ] - }, - "taxCategoryOverride": { - "type": "string", - "enum": [ - "TAX_CATEGORY_UNSPECIFIED" - ] - } - } - }, - "shared.GcpCommerceProducerPriceTier": { - "type": "object", - "properties": { - "endUsageAmount": { - "description": "The usage amount below which this tier is effective.", - "type": "number" - }, - "price": { - "description": "The price of this tier", - "allOf": [ - { - "$ref": "#/definitions/shared.GcpCommerceProducerPrice" - } - ] - }, - "startUsageAmount": { - "description": "The usage amount beyond which this tier is effective.", - "type": "number" - } - } - }, - "shared.GcpCommerceProducerPriceUsage": { - "type": "object", - "properties": { - "displayQuantity": { - "description": "Default value is 1.", - "type": "integer" - }, - "metricId": { - "description": "the usage metering dimension key", - "type": "string" - }, - "priceTiers": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpCommerceProducerPriceTier" - } - }, - "taxCategoryOverride": { - "type": "string", - "enum": [ - "TAX_CATEGORY_UNSPECIFIED" - ] - } - } - }, - "shared.GcpCommerceProducerPurchaseMetric": { - "type": "object", - "properties": { - "description": { - "description": "Description: A detailed description of the metric, which can be used in documentation.", - "type": "string" - }, - "displayName": { - "type": "string" - }, - "displayUnit": { - "type": "string" - }, - "displayUnitDescription": { - "type": "string" - }, - "id": { - "description": "The usage metering dimension key, in format of \"{plan_key}_{usage_dimension_key}\"", - "type": "string" - }, - "metricKind": { - "type": "string" - }, - "name": { - "description": "Name: The resource name of the metric descriptor, in format of \"{service_name}/{plan_key}_{usage_dimension_key}\"", - "type": "string" - }, - "reportingUnit": { - "type": "string" - }, - "unit": { - "type": "string" - }, - "valueType": { - "$ref": "#/definitions/shared.ValueType" - } - } - }, - "shared.GcpCommerceProducerPurchaseSpec": { - "type": "object", - "properties": { - "metrics": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpCommerceProducerPurchaseMetric" - } - }, - "purchaseOptionSpecs": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpPurchasePlan" - } - } - } - }, - "shared.GcpCommerceProducerServiceBilling": { - "type": "object", - "properties": { - "metrics": { - "description": "in format of [\"{product-name}.endpoints.{provider-id}.cloud.goog/{plan_key}_{usage_dimension_key}\"]", - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "shared.GcpCommerceProducerServiceConfig": { - "type": "object", - "properties": { - "billing": { - "$ref": "#/definitions/shared.GcpCommerceProducerServiceBilling" - }, - "metrics": { - "description": "Metrics: Defines the metrics used by this service.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpCommerceProducerPurchaseMetric" - } - }, - "name": { - "description": "In format of \"{product-name}.endpoints.{provider-id}.cloud.goog\"", - "type": "string" - }, - "producerProjectId": { - "type": "string" - }, - "title": { - "description": "The Product title", - "type": "string" - } - } - }, - "shared.GcpCommerceProducerSupportSpec": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "email": { - "type": "string" - }, - "uri": { - "type": "string" - } - } - }, - "shared.GcpIntegration": { - "type": "object", - "properties": { - "gcpProjectId": { - "type": "string" - }, - "gcpProjectNumber": { - "type": "string" - }, - "identityProviderId": { - "type": "string" - }, - "partnerId": { - "description": "The GCP Marketplace Partner ID, it is also called as Provider ID somewhere.", - "type": "string" - }, - "pubsubTopic": { - "description": "The resource name of the Pub/Sub topic to receive notifications from Google when a user signs up for your service, purchases a plan, or changes an existing plan.", - "type": "string" - }, - "reportBucket": { - "description": "The GCP storage bucket name to store the GCP Marketplace reports.", - "type": "string" - }, - "reportFullSyncDone": { - "description": "Is GCP Marketplace Report full-sync done.", - "type": "boolean" - }, - "reportStartDate": { - "description": "The UTC date when GCP Marketplace reprots start to generate.", - "type": "string", - "format": "date-time" - }, - "serviceAccountEmail": { - "type": "string" - }, - "serviceNames": { - "description": "The array of service resource names of the listings in GCP Marketplace.", - "type": "array", - "items": { - "type": "string" - } - }, - "workloadIdentityPoolId": { - "type": "string" - } - } - }, - "shared.GcpMarketplaceConsumer": { - "type": "object", - "properties": { - "project": { - "description": "The project name with format `projects/`.", - "type": "string" - } - } - }, - "shared.GcpMarketplaceEntitlement": { - "type": "object", - "properties": { - "account": { - "description": "The resource name of the account that this entitlement is based on, if any, in format \"\"providers/{provider_id}/accounts/{account_id}\"", - "type": "string" - }, - "consumers": { - "description": "The resources using this entitlement, if applicable.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpMarketplaceConsumer" - } - }, - "createTime": { - "type": "string" - }, - "id": { - "description": "Entitlement Id generated by GCP Marketplace. For Marketplace pub/sub event.", - "type": "string" - }, - "inputProperties": { - "description": "The custom properties that were collected from the user to create this entitlement.", - "type": "array", - "items": { - "type": "integer" - } - }, - "messageToUser": { - "description": "Provider-supplied message that is displayed to the end user. Currently this is used to communicate progress and ETA for\nprovisioning. This field can be updated only when a user is waiting for an action from the provider, i.e. entitlement state is\nEntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED or EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL. This field is cleared automatically when the entitlement state changes.", - "type": "string" - }, - "name": { - "description": "The resource name of the entitlement. Entitlement names have the form `providers/{provider_id}/entitlements/{entitlement_id}`.", - "type": "string" - }, - "newOfferDuration": { - "description": "in ISO 8601 duration format, such as \"P2Y3M\". For Marketplace pub/sub event.", - "type": "string" - }, - "newOfferEndTime": { - "description": "Output only. The end time of the new offer. Field is empty if the pending plan change is not moving to an offer.\nIf the offer was created with a term instead of a specified end date, this field is empty.", - "type": "string" - }, - "newOfferStartTime": { - "description": "Output only. The start time of the new offer. Field is empty if the pending plan change is not moving to an offer.", - "type": "string" - }, - "newPendingOffer": { - "description": "The name of the offer the entitlement is switching to upon a pending plan change. Only exists if the\npending plan change is moving to an offer. Format:\n'projects/{project}/services/{service}/privateOffers/{offer-id}' OR\n'projects/{project}/services/{service}/standardOffers/{offer-id}',\ndepending on whether the offer is private or public.", - "type": "string" - }, - "newPendingOfferDuration": { - "description": "The offer duration of the new offer in ISO 8601 duration format. Field is empty if the pending plan\nchange is not moving to an offer since the entitlement is not pending, only the plan change is pending.", - "type": "string" - }, - "newPendingPlan": { - "description": "The identifier of the pending new plan. Required if the product has plans and the entitlement has a pending plan change.", - "type": "string" - }, - "newPlan": { - "description": "When the buyer changes plan, For Marketplace pub/sub event.", - "type": "string" - }, - "offer": { - "description": "The name of the offer that was procured. Field is empty if order was not made using an offer. Format:\n'projects/{project}/services/{service}/privateOffers/{offer-id}' OR 'projects/{project}/services/{service}/standardOffers/{offer-id}',\ndepending on whether the offer is private or public.", - "type": "string" - }, - "offerDuration": { - "description": "The offer duration of the current offer in ISO 8601 duration format. Field is empty if entitlement was not made using an offer, such as \"P1Y\", \"P2M\"", - "type": "string" - }, - "offerEndTime": { - "description": "Output only. End time for the Offer association corresponding to this entitlement. The field is only populated if the entitlement is currently associated with an Offer.", - "type": "string" - }, - "plan": { - "description": "The identifier of the plan that was procured. Required if the product has plans.", - "type": "string" - }, - "product": { - "description": "The identifier of the entity that was purchased. This may actually represent a product, quote, or offer.\nFor Private offer, \"projects/project-id/services/product-id.endpoints.partner-id.cloud.goog/privateOffers/private-offer-id\"", - "type": "string" - }, - "productExternalName": { - "description": "The identifier of the product that was procured.", - "type": "string" - }, - "provider": { - "description": "The ID of the service provider under Cloud Commerce platform that this entitlement was created against.", - "type": "string" - }, - "quoteExternalName": { - "description": "The identifier of the quote that was used to procure, such as the private offer Id. Empty if the order is not purchased using a quote.", - "type": "string" - }, - "state": { - "description": "Enums of the Entitlement State. https://cloud.google.com/marketplace/docs/partners/commerce-procurement-api/reference/rest/v1/providers.entitlements#EntitlementState", - "allOf": [ - { - "$ref": "#/definitions/shared.GcpMarketplaceEntitlementState" - } - ] - }, - "subscriptionEndTime": { - "description": "The End time for the subscription corresponding to this entitlement.", - "type": "string" - }, - "updateTime": { - "description": "The last update timestamp. It is the endTime for the cancelled entitlement.", - "type": "string", - "format": "date-time" - }, - "usageReportingId": { - "description": "The consumerId to use when reporting usage through the Service Control API. See the consumerId field at\nReporting Metrics (https://cloud.google.com/service-control/reporting-metrics) for more details.\nThis field is present only if the product has usage-based billing configured.", - "type": "string" - } - } - }, - "shared.GcpMarketplaceEntitlementState": { - "type": "string", - "enum": [ - "ENTITLEMENT_STATE_UNSPECIFIED", - "ENTITLEMENT_ACTIVATION_REQUESTED", - "ENTITLEMENT_ACTIVE", - "ENTITLEMENT_PENDING_CANCELLATION", - "ENTITLEMENT_CANCELLED", - "ENTITLEMENT_PENDING_PLAN_CHANGE", - "ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL", - "ENTITLEMENT_SUSPENDED" - ], - "x-enum-varnames": [ - "GcpMarketplaceEntitlementState_ENTITLEMENT_STATE_UNSPECIFIED", - "GcpMarketplaceEntitlementState_ENTITLEMENT_ACTIVATION_REQUESTED", - "GcpMarketplaceEntitlementState_ENTITLEMENT_ACTIVE", - "GcpMarketplaceEntitlementState_ENTITLEMENT_PENDING_CANCELLATION", - "GcpMarketplaceEntitlementState_ENTITLEMENT_CANCELLED", - "GcpMarketplaceEntitlementState_ENTITLEMENT_PENDING_PLAN_CHANGE", - "GcpMarketplaceEntitlementState_ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL", - "GcpMarketplaceEntitlementState_ENTITLEMENT_SUSPENDED" - ] - }, - "shared.GcpMarketplaceUserAccount": { - "type": "object", - "properties": { - "approvals": { - "description": "The approvals for this account, that are permitted or have been completed.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpMarketplaceUserAccountApproval" - } - }, - "createTime": { - "type": "string", - "format": "date-time" - }, - "id": { - "description": "GCP Marketplace User Account ID.", - "type": "string" - }, - "inputProperties": { - "description": "RFC3339 UTC timestamp", - "type": "array", - "items": { - "type": "integer" - } - }, - "name": { - "description": "The resource name of the account. Account names have the form providers/{provider_id}/accounts/{account_id}.", - "type": "string" - }, - "provider": { - "description": "The identifier of the service provider (SaaS Seller) that this account was created against.", - "type": "string" - }, - "state": { - "description": "The state of the account. An account might not be able to make a purchase if the billing account is suspended, for example.", - "allOf": [ - { - "$ref": "#/definitions/shared.GcpMarketplaceUserAccountState" - } - ] - }, - "updateTime": { - "description": "RFC3339 UTC timestamp", - "type": "string", - "format": "date-time" - }, - "userInfo": { - "$ref": "#/definitions/shared.GcpUserInfo" - } - } - }, - "shared.GcpMarketplaceUserAccountApproval": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "reason": { - "description": "An explanation for the state of the approval.", - "type": "string" - }, - "state": { - "$ref": "#/definitions/shared.GcpMarketplaceUserAccountApprovalState" - }, - "updateTime": { - "description": "RFC3339 UTC timestamp", - "type": "string" - } - } - }, - "shared.GcpMarketplaceUserAccountApprovalState": { - "type": "string", - "enum": [ - "STATE_UNSPECIFIED", - "PENDING", - "APPROVED", - "REJECTED" - ], - "x-enum-varnames": [ - "GcpMarketplaceUserAccountApprovalState_STATE_UNSPECIFIED", - "GcpMarketplaceUserAccountApprovalState_PENDING", - "GcpMarketplaceUserAccountApprovalState_APPROVED", - "GcpMarketplaceUserAccountApprovalState_REJECTED" - ] - }, - "shared.GcpMarketplaceUserAccountState": { - "type": "string", - "enum": [ - "ACCOUNT_STATE_UNSPECIFIED", - "ACCOUNT_ACTIVE" - ], - "x-enum-varnames": [ - "GcpMarketplaceUserAccountState_UNSPECIFIED", - "GcpMarketplaceUserAccountState_ACTIVE" - ] - }, - "shared.GcpProduct": { - "type": "object", - "properties": { - "createTime": { - "type": "string", - "format": "date-time" - }, - "id": { - "description": "Nullable, GCP Marketplace Product UUID", - "type": "string" - }, - "listingSpec": { - "$ref": "#/definitions/shared.GcpCommerceProducerListingSpec" - }, - "marketplace": { - "type": "string", - "enum": [ - "marketplaces/google-cloud" - ] - }, - "name": { - "description": "In format of \"projects/{project-number}/listings/{product-name}.endpoints.{provider-id}.cloud.goog\"", - "type": "string" - }, - "service": { - "description": "In format of \"services/{product-name}.endpoints.{provider-id}.cloud.goog\"", - "type": "string" - }, - "serviceConfig": { - "$ref": "#/definitions/shared.GcpCommerceProducerServiceConfig" - } - } - }, - "shared.GcpPurchasePlan": { - "type": "object", - "properties": { - "name": { - "description": "The Plan key.", - "type": "string" - }, - "priceInfo": { - "$ref": "#/definitions/shared.GcpCommerceProducerPriceInfo" - }, - "purchaseMode": { - "type": "string", - "enum": [ - "PURCHASE_MODE_PUBLIC" - ] - }, - "title": { - "description": "The Plan title", - "type": "string" - } - } - }, - "shared.GcpUserInfo": { - "type": "object", - "properties": { - "roles": { - "description": "An array of strings representing the user's roles. Right now, it can be either: ** account_admin, which indicates that the user is a Billing Account Administrator of the billing account that purchased the product, or ** project_editor, which indicates that the user is a Project Editor, but not a Billing Administrator, of the project under that billing account.", - "type": "array", - "items": { - "type": "string" - } - }, - "user_identity": { - "description": "The user's obfuscated GAIA ID, which can be used to initiate Open ID Connect.", - "type": "string" - } - } - }, - "shared.GetApiClientAccessTokenParams": { - "type": "object", - "required": [ - "id", - "organizationID", - "secret" - ], - "properties": { - "id": { - "description": "The ID of the API Client.", - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "secret": { - "description": "The secret of the API Client.", - "type": "string" - } - } - }, - "shared.GetRevenueReportParams": { - "type": "object", - "required": [ - "organizationID", - "partner", - "reportType", - "service" - ], - "properties": { - "buyerID": { - "description": "Optional, if available, return the report for the Buyer.", - "type": "string" - }, - "entitlementID": { - "description": "Optional, if available, return the report for the Entitlement.", - "type": "string" - }, - "organizationID": { - "description": "Required. If the productID & entitlementID are emtpy, return the report for the entire Organization.", - "type": "string" - }, - "partner": { - "description": "Required.", - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "productID": { - "description": "Optional, if available, return the report for the Product.", - "type": "string" - }, - "reportType": { - "$ref": "#/definitions/shared.RevenueReportType" - }, - "service": { - "description": "Required.", - "type": "string", - "enum": [ - "MARKETPLACE" - ] - } - } - }, - "shared.GetUsageReportParams": { - "type": "object", - "required": [ - "entitlementID", - "organizationID" - ], - "properties": { - "entitlementID": { - "type": "string" - }, - "organizationID": { - "type": "string" - } - } - }, - "shared.HubspotCrmCredential": { - "type": "object", - "properties": { - "accessToken": { - "type": "string" - }, - "acquiredOn": { - "description": "UTC timestamp on receiving the auth response", - "type": "integer" - }, - "expiresIn": { - "type": "integer" - }, - "refreshToken": { - "type": "string" - } - } - }, - "shared.HubspotCrmIntegration": { - "type": "object", - "properties": { - "credential": { - "$ref": "#/definitions/shared.HubspotCrmCredential" - }, - "portalId": { - "description": "Hubspot Account Id", - "type": "integer" - }, - "secretKey": { - "type": "string" - } - } - }, - "shared.IdentityBuyer": { - "type": "object", - "properties": { - "creationTime": { - "type": "string", - "format": "date-time" - }, - "description": { - "type": "string" - }, - "externalID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.BuyerInfo" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "name": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - } - } - }, - "shared.IdentityIntegration": { - "type": "object", - "properties": { - "createdBy": { - "type": "string" - }, - "creationTime": { - "type": "string", - "format": "date-time" - }, - "info": { - "$ref": "#/definitions/shared.IntegrationInfo" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "lastUpdatedBy": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - }, - "status": { - "type": "string", - "enum": [ - "CREATED", - "VERIFIED", - "NOT_VERIFIED" - ] - } - } - }, - "shared.IntegrationInfo": { - "type": "object", - "properties": { - "awsAceIntegration": { - "description": "AWS ACE Integration", - "allOf": [ - { - "$ref": "#/definitions/shared.AwsAceIntegration" - } - ] - }, - "awsIntegration": { - "description": "AWS Marketplace Integration", - "allOf": [ - { - "$ref": "#/definitions/shared.AwsMarketplaceIntegration" - } - ] - }, - "azureIntegration": { - "description": "Azure Marketplace Integration", - "allOf": [ - { - "$ref": "#/definitions/shared.AzureIntegration" - } - ] - }, - "gcpIntegration": { - "description": "GCP Marketplace Integration", - "allOf": [ - { - "$ref": "#/definitions/shared.GcpIntegration" - } - ] - }, - "hubspotCrmIntegration": { - "description": "Integration for HubSpot CRM", - "allOf": [ - { - "$ref": "#/definitions/shared.HubspotCrmIntegration" - } - ] - }, - "salesforceCrmIntegration": { - "description": "Integration for Salesforce CRM", - "allOf": [ - { - "$ref": "#/definitions/shared.SalesforceCrmIntegration" - } - ] - }, - "slackIntegration": { - "$ref": "#/definitions/shared.SlackIntegration" - } - } - }, - "shared.ListRevenueRecordDetailsResponse": { - "type": "object", - "properties": { - "nextOffset": { - "type": "integer" - }, - "revenueRecordDetails": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.RevenueRecordDetail" - } - } - } - }, - "shared.ListRevenueRecordsResponse": { - "type": "object", - "properties": { - "nextOffset": { - "type": "integer" - }, - "revenueRecords": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.RevenueRecord" - } - } - } - }, - "shared.ListUsageRecordGroupsResponse": { - "type": "object", - "properties": { - "nextOffset": { - "type": "integer" - }, - "usageRecordGroups": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.MeteringUsageRecordGroup" - } - } - } - }, - "shared.ListUsageRecordReportsResponse": { - "type": "object", - "properties": { - "nextOffset": { - "type": "integer" - }, - "usageRecordReports": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.MeteringUsageRecordReport" - } - } - } - }, - "shared.MeteringDimension": { - "description": "The dimension to meter usage in entitlement.", - "type": "object", - "properties": { - "category": { - "type": "string" - }, - "description": { - "type": "string" - }, - "includedBaseQuantities": { - "description": "how many quantities of this dimension are included in the commit.", - "type": "array", - "items": { - "$ref": "#/definitions/AzureIncludedBaseQuantity" - } - }, - "key": { - "type": "string" - }, - "name": { - "description": "Display name of the dimension", - "type": "string" - }, - "rate": { - "type": "number" - }, - "types": { - "type": "array", - "items": { - "type": "string" - } - }, - "usageCount": { - "description": "The current Dimension Usage Count. Available when call GetEntitlement API.", - "allOf": [ - { - "$ref": "#/definitions/shared.UsageCount" - } - ] - }, - "valueType": { - "$ref": "#/definitions/shared.ValueType" - } - } - }, - "shared.MeteringUsageRecordGroup": { - "type": "object", - "properties": { - "creationTime": { - "type": "string", - "format": "date-time" - }, - "entitlementID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "metaInfo": { - "$ref": "#/definitions/shared.MeteringUsageRecordGroupMetaInfo" - }, - "organizationID": { - "type": "string" - }, - "records": { - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "serialID": { - "type": "integer" - }, - "status": { - "type": "string" - }, - "usageRecordReportID": { - "type": "string" - } - } - }, - "shared.MeteringUsageRecordGroupMetaInfo": { - "type": "object", - "properties": { - "originRecords": { - "description": "The original records reported by the customer before convertion. If no dimension mapping is applied, this field is the same as the records field.", - "type": "object", - "additionalProperties": { - "type": "number" - } - } - } - }, - "shared.MeteringUsageRecordReport": { - "type": "object", - "properties": { - "creationTime": { - "type": "string", - "format": "date-time" - }, - "entitlementID": { - "type": "string" - }, - "entitlementTermID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.MeteringUsageRecordReportInfo" - }, - "organizationID": { - "type": "string" - }, - "productID": { - "type": "string" - } - } - }, - "shared.MeteringUsageRecordReportInfo": { - "type": "object", - "properties": { - "awsMeteringResponse": { - "description": "The raw response from AWS metering service.", - "allOf": [ - { - "$ref": "#/definitions/marketplacemetering.BatchMeterUsageOutput" - } - ] - }, - "azureMeteringResponse": { - "description": "The raw response from Azure metering service.", - "allOf": [ - { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_azure_sdk_marketplacemeteringv1.BatchUsageEventOkResponse" - } - ] - }, - "commitAmount": { - "description": "The amount of the commit if applicable.", - "type": "number" - }, - "creditAmount": { - "description": "The amount of the credit if applicable.", - "type": "number" - }, - "creditRecords": { - "description": "The credit usage records in the map of ", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "dimensionUnitPrice": { - "description": "The unit price of each dimension in the map of ", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "endTime": { - "description": "time in UTC when the UsageRecordReport ends", - "type": "string", - "format": "date-time" - }, - "gcpMeteringResponse": { - "description": "The raw response from GCP metering service.", - "allOf": [ - { - "$ref": "#/definitions/servicecontrol.ReportResponse" - } - ] - }, - "includedRecords": { - "description": "The included usage records in the map of ", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "reportedRecords": { - "description": "The reported usage records in the map of ", - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "startTime": { - "description": "time in UTC when the UsageRecordReport starts", - "type": "string", - "format": "date-time" - }, - "usageRecordGroupIds": { - "description": "The IDs of UsageRecordGroups aggregated in this UsageRecordReport.", - "type": "array", - "items": { - "type": "string" - } - }, - "usedCommitAmount": { - "description": "The amount of the used commit before the this usage record report if applicable.", - "type": "number" - }, - "usedCommitAmountIncrement": { - "description": "The amount of the used commit increment in this usage record report if applicable.", - "type": "number" - }, - "usedCreditAmount": { - "description": "The amount of the used credit before the this usage record report if applicable.", - "type": "number" - }, - "usedCreditAmountIncrement": { - "description": "The amount of the used credit increment in this usage record report if applicable.", - "type": "number" - } - } - }, - "shared.NotificationEvent": { - "type": "object", - "properties": { - "action": { - "$ref": "#/definitions/shared.NotificationEventAction" - }, - "entityID": { - "type": "string" - }, - "entityStatus": { - "type": "string" - }, - "entityType": { - "$ref": "#/definitions/shared.EntityType" - }, - "eventID": { - "description": "notification event id.", - "type": "string" - }, - "eventStatus": { - "description": "notification event status.", - "allOf": [ - { - "$ref": "#/definitions/shared.NotificationEventStatus" - } - ] - }, - "lastUpdateTime": { - "description": "timestamp of the event when it is updated.", - "type": "string", - "format": "date-time" - }, - "message": { - "type": "string" - }, - "organizationID": { - "description": "suger organization id.", - "type": "string" - }, - "timestamp": { - "description": "timestamp of the event when it is scheduled or created.", - "type": "string", - "format": "date-time" - } - } - }, - "shared.NotificationEventAction": { - "type": "string", - "enum": [ - "ACCEPT", - "CREATE", - "DELETE", - "CANCEL", - "PENDING_CANCEL", - "EXPIRE", - "REINSTATE", - "SUSPEND", - "UPDATE", - "NOTIFY_CONTACTS", - "TEST" - ], - "x-enum-comments": { - "NotificationEventAction_NOTIFY_CONTACTS": "Notify the contacts when the offer is pending acceptance", - "NotificationEventAction_TEST": "For suger internal testing purpose" - }, - "x-enum-varnames": [ - "NotificationEventAction_ACCEPT", - "NotificationEventAction_CREATE", - "NotificationEventAction_DELETE", - "NotificationEventAction_CANCEL", - "NotificationEventAction_PENDING_CANCEL", - "NotificationEventAction_EXPIRE", - "NotificationEventAction_REINSTATE", - "NotificationEventAction_SUSPEND", - "NotificationEventAction_UPDATE", - "NotificationEventAction_NOTIFY_CONTACTS", - "NotificationEventAction_TEST" - ] - }, - "shared.NotificationEventStatus": { - "type": "string", - "enum": [ - "", - "SCHEDULED", - "PENDING", - "DONE", - "FAILED" - ], - "x-enum-varnames": [ - "NotificationEventStatus_UNKNOWN", - "NotificationEventStatus_SCHEDULED", - "NotificationEventStatus_PENDING", - "NotificationEventStatus_DONE", - "NotificationEventStatus_FAILED" - ] - }, - "shared.OfferInfo": { - "type": "object", - "properties": { - "azureOriginalPlan": { - "description": "The origin pricing of Azure plan. Only applicable for Azure Marketplace plans.", - "allOf": [ - { - "$ref": "#/definitions/AzurePriceAndAvailabilityPrivateOfferPlan" - } - ] - }, - "azurePrivateOffer": { - "description": "The private offer for Azure Marketplace. Only applicable for Azure Marketplace private offers.", - "allOf": [ - { - "$ref": "#/definitions/AzureMarketplacePrivateOffer" - } - ] - }, - "azureProductVariant": { - "$ref": "#/definitions/AzureProductVariant" - }, - "buyerAwsAccountIds": { - "description": "The buyers' AWS Account IDs of this offer.", - "type": "array", - "items": { - "type": "string" - } - }, - "buyerAzureTenants": { - "description": "The buyers' Azure tenants of this offer.", - "type": "array", - "items": { - "$ref": "#/definitions/AzureAudience" - } - }, - "commits": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.CommitDimension" - } - }, - "currency": { - "type": "string" - }, - "dimensions": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.MeteringDimension" - } - }, - "discount": { - "description": "The rate of discount (0 ~ 1.0), such as 0.1 which is 10% off. 0 which is no discount.", - "type": "number" - }, - "eulaType": { - "$ref": "#/definitions/shared.EulaType" - }, - "eulaUrl": { - "type": "string" - }, - "gcpMetrics": { - "description": "Only applicable for GCP Marketplace Offers (the default or private offer)", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpCommerceProducerPurchaseMetric" - } - }, - "gcpPlans": { - "description": "Only applicable for GCP Marketplace Offers (the default or private offer).", - "type": "array", - "items": { - "$ref": "#/definitions/shared.GcpPurchasePlan" - } - }, - "paymentInstallments": { - "description": "For flexible payment schedule. Not empty if it is enabled.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.PaymentInstallment" - } - }, - "privateOfferUrl": { - "description": "The URL of the private offer sent to buyers to accept. Only applicable for private offer.", - "type": "string" - }, - "refundCancelationPolicy": { - "type": "string" - }, - "sellerNotes": { - "type": "string" - }, - "visibility": { - "description": "The default visibility of offer is PRIVATE.", - "type": "string", - "enum": [ - "PRIVATE", - "PUBLIC" - ] - } - } - }, - "shared.OfferMetaInfo": { - "type": "object", - "properties": { - "baseAgreementId": { - "description": "Applicable for AWS Marketplace only, when the IsAgreementBasedOffer is true.", - "type": "string" - }, - "contacts": { - "description": "The contacts of the offer to notify if any updates.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.Contact" - } - }, - "isAgreementBasedOffer": { - "description": "Applicable for AWS Marketplace only, If this offer is agreement based offer.", - "type": "boolean" - }, - "isRenewalOffer": { - "description": "Applicable for AWS Marketplace only, If this offer is renewal offer.", - "type": "boolean" - }, - "notifications": { - "description": "The notifications of the offer if any updates. In most cases, it is to notify contacts/buyers when the offer is pending acceptance.", - "type": "array", - "items": { - "$ref": "#/definitions/shared.NotificationEvent" - } - } - } - }, - "shared.Operation": { - "type": "object", - "properties": { - "endTime": { - "type": "string", - "format": "date-time" - }, - "id": { - "description": "Operation ID.", - "type": "string" - }, - "message": { - "type": "string" - }, - "name": { - "type": "string" - }, - "startTime": { - "type": "string", - "format": "date-time" - }, - "status": { - "type": "string" - }, - "type": { - "$ref": "#/definitions/shared.OperationType" - } - } - }, - "shared.OperationType": { - "type": "string", - "enum": [ - "TemporalWorkflow" - ], - "x-enum-varnames": [ - "OperationType_TemporalWorkflow" - ] - }, - "shared.PaymentInstallment": { - "type": "object", - "properties": { - "amount": { - "type": "number" - }, - "chargeOn": { - "type": "string", - "format": "date-time" - } - } - }, - "shared.ProductInfo": { - "type": "object", - "properties": { - "attributes": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "awsSaasProduct": { - "$ref": "#/definitions/shared.AwsSaasProduct" - }, - "awsSnsSubscriptions": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.AwsSnsSubscription" - } - }, - "azureProduct": { - "$ref": "#/definitions/AzureProduct" - }, - "commits": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.CommitDimension" - } - }, - "currency": { - "type": "string" - }, - "dimensions": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.MeteringDimension" - } - }, - "eulaUrl": { - "type": "string" - }, - "gcpProduct": { - "$ref": "#/definitions/shared.GcpProduct" - }, - "refundCancelationPolicy": { - "type": "string" - }, - "sellerNotes": { - "type": "string" - } - } - }, - "shared.RevenueRecord": { - "type": "object", - "properties": { - "amount": { - "description": "The revenue amount for the revenue report", - "type": "number" - }, - "buyerID": { - "type": "string" - }, - "collectableAmount": { - "description": "The revenue amount that the seller/ISV can collect.", - "type": "number" - }, - "currency": { - "description": "The currency of the revenue in ISO 4217 format, such as \"USD\".", - "type": "string" - }, - "date": { - "description": "The date for the revenue report", - "type": "string", - "format": "date-time" - }, - "disburseAmount": { - "type": "number" - }, - "disburseDate": { - "type": "string", - "format": "date-time" - }, - "entitlementID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.RevenueRecordInfo" - }, - "invoiceAmount": { - "type": "number" - }, - "invoiceDate": { - "type": "string", - "format": "date-time" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string" - }, - "paymentDueDate": { - "type": "string", - "format": "date-time" - }, - "productID": { - "type": "string" - }, - "refundDisburseAmount": { - "type": "number" - }, - "refundDisburseDate": { - "type": "string", - "format": "date-time" - }, - "refundInvoiceAmount": { - "type": "number" - }, - "refundInvoiceDate": { - "type": "string", - "format": "date-time" - }, - "taxAmount": { - "type": "number" - } - } - }, - "shared.RevenueRecordDetail": { - "type": "object", - "properties": { - "awsRevenueRecordDetail": { - "description": "For AWS Marketplace", - "allOf": [ - { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.BillingAwsBillingEvent" - } - ] - }, - "azureRevenueRecordDetail": { - "description": "For Azure Marketplace", - "allOf": [ - { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.BillingAzureCmaRevenue" - } - ] - }, - "gcpRevenueRecordDetail": { - "description": "For GCP Marketplace", - "allOf": [ - { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.BillingGcpChargeUsage" - } - ] - } - } - }, - "shared.RevenueRecordInfo": { - "type": "object", - "properties": { - "awsRevenueRecords": { - "description": "For raw revenue records in AWS Marketplace", - "type": "array", - "items": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.BillingAwsBillingEvent" - } - }, - "azureRevenueRecords": { - "description": "For raw revenue records in Azure Marketplace", - "type": "array", - "items": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.BillingAzureCmaRevenue" - } - }, - "gcpRevenueRecords": { - "description": "For raw revenue records in GCP Marketplace", - "type": "array", - "items": { - "$ref": "#/definitions/github_com_sugerio_marketplace-service_rds-db_lib.BillingGcpChargeUsage" - } - } - } - }, - "shared.RevenueReport": { - "type": "object", - "properties": { - "buyerID": { - "type": "string" - }, - "entitlementID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string" - }, - "productID": { - "type": "string" - }, - "reportDate": { - "type": "string", - "format": "date-time" - }, - "reportType": { - "$ref": "#/definitions/shared.RevenueReportType" - }, - "revenueRecords": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.RevenueRecord" - } - }, - "service": { - "type": "string" - } - } - }, - "shared.RevenueReportType": { - "type": "string", - "enum": [ - "InvoicedAmount", - "CollectableAmount", - "DisbursedAmount" - ], - "x-enum-varnames": [ - "RevenueReportType_InvoicedAmount", - "RevenueReportType_CollectableAmount", - "RevenueReportType_DisbursedAmount" - ] - }, - "shared.SalesforceCrmCredential": { - "type": "object", - "properties": { - "access_token": { - "type": "string" - }, - "exp": { - "type": "integer" - }, - "instance_url": { - "type": "string" - }, - "refresh_token": { - "type": "string" - } - } - }, - "shared.SalesforceCrmIntegration": { - "type": "object", - "properties": { - "credential": { - "description": "System created", - "allOf": [ - { - "$ref": "#/definitions/shared.SalesforceCrmCredential" - } - ] - }, - "filters": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.SalesforceSyncFilter" - } - }, - "instanceUrl": { - "type": "string" - }, - "isSandbox": { - "type": "boolean" - }, - "secretKey": { - "type": "string" - }, - "subdomain": { - "description": "User defined when setting up the integration", - "type": "string" - } - } - }, - "shared.SalesforceSyncFilter": { - "type": "object", - "properties": { - "fieldName": { - "type": "string" - }, - "operator": { - "type": "string" - }, - "value": {} - } - }, - "shared.SlackIntegration": { - "type": "object", - "properties": { - "accessToken": { - "type": "string" - }, - "appId": { - "type": "string" - }, - "authedUser": { - "$ref": "#/definitions/slack.OAuthV2ResponseAuthedUser" - }, - "botUserId": { - "type": "string" - }, - "enterprise": { - "$ref": "#/definitions/slack.OAuthV2ResponseEnterprise" - }, - "expiresIn": { - "type": "integer" - }, - "incomingWebhook": { - "$ref": "#/definitions/slack.OAuthResponseIncomingWebhook" - }, - "redirectUrl": { - "type": "string" - }, - "refreshToken": { - "type": "string" - }, - "scope": { - "description": "The scope of the access token. multiple scopes are separated by comma.", - "type": "string" - }, - "team": { - "$ref": "#/definitions/slack.OAuthV2ResponseTeam" - }, - "tokenType": { - "type": "string" - } - } - }, - "shared.UpdateIntegrationParams": { - "type": "object", - "required": [ - "info", - "organizationID", - "partner", - "service" - ], - "properties": { - "info": { - "$ref": "#/definitions/shared.IntegrationInfo" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - } - } - }, - "shared.UpdateProductParams": { - "type": "object", - "required": [ - "fulfillmentUrl", - "id", - "organizationID" - ], - "properties": { - "fulfillmentUrl": { - "type": "string" - }, - "id": { - "type": "string" - }, - "organizationID": { - "type": "string" - } - } - }, - "shared.UsageCount": { - "type": "object", - "properties": { - "creditCount": { - "description": "The count of this dimension usage records that are handled as credit.", - "type": "number" - }, - "includedCount": { - "description": "The count of this dimension usage records that are handled as included in IncludedBaseQuantity", - "type": "number" - }, - "reportedCount": { - "description": "The count of this dimension usage records that are reported to cloud vendors.", - "type": "number" - } - } - }, - "shared.UsageReport": { - "type": "object", - "properties": { - "entitlementID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "reportDate": { - "type": "string", - "format": "date-time" - }, - "usageRecords": { - "type": "array", - "items": { - "$ref": "#/definitions/shared.EntitlementUsageRecord" - } - } - } - }, - "shared.ValueType": { - "type": "string", - "enum": [ - "VALUE_TYPE_UNSPECIFIED", - "BOOL", - "INT64", - "DOUBLE", - "STRING", - "DISTRIBUTION", - "MONEY" - ], - "x-enum-varnames": [ - "ValueType_UNSPECIFIED", - "ValueType_BOOL", - "ValueType_INT64", - "ValueType_DOUBLE", - "ValueType_STRING", - "ValueType_DISTRIBUTION", - "ValueType_MONEY" - ] - }, - "shared.WorkloadEntitlement": { - "type": "object", - "properties": { - "buyerID": { - "type": "string" - }, - "creationTime": { - "type": "string", - "format": "date-time" - }, - "endTime": { - "description": "nullable", - "type": "string", - "format": "date-time" - }, - "entitlementTermID": { - "type": "string" - }, - "externalBuyerID": { - "type": "string" - }, - "externalID": { - "type": "string" - }, - "externalProductID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.EntitlementInfo" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "name": { - "type": "string" - }, - "offerID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "productID": { - "type": "string" - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - }, - "startTime": { - "type": "string", - "format": "date-time" - }, - "status": { - "type": "string", - "enum": [ - "ACTIVE", - "CANCELLED", - "SUSPENDED", - "PENDING_START", - "UNKNOWN" - ] - }, - "type": { - "type": "string" - } - } - }, - "shared.WorkloadEntitlementTerm": { - "type": "object", - "properties": { - "buyerID": { - "type": "string" - }, - "commitAmount": { - "type": "number" - }, - "creditAmount": { - "type": "number" - }, - "endTime": { - "description": "nullable", - "type": "string", - "format": "date-time" - }, - "entitlementID": { - "type": "string" - }, - "entitlementInfo": { - "$ref": "#/definitions/shared.EntitlementInfo" - }, - "externalEntitlementID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.EntitlementTermInfo" - }, - "offerID": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "productID": { - "type": "string" - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - }, - "startTime": { - "type": "string", - "format": "date-time" - }, - "usedCommitAmount": { - "type": "number" - }, - "usedCreditAmount": { - "type": "number" - } - } - }, - "shared.WorkloadOffer": { - "type": "object", - "properties": { - "createdBy": { - "type": "string" - }, - "creationTime": { - "type": "string", - "format": "date-time" - }, - "endTime": { - "description": "nullable", - "type": "string", - "format": "date-time" - }, - "expireTime": { - "description": "nullable", - "type": "string", - "format": "date-time" - }, - "externalID": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.OfferInfo" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "lastUpdatedBy": { - "type": "string" - }, - "metaInfo": { - "$ref": "#/definitions/shared.OfferMetaInfo" - }, - "name": { - "type": "string" - }, - "offerType": { - "type": "string", - "enum": [ - "DEFAULT", - "CONTRACT", - "SUBSCRIPTION", - "FREE_TRIAL", - "FLAT_RATE", - "PER_USER", - "PRIVATE", - "UNKNOWN" - ] - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "productID": { - "type": "string" - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - }, - "status": { - "type": "string", - "enum": [ - "ACCEPTED", - "PENDING_CREATE", - "CREATE_FAILED", - "CREATE_SUCCESS", - "DRAFT", - "EXPIRED", - "PENDING_ACCEPTANCE", - "PENDING_CANCEL", - "CANCEL_FAILED", - "CANCEL_SUCCESS" - ] - } - } - }, - "shared.WorkloadProduct": { - "type": "object", - "properties": { - "createdBy": { - "type": "string" - }, - "creationTime": { - "type": "string", - "format": "date-time" - }, - "externalID": { - "type": "string" - }, - "fulfillmentUrl": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/shared.ProductInfo" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time" - }, - "lastUpdatedBy": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organizationID": { - "type": "string" - }, - "partner": { - "type": "string", - "enum": [ - "AWS", - "AZURE", - "GCP" - ] - }, - "productType": { - "type": "string", - "enum": [ - "UNKNOWN", - "SUBSCRIPTION", - "CONTRACT", - "FLAT_RATE", - "PER_USER", - "USAGE_BASED" - ] - }, - "service": { - "type": "string", - "enum": [ - "MARKETPLACE" - ] - }, - "status": { - "type": "string" - } - } - }, - "slack.OAuthResponseIncomingWebhook": { - "type": "object", - "properties": { - "channel": { - "type": "string" - }, - "channel_id": { - "type": "string" - }, - "configuration_url": { - "type": "string" - }, - "url": { - "type": "string" - } - } - }, - "slack.OAuthV2ResponseAuthedUser": { - "type": "object", - "properties": { - "access_token": { - "type": "string" - }, - "expires_in": { - "type": "integer" - }, - "id": { - "type": "string" - }, - "refresh_token": { - "type": "string" - }, - "scope": { - "type": "string" - }, - "token_type": { - "type": "string" - } - } - }, - "slack.OAuthV2ResponseEnterprise": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "slack.OAuthV2ResponseTeam": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "sql.NullTime": { - "type": "object", - "properties": { - "time": { - "type": "string" - }, - "valid": { - "description": "Valid is true if Time is not NULL", - "type": "boolean" - } - } - }, - "types.Entitlement": { - "type": "object", - "properties": { - "customerIdentifier": { - "description": "The customer identifier is a handle to each unique customer in an application.\nCustomer identifiers are obtained through the ResolveCustomer operation in AWS\nMarketplace Metering Service.", - "type": "string" - }, - "dimension": { - "description": "The dimension for which the given entitlement applies. Dimensions represent\ncategories of capacity in a product and are specified when the product is listed\nin AWS Marketplace.", - "type": "string" - }, - "expirationDate": { - "description": "The expiration date represents the minimum date through which this entitlement\nis expected to remain valid. For contractual products listed on AWS Marketplace,\nthe expiration date is the date at which the customer will renew or cancel their\ncontract. Customers who are opting to renew their contract will still have\nentitlements with an expiration date.", - "type": "string" - }, - "productCode": { - "description": "The product code for which the given entitlement applies. Product codes are\nprovided by AWS Marketplace when the product listing is created.", - "type": "string" - }, - "value": { - "description": "The EntitlementValue represents the amount of capacity that the customer is\nentitled to for the product." - } - } - }, - "types.UsageAllocation": { - "type": "object", - "properties": { - "allocatedUsageQuantity": { - "description": "The total quantity allocated to this bucket of usage.\n\nThis member is required.", - "type": "integer" - }, - "tags": { - "description": "The set of tags that define the bucket of usage. For the bucket of items with no\ntags, this parameter can be left out.", - "type": "array", - "items": { - "$ref": "#/definitions/github_com_aws_aws-sdk-go-v2_service_marketplacemetering_types.Tag" - } - } - } - }, - "types.UsageRecord": { - "type": "object", - "properties": { - "customerIdentifier": { - "description": "The CustomerIdentifier is obtained through the ResolveCustomer operation and\nrepresents an individual buyer in your application.\n\nThis member is required.", - "type": "string" - }, - "dimension": { - "description": "During the process of registering a product on AWS Marketplace, dimensions are\nspecified. These represent different units of value in your application.\n\nThis member is required.", - "type": "string" - }, - "quantity": { - "description": "The quantity of usage consumed by the customer for the given dimension and time.\nDefaults to 0 if not specified.", - "type": "integer" - }, - "timestamp": { - "description": "Timestamp, in UTC, for which the usage is being reported. Your application can\nmeter usage for up to one hour in the past. Make sure the timestamp value is not\nbefore the start of the software usage.\n\nThis member is required.", - "type": "string" - }, - "usageAllocations": { - "description": "The set of UsageAllocations to submit. The sum of all UsageAllocation quantities\nmust equal the Quantity of the UsageRecord.", - "type": "array", - "items": { - "$ref": "#/definitions/types.UsageAllocation" - } - } - } - }, - "types.UsageRecordResult": { - "type": "object", - "properties": { - "meteringRecordId": { - "description": "The MeteringRecordId is a unique identifier for this metering event.", - "type": "string" - }, - "status": { - "description": "The UsageRecordResultStatus indicates the status of an individual UsageRecord\nprocessed by BatchMeterUsage.\n\n* Success- The UsageRecord was accepted and\nhonored by BatchMeterUsage.\n\n* CustomerNotSubscribed- The CustomerIdentifier\nspecified is not able to use your product. The UsageRecord was not honored.\nThere are three causes for this result:\n\n* The customer identifier is\ninvalid.\n\n* The customer identifier provided in the metering record does not\nhave an active agreement or subscription with this product. Future UsageRecords\nfor this customer will fail until the customer subscribes to your product.\n\n*\nThe customer's AWS account was suspended.\n\n* DuplicateRecord- Indicates that the\nUsageRecord was invalid and not honored. A previously metered UsageRecord had\nthe same customer, dimension, and time, but a different quantity.", - "allOf": [ - { - "$ref": "#/definitions/types.UsageRecordResultStatus" - } - ] - }, - "usageRecord": { - "description": "The UsageRecord that was part of the BatchMeterUsage request.", - "allOf": [ - { - "$ref": "#/definitions/types.UsageRecord" - } - ] - } - } - }, - "types.UsageRecordResultStatus": { - "type": "string", - "enum": [ - "Success", - "CustomerNotSubscribed", - "DuplicateRecord" - ], - "x-enum-varnames": [ - "UsageRecordResultStatusSuccess", - "UsageRecordResultStatusCustomerNotSubscribed", - "UsageRecordResultStatusDuplicateRecord" - ] - } - }, - "securityDefinitions": { - "BearerTokenAuth": { - "description": "Bearer token for authorization, it is from the API GetApiClientAccessToken.", - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - } - } -} \ No newline at end of file +Skipped; Swagger 2.0 is not supported in-memory \ No newline at end of file diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/openapi-ir.test.ts b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/openapi-ir.test.ts index 88acaf8ff41..2a7a457465f 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/openapi-ir.test.ts +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/openapi-ir.test.ts @@ -57,13 +57,17 @@ describe("openapi-ir-in-memory", async () => { it( fixture.name, async () => { + const snapshotFilepath = `./__snapshots__/openapi-ir-in-memory/${fixture.name}.json`; + if (shouldSkipInMemory(fixture.name)) { + expect("Skipped; Swagger 2.0 is not supported in-memory").toMatchFileSnapshot(snapshotFilepath); + return; + } + const fixtureFilePath = await getTestFixturePath(join(FIXTURES_DIR, RelativeFilePath.of(fixture.name))); const document = await loader.loadDocument({ parsed: await readAndParseOpenAPI(fixtureFilePath) }); - expect(JSON.stringify(document, undefined, 2)).toMatchFileSnapshot( - `./__snapshots__/openapi-ir-in-memory/${fixture.name}.json` - ); + expect(JSON.stringify(document, undefined, 2)).toMatchFileSnapshot(snapshotFilepath); }, 90_000 ); @@ -88,3 +92,9 @@ async function getTestFixturePath(fixtureFilePath: AbsoluteFilePath): Promise { + }): Promise { const parsed = await this.parseOpenAPI({ parsed: openapi }); @@ -36,7 +36,7 @@ export class InMemoryOpenAPILoader { return parsed; } - private async parseOpenAPI({ parsed }: { parsed: OpenAPI.Document }): Promise { + private async parseOpenAPI({ parsed }: { parsed: OpenAPI.Document }): Promise { const result = await bundle({ ...DEFAULT_OPENAPI_BUNDLE_OPTIONS, doc: { @@ -44,6 +44,10 @@ export class InMemoryOpenAPILoader { parsed } }); - return result.bundle.parsed; + const v3 = result.bundle.parsed; + if (isOpenAPIV2(v3)) { + throw new Error("Swagger 2.0 is not supported in the browser"); + } + return v3; } } diff --git a/packages/cli/workspace/commons/package.json b/packages/cli/workspace/commons/package.json index 494138eb6f8..c3a48adc645 100644 --- a/packages/cli/workspace/commons/package.json +++ b/packages/cli/workspace/commons/package.json @@ -38,7 +38,8 @@ "@fern-api/fern-definition-schema": "workspace:*", "@redocly/openapi-core": "^1.4.1", "js-yaml": "^4.1.0", - "lodash-es": "^4.17.21" + "lodash-es": "^4.17.21", + "openapi-types": "^12.1.3" }, "devDependencies": { "@types/jest": "^29.5.12", diff --git a/packages/cli/workspace/commons/src/openapi/index.ts b/packages/cli/workspace/commons/src/openapi/index.ts index c8e23956050..62ee2901392 100644 --- a/packages/cli/workspace/commons/src/openapi/index.ts +++ b/packages/cli/workspace/commons/src/openapi/index.ts @@ -2,3 +2,5 @@ export { BaseOpenAPIWorkspace } from "./BaseOpenAPIWorkspace"; export { getBaseOpenAPIWorkspaceSettingsFromGeneratorInvocation } from "./getBaseOpenAPIWorkspaceSettingsFromGeneratorInvocation"; export { type OpenAPISettings } from "./OpenAPISettings"; export { DEFAULT_OPENAPI_BUNDLE_OPTIONS } from "./constants"; +export { isOpenAPIV2 } from "./isOpenAPIV2"; +export { isOpenAPIV3 } from "./isOpenAPIV3"; diff --git a/packages/cli/workspace/commons/src/openapi/isOpenAPIV2.ts b/packages/cli/workspace/commons/src/openapi/isOpenAPIV2.ts new file mode 100644 index 00000000000..38479f89aa0 --- /dev/null +++ b/packages/cli/workspace/commons/src/openapi/isOpenAPIV2.ts @@ -0,0 +1,6 @@ +import { OpenAPI, OpenAPIV2 } from "openapi-types"; + +export function isOpenAPIV2(openApi: OpenAPI.Document): openApi is OpenAPIV2.Document { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + return (openApi as OpenAPIV2.Document).swagger != null; +} diff --git a/packages/cli/workspace/commons/src/openapi/isOpenAPIV3.ts b/packages/cli/workspace/commons/src/openapi/isOpenAPIV3.ts new file mode 100644 index 00000000000..0e31941085f --- /dev/null +++ b/packages/cli/workspace/commons/src/openapi/isOpenAPIV3.ts @@ -0,0 +1,6 @@ +import { OpenAPI, OpenAPIV3 } from "openapi-types"; + +export function isOpenAPIV3(openApi: OpenAPI.Document): openApi is OpenAPIV3.Document { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + return (openApi as OpenAPIV3.Document).openapi != null; +} diff --git a/packages/cli/workspace/lazy-fern-workspace/package.json b/packages/cli/workspace/lazy-fern-workspace/package.json index fb405b0740a..4194db48e27 100644 --- a/packages/cli/workspace/lazy-fern-workspace/package.json +++ b/packages/cli/workspace/lazy-fern-workspace/package.json @@ -51,6 +51,7 @@ "lodash-es": "^4.17.21", "object-hash": "^3.0.0", "openapi-types": "^12.1.3", + "swagger2openapi": "7.0.8", "tar": "^6.2.1", "tmp-promise": "^3.0.3", "uuid": "^9.0.1", @@ -62,6 +63,7 @@ "@types/lodash-es": "^4.17.12", "@types/node": "18.7.18", "@types/object-hash": "^3.0.6", + "@types/swagger2openapi": "^7.0.4", "@types/tar": "^6.1.11", "depcheck": "^1.4.6", "eslint": "^8.56.0", diff --git a/packages/cli/workspace/lazy-fern-workspace/src/loaders/OpenAPILoader.ts b/packages/cli/workspace/lazy-fern-workspace/src/loaders/OpenAPILoader.ts index a4093383b3b..50f49b1a629 100644 --- a/packages/cli/workspace/lazy-fern-workspace/src/loaders/OpenAPILoader.ts +++ b/packages/cli/workspace/lazy-fern-workspace/src/loaders/OpenAPILoader.ts @@ -1,13 +1,14 @@ import { TaskContext } from "@fern-api/task-context"; import { mergeWithOverrides } from "./mergeWithOverrides"; import { AbsoluteFilePath, dirname, join, relative, RelativeFilePath } from "@fern-api/fs-utils"; -import { AsyncAPIV2, Document, FernOpenAPIExtension, FERN_TYPE_EXTENSIONS } from "@fern-api/openapi-ir-parser"; +import { AsyncAPIV2, Document, FernOpenAPIExtension } from "@fern-api/openapi-ir-parser"; import { Source as OpenApiIrSource } from "@fern-api/openapi-ir"; import { readFile } from "fs/promises"; -import { OpenAPI } from "openapi-types"; +import { OpenAPI, OpenAPIV2, OpenAPIV3 } from "openapi-types"; import { bundle, Source } from "@redocly/openapi-core"; import yaml from "js-yaml"; -import { DEFAULT_OPENAPI_BUNDLE_OPTIONS, OpenAPISpec } from "@fern-api/api-workspace-commons"; +import { DEFAULT_OPENAPI_BUNDLE_OPTIONS, OpenAPISpec, isOpenAPIV3, isOpenAPIV2 } from "@fern-api/api-workspace-commons"; +import { convertObj } from "swagger2openapi"; export class OpenAPILoader { constructor(private readonly absoluteFilePath: AbsoluteFilePath) {} @@ -36,13 +37,24 @@ export class OpenAPILoader { context, absolutePathToOpenAPIOverrides: spec.absoluteFilepathToOverrides }); - documents.push({ - type: "openapi", - value: openAPI, - source, - namespace: spec.namespace, - settings: spec.settings - }); + if (isOpenAPIV3(openAPI)) { + documents.push({ + type: "openapi", + value: openAPI, + source, + namespace: spec.namespace, + settings: spec.settings + }); + } else if (isOpenAPIV2(openAPI)) { + const convertedOpenAPI = await this.convertOpenAPIV2ToV3(openAPI); + documents.push({ + type: "openapi", + value: convertedOpenAPI, + source, + namespace: spec.namespace, + settings: spec.settings + }); + } } else if (contents.includes("asyncapi")) { const asyncAPI = await this.loadAsyncAPI({ context, @@ -150,4 +162,9 @@ export class OpenAPILoader { }); return result.bundle.parsed; } + + private async convertOpenAPIV2ToV3(openAPI: OpenAPIV2.Document): Promise { + const conversionResult = await convertObj(openAPI, {}); + return conversionResult.openapi; + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 956c5b68685..157c206c3e7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3581,9 +3581,6 @@ importers: openapi-types: specifier: ^12.1.3 version: 12.1.3 - swagger2openapi: - specifier: 7.0.8 - version: 7.0.8 zod: specifier: ^3.22.3 version: 3.23.8 @@ -3591,9 +3588,6 @@ importers: '@types/lodash-es': specifier: ^4.17.12 version: 4.17.12 - '@types/swagger2openapi': - specifier: ^7.0.4 - version: 7.0.4 depcheck: specifier: ^1.4.6 version: 1.4.6 @@ -6068,6 +6062,9 @@ importers: lodash-es: specifier: ^4.17.21 version: 4.17.21 + openapi-types: + specifier: ^12.1.3 + version: 12.1.3 devDependencies: '@types/jest': specifier: ^29.5.12 @@ -6168,6 +6165,9 @@ importers: openapi-types: specifier: ^12.1.3 version: 12.1.3 + swagger2openapi: + specifier: 7.0.8 + version: 7.0.8 tar: specifier: ^6.2.1 version: 6.2.1 @@ -6196,6 +6196,9 @@ importers: '@types/object-hash': specifier: ^3.0.6 version: 3.0.6 + '@types/swagger2openapi': + specifier: ^7.0.4 + version: 7.0.4 '@types/tar': specifier: ^6.1.11 version: 6.1.11