openapi: 3.2.0 info: title: CloudChipr Enterprise Resources API description: CloudChipr Enterprise API document provides detailed description about how to interact with CloudChipr Enterprise service version: 0.1.0 contact: email: info@cloudchipr.com license: name: Cloudchipr 1.0 url: https://cloudchipr.com servers: - url: https://api.cloudchipr.com tags: - name: Resources description: Endpoints for resources paths: /resources/lookup: get: summary: Get a resource by its identifier description: Returns the full data of a single live resource — its details, prices, account, creation metadata and the complete cloud tag list (including any creator/owner tag the organisation uses). The resource is identified by its provider identifier (e.g. an EC2 instance id or an ARN); when the owning account is not given, every connected cloud account of the organisation is searched. The response shape varies by resource type; the fields listed in the schema are common to all types. operationId: lookupResource tags: - Resources security: - ApiKey: [] parameters: - name: resource_id in: query required: true schema: type: string description: The provider identifier of the resource (instance id, ARN, resource name, ...) - name: resource_type in: query required: false schema: type: string description: Optional resource type (e.g. EC2, EBS, RDS) to speed up the lookup - name: account_id in: query required: false schema: type: string format: uuid description: Optional CloudChipr account id when the owning account is known responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/ResourceDetails' '401': $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalServerError' /accounts/{accountId}/resources: post: summary: Get resources matched with provided filters tags: - Resources security: - ApiKey: [] parameters: - name: accountId required: true in: path description: The id of account which resources will be fetched schema: type: string format: UUID requestBody: $ref: '#/components/requestBodies/GetResourcesWithFilters' responses: '200': description: Json object of resources that matched with filters content: application/json: schema: type: object properties: ebs: description: List of elastic block stores type: array items: $ref: '#/components/schemas/Ebs' ec2: description: List of AWS ec2 instances type: array items: $ref: '#/components/schemas/Ec2' rds: description: List of AWS rds instances type: array items: $ref: '#/components/schemas/Rds' eip: description: List of AWS eip addresses type: array items: $ref: '#/components/schemas/Eip' elc: description: List of AWS elasticache resources type: array items: $ref: '#/components/schemas/Elc' elb: description: List of AWS load balancers type: array items: $ref: '#/components/schemas/Elb' vm: description: List of GCP virtual machines type: array items: $ref: '#/components/schemas/Vm' disk: description: List of GCP disks type: array items: $ref: '#/components/schemas/Disk' sql: description: List of GCP sql instances type: array items: $ref: '#/components/schemas/Sql' ip: description: List of GCP Ip addresses type: array items: $ref: '#/components/schemas/Ip' lb: description: List of GCP load balancers type: array items: $ref: '#/components/schemas/Lb' required: - ebs - ec2 - rds - eip - elb - elc - disk - sql - vm - ip - lb examples: FilteredResourcesResponse: $ref: '#/components/examples/FilteredResourcesResponseExample' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFound' operationId: get-resources components: requestBodies: GetResourcesWithFilters: content: application/json: schema: type: array items: type: object properties: type: type: string description: The resource type to which filters will be applied enum: - ec2 - ebs - eip - elb - rds - elc - vm - disk - ip - lb - sql filters: type: array items: type: object properties: key: allOf: - {} - $ref: '#/components/schemas/FilterKeyType' value: oneOf: - type: string - type: integer - type: number - type: boolean operator: allOf: - {} - $ref: '#/components/schemas/FilterOperatorType' metric: allOf: - {} - $ref: '#/components/schemas/FilterMetric' required: - key - operator required: - type - filters examples: aws-example: value: - type: ec2 filters: [] - type: eip filters: - key: instance_ids operator: is_absent - key: association_ids operator: is_absent - type: ebs filters: - key: attachments operator: is_empty - type: elb filters: - key: instances operator: is_empty - type: rds filters: - key: database_connections value: 1 operator: less_than_equal_to metric: statistics_type: maximum since: value: 7 unit: days - type: elc filters: - key: launch_time value: 604800 operator: less_than_equal_to gcp-example: value: - type: vm filters: [] - type: ip filters: - key: instance_ids operator: is_absent - key: association_ids operator: is_absent - type: disk filters: - key: attachments operator: is_empty - type: lb filters: - key: instances operator: is_empty - type: sql filters: - key: database_connections value: 1 operator: less_than_equal_to metric: statistics_type: maximum since: value: 7 unit: days description: '' responses: BadRequest: description: Bad Request. content: application/json: schema: type: object properties: message: type: string example: Some business domain specific validation message UnauthorizedError: description: Authentication information is missing or invalid content: application/json: schema: type: object properties: message: type: string example: Unauthorized InternalServerError: description: Internal Server Error. content: application/json: schema: type: object properties: message: type: string example: Internal Server Error. NotFound: description: Resource was not found. content: application/json: schema: type: object properties: message: type: string example: Resource not found by id 92262c27-a20b-4814-8717-53f25b69a4d8 schemas: FilterOperatorType: type: string title: FilterOperatorType enum: - equal - not_equal - greater_than - greater_than_equal_to - less_than - less_than_equal_to - exists - does_not_exist - contains - does_not_contain - is_empty - is_not_empty - is_absent - is_not_absent - in - is_true - is_false - is_expired - is_invalid - does_never_expire - not_in Date: type: string description: ISO 8601 example: '2022-09-11T21:14:49.691823' Elb: type: object description: AWS Elastic load balancer properties: id: type: string format: uuid readOnly: true example: 00018acc-a66f-4747-9670-fadc3a2ead87 type: type: string example: classic load_balancer_name: type: string example: aefa65ba0b5984a288a5b362d364cf05 load_balancer_arn: type: - string - 'null' price_per_month: type: number example: 18 format: double dns_name: type: string example: aefa65ba0b5984a288a5b362d364cf05-10405585a988f0cx.elb.us-west-2.amazonaws.com created_at: allOf: - {} - $ref: '#/components/schemas/Date' region: type: string example: us-west-2 has_attachments: type: boolean example: true tags: allOf: - $ref: '#/components/schemas/Tags' - {} link: type: string required: - id - type - load_balancer_name - load_balancer_arn - price_per_month - dns_name - created_at - region - has_attachments - tags - link Eip: type: object description: AWS Eip address properties: id: type: string format: UUID readOnly: true example: b8414855-8b25-436f-9364-16c5df2e960d ip: type: string example: 44.199.21.179 allocation_id: type: - string - 'null' example: eipalloc-0d32941e0f777d5aa association_id: type: - string - 'null' example: eipassoc-0d50c0ad2e169e445 instance_id: type: - string - 'null' example: i-0af2561eb64b7ab79 domain: type: - string - 'null' example: vpc price_per_month: type: number example: 3.6 created_at: allOf: - {} - $ref: '#/components/schemas/Date' region: type: string example: us-east-1 tags: type: array items: allOf: - {} - $ref: '#/components/schemas/Tags' link: type: string example: https://console.aws.amazon.com/ec2/home?region=us-east-1#ElasticIpDetails:AllocationId=eipalloc-0b2a1808368aa6d10 required: - id - ip - allocation_id - association_id - instance_id - domain - price_per_month - created_at - region - tags - link FilterMetric: type: object description: Object to filter with metrics properties: statistics_type: $ref: '#/components/schemas/FilterStatisticsType' since: type: object properties: value: type: number unit: type: string enum: - hours - days Metric: title: Metric type: object x-examples: example-1: timestamp: '2022-02-05T17:20:00Z' average: 0.11278171781244677 minimum: 0 maximum: 8.64406779661002 sum: 162.40567364992333 unit: Percent properties: timestamp: type: string example: '2022-02-06T17:20:00Z' average: type: number format: double maximum: type: number format: double minimum: type: number format: double sum: type: number format: double unit: type: string example: Percent required: - timestamp - average - maximum - minimum - sum - unit Vm: type: object description: GCP Vm Instance properties: id: type: string format: uuid example: 829eeb09-a9be-40d3-93b5-dd12534a3090 readOnly: true image_id: type: string example: instance-1 type: type: string example: e2-medium cpu: type: array items: $ref: '#/components/schemas/Metric' cpu_by_hours: type: array items: $ref: '#/components/schemas/Metric' network_in: type: array items: $ref: '#/components/schemas/Metric' network_in_by_hours: type: array items: $ref: '#/components/schemas/Metric' network_out: type: array items: $ref: '#/components/schemas/Metric' network_out_by_hours: type: array items: $ref: '#/components/schemas/Metric' created_at: allOf: - {} - $ref: '#/components/schemas/Date' price_per_month: type: number availability_zone: type: string region: type: - string - 'null' tags: allOf: - {} - $ref: '#/components/schemas/Tags' link: type: string example: https://console.cloud.google.com/compute/instancesDetail/zones/us-central1-a/instances/instance-1?project=my-project required: - id - image_id - type - cpu - network_in - network_out - cpu_by_hours - network_in_by_hours - network_out_by_hours - created_at - price_per_month - availability_zone - tags - link - region Tags: title: Tags type: object x-examples: example-1: key: env value: production description: Provider resource tag properties: key: type: string example: env value: type: string example: production required: - key - value Elc: type: object description: AWS elasticache cache properties: id: type: string format: uuid readOnly: true example: 000e374e-f395-4bce-91a3-2f431dd7ad45 cluster_id: type: string example: redis-cluster price_per_month: type: number format: double example: 444.96 instance_type: type: string example: cache.r6g.large cache_type: type: string example: redis enum: - redis - memcached nodes_count: type: number example: 3 connections: type: array format: double items: $ref: '#/components/schemas/Metric' connections_by_hours: type: array items: $ref: '#/components/schemas/Metric' cpu: type: array format: double items: $ref: '#/components/schemas/Metric' cpu_by_hours: type: array items: $ref: '#/components/schemas/Metric' created_at: allOf: - {} - $ref: '#/components/schemas/Date' region: type: string example: us-east-1 tags: allOf: - $ref: '#/components/schemas/Tags' - {} link: example: https://console.aws.amazon.com/elasticache/home?region=us-east-1#/redis/redis-cluster type: string required: - id - cluster_id - price_per_month - instance_type - cache_type - nodes_count - connections - connections_by_hours - cpu - created_at - region - tags - link Disk: type: object description: GCP disk properties: id: type: string format: uuid example: c1c9d9bc-74ab-478c-9083-d9238bcfa516 readOnly: true name: type: string example: disk-1 price_per_month: type: number format: double example: 3.2 type: type: string example: pd-standard size: type: number example: 10737418240 state: format: double type: string example: READY availability_zone: type: string example: us-central1-a region: type: - string - 'null' example: us-central1 tags: allOf: - {} - $ref: '#/components/schemas/Tags' has_attachments: type: boolean link: example: /compute/disksDetail/zones/us-central1-a/disks/disk-1?project=my-project type: string required: - id - name - price_per_month - type - size - state - availability_zone - region - tags - link - has_attachments Ip: type: object description: GCP Ip address properties: id: type: string format: uuid readOnly: true example: 05c5c3f5-60ee-43f1-af1d-0723fe440ab2 ip: type: string example: 34.120.161.211 name: type: string example: ip-address is_in_use: type: boolean price_per_month: type: number example: 7.3 format: double region: type: string example: us-central1 tags: allOf: - {} - $ref: '#/components/schemas/Tags' created_at: allOf: - {} - $ref: '#/components/schemas/Date' link: type: string example: https://console.cloud.google.com/networking/addresses/list?project=my-project required: - id - ip - is_in_use - price_per_month - region - tags - created_at - link - name Ec2: type: object description: AWS Ec2 Instance properties: id: type: string format: uuid readOnly: true example: 829eeb09-a9be-40d3-93b5-dd12534a3090 image_id: type: string example: ami-0b93ce03dcbcb10f6 instance_id: type: string example: i-0a5ff2749d14ec42c is_spot_instance: type: boolean type: type: string example: t2.micro cpu: type: array format: double items: $ref: '#/components/schemas/Metric' cpu_by_hours: type: array items: $ref: '#/components/schemas/Metric' network_in: type: array items: $ref: '#/components/schemas/Metric' network_in_by_hours: type: array items: $ref: '#/components/schemas/Metric' network_out: type: array items: $ref: '#/components/schemas/Metric' network_out_by_hours: type: array items: $ref: '#/components/schemas/Metric' created_at: allOf: - {} - $ref: '#/components/schemas/Date' price_per_month: type: number example: 8.35 availability_zone: type: string example: us-east-1b region: type: string example: us-east-1 tags: allOf: - {} - $ref: '#/components/schemas/Tags' link: type: string required: - id - image_id - instance_id - is_spot_instance - type - cpu - network_in - network_out - cpu_by_hours - network_in_by_hours - network_out_by_hours - created_at - price_per_month - availability_zone - region - tags - link FilterKeyType: type: string title: FilterKeyType x-stoplight: id: 1svtkfi62ljs0 enum: - launch_time - cpu - network_in - network_out - tag - attachments - volume_age - database_connections - instances - instance_ids - association_ids - region - in_use - total_connections - cloudchipr_ttl - provider_unique_identifier ResourceDetails: type: object description: A live resource's data. Additional type-specific fields (e.g. instance type, volume size) are present depending on the resource type. additionalProperties: true properties: resource_type: type: string id: type: string format: uuid provider_unique_identifier: type: string name: type: string region: type: string price_per_month: type: number created_at: type: string tags: type: array description: The resource's cloud tags, including any creator/owner tag items: type: object properties: key: type: string value: type: string creation_data: type: - object - 'null' description: Who created the resource and when, where CloudChipr could determine it properties: creator: type: string timestamp: type: string account: type: object description: The CloudChipr account owning the resource billing_cost: type: - object - 'null' listing_price: type: - object - 'null' forecasted_end_of_month: type: - number - 'null' billing_explorer_resource_identifier: type: array items: type: string Lb: type: object description: GCP load balancer properties: id: type: string format: uuid readOnly: true example: 05c5c3f5-60ee-43f1-af1d-0723fe440ab2 load_balancer_name: type: string example: test-backend-load-balancer-forwarding-rule price_per_month: type: number format: double type: type: string enum: - TCP global: type: boolean created_at: allOf: - {} - $ref: '#/components/schemas/Date' has_attachments: type: boolean tags: allOf: - {} - $ref: '#/components/schemas/Tags' region: type: - string - 'null' example: us-central1 link: type: string example: https://console.cloud.google.com/net-services/loadbalancing/advanced/forwardingRules/details/regions/us-central1/forwardingRules/test-backend-load-balancer-forwarding-rule?project=my-project required: - id - load_balancer_name - price_per_month - global - created_at - has_attachments - tags - link - type Sql: type: object description: GCP Sql instance properties: id: type: string format: uuid example: 696629a1-a09a-4d89-9315-2a80ce722062 readOnly: true multi_az: type: boolean price_per_month: type: number format: double example: 547.29 cpu_size: type: string example: '4' ram_size: type: string example: '26624' storage: type: string connections_by_hours: type: array items: $ref: '#/components/schemas/Metric' cpu: type: array items: $ref: '#/components/schemas/Metric' cpu_by_hours: type: array items: $ref: '#/components/schemas/Metric' connections: type: array items: $ref: '#/components/schemas/Metric' type: type: string example: MYSQL_8_0 created_at: allOf: - {} - $ref: '#/components/schemas/Date' region: type: string example: us-central1 tags: allOf: - {} - $ref: '#/components/schemas/Tags' link: example: https://console.cloud.google.com/sql/instances/test-instance/overview?project=my-project type: string required: - id - multi_az - price_per_month - cpu_size - ram_size - storage - connections_by_hours - cpu_by_hours - cpu - connections - type - created_at - region - tags - link FilterStatisticsType: type: string title: FilterStatisticsType enum: - sum - maximum - minimum - average Ebs: type: object description: AWS Ebs volume properties: id: type: string format: UUID readOnly: true example: d74d45ff-f686-4b2f-86c0-54d3801a236c volume_id: type: string example: vol-02d58dce2f4667172 size: type: string example: '1073741824' state: type: string example: available type: type: string example: gp2 price_per_month: type: number example: 0.1 availability_zone: type: string example: us-east-1a has_attachments: type: boolean example: true created_at: allOf: - {} - $ref: '#/components/schemas/Date' tags: type: array items: allOf: - {} - $ref: '#/components/schemas/Tags' description: List of tags region: type: string example: us-east-1 description: Region of ebs volume link: type: string example: https://console.aws.amazon.com/ec2/home?region=us-east-1#VolumeDetails:volumeId=vol-02d58dce2f4667172 required: - id - volume_id - size - state - type - price_per_month - availability_zone - has_attachments - created_at - tags - region - link Rds: type: object description: AWS Rds instance properties: id: type: string format: uuid readOnly: true example: 06e5e3ed-bfb4-4c9b-a500-4cfbee0d83fc db_id: type: string example: mysql-rds price_per_month: type: number format: double example: 195.84 instance_type: type: string example: db.t2.large storage_type: type: string example: gp2 connections_by_hours: type: array items: $ref: '#/components/schemas/Metric' cpu: type: array items: $ref: '#/components/schemas/Metric' cpu_by_hours: type: array items: $ref: '#/components/schemas/Metric' connections: type: array format: double items: $ref: '#/components/schemas/Metric' db_type: type: string example: mysql created_at: allOf: - {} - $ref: '#/components/schemas/Date' availability_zone: type: string example: us-west-2b status: type: string example: available region: type: string example: us-west-2 tags: allOf: - {} - $ref: '#/components/schemas/Tags' cluster_id: type: - string - 'null' nodes_count: type: - integer - 'null' example: 3 link: type: string example: https://console.aws.amazon.com/rds/home?region=$region#database:id=$dbId;is-cluster=false required: - id - db_id - price_per_month - instance_type - storage_type - connections_by_hours - cpu - cpu_by_hours - connections - db_type - created_at - availability_zone - region - tags - link - status - cluster_id - nodes_count examples: FilteredResourcesResponseExample: value: ebs: - id: d74d45ff-f686-4b2f-86c0-54d3801a236c volume_id: vol-02d58dce2f4667172 size: '1073741824' state: available type: gp2 price_per_month: 0.1 availability_zone: us-east-1a has_attachments: false created_at: '2023-01-30T07:40:15.188' tags: [] region: us-east-1 link: https://console.aws.amazon.com/ec2/home?region=us-east-1#VolumeDetails:volumeId=vol-02d58dce2f4667172 ec2: [] eip: - id: b8414855-8b25-436f-9364-16c5df2e960d ip: 44.199.21.179 allocation_id: eipalloc-0d32941e0f777d5aa association_id: null instance_id: null domain: vpc price_per_month: 3.6 created_at: '2023-01-30T07:45:26.347834' region: us-east-1 tags: [] link: https://console.aws.amazon.com/ec2/home?region=us-east-1#ElasticIpDetails:AllocationId=eipalloc-0d32941e0f777d5aa elb: - id: 6827374e-f877-4a17-802e-a7662ef9a600 load_balancer_name: lb-test load_balancer_arn: arn:aws:elasticloadbalancing:us-east-1:197857533772:loadbalancer/app/lb-test/9ea3b42ce6167896 dns_name: lb-test-1842671261.us-east-1.elb.amazonaws.com price_per_month: 16.2 has_attachments: false created_at: '2023-01-30T07:41:46.78' tags: [] type: application region: us-east-1 link: https://console.aws.amazon.com/ec2/home?region=us-east-1#LoadBalancer:loadBalancerArn=arn:aws:elasticloadbalancing:us-east-1:197857533772:loadbalancer/app/lb-test/9ea3b42ce6167896;tab=listeners rds: - id: ac07400b-e3c3-465c-a138-6d8943a18a3c db_id: test-single price_per_month: 12.24 instance_type: db.t3.micro storage_type: gp2 cpu: - timestamp: '2023-01-29T07:45:00Z' average: 3.556635830430985 minimum: 2.6 maximum: 24.725 sum: 366.33349053439144 unit: Percent connections: - timestamp: '2023-01-29T07:45:00Z' average: 0 minimum: 0 maximum: 0 sum: 0 unit: Count cpu_by_hours: [] connections_by_hours: [] db_type: mysql created_at: '2023-01-30T06:01:04.957' availability_zone: us-east-1a status: available tags: [] region: us-east-1 cluster_id: null nodes_count: 1 link: https://console.aws.amazon.com/rds/home?region=us-east-1#database:id=test-single;is-cluster=false;tab=connectivity elc: - id: 55349e79-f74a-476a-a947-795e8d2f4b25 cluster_id: mem-test instance_type: cache.r6g.large cache_type: memcached nodes_count: 1 cpu: [] connections: [] cpu_by_hours: [] connections_by_hours: [] created_at: '2023-01-30T07:45:26.347834' price_per_month: 148.32 region: us-east-1 tags: [] link: https://console.aws.amazon.com/elasticache/home?region=us-east-1#/memcached/mem-test - id: e111fff7-62ff-432a-ae11-d94e1020c984 cluster_id: redis-test instance_type: cache.r6g.large cache_type: redis nodes_count: 3 cpu: [] connections: [] cpu_by_hours: [] connections_by_hours: [] created_at: '2023-01-30T07:42:42.101' price_per_month: 444.96 region: us-east-1 tags: [] link: https://console.aws.amazon.com/elasticache/home?region=us-east-1#/redis/redis-test vm: [] lb: [] ip: [] disk: [] sql: [] securitySchemes: ApiKey: type: apiKey name: x-api-key in: header