Skip to content

Commit

Permalink
update price api. (eclipse-xpanse#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alice1319 authored May 27, 2024
1 parent ce4a63e commit 9cda860
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 13 deletions.
97 changes: 86 additions & 11 deletions src/xpanse-api/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "XpanseAPI",
"description": "RESTful Services to interact with Xpanse runtime.",
"version": "1.0.11-SNAPSHOT"
"version": "1.0.14-SNAPSHOT"
},
"servers": [{ "url": "http://localhost:8080", "description": "Generated server url" }],
"security": [{ "OAuth2Flow": [] }],
Expand Down Expand Up @@ -796,14 +796,14 @@
"description": "Unauthorized",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"400": {
"description": "Bad Request",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"422": {
"description": "Unprocessable Entity",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"400": {
"description": "Bad Request",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"403": {
"description": "Forbidden",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
Expand Down Expand Up @@ -1672,14 +1672,14 @@
"description": "Unauthorized",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"400": {
"description": "Bad Request",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"422": {
"description": "Unprocessable Entity",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"400": {
"description": "Bad Request",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"403": {
"description": "Forbidden",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
Expand Down Expand Up @@ -2872,6 +2872,73 @@
}
}
},
"/xpanse/pricing/{templateId}/{region}/{flavorName}/{billingMode}": {
"get": {
"tags": ["CloudResources"],
"description": "List existing cloud resource names with kind<br>Required role:<b> admin</b> or <b>user</b>",
"operationId": "getServicePriceByFlavor",
"parameters": [
{
"name": "templateId",
"in": "path",
"description": "id of the service template",
"required": true,
"schema": { "type": "string" }
},
{
"name": "region",
"in": "path",
"description": "region name of the service",
"required": true,
"schema": { "type": "string" }
},
{
"name": "flavorName",
"in": "path",
"description": "flavor name of the service",
"required": true,
"schema": { "type": "string" }
},
{
"name": "billingMode",
"in": "path",
"description": "mode of billing",
"required": true,
"schema": { "type": "string", "enum": ["Fixed", "Pay per Use"] }
}
],
"responses": {
"500": {
"description": "Internal Server Error",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"401": {
"description": "Unauthorized",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"400": {
"description": "Bad Request",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"422": {
"description": "Unprocessable Entity",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"403": {
"description": "Forbidden",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"502": {
"description": "Bad Gateway",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Response" } } }
},
"200": {
"description": "OK",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServicePrice" } } }
}
}
}
},
"/xpanse/metrics": {
"get": {
"tags": ["Monitor"],
Expand Down Expand Up @@ -4012,6 +4079,7 @@
"Billing Mode Not Supported",
"Service State Management Task Not Found",
"Service Modification Audit Not Found",
"Service Price Calculation Failed",
"Invalid Git Repo Details"
]
},
Expand Down Expand Up @@ -4331,10 +4399,10 @@
}
},
"Price": {
"required": ["cost", "currency", "period"],
"required": ["cost", "currency"],
"type": "object",
"properties": {
"cost": { "type": "integer", "description": "The value of the cost.", "format": "int64" },
"cost": { "type": "number", "description": "The value of the cost." },
"currency": {
"type": "string",
"description": "The currency of the cost.",
Expand Down Expand Up @@ -5489,6 +5557,13 @@
}
}
},
"ServicePrice": {
"type": "object",
"properties": {
"recurringPrice": { "$ref": "#/components/schemas/Price" },
"oneTimePaymentPrice": { "$ref": "#/components/schemas/Price" }
}
},
"Metric": {
"required": ["monitorResourceType", "name", "type", "unit"],
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion src/xpanse-api/generated/core/OpenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type OpenAPIConfig = {

export const OpenAPI: OpenAPIConfig = {
BASE: 'http://localhost:8080',
VERSION: '1.0.11-SNAPSHOT',
VERSION: '1.0.14-SNAPSHOT',
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',
TOKEN: undefined,
Expand Down
1 change: 1 addition & 0 deletions src/xpanse-api/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export { ServiceModificationAuditDetails } from './models/ServiceModificationAud
export type { ServicePolicy } from './models/ServicePolicy';
export type { ServicePolicyCreateRequest } from './models/ServicePolicyCreateRequest';
export type { ServicePolicyUpdateRequest } from './models/ServicePolicyUpdateRequest';
export type { ServicePrice } from './models/ServicePrice';
export type { ServiceProviderContactDetails } from './models/ServiceProviderContactDetails';
export { ServiceStateManagementTaskDetails } from './models/ServiceStateManagementTaskDetails';
export { ServiceTemplateDetailVo } from './models/ServiceTemplateDetailVo';
Expand Down
2 changes: 1 addition & 1 deletion src/xpanse-api/generated/models/Price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type Price = {
/**
* The period of the cost.
*/
period: Price.period;
period?: Price.period;
};
export namespace Price {
/**
Expand Down
1 change: 1 addition & 0 deletions src/xpanse-api/generated/models/Response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export namespace Response {
BILLING_MODE_NOT_SUPPORTED = 'Billing Mode Not Supported',
SERVICE_STATE_MANAGEMENT_TASK_NOT_FOUND = 'Service State Management Task Not Found',
SERVICE_MODIFICATION_AUDIT_NOT_FOUND = 'Service Modification Audit Not Found',
SERVICE_PRICE_CALCULATION_FAILED = 'Service Price Calculation Failed',
INVALID_GIT_REPO_DETAILS = 'Invalid Git Repo Details',
}
}
14 changes: 14 additions & 0 deletions src/xpanse-api/generated/models/ServicePrice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: Huawei Inc.
*/

/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Price } from './Price';
export type ServicePrice = {
recurringPrice?: Price;
oneTimePaymentPrice?: Price;
};
35 changes: 35 additions & 0 deletions src/xpanse-api/generated/services/CloudResourcesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,42 @@
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
import type { ServicePrice } from '../models/ServicePrice';
export class CloudResourcesService {
/**
* List existing cloud resource names with kind<br>Required role:<b> admin</b> or <b>user</b>
* @param templateId id of the service template
* @param region region name of the service
* @param flavorName flavor name of the service
* @param billingMode mode of billing
* @returns ServicePrice OK
* @throws ApiError
*/
public static getServicePriceByFlavor(
templateId: string,
region: string,
flavorName: string,
billingMode: 'Fixed' | 'Pay per Use'
): CancelablePromise<ServicePrice> {
return __request(OpenAPI, {
method: 'GET',
url: '/xpanse/pricing/{templateId}/{region}/{flavorName}/{billingMode}',
path: {
templateId: templateId,
region: region,
flavorName: flavorName,
billingMode: billingMode,
},
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
422: `Unprocessable Entity`,
500: `Internal Server Error`,
502: `Bad Gateway`,
},
});
}
/**
* List existing cloud resource names with kind<br>Required role:<b> admin</b> or <b>user</b>
* @param csp name of the cloud service provider
Expand Down

0 comments on commit 9cda860

Please sign in to comment.