Skip to content

Commit

Permalink
DOC-2166 / SF-18880 - add Cost Intelligence 'Setup CI on Spot account…
Browse files Browse the repository at this point in the history
…' related API endpoints. (#689)
  • Loading branch information
paul-van-wichen authored Dec 11, 2024
1 parent 72112fa commit c1d8730
Show file tree
Hide file tree
Showing 21 changed files with 453 additions and 1 deletion.
11 changes: 11 additions & 0 deletions api/commons/schemas/errorModel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
properties:
code:
type: string
description: Error code.
message:
type: string
description: Error message.
type: object
required:
- message
title: ErrorModel
12 changes: 12 additions & 0 deletions api/commons/schemas/errorResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
allOf:
- $ref: "../schemas/responseWrapper.yaml"
- type: "object"
properties:
response:
type: "object"
properties:
errors:
type: "array"
description: List of errors.
items:
$ref: "../schemas/errorModel.yaml"
25 changes: 25 additions & 0 deletions api/commons/schemas/paginatedResponseItemWrapper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
allOf:
- $ref: "../schemas/responseWrapper.yaml"
- type: "object"
properties:
response:
type: "object"
properties:
items:
type: "array"
description: >
Array of data objects.
items:
type: "object"
count:
type: "integer"
example: 1
description: >
Size of the data object array.
kind:
type: "string"
description: >
The data type of each item in the response.
paginationInfo:
$ref: "../schemas/paginationInfo.yaml"
nullable: true
15 changes: 15 additions & 0 deletions api/commons/schemas/paginationInfo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
properties:
totalCount:
type: integer
nullable: true
description: "[Optional/Not supported on all APIs] Total number of items (for all pages)."
nextKey:
type: string
nullable: true
description: Key used to fetch next page of data (if any).
previousKey:
type: string
nullable: true
description: Key used to fetch previous page of data (if any).
type: object
title: PaginationInfo
77 changes: 77 additions & 0 deletions api/services/beci/setup/paths/cbiV1SetupAccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
post:
tags:
- Accounts
summary: Setup Cost Intelligence
description: Sets up and enables Cost Intelligence functionality on a Spot account.
The Spot account must already have credentials and be linked to a valid cloud
provider account (e.g. AWS account, Azure subscription, etc).
operationId: setupAccountCbiV1SetupAccountPost
requestBody:
required: true
content:
application/json:
schema:
$ref: ../schemas/createCIRegisteredAccountModel.yaml
responses:
'200':
$ref: ../responses/post200cbiV1SetupAccount.yaml
'400':
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
description: Invalid request error response. Adjust the request before retrying.
'404':
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
description: Not found error response. The requested resource does not exist.
'422':
description: Error response.
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
get:
tags:
- Accounts
summary: Get Cost Intelligence Registered Accounts
description: Get list of Spot accounts where Cost Intelligence has been setup.
operationId: getAccountsCbiV1SetupAccountGet
parameters:
- name: paginationSize
in: query
required: false
schema:
type: integer
description: Number of items to include in the response
description: Number of items to include in the response
- name: paginationKey
in: query
required: false
schema:
type: string
description: Key used to fetch a specific page of items
description: Key used to fetch a specific page of items
responses:
'200':
$ref: ../responses/get200cbiV1SetupAccount.yaml
'400':
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
description: Invalid request error response. Adjust the request before retrying.
'404':
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
description: Not found error response. The requested resource does not exist.
'422':
description: Error response.
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
34 changes: 34 additions & 0 deletions api/services/beci/setup/paths/cbiV1SetupAccountValidation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
post:
tags:
- Accounts
summary: Perform Cost Intelligence Setup Validations
description: Validate that Cost Intelligence can be setup on the specified Spot
Account.
operationId: validateSetupAccountCbiV1SetupAccountValidationPost
requestBody:
required: true
content:
application/json:
schema:
$ref: ../schemas/createCIRegisteredAccountModel.yaml
responses:
'200':
$ref: ../responses/post200cbiV1SetupAccountValidation.yaml
'400':
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
description: Invalid request error response. Adjust the request before retrying.
'404':
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
description: Not found error response. The requested resource does not exist.
'422':
description: Error response.
content:
application/json:
schema:
$ref: ../../../../commons/schemas/errorResponse.yaml
24 changes: 24 additions & 0 deletions api/services/beci/setup/responses/get200cbiV1SetupAccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: Successful response
content:
application/json:
schema:
allOf:
- $ref: ../../../../commons/schemas/paginatedResponseItemWrapper.yaml
- type: object
properties:
request:
type: object
properties:
url:
example: /cbi/v1/setup/account
method:
example: GET
response:
type: object
properties:
items:
type: array
items:
$ref: ../schemas/CIRegisteredAccountWithStatusResponse.yaml
kind:
example: string
24 changes: 24 additions & 0 deletions api/services/beci/setup/responses/post200cbiV1SetupAccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: Successful response
content:
application/json:
schema:
allOf:
- $ref: ../../../../commons/schemas/responseItemWrapper.yaml
- type: object
properties:
request:
type: object
properties:
url:
example: /cbi/v1/setup/account
method:
example: POST
response:
type: object
properties:
items:
type: array
items:
$ref: ../schemas/CIRegisteredAccountResponse.yaml
kind:
example: spotinst:cbi:inventory:ciRegisteredAccount
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: Successful response
content:
application/json:
schema:
allOf:
- $ref: ../../../../commons/schemas/responseItemWrapper.yaml
- type: object
properties:
request:
type: object
properties:
url:
example: /cbi/v1/setup/account/validation
method:
example: POST
response:
type: object
properties:
items:
type: array
items:
$ref: ../schemas/validationModelResponse.yaml
kind:
example: spotinst:cbi:accountRegistrationValidation
37 changes: 37 additions & 0 deletions api/services/beci/setup/schemas/CIRegisteredAccountResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
properties:
organizationId:
type: string
description: Spot Organization ID.
example: '60100100100100'
accountId:
type: string
description: Spot Account ID.
example: act-012345
providerName:
$ref: cloudProvider.yaml
description: Cloud provider of setup account.
example: aws
externalProviderId:
type: string
description: Cloud provider of setup account.
example: '012345678901'
enabledDate:
type: string
format: date-time
description: Date/time when Cost Intelligence was registered on the Spot account.
updatedDate:
type: string
format: date-time
description: Date/time when the Cost Intelligence registration was updated on
the Spot account.
type: object
required:
- organizationId
- accountId
- providerName
- externalProviderId
- enabledDate
- updatedDate
title: CIRegisteredAccountResponse
description: Represents a Spot account on which Cost Intelligence has been registered
/ enabled. [kind/spotinst:cbi:inventory:ciRegisteredAccount]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
properties:
organizationId:
type: string
description: Spot Organization ID.
example: '60100100100100'
accountId:
type: string
description: Spot Account ID.
example: act-012345
providerName:
$ref: cloudProvider.yaml
description: Cloud provider of setup account.
example: aws
externalProviderId:
type: string
description: Cloud provider of setup account.
example: '012345678901'
enabledDate:
type: string
format: date-time
description: Date/time when Cost Intelligence was registered on the Spot account.
updatedDate:
type: string
format: date-time
description: Date/time when the Cost Intelligence registration was updated on
the Spot account.
statusSummary:
$ref: accountStatusSummary.yaml
description: Account status summary.
status:
description: Account status
type: array
items:
$ref: accountStatusItem.yaml
nullable: true
type: object
required:
- organizationId
- accountId
- providerName
- externalProviderId
- enabledDate
- updatedDate
- statusSummary
title: CIRegisteredAccountWithStatusResponse
8 changes: 8 additions & 0 deletions api/services/beci/setup/schemas/account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
properties:
accountId:
type: string
description: Spot account ID
type: object
required:
- accountId
title: Account
29 changes: 29 additions & 0 deletions api/services/beci/setup/schemas/accountStatusItem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
properties:
productOffering:
$ref: productOfferingEnum.yaml
description: Product offering.
statusType:
type: string
description: Status type.
statusCode:
type: string
description: Status code.
statusMessage:
description: Status message.
type: string
nullable: true
statistics:
description: Status statistics.
$ref: accountStatusStatistic.yaml
nullable: true
statusTimestamp:
type: string
format: date-time
description: Status timestamp.
type: object
required:
- productOffering
- statusType
- statusCode
- statusTimestamp
title: AccountStatusItem
Loading

0 comments on commit c1d8730

Please sign in to comment.