Skip to content

Commit

Permalink
Fixes in the specification checked by swagger-cli;
Browse files Browse the repository at this point in the history
  • Loading branch information
joergdw committed Jul 12, 2023
1 parent f2124fa commit f9020ce
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 218 deletions.
88 changes: 27 additions & 61 deletions api/application-metric-api.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
openapi: 3.1.0
openapi: 3.0.0
info:
title: Application Metric API
description: |
List aggregated metrics of an application. AutoScaler collects the instances' metrics of an application,
and aggregate the raw data into an accumulated value for evaluation.
List aggregated metrics of an application. AutoScaler collects the instances' metrics of an
application, and aggregate the raw data into an accumulated value for evaluation.
This API is used to return the aggregated metric result of an application.
version: 1.0.0
security: # Do we need that?
#- mtls: []
- basicAuthentication: []
# - mtls: []
- basicAuthentication: []
tags:
- name: Application Metric API V1
description: List instance metrics of an application.
description: List aggregated metrics of an application.

paths:
/v1/apps/{guid}/aggregated_metric_histories/{metric_type}:
Expand All @@ -25,20 +26,12 @@ paths:
It can be found in the `application_id` property of the JSON object stored in the
`VCAP_APPLICATION` environment variable.
schema:
# type: string
# pattern: (\d|[a-f]){8}-(\d|[a-f]){4}-(\d|[a-f]){4}-(\d|[a-f]){4}-(\d|[a-f]){12}
# example: 8d0cee08-23ad-4813-a779-ad8118ea0b91
$ref: "./shared_definitions.yaml#/schemas/GUID"
$ref: "./shared_definitions.yaml#/schemas/GUID"
- name: metric_type
in: path
required: true
description: The metric type
schema:
# description: |
# One user-defined custom metric type or one of the system-default metric types, which are:
# "memoryused", "memoryutil", "responsetime", "throughput" and "cpu"
# type: string
# example: memoryused
$ref: "./shared_definitions.yaml#/schemas/metric_type"
- name: start-time
in: query
Expand Down Expand Up @@ -67,7 +60,7 @@ paths:
example: order-direction=desc
- name: page
in: query
description: The page number to query
description: The page number to query.
schema:
type: integer
minimum: 1 # Or Should it be "1"?
Expand All @@ -81,16 +74,16 @@ paths:
minimum: 0 # Or Should it be "1"?
default: 50
example: results-per-page=10
#- name: Authorization
#in: header
#schema:
#type: string
#example: |
#bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQwOCIsImVtYWlsIjoiZW1haWwtMzAzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NzF9.RMJZvSzCSxpj4jjZBmzbO7eoSfTAcIWVSHqFu5\_Iu\_o
# - name: Authorization
# in: header
# schema:
# type: string
# example: |
# bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTQwOCIsImVtYWlsIjoiZW1haWwtMzAzQHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0NDU1NTc5NzF9.RMJZvSzCSxpj4jjZBmzbO7eoSfTAcIWVSHqFu5\_Iu\_o
get:
summary: Retrieves the instance metrics of an application
summary: Retrieves the instance metrics of an application.
description: |
Use to retrieve instance metrics of an application
Use to retrieve instance metrics of an application.
tags:
- Application Metric API V1
responses:
Expand All @@ -101,35 +94,20 @@ paths:
schema:
$ref: "#/components/schemas/Application_Metrics"
default:
# description: |
# Error, the response body may contain further information.
# content:
# application/json:
# schema:
# $ref: "#/components/schemas/ErrorResponse"
$ref: "./shared_definitions.yaml#/responses/Error"
$ref: "./shared_definitions.yaml#/responses/Error"
security:
- basicAuthentication: []
x-codegen-request-body-name: body
components:
schemas:
ErrorResponse:
type: object
properties:
code:
type: string
description: The textual error code.
message:
type: string
description: The message describing the cause of the error.
Application_Metrics:
description: Object containing Application Metrics.
description: Object containing Application Metrics
type: object
properties:
total_results:
type: integer
format: int64
description: Number of history entries found for the given query.
description: Number of history entries found for the given query
example: 2
total_pages:
type: integer
Expand All @@ -139,7 +117,7 @@ components:
page:
type: integer
format: int64
description: Number of the current page.
description: Number of the current page
example: 1
prev_url:
type: string
Expand All @@ -152,19 +130,12 @@ components:
items:
$ref: '#/components/schemas/ApplicationMetric'
ApplicationMetric:
description: Object containing metric history
description: Object containing metric history
type: object
properties:
app_guid:
description: |
Identificator used by Cloud Foundry for entities.

Anything is an entity. Apps, services, service-bindings, …
schema:
# type: string
# pattern: (\d|[a-f]){8}-(\d|[a-f]){4}-(\d|[a-f]){4}-(\d|[a-f]){4}-(\d|[a-f]){12}
# example: 8d0cee08-23ad-4813-a779-ad8118ea0b91
$ref: "./shared_definitions.yaml#/schemas/GUID"
$ref: "./shared_definitions.yaml#/schemas/GUID"
instanceIndex:
type: integer
description: Application Metric #TODO
Expand All @@ -179,21 +150,16 @@ components:
description: |
The time at which the metrics were collected in the number of nanoseconds
example: 1494989539138350000
metric_type:
# description: |
# One user-defined custom metric type or one of the system-default metric types, which are:
# "memoryused", "memoryutil", "responsetime", "throughput" and "cpu"
# type: string
# example: memoryused
schema:
$ref: "./shared_definitions.yaml#/schemas/metric_type"
metric_type:

$ref: "./shared_definitions.yaml#/schemas/metric_type"
value:
type: integer
description: |
The value of metric type to be returned as the aggregated metric result of an application
example: 400
unit:
type: string
type: string
example: megabytes
securitySchemes:
basicAuthentication:
Expand Down
38 changes: 12 additions & 26 deletions api/custom-metrics-api.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
openapi: 3.1.0
openapi: 3.0.0
info:
title: app-autoscaler custom metrics API
description: |
app-autoscaler lets you automatically increase or decrease the number of your application instances based on the policies you have defined. Your applications can call the app-autoscaler custom metrics API to submit custom metrics defined and used in a dynamic scaling policy to enable automatic scaling based on application-specific metrics.
version: 1.0.0
security:
- mtls: []
# - mtls: []
- basicAuthentication: []
tags:
- name: Custom Metrics API V1
Expand All @@ -17,18 +17,21 @@ paths:
- in: path
name: appGuid
description: |
The GUID identifying the application for which the scaling history is fetched.
The GUID identifying the application for which the metrics are fetched.
It can be found in the `application_id` property of the JSON object stored in the
`VCAP_APPLICATION` environment variable.
example: 58d162ad-87d5-4f52-8abf-e56a63a67292
required: true
schema:
# type: string
$ref: "shared_definitions.yaml#/schemas/GUID"
$ref: "./shared_definitions.yaml#/schemas/GUID"
post:
summary: Submits application-specific custom metrics to app-autoscaler.
description: |
Use to submit custom metrics to app-autoscaler which are defined and used in a dynamic scaling policy to enable automatic scaling based on application-specific metrics. We recommend submitting the custom metrics every 40 seconds from every application instance.
Use to submit custom metrics to app-autoscaler which are defined and used in a dynamic
scaling policy to enable automatic scaling based on application-specific metrics.
We recommend submitting the custom metrics every 40 seconds from every application instance.
tags:
- Custom Metrics API V1
requestBody:
Expand All @@ -47,14 +50,6 @@ paths:
- mtls: []
x-codegen-request-body-name: body
components:
responses:
Error:
description: |
Error, the response body may contain further information.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
Metrics:
required:
Expand Down Expand Up @@ -90,19 +85,10 @@ components:
type: string
description: An optional unit for the metric, for display purposes only.
example: jobs
ErrorResponse:
type: object
properties:
code:
type: string
description: The textual error code.
message:
type: string
description: The message describing the cause of the error.
securitySchemes:
mtls:
type: mutualTLS
description: Use the Instance Identity Credentials provided by the Cloud Foundry runtime
# mtls:
# type: mutualTLS
# description: Use the Instance Identity Credentials provided by the Cloud Foundry runtime
basicAuthentication:
type: http
scheme: basic
Loading

0 comments on commit f9020ce

Please sign in to comment.