--- swagger: "2.0" host: "localhost:8000" basePath: "/api/v1.0" info: description: An API which supports creation, deletion, listing etc of Plan Manager version: "1.0.0" title: Plan Manager Management API contact: email: sean@cyclops-labs.io license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' tags: - name: statusManagement description: Actions relating to the reporting of the state of the service - name: triggerManagement description: Actions relating to the periodics actions to be triggered in the system - name: bundleManagement description: Actions relating to management of sku bundles - name: cycleManagement description: Actions relating to management of life cycles - name: planManagement description: Actions relating to management of plans - name: priceManagement description: Actions relating to management of sku prices - name: skuManagement description: Actions relating to management of skus and prices securityDefinitions: APIKeyHeader: type: apiKey in: header name: X-API-KEY APIKeyParam: type: apiKey in: query name: api_key Keycloak: type: oauth2 flow: accessCode authorizationUrl: 'http://localhost:8080/auth/realms/Dev/protocol/openid-connect/auth' tokenUrl: 'http://localhost:8080/auth/realms/Dev/protocol/openid-connect/token' scopes: admin: Admin scope user: User scope schemes: - http - https security: - Keycloak: [user,admin] - APIKeyHeader: [] - APIKeyParam: [] paths: /status: get: tags: - statusManagement produces: - application/json summary: Basic status of the system security: - Keycloak: [user] - APIKeyHeader: [] - APIKeyParam: [] operationId: showStatus responses: '200': description: Status information of the system schema: $ref: "#/definitions/Status" /status/{id}: get: tags: - statusManagement produces: - application/json summary: Basic status of the system security: - Keycloak: [user] - APIKeyHeader: [] - APIKeyParam: [] operationId: getStatus responses: '200': description: Status information of the system schema: $ref: "#/definitions/Status" '404': description: The endpoint provided doesn't exist schema: $ref: "#/definitions/ErrorResponse" parameters: - name: id in: path type: string enum: - kafka-receiver - kafka-sender - status - trigger - bundle - cycle - plan - price - sku required: true description: Id of the endpoint to be checked /trigger/sample: get: tags: - triggerManagement produces: - application/json summary: Sample task trigger security: - Keycloak: [user] - APIKeyHeader: [] - APIKeyParam: [] operationId: execSample responses: '200': description: Sample task executed successfully '500': description: Something unexpected happend, error raised schema: $ref: "#/definitions/ErrorResponse" /cycle: get: tags: - cycleManagement summary: List all cycles operationId: listCycles description: lists all cycles responses: '200': description: list of cycles returned schema: type: array items: $ref: "#/definitions/Cycle" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: state to filter in: query name: state type: string - description: resource type to filter in: query name: type type: string post: tags: - cycleManagement consumes: - application/json produces: - application/json summary: Create a plan operationId: createCycle description: Creates a new cycle responses: '201': description: item created schema: $ref: "#/definitions/ItemCreatedResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" '400': description: 'invalid input, object invalid' '409': description: an existing item already exists schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Cycle to be added in: body name: cycle schema: $ref: '#/definitions/Cycle' /cycle/{id}: get: tags: - cycleManagement consumes: - application/json produces: - application/json summary: Get specific cycle operationId: getCycle description: get cycle with given id responses: '200': description: cycle returned schema: $ref: "#/definitions/Cycle" '404': description: cycle with id not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of cycle to be obtained in: path name: id required: true type: string put: tags: - cycleManagement consumes: - application/json produces: - application/json summary: Update specific cycle operationId: updateCycle description: Update cycle with given id responses: '200': description: updated cycle schema: $ref: "#/definitions/Cycle" '404': description: cycle with id not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of cycle to be updated in: path name: id required: true type: string - description: updated cycle containing all parameters except id in: body name: cycle required: true schema: $ref: "#/definitions/Cycle" /plan: get: tags: - planManagement summary: List all plans operationId: listPlans description: lists all plans (tbd - pagination?) responses: '200': description: list of plans returned schema: type: array items: $ref: "#/definitions/Plan" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" post: tags: - planManagement consumes: - application/json produces: - application/json summary: Create a plan operationId: createPlan description: Creates a new plan responses: '201': description: item created schema: $ref: "#/definitions/ItemCreatedResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" '400': description: 'invalid input, object invalid' '409': description: an existing item already exists schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Plan to be added in: body name: plan schema: $ref: '#/definitions/Plan' /plan/{id}: get: tags: - planManagement consumes: - application/json produces: - application/json summary: Get specific plan operationId: getPlan description: get plan with given planid responses: '200': description: plan returned schema: $ref: "#/definitions/Plan" '404': description: plan with planid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of plan to be obtained in: path name: id required: true type: string put: tags: - planManagement consumes: - application/json produces: - application/json summary: Update specific plan operationId: updatePlan description: Update plan with given planId responses: '200': description: updated plan schema: $ref: "#/definitions/Plan" '404': description: plan with planid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of plan to be obtained in: path name: id required: true type: string - description: updated plan containing all parameters except id in: body name: plan required: true schema: $ref: "#/definitions/Plan" /plan/complete: get: tags: - planManagement consumes: - application/json produces: - application/json summary: Get full information relating to known plans operationId: listCompletePlans description: Obtains full information on all known plans responses: '200': description: Set of known plans returned in full schema: type: array items: $ref: "#/definitions/Plan" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" /plan/complete/{id}: get: tags: - planManagement consumes: - application/json produces: - application/json summary: Get complete plan operationId: getCompletePlan description: gets complete plan with planid responses: '200': description: plan returned schema: $ref: "#/definitions/Plan" '404': description: complete plan with planid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of plan to be obtained in: path name: id required: true type: string /sku: get: tags: - skuManagement summary: list SKUs operationId: listSkus description: lists all skus responses: '200': description: list of skus returned schema: type: array items: $ref: "#/definitions/Sku" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" post: tags: - skuManagement consumes: - application/json produces: - application/json summary: create SKU operationId: createSku description: Creates a new sku responses: '201': description: item created schema: $ref: "#/definitions/ItemCreatedResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" '400': description: invalid input, object invalid '409': description: an existing item already exists schema: $ref: "#/definitions/ErrorResponse" parameters: - description: SKU to be added in: body name: sku schema: $ref: '#/definitions/Sku' /sku/{id}: get: tags: - skuManagement consumes: - application/json produces: - application/json summary: Get specific sku operationId: getSku description: get sku with given skuid responses: '200': description: sku returned schema: $ref: "#/definitions/Sku" '404': description: sku with skuid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku to be obtained in: path name: id required: true type: string put: tags: - skuManagement consumes: - application/json produces: - application/json summary: Update specific sku operationId: updateSku description: Update sku with given skuid responses: '200': description: updated sku schema: $ref: "#/definitions/Sku" '404': description: sku with skuid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku to be obtained in: path name: id required: true type: string - description: updated sku containing all parameters except id in: body name: sku required: true schema: $ref: "#/definitions/Sku" /sku/bundle: get: tags: - bundleManagement summary: list SKU Bundles operationId: listSkuBundles description: lists all sku bundles responses: '200': description: list of skus bundles returned schema: type: array items: $ref: "#/definitions/SkuBundle" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" post: tags: - bundleManagement consumes: - application/json produces: - application/json summary: create SKU bundle operationId: createSkuBundle description: Creates a new sku bundle responses: '201': description: item created schema: $ref: "#/definitions/ItemCreatedResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" '400': description: invalid input, object invalid '409': description: an existing item already exists schema: $ref: "#/definitions/ErrorResponse" parameters: - description: SKU bundle to be added in: body name: bundle schema: $ref: '#/definitions/SkuBundle' /sku/bundle/{id}: get: tags: - bundleManagement consumes: - application/json produces: - application/json summary: Get specific sku bundle operationId: getSkuBundle description: get sku bundle with given id responses: '200': description: sku bundle returned schema: $ref: "#/definitions/SkuBundle" '404': description: sku bundle with id not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku bundle to be obtained in: path name: id required: true type: string put: tags: - bundleManagement consumes: - application/json produces: - application/json summary: Update specific sku bundle operationId: updateSkuBundle description: Update sku bundle with given id responses: '200': description: updated sku bundle schema: $ref: "#/definitions/SkuBundle" '404': description: sku bundle with id not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku bundle to be obtained in: path name: id required: true type: string - description: updated sku bundle containing all parameters except id in: body name: bundle required: true schema: $ref: "#/definitions/SkuBundle" /sku/bundle/name/{name}: get: tags: - bundleManagement consumes: - application/json produces: - application/json summary: Get specific sku bundle operationId: getSkuBundleByName description: get sku bundle with given name responses: '200': description: sku bundle returned schema: $ref: "#/definitions/SkuBundle" '404': description: sku bundle with name not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku bundle to be obtained in: path name: name required: true type: string /sku/price: get: tags: - priceManagement summary: list SKU Prices operationId: listSkuPrices description: lists all sku prices responses: '200': description: list of skus prices returned schema: type: array items: $ref: "#/definitions/SkuPrice" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" post: tags: - priceManagement consumes: - application/json produces: - application/json summary: create SKU price operationId: createSkuPrice description: Creates a new sku price responses: '201': description: item created schema: $ref: "#/definitions/ItemCreatedResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" '400': description: invalid input, object invalid '409': description: an existing item already exists schema: $ref: "#/definitions/ErrorResponse" parameters: - description: SKU price to be added in: body name: price schema: $ref: '#/definitions/SkuPrice' /sku/price/{id}: get: tags: - priceManagement consumes: - application/json produces: - application/json summary: Get specific sku price operationId: getSkuPrice description: get sku price with given skupriceid responses: '200': description: sku price returned schema: $ref: "#/definitions/SkuPrice" '404': description: sku price with skupriceid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku price to be obtained in: path name: id required: true type: string put: tags: - priceManagement consumes: - application/json produces: - application/json summary: Update specific sku price operationId: updateSkuPrice description: Update sku price with given skupriceid responses: '200': description: updated sku price schema: $ref: "#/definitions/SkuPrice" '404': description: sku price with skupriceid not found schema: $ref: "#/definitions/ErrorResponse" '500': description: unexpected error schema: $ref: "#/definitions/ErrorResponse" parameters: - description: Id of sku price to be obtained in: path name: id required: true type: string - description: updated sku containing all parameters except id in: body name: price required: true schema: $ref: "#/definitions/SkuPrice" definitions: ErrorResponse: type: object required: - errorString properties: errorString: type: string ItemCreatedResponse: properties: Link: type: string ID: type: string Message: type: string Status: type: object required: - SystemState properties: AverageResponseTime: type: number format: double DBState: type: string LastRequest: type: string RequestsBoT: type: integer RequestsLastHour: type: integer RequestsToday: type: integer SystemState: type: string Metadata: type: object x-go-type: import: package: "gitlab.com/cyclops-enterprise/datamodels" type: JSONdb Cycle: type: object required: - State - ResourceType - SkuList properties: ID: type: string x-go-custom-tag: gorm:"primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid" State: type: string ResourceType: type: string SkuList: x-go-custom-tag: gorm:"type:jsonb" $ref: '#/definitions/Metadata' Plan: type: object required: - Name - OfferedEndDate - OfferedStartDate properties: Discount: type: number format: double default: 0.0 x-go-custom-tag: gorm:"type:numeric(23,13);default:0.0" ID: type: string x-go-custom-tag: gorm:"primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid" Name: type: string example: 'Standard 3 year plan starting 1/1/2019' OfferedEndDate: type: string format: date example: '2016-08-29' x-go-custom-tag: gorm:"type:date" OfferedStartDate: type: string format: date example: '2016-08-29' x-go-custom-tag: gorm:"type:date" SkuPrices: type: array items: $ref: "#/definitions/SkuPrice" x-go-custom-tag: gorm:"-" Sku: type: object required: - Name properties: ID: type: string x-go-custom-tag: gorm:"primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid" Name: type: string example: 'Standard 3 year plan starting 1/1/2019' Unit: type: string SkuBundle: type: object required: - Name properties: ID: type: string x-go-custom-tag: gorm:"primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid" Name: type: string SkuPrices: x-go-custom-tag: gorm:"type:jsonb" $ref: '#/definitions/Metadata' SkuPrice: type: object required: - PlanID - SkuID - Unit - UnitPrice properties: ID: type: string x-go-custom-tag: gorm:"primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid" PlanID: type: string Discount: type: number format: double default: 0.0 x-go-custom-tag: gorm:"type:numeric(23,13);default:0.0" SkuID: type: string SkuName: type: string Unit: type: string UnitPrice: type: number format: double x-go-custom-tag: gorm:"type:numeric(23,13)" UnitCreditPrice: type: number format: double x-go-custom-tag: gorm:"type:numeric(23,13)" AccountingMode: type: string x-go-custom-tag: gorm:"index;default:CREDIT" default: CREDIT enum: - CREDIT - CASH - BOTH - NONE