Skip to content

Commit

Permalink
PMM-8322: Delete artifact from storage (#758)
Browse files Browse the repository at this point in the history
* PMM-8158: Delete artifact from storage

* rename field

* rename api

* rename endpoint

* add delete statuses

Co-authored-by: Artem Gavrilov <[email protected]>
  • Loading branch information
oter and artemgavrilov authored Jul 15, 2021
1 parent c29d5c0 commit eabde8d
Show file tree
Hide file tree
Showing 11 changed files with 944 additions and 90 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
/api/nginx/*.pem
/bin
/third_party

# System Files
.DS_Store
288 changes: 238 additions & 50 deletions api/managementpb/backup/artifacts.pb.go

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions api/managementpb/backup/artifacts.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions api/managementpb/backup/artifacts.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ enum BackupStatus {
BACKUP_STATUS_PAUSED = 3;
BACKUP_STATUS_SUCCESS = 4;
BACKUP_STATUS_ERROR = 5;
BACKUP_STATUS_DELETING = 6;
BACKUP_STATUS_FAILED_TO_DELETE = 7;
}

// Artifact represents single backup artifact.
Expand Down Expand Up @@ -48,6 +50,15 @@ message ListArtifactsResponse {
repeated Artifact artifacts = 1;
}

message DeleteArtifactRequest {
// Machine-readable artifact ID.
string artifact_id = 1;
// Removes all the backup files associated with artifact if flag is set.
bool remove_files = 2;
}

message DeleteArtifactResponse {}

// Artifacts service provides public methods for managing backup artifacts.
service Artifacts {
// ListArtifacts returns a list of all backup artifacts.
Expand All @@ -57,4 +68,11 @@ service Artifacts {
body: "*"
};
}
// DeleteArtifact deletes specified artifact.
rpc DeleteArtifact(DeleteArtifactRequest) returns (DeleteArtifactResponse) {
option (google.api.http) = {
post: "/v1/management/backup/Artifacts/Delete"
body: "*"
};
}
}
6 changes: 6 additions & 0 deletions api/managementpb/backup/artifacts.validator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 81 additions & 1 deletion api/managementpb/backup/json/backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,84 @@
"version": "v1beta1"
},
"paths": {
"/v1/management/backup/Artifacts/Delete": {
"post": {
"tags": [
"Artifacts"
],
"summary": "DeleteArtifact deletes specified artifact.",
"operationId": "DeleteArtifact",
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"artifact_id": {
"description": "Machine-readable artifact ID.",
"type": "string",
"x-order": 0
},
"remove_files": {
"description": "Removes all the backup files associated with artifact if flag is set.",
"type": "boolean",
"x-order": 1
}
}
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"type": "object"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"x-order": 1
},
"details": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type_url": {
"type": "string",
"x-order": 0
},
"value": {
"type": "string",
"format": "byte",
"x-order": 1
}
}
},
"x-order": 3
},
"error": {
"type": "string",
"x-order": 0
},
"message": {
"type": "string",
"x-order": 2
}
}
}
}
}
}
},
"/v1/management/backup/Artifacts/List": {
"post": {
"tags": [
Expand Down Expand Up @@ -101,7 +179,9 @@
"BACKUP_STATUS_IN_PROGRESS",
"BACKUP_STATUS_PAUSED",
"BACKUP_STATUS_SUCCESS",
"BACKUP_STATUS_ERROR"
"BACKUP_STATUS_ERROR",
"BACKUP_STATUS_DELETING",
"BACKUP_STATUS_FAILED_TO_DELETE"
],
"x-order": 8
},
Expand Down
35 changes: 35 additions & 0 deletions api/managementpb/backup/json/client/artifacts/artifacts_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eabde8d

Please sign in to comment.