Skip to content

Commit

Permalink
APPS-1398 Introduce routine status property and endpoints to manage it (
Browse files Browse the repository at this point in the history
#285)

* add endpoint

* generate openapi

* use routers

* add test

* run cancel on disabling

* bandwidth in mb

* dont schedule disabled routines

* add unittest

* add every second backup

* add yaml tag

* fix disabe/enable flags
  • Loading branch information
korotkov-aerospike authored Dec 17, 2024
1 parent 7e77999 commit 44c0c86
Show file tree
Hide file tree
Showing 12 changed files with 400 additions and 13 deletions.
11 changes: 9 additions & 2 deletions config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ backup-policies:
keepFilesPolicySlow:
parallel: 8
remove-files: KeepAll
bandwidth: 120000
bandwidth: 1
sealed: true
encryptedCompressedPolicy128:
parallel: 8
Expand Down Expand Up @@ -201,7 +201,7 @@ backup-routines:
namespaces: [ "source-ns15", "source-ns16", "source-ns17" ]
backup-policy: keepFilesPolicy
fullBackupSlow:
interval-cron: "*/20 * * * * *"
interval-cron: "@yearly"
source-cluster: absDefaultCluster
storage: local
namespaces: [ "source-ns13" ]
Expand Down Expand Up @@ -237,6 +237,13 @@ backup-routines:
storage: local
namespaces: [ "source-ns14" ]
backup-policy: keepFilesPolicy
everySecondBackup:
interval-cron: "* * * * * *"
source-cluster: absDefaultCluster
storage: local
namespaces: [ "source-ns20" ]
disabled: true
backup-policy: keepFilesPolicy

service:
logger:
Expand Down
68 changes: 68 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,70 @@ const docTemplate = `{
}
}
},
"/v1/config/routines/{name}/disable": {
"put": {
"tags": [
"Configuration"
],
"summary": "Disable a backup routine.",
"operationId": "disableRoutine",
"parameters": [
{
"type": "string",
"description": "The name of the backup routine.",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "Routine successfully disabled."
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"500": {
"description": "Unexpected error occurred.",
"schema": {
"type": "string"
}
}
}
}
},
"/v1/config/routines/{name}/enable": {
"put": {
"tags": [
"Configuration"
],
"summary": "Enable a backup routine.",
"operationId": "enableRoutine",
"parameters": [
{
"type": "string",
"description": "Backup routine name",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "Routine successfully enabled."
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/v1/config/storage": {
"get": {
"produces": [
Expand Down Expand Up @@ -1808,6 +1872,10 @@ const docTemplate = `{
"dataBin"
]
},
"disabled": {
"description": "Whether this routine is disabled and should not run.",
"type": "boolean"
},
"incr-interval-cron": {
"description": "The interval for incremental backup as a cron expression string (optional).",
"type": "string",
Expand Down
78 changes: 78 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,80 @@
"x-codegen-request-body-name" : "routine"
}
},
"/v1/config/routines/{name}/disable" : {
"put" : {
"operationId" : "disableRoutine",
"parameters" : [ {
"description" : "The name of the backup routine.",
"in" : "path",
"name" : "name",
"required" : true,
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"204" : {
"content" : { },
"description" : "Routine successfully disabled."
},
"404" : {
"content" : {
"*/*" : {
"schema" : {
"type" : "string"
}
}
},
"description" : "Not Found"
},
"500" : {
"content" : {
"*/*" : {
"schema" : {
"type" : "string"
}
}
},
"description" : "Unexpected error occurred."
}
},
"summary" : "Disable a backup routine.",
"tags" : [ "Configuration" ]
}
},
"/v1/config/routines/{name}/enable" : {
"put" : {
"operationId" : "enableRoutine",
"parameters" : [ {
"description" : "Backup routine name",
"in" : "path",
"name" : "name",
"required" : true,
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"204" : {
"content" : { },
"description" : "Routine successfully enabled."
},
"404" : {
"content" : {
"*/*" : {
"schema" : {
"type" : "string"
}
}
},
"description" : "Not Found"
}
},
"summary" : "Enable a backup routine.",
"tags" : [ "Configuration" ]
}
},
"/v1/config/storage" : {
"get" : {
"operationId" : "ReadAllStorage",
Expand Down Expand Up @@ -1994,6 +2068,10 @@
},
"type" : "array"
},
"disabled" : {
"description" : "Whether this routine is disabled and should not run.",
"type" : "boolean"
},
"incr-interval-cron" : {
"description" : "The interval for incremental backup as a cron expression string (optional).",
"example" : "*/10 * * * * *",
Expand Down
73 changes: 65 additions & 8 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,58 @@ paths:
tags:
- Configuration
x-codegen-request-body-name: routine
/v1/config/routines/{name}/disable:
put:
operationId: disableRoutine
parameters:
- description: The name of the backup routine.
in: path
name: name
required: true
schema:
type: string
responses:
"204":
content: {}
description: Routine successfully disabled.
"404":
content:
'*/*':
schema:
type: string
description: Not Found
"500":
content:
'*/*':
schema:
type: string
description: Unexpected error occurred.
summary: Disable a backup routine.
tags:
- Configuration
/v1/config/routines/{name}/enable:
put:
operationId: enableRoutine
parameters:
- description: Backup routine name
in: path
name: name
required: true
schema:
type: string
responses:
"204":
content: {}
description: Routine successfully enabled.
"404":
content:
'*/*':
schema:
type: string
description: Not Found
summary: Enable a backup routine.
tags:
- Configuration
/v1/config/storage:
get:
operationId: ReadAllStorage
Expand Down Expand Up @@ -1452,6 +1504,10 @@ components:
dto.BackupRoutine:
description: BackupRoutine represents a scheduled backup operation routine.
example:
bin-list:
- dataBin
secret-agent: sa
storage: aws
incr-interval-cron: '*/10 * * * * *'
set-list:
- set1
Expand All @@ -1463,11 +1519,8 @@ components:
- "...]]"
prefer-racks:
- 0
bin-list:
- dataBin
source-cluster: testCluster
secret-agent: sa
storage: aws
disabled: true
partition-list: 0-1000
namespaces:
- source-ns1
Expand All @@ -1484,6 +1537,9 @@ components:
items:
type: string
type: array
disabled:
description: Whether this routine is disabled and should not run.
type: boolean
incr-interval-cron:
description: The interval for incremental backup as a cron expression string
(optional).
Expand Down Expand Up @@ -1640,6 +1696,10 @@ components:
local-storage: "{}"
backup-routines:
key:
bin-list:
- dataBin
secret-agent: sa
storage: aws
incr-interval-cron: '*/10 * * * * *'
set-list:
- set1
Expand All @@ -1651,11 +1711,8 @@ components:
- "...]]"
prefer-racks:
- 0
bin-list:
- dataBin
source-cluster: testCluster
secret-agent: sa
storage: aws
disabled: true
partition-list: 0-1000
namespaces:
- source-ns1
Expand Down
Loading

0 comments on commit 44c0c86

Please sign in to comment.