feat: update codegen to include legacy backup/restore routes (#182)
This commit is contained in:
parent
3ca681b1dd
commit
4452aac87d
@ -27,6 +27,19 @@ var (
|
||||
|
||||
type BackupApi interface {
|
||||
|
||||
/*
|
||||
* GetBackupKV Download snapshot of metadata stored in the server's embedded KV store. Should not be used in versions > 2.1.x, as it doesn't include metadata stored in embedded SQL.
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @return ApiGetBackupKVRequest
|
||||
*/
|
||||
GetBackupKV(ctx _context.Context) ApiGetBackupKVRequest
|
||||
|
||||
/*
|
||||
* GetBackupKVExecute executes the request
|
||||
* @return *os.File
|
||||
*/
|
||||
GetBackupKVExecute(r ApiGetBackupKVRequest) (*_nethttp.Response, error)
|
||||
|
||||
/*
|
||||
* GetBackupMetadata Download snapshot of all metadata in the server
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@ -78,6 +91,129 @@ func (a *BackupApiService) OnlyCloud() BackupApi {
|
||||
return a
|
||||
}
|
||||
|
||||
type ApiGetBackupKVRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService BackupApi
|
||||
zapTraceSpan *string
|
||||
}
|
||||
|
||||
func (r ApiGetBackupKVRequest) ZapTraceSpan(zapTraceSpan string) ApiGetBackupKVRequest {
|
||||
r.zapTraceSpan = &zapTraceSpan
|
||||
return r
|
||||
}
|
||||
func (r ApiGetBackupKVRequest) GetZapTraceSpan() *string {
|
||||
return r.zapTraceSpan
|
||||
}
|
||||
|
||||
func (r ApiGetBackupKVRequest) Execute() (*_nethttp.Response, error) {
|
||||
return r.ApiService.GetBackupKVExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* GetBackupKV Download snapshot of metadata stored in the server's embedded KV store. Should not be used in versions > 2.1.x, as it doesn't include metadata stored in embedded SQL.
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @return ApiGetBackupKVRequest
|
||||
*/
|
||||
func (a *BackupApiService) GetBackupKV(ctx _context.Context) ApiGetBackupKVRequest {
|
||||
return ApiGetBackupKVRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return *os.File
|
||||
*/
|
||||
func (a *BackupApiService) GetBackupKVExecute(r ApiGetBackupKVRequest) (*_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodGet
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue *_nethttp.Response
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupApiService.GetBackupKV")
|
||||
if err != nil {
|
||||
return localVarReturnValue, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/backup/kv"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/octet-stream", "application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
if r.zapTraceSpan != nil {
|
||||
localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "")
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
var errorPrefix string
|
||||
if a.isOnlyOSS {
|
||||
errorPrefix = "InfluxDB OSS-only command failed: "
|
||||
} else if a.isOnlyCloud {
|
||||
errorPrefix = "InfluxDB Cloud-only command failed: "
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
||||
if err != nil {
|
||||
body.Close()
|
||||
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
|
||||
}
|
||||
localVarBody, err := _ioutil.ReadAll(body)
|
||||
body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
|
||||
}
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: _fmt.Sprintf("%s%s", errorPrefix, localVarHTTPResponse.Status),
|
||||
}
|
||||
var v Error
|
||||
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
|
||||
newErr.model = &v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
localVarReturnValue = localVarHTTPResponse
|
||||
|
||||
return localVarReturnValue, nil
|
||||
}
|
||||
|
||||
type ApiGetBackupMetadataRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService BackupApi
|
||||
|
@ -27,6 +27,20 @@ var (
|
||||
|
||||
type RestoreApi interface {
|
||||
|
||||
/*
|
||||
* PostRestoreBucketID Overwrite storage metadata for a bucket with shard info from a backup.
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The bucket ID.
|
||||
* @return ApiPostRestoreBucketIDRequest
|
||||
*/
|
||||
PostRestoreBucketID(ctx _context.Context, bucketID string) ApiPostRestoreBucketIDRequest
|
||||
|
||||
/*
|
||||
* PostRestoreBucketIDExecute executes the request
|
||||
* @return string
|
||||
*/
|
||||
PostRestoreBucketIDExecute(r ApiPostRestoreBucketIDRequest) (string, error)
|
||||
|
||||
/*
|
||||
* PostRestoreBucketMetadata Create a new bucket pre-seeded with shard info from a backup.
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@ -101,6 +115,184 @@ func (a *RestoreApiService) OnlyCloud() RestoreApi {
|
||||
return a
|
||||
}
|
||||
|
||||
type ApiPostRestoreBucketIDRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService RestoreApi
|
||||
bucketID string
|
||||
body []byte
|
||||
zapTraceSpan *string
|
||||
contentType *string
|
||||
}
|
||||
|
||||
func (r ApiPostRestoreBucketIDRequest) BucketID(bucketID string) ApiPostRestoreBucketIDRequest {
|
||||
r.bucketID = bucketID
|
||||
return r
|
||||
}
|
||||
func (r ApiPostRestoreBucketIDRequest) GetBucketID() string {
|
||||
return r.bucketID
|
||||
}
|
||||
|
||||
func (r ApiPostRestoreBucketIDRequest) Body(body []byte) ApiPostRestoreBucketIDRequest {
|
||||
r.body = body
|
||||
return r
|
||||
}
|
||||
func (r ApiPostRestoreBucketIDRequest) GetBody() []byte {
|
||||
return r.body
|
||||
}
|
||||
|
||||
func (r ApiPostRestoreBucketIDRequest) ZapTraceSpan(zapTraceSpan string) ApiPostRestoreBucketIDRequest {
|
||||
r.zapTraceSpan = &zapTraceSpan
|
||||
return r
|
||||
}
|
||||
func (r ApiPostRestoreBucketIDRequest) GetZapTraceSpan() *string {
|
||||
return r.zapTraceSpan
|
||||
}
|
||||
|
||||
func (r ApiPostRestoreBucketIDRequest) ContentType(contentType string) ApiPostRestoreBucketIDRequest {
|
||||
r.contentType = &contentType
|
||||
return r
|
||||
}
|
||||
func (r ApiPostRestoreBucketIDRequest) GetContentType() *string {
|
||||
return r.contentType
|
||||
}
|
||||
|
||||
func (r ApiPostRestoreBucketIDRequest) Execute() (string, error) {
|
||||
return r.ApiService.PostRestoreBucketIDExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* PostRestoreBucketID Overwrite storage metadata for a bucket with shard info from a backup.
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The bucket ID.
|
||||
* @return ApiPostRestoreBucketIDRequest
|
||||
*/
|
||||
func (a *RestoreApiService) PostRestoreBucketID(ctx _context.Context, bucketID string) ApiPostRestoreBucketIDRequest {
|
||||
return ApiPostRestoreBucketIDRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
bucketID: bucketID,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return string
|
||||
*/
|
||||
func (a *RestoreApiService) PostRestoreBucketIDExecute(r ApiPostRestoreBucketIDRequest) (string, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodPost
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RestoreApiService.PostRestoreBucketID")
|
||||
if err != nil {
|
||||
return localVarReturnValue, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/restore/bucket/{bucketID}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
if r.body == nil {
|
||||
return localVarReturnValue, reportError("body is required and must be specified")
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"text/plain"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
if r.zapTraceSpan != nil {
|
||||
localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "")
|
||||
}
|
||||
if r.contentType != nil {
|
||||
localVarHeaderParams["Content-Type"] = parameterToString(*r.contentType, "")
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.body
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, err
|
||||
}
|
||||
|
||||
var errorPrefix string
|
||||
if a.isOnlyOSS {
|
||||
errorPrefix = "InfluxDB OSS-only command failed: "
|
||||
} else if a.isOnlyCloud {
|
||||
errorPrefix = "InfluxDB Cloud-only command failed: "
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
||||
if err != nil {
|
||||
body.Close()
|
||||
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
|
||||
}
|
||||
localVarBody, err := _ioutil.ReadAll(body)
|
||||
body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
|
||||
}
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: _fmt.Sprintf("%s%s", errorPrefix, localVarHTTPResponse.Status),
|
||||
}
|
||||
var v Error
|
||||
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
|
||||
newErr.model = &v
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
||||
if err != nil {
|
||||
body.Close()
|
||||
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
|
||||
}
|
||||
localVarBody, err := _ioutil.ReadAll(body)
|
||||
body.Close()
|
||||
if err != nil {
|
||||
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
|
||||
}
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: _fmt.Sprintf("%s%s", errorPrefix, err.Error()),
|
||||
}
|
||||
return localVarReturnValue, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, nil
|
||||
}
|
||||
|
||||
type ApiPostRestoreBucketMetadataRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService RestoreApi
|
||||
|
@ -57,6 +57,8 @@ paths:
|
||||
$ref: "./openapi/src/common/paths/tasks_taskID_logs.yml"
|
||||
/tasks/{taskID}/runs/{runID}/logs:
|
||||
$ref: "./openapi/src/common/paths/tasks_taskID_runs_runID_logs.yml"
|
||||
/backup/kv:
|
||||
$ref: "./openapi/src/oss/paths/backup_kv.yml"
|
||||
/backup/metadata:
|
||||
$ref: "./overrides/paths/backup_metadata.yml"
|
||||
/backup/shards/{shardID}:
|
||||
@ -65,6 +67,8 @@ paths:
|
||||
$ref: "./openapi/src/oss/paths/restore_kv.yml"
|
||||
/restore/sql:
|
||||
$ref: "./openapi/src/oss/paths/restore_sql.yml"
|
||||
/restore/bucket/{bucketID}:
|
||||
$ref: "./openapi/src/oss/paths/restore_bucket_bucketID.yml"
|
||||
/restore/bucket-metadata:
|
||||
$ref: "./openapi/src/oss/paths/restore_bucket-metadata.yml"
|
||||
/restore/shards/{shardID}:
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 99b90ac05ae3c57ac06e50fca5dca8608c9f6346
|
||||
Subproject commit 0bd5f47ad999b4b47e6de316834ac5c4b25e8db5
|
@ -26,6 +26,8 @@ type Task struct {
|
||||
Org *string `json:"org,omitempty" yaml:"org,omitempty"`
|
||||
// The name of the task.
|
||||
Name string `json:"name" yaml:"name"`
|
||||
// The ID of the user who owns this Task.
|
||||
OwnerID *string `json:"ownerID,omitempty" yaml:"ownerID,omitempty"`
|
||||
// An optional description of the task.
|
||||
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"`
|
||||
@ -206,6 +208,38 @@ func (o *Task) SetName(v string) {
|
||||
o.Name = v
|
||||
}
|
||||
|
||||
// GetOwnerID returns the OwnerID field value if set, zero value otherwise.
|
||||
func (o *Task) GetOwnerID() string {
|
||||
if o == nil || o.OwnerID == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.OwnerID
|
||||
}
|
||||
|
||||
// GetOwnerIDOk returns a tuple with the OwnerID field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Task) GetOwnerIDOk() (*string, bool) {
|
||||
if o == nil || o.OwnerID == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.OwnerID, true
|
||||
}
|
||||
|
||||
// HasOwnerID returns a boolean if a field has been set.
|
||||
func (o *Task) HasOwnerID() bool {
|
||||
if o != nil && o.OwnerID != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetOwnerID gets a reference to the given string and assigns it to the OwnerID field.
|
||||
func (o *Task) SetOwnerID(v string) {
|
||||
o.OwnerID = &v
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *Task) GetDescription() string {
|
||||
if o == nil || o.Description == nil {
|
||||
@ -663,6 +697,9 @@ func (o Task) MarshalJSON() ([]byte, error) {
|
||||
if true {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
if o.OwnerID != nil {
|
||||
toSerialize["ownerID"] = o.OwnerID
|
||||
}
|
||||
if o.Description != nil {
|
||||
toSerialize["description"] = o.Description
|
||||
}
|
||||
|
@ -36,6 +36,35 @@ func (m *MockBackupApi) EXPECT() *MockBackupApiMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetBackupKV mocks base method.
|
||||
func (m *MockBackupApi) GetBackupKV(arg0 context.Context) api.ApiGetBackupKVRequest {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetBackupKV", arg0)
|
||||
ret0, _ := ret[0].(api.ApiGetBackupKVRequest)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetBackupKV indicates an expected call of GetBackupKV.
|
||||
func (mr *MockBackupApiMockRecorder) GetBackupKV(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBackupKV", reflect.TypeOf((*MockBackupApi)(nil).GetBackupKV), arg0)
|
||||
}
|
||||
|
||||
// GetBackupKVExecute mocks base method.
|
||||
func (m *MockBackupApi) GetBackupKVExecute(arg0 api.ApiGetBackupKVRequest) (*http.Response, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetBackupKVExecute", arg0)
|
||||
ret0, _ := ret[0].(*http.Response)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBackupKVExecute indicates an expected call of GetBackupKVExecute.
|
||||
func (mr *MockBackupApiMockRecorder) GetBackupKVExecute(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBackupKVExecute", reflect.TypeOf((*MockBackupApi)(nil).GetBackupKVExecute), arg0)
|
||||
}
|
||||
|
||||
// GetBackupMetadata mocks base method.
|
||||
func (m *MockBackupApi) GetBackupMetadata(arg0 context.Context) api.ApiGetBackupMetadataRequest {
|
||||
m.ctrl.T.Helper()
|
||||
|
Loading…
x
Reference in New Issue
Block a user