feat: add API & override specs for template application (#144)

This commit is contained in:
Daniel Moran
2021-06-24 11:31:08 -04:00
committed by GitHub
parent 8972d23024
commit 1183d3780b
99 changed files with 13191 additions and 97 deletions

View File

@ -0,0 +1,37 @@
post:
operationId: ApplyTemplate
tags:
- Templates
summary: Apply or dry-run an InfluxDB Template
requestBody:
required: true
content:
application/json:
schema:
$ref: "../schemas/TemplateApply.yml"
responses:
"200":
description: >
Influx package dry-run successful, no new resources created.
The provided diff and summary will not have IDs for resources
that do not exist at the time of the dry run.
content:
application/json:
schema:
$ref: "../schemas/TemplateSummary.yml"
"201":
description: >
Influx package applied successfully. Newly created resources created
available in summary. The diff compares the state of the world before
the package is applied with the changes the application will impose.
This corresponds to `"dryRun": true`
content:
application/json:
schema:
$ref: "../schemas/TemplateSummary.yml"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../../openapi/src/common/schemas/Error.yml"

View File

@ -0,0 +1,30 @@
type: object
properties:
dryRun:
type: boolean
orgID:
type: string
stackID:
type: string
template:
$ref: "./TemplateApplyTemplate.yml"
templates:
type: array
items:
$ref: "./TemplateApplyTemplate.yml"
envRefs:
type: object
additionalProperties: true
secrets:
type: object
additionalProperties:
type: string
remotes:
type: array
items:
$ref: "./TemplateApplyRemoteRef.yml"
actions:
type: array
items:
$ref: "./TemplateApplyAction.yml"
required: [dryRun, orgID, templates, remotes, actions]

View File

@ -0,0 +1,13 @@
type: object
properties:
action:
$ref: "./TemplateApplyActionKind.yml"
properties:
type: object
properties:
kind:
type: string
resourceTemplateName:
type: string
required: [kind]
required: [action, properties]

View File

@ -0,0 +1,4 @@
type: string
enum:
- skipKind
- skipResource

View File

@ -0,0 +1,7 @@
type: object
properties:
url:
type: string
contentType:
type: string
required: [url]

View File

@ -0,0 +1,9 @@
type: object
properties:
sources:
type: array
items:
type: string
contents:
$ref: "./Template.yml"
required: [sources, contents]

View File

@ -9,5 +9,7 @@ properties:
properties:
name:
type: string
required: [name]
spec:
type: object
required: [apiVersion, kind, meta, spec]

View File

@ -0,0 +1,15 @@
type: object
properties:
resourceField:
type: string
description: Field the environment reference corresponds too
envRefKey:
type: string
description: Key identified as environment reference and is the key identified in the template
value:
description: Value provided to fulfill reference
nullable: true
defaultValue:
description: Default value that will be provided for the reference when no value is provided
nullable: true
required: [resourceField, envRefKey]

View File

@ -0,0 +1,17 @@
type: object
properties:
sources:
type: array
items:
type: string
stackID:
type: string
summary:
$ref: "./TemplateSummaryResources.yml"
diff:
$ref: "./TemplateSummaryDiff.yml"
errors:
type: array
items:
$ref: "./TemplateSummaryError.yml"
required: [sources, stackID, summary, diff, errors]

View File

@ -0,0 +1,16 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
id:
type: string
name:
type: string
description:
type: string
retentionPeriod:
type: integer
schemaType:
type: string
required: [id, name, retentionPeriod]

View File

@ -0,0 +1,11 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
id:
type: string
name:
type: string
description:
type: string
required: [id, name]

View File

@ -0,0 +1,9 @@
allOf:
- $ref: "./TemplateSummaryCore.yml"
- type: object
properties:
labelAssociations:
type: array
items:
$ref: "./TemplateSummaryLabel.yml"
required: [labelAssociations]

View File

@ -0,0 +1,11 @@
type: object
properties:
kind:
type: string
templateMetaName:
type: string
envReferences:
type: array
items:
$ref: "./TemplateEnvReference.yml"
required: [kind, tempateMetaName, envReferences]

View File

@ -0,0 +1,11 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
id:
type: "string"
name:
type: "string"
description:
type: "string"
required: [id, name]

View File

@ -0,0 +1,53 @@
type: object
properties:
buckets:
type: array
items:
$ref: "./TemplateSummaryDiffBucket.yml"
checks:
type: array
items:
$ref: "./TemplateSummaryDiffCheck.yml"
dashboards:
type: array
items:
$ref: "./TemplateSummaryDiffDashboard.yml"
labels:
type: array
items:
$ref: "./TemplateSummaryDiffLabel.yml"
labelMappings:
type: array
items:
$ref: "./TemplateSummaryLabelMapping.yml"
notificationEndpoints:
type: array
items:
$ref: "./TemplateSummaryDiffNotificationEndpoint.yml"
notificationRules:
type: array
items:
$ref: "./TemplateSummaryDiffNotificationRule.yml"
tasks:
type: array
items:
$ref: "./TemplateSummaryDiffTask.yml"
telegrafConfigs:
type: array
items:
$ref: "./TemplateSummaryDiffTelegraf.yml"
variables:
type: array
items:
$ref: "./TemplateSummaryDiffVariable.yml"
required:
- buckets
- checks
- dashboards
- labels
- labelMappings
- notificationEndpoints
- notificationRules
- tasks
- telegrafConfigs
- variables

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffBucketFields.yml"
old:
$ref: "./TemplateSummaryDiffBucketFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,9 @@
type: object
properties:
name:
type: string
description:
type: string
retentionRules:
$ref: "../../openapi/src/common/schemas/RetentionRules.yml"
required: [name, retentionRules]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffCheckFields.yml"
old:
$ref: "./TemplateSummaryDiffCheckFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,7 @@
type: object
properties:
name:
type: string
description:
type: string
required: [name]

View File

@ -0,0 +1,15 @@
type: object
properties:
stateStatus:
type: string
id:
type: string
kind:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffDashboardFields.yml"
old:
$ref: "./TemplateSummaryDiffDashboardFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,11 @@
type: object
properties:
name:
type: string
description:
type: string
charts:
type: array
items:
type: object
required: [name, charts]

View File

@ -0,0 +1,15 @@
type: object
properties:
stateStatus:
type: string
kind:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffLabelFields.yml"
old:
$ref: "./TemplateSummaryDiffLabelFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,9 @@
type: object
properties:
name:
type: string
color:
type: string
description:
type: string
required: [name, color]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffNotificationEndpointFields.yml"
old:
$ref: "./TemplateSummaryDiffNotificationEndpointFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,5 @@
type: object
properties:
name:
type: string
required: [name]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffNotificationRuleFields.yml"
old:
$ref: "./TemplateSummaryDiffNotificationRuleFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,19 @@
type: object
properties:
name:
type: string
description:
type: string
endpointName:
type: string
endpointID:
type: string
endpointType:
type: string
every:
type: string
offset:
type: string
messageTemplate:
type: string
required: [name, endpointName, endpointID, endpointType, every, offset]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffTaskFields.yml"
old:
$ref: "./TemplateSummaryDiffTaskFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,17 @@
type: object
properties:
name:
type: string
cron:
type: string
description:
type: string
every:
type: string
offset:
type: string
query:
type: string
status:
type: string
required: [name, status]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryTelegrafConfig.yml"
old:
$ref: "./TemplateSummaryTelegrafConfig.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
stateStatus:
type: string
id:
type: string
templateMetaName:
type: string
new:
$ref: "./TemplateSummaryDiffVariableFields.yml"
old:
$ref: "./TemplateSummaryDiffVariableFields.yml"
required: [kind, stateStatus, id, templateMetaName]

View File

@ -0,0 +1,9 @@
type: object
properties:
name:
type: string
description:
type: string
args:
$ref: "./TemplateSummaryVariableArgs.yml"
required: [name, args]

View File

@ -0,0 +1,15 @@
type: object
properties:
kind:
type: string
reason:
type: string
fields:
type: array
items:
type: string
indexes:
type: array
items:
type: integer
required: [kind, reason, fields, indexes]

View File

@ -0,0 +1,19 @@
allOf:
- $ref: "./TemplateSummaryCore.yml"
- type: object
properties:
id:
type: string
orgID:
type: string
name:
type: string
properties:
type: object
properties:
color:
type: string
description:
type: string
required: [color]
required: [id, name, properties]

View File

@ -0,0 +1,27 @@
type: object
properties:
status:
type: string
resourceTemplateMetaName:
type: string
resourceName:
type: string
resourceID:
type: string
resourceType:
type: string
labelTemplateMetaName:
type: string
labelName:
type: string
labelID:
type: string
required:
- status
- resourceTemplateMetaName
- resourceName
- resourceID
- resourceType
- labelTemplateMetaName
- labelName
- labelID

View File

@ -0,0 +1,13 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
id:
type: string
name:
type: string
description:
type: string
status:
type: string
required: [id, name, status]

View File

@ -0,0 +1,19 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
name:
type: string
description:
type: string
endpointTemplateMetaName:
type: string
endpointID:
type: string
endpointType:
type: string
every:
type: string
offset:
type: string
required: [name, endpointTemplateMetaName, endpointID, endpointType, every, offset]

View File

@ -0,0 +1,63 @@
type: object
properties:
buckets:
type: array
items:
$ref: "./TemplateSummaryBucket.yml"
checks:
type: array
items:
$ref: "./TemplateSummaryCheck.yml"
dashboards:
type: array
items:
$ref: "./TemplateSummaryDashboard.yml"
labels:
type: array
items:
$ref: "./TemplateSummaryLabel.yml"
labelMappings:
type: array
items:
$ref: "./TemplateSummaryLabelMapping.yml"
missingEnvRefs:
type: array
items:
type: string
missingSecrets:
type: array
items:
type: string
notificationEndpoints:
type: array
items:
$ref: "./TemplateSummaryNotificationEndpoint.yml"
notificationRules:
type: array
items:
$ref: "./TemplateSummaryNotificationRule.yml"
tasks:
type: array
items:
$ref: "./TemplateSummaryTask.yml"
telegrafConfigs:
type: array
items:
$ref: "./TemplateSummaryTelegraf.yml"
variables:
type: array
items:
$ref: "./TemplateSummaryVariable.yml"
required:
- buckets
- checks
- dashboards
- labels
- labelMappings
- missingEnvRefs
- missingSecrets
- notificationEndpoints
- notificationRules
- tasks
- telegrafConfigs
- variables

View File

@ -0,0 +1,17 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
id:
type: string
name:
type: string
description:
type: string
cron:
type: string
every:
type: string
offset:
type: string
required: [id, name]

View File

@ -0,0 +1,7 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
telegrafConfig:
$ref: "./TemplateSummaryTelegrafConfig.yml"
required: [telegrafConfig]

View File

@ -0,0 +1,9 @@
type: object
properties:
id:
type: string
name:
type: string
description:
type: string
required: [id, name]

View File

@ -0,0 +1,13 @@
allOf:
- $ref: "./TemplateSummaryCommon.yml"
- type: object
properties:
id:
type: string
name:
type: string
description:
type: string
arguments:
$ref: "./TemplateSummaryVariableArgs.yml"
required: [id, name, arguments]

View File

@ -0,0 +1,6 @@
type: object
properties:
type:
type: string
required: [type]
additionalProperties: true