Skip to content

Commit

Permalink
document openapi spec about binding configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
asalan316 committed Nov 26, 2024
1 parent a33ae80 commit 1fdc289
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 35 deletions.
4 changes: 2 additions & 2 deletions api/application-metric-api.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Application Metric API
description: |
List aggregated metrics of an application. AutoScaler collects the instances' metrics of an
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.
Expand All @@ -22,7 +22,7 @@ paths:
in: path
required: true
description: |
The GUID identifying the application for which the scaling history is fetched.
The GUID identifying the application for which the aggregated metric histories is fetched.
It can be found in the `application_id` property of the JSON object stored in the
`VCAP_APPLICATION` environment variable.
Expand Down
31 changes: 28 additions & 3 deletions api/policy-api.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ paths:
in: path
required: true
description: |
The GUID identifying the application for which the scaling history is fetched.
The GUID identifying the application for which the scaling policy is fetched.
It can be found in the `application_id` property of the JSON object stored in the
`VCAP_APPLICATION` environment variable.
schema:
$ref: "./shared_definitions.yaml#/schemas/GUID"
put:
summary: Retrieves the Policy
summary: Create the Policy
description: This API is used to create the policy
tags:
- Create Policy API V1
Expand Down Expand Up @@ -78,8 +78,16 @@ paths:
components:
schemas:
Policy:
description: Object containing Policy
description: Object containing policy and optional configuration
type: object
required:
- instance_min_count
- instance_max_count
anyOf:
- required:
- scaling_rules
- required:
- schedules
properties:
instance_min_count:
type: integer
Expand All @@ -95,6 +103,23 @@ components:
type: array
items:
$ref: '#/components/schemas/ScalingRule'
configuration:
type: object
properties:
custom_metrics:
type: object
properties:
metric_submission_strategy:
type: object
properties:
allow_from:
type: string
enum:
- bound_app
required:
- allow_from
required:
- metric_submission_strategy
ScalingRule:
type: object
required:
Expand Down
30 changes: 0 additions & 30 deletions src/autoscaler/api/publicapiserver/public_api_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,36 +139,6 @@ var _ = Describe("PublicApiHandler", func() {
}]
}
}`
invalidCustomMetricsConfigurationStr = `{
"configuration": {
"custom_metrics": {
"metric_submission_strategy": {
"allow_from": "invalid"
}
}
},
"instance_min_count": 1,
"instance_max_count": 5,
"scaling_rules": [{
"metric_type": "memoryused",
"breach_duration_secs": 300,
"threshold": 30,
"operator": ">",
"cool_down_secs": 300,
"adjustment": "-1"
}],
"schedules": {
"timezone": "Asia/Kolkata",
"recurring_schedule": [{
"start_time": "10:00",
"end_time": "18:00",
"days_of_week": [1, 2, 3],
"instance_min_count": 1,
"instance_max_count": 10,
"initial_min_instance_count": 5
}]
}
}`
)
var (
policydb *fakes.FakePolicyDB
Expand Down

0 comments on commit 1fdc289

Please sign in to comment.