diff --git a/api/api_backup.gen.go b/api/api_backup.gen.go new file mode 100644 index 0000000..4cc7f06 --- /dev/null +++ b/api/api_backup.gen.go @@ -0,0 +1,376 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + _gzip "compress/gzip" + _context "context" + _io "io" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + "time" +) + +// Linger please +var ( + _ _context.Context +) + +type BackupApi interface { + + /* + * 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(). + * @return ApiGetBackupMetadataRequest + */ + GetBackupMetadata(ctx _context.Context) ApiGetBackupMetadataRequest + + /* + * GetBackupMetadataExecute executes the request + * @return MetadataBackup + */ + GetBackupMetadataExecute(r ApiGetBackupMetadataRequest) (MetadataBackup, error) + + /* + * GetBackupShardId Download snapshot of all TSM data in a shard + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param shardID The shard ID. + * @return ApiGetBackupShardIdRequest + */ + GetBackupShardId(ctx _context.Context, shardID int64) ApiGetBackupShardIdRequest + + /* + * GetBackupShardIdExecute executes the request + * @return *os.File + */ + GetBackupShardIdExecute(r ApiGetBackupShardIdRequest) (_io.ReadCloser, error) +} + +// backupApiGzipReadCloser supports streaming gzip response-bodies directly from the server. +type backupApiGzipReadCloser struct { + underlying _io.ReadCloser + gzip _io.ReadCloser +} + +func (gzrc *backupApiGzipReadCloser) Read(p []byte) (int, error) { + return gzrc.gzip.Read(p) +} +func (gzrc *backupApiGzipReadCloser) Close() error { + if err := gzrc.gzip.Close(); err != nil { + return err + } + return gzrc.underlying.Close() +} + +// BackupApiService BackupApi service +type BackupApiService service + +type ApiGetBackupMetadataRequest struct { + ctx _context.Context + ApiService BackupApi + zapTraceSpan *string + acceptEncoding *string +} + +func (r ApiGetBackupMetadataRequest) ZapTraceSpan(zapTraceSpan string) ApiGetBackupMetadataRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiGetBackupMetadataRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiGetBackupMetadataRequest) AcceptEncoding(acceptEncoding string) ApiGetBackupMetadataRequest { + r.acceptEncoding = &acceptEncoding + return r +} +func (r ApiGetBackupMetadataRequest) GetAcceptEncoding() *string { + return r.acceptEncoding +} + +func (r ApiGetBackupMetadataRequest) Execute() (MetadataBackup, error) { + return r.ApiService.GetBackupMetadataExecute(r) +} + +/* + * 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(). + * @return ApiGetBackupMetadataRequest + */ +func (a *BackupApiService) GetBackupMetadata(ctx _context.Context) ApiGetBackupMetadataRequest { + return ApiGetBackupMetadataRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return MetadataBackup + */ +func (a *BackupApiService) GetBackupMetadataExecute(r ApiGetBackupMetadataRequest) (MetadataBackup, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue MetadataBackup + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupApiService.GetBackupMetadata") + if err != nil { + return localVarReturnValue, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backup/metadata" + + 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{"multipart/mixed", "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.acceptEncoding != nil { + localVarHeaderParams["Accept-Encoding"] = parameterToString(*r.acceptEncoding, "") + } + 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 body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return localVarReturnValue, err + } + body = &backupApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return localVarReturnValue, err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, newErr + } + newErr.model = &v + return localVarReturnValue, newErr + } + + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return localVarReturnValue, err + } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetBackupShardIdRequest struct { + ctx _context.Context + ApiService BackupApi + shardID int64 + zapTraceSpan *string + acceptEncoding *string + since *time.Time +} + +func (r ApiGetBackupShardIdRequest) ShardID(shardID int64) ApiGetBackupShardIdRequest { + r.shardID = shardID + return r +} +func (r ApiGetBackupShardIdRequest) GetShardID() int64 { + return r.shardID +} + +func (r ApiGetBackupShardIdRequest) ZapTraceSpan(zapTraceSpan string) ApiGetBackupShardIdRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiGetBackupShardIdRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiGetBackupShardIdRequest) AcceptEncoding(acceptEncoding string) ApiGetBackupShardIdRequest { + r.acceptEncoding = &acceptEncoding + return r +} +func (r ApiGetBackupShardIdRequest) GetAcceptEncoding() *string { + return r.acceptEncoding +} + +func (r ApiGetBackupShardIdRequest) Since(since time.Time) ApiGetBackupShardIdRequest { + r.since = &since + return r +} +func (r ApiGetBackupShardIdRequest) GetSince() *time.Time { + return r.since +} + +func (r ApiGetBackupShardIdRequest) Execute() (_io.ReadCloser, error) { + return r.ApiService.GetBackupShardIdExecute(r) +} + +/* + * GetBackupShardId Download snapshot of all TSM data in a shard + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param shardID The shard ID. + * @return ApiGetBackupShardIdRequest + */ +func (a *BackupApiService) GetBackupShardId(ctx _context.Context, shardID int64) ApiGetBackupShardIdRequest { + return ApiGetBackupShardIdRequest{ + ApiService: a, + ctx: ctx, + shardID: shardID, + } +} + +/* + * Execute executes the request + * @return *os.File + */ +func (a *BackupApiService) GetBackupShardIdExecute(r ApiGetBackupShardIdRequest) (_io.ReadCloser, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue _io.ReadCloser + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupApiService.GetBackupShardId") + if err != nil { + return localVarReturnValue, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/backup/shards/{shardID}" + localVarPath = strings.Replace(localVarPath, "{"+"shardID"+"}", _neturl.PathEscape(parameterToString(r.shardID, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.since != nil { + localVarQueryParams.Add("since", parameterToString(*r.since, "")) + } + // 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, "") + } + if r.acceptEncoding != nil { + localVarHeaderParams["Accept-Encoding"] = parameterToString(*r.acceptEncoding, "") + } + 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 body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return localVarReturnValue, err + } + body = &backupApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return localVarReturnValue, err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, newErr + } + newErr.model = &v + return localVarReturnValue, newErr + } + + localVarReturnValue = body + + return localVarReturnValue, nil +} diff --git a/api/api_restore.gen.go b/api/api_restore.gen.go new file mode 100644 index 0000000..841731b --- /dev/null +++ b/api/api_restore.gen.go @@ -0,0 +1,696 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + _gzip "compress/gzip" + _context "context" + _io "io" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "os" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +type RestoreApi interface { + + /* + * PostRestoreBucketMetadataId 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(). + * @param bucketID The bucket ID. + * @return ApiPostRestoreBucketMetadataIdRequest + */ + PostRestoreBucketMetadataId(ctx _context.Context, bucketID string) ApiPostRestoreBucketMetadataIdRequest + + /* + * PostRestoreBucketMetadataIdExecute executes the request + * @return []BucketShardMapping + */ + PostRestoreBucketMetadataIdExecute(r ApiPostRestoreBucketMetadataIdRequest) ([]BucketShardMapping, error) + + /* + * PostRestoreKV Overwrite the embedded KV store on the server with a backed-up snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostRestoreKVRequest + */ + PostRestoreKV(ctx _context.Context) ApiPostRestoreKVRequest + + /* + * PostRestoreKVExecute executes the request + */ + PostRestoreKVExecute(r ApiPostRestoreKVRequest) error + + /* + * PostRestoreSQL Overwrite the embedded SQL store on the server with a backed-up snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostRestoreSQLRequest + */ + PostRestoreSQL(ctx _context.Context) ApiPostRestoreSQLRequest + + /* + * PostRestoreSQLExecute executes the request + */ + PostRestoreSQLExecute(r ApiPostRestoreSQLRequest) error + + /* + * PostRestoreShardId Restore a TSM snapshot into a shard. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param shardID The shard ID. + * @return ApiPostRestoreShardIdRequest + */ + PostRestoreShardId(ctx _context.Context, shardID string) ApiPostRestoreShardIdRequest + + /* + * PostRestoreShardIdExecute executes the request + */ + PostRestoreShardIdExecute(r ApiPostRestoreShardIdRequest) error +} + +// restoreApiGzipReadCloser supports streaming gzip response-bodies directly from the server. +type restoreApiGzipReadCloser struct { + underlying _io.ReadCloser + gzip _io.ReadCloser +} + +func (gzrc *restoreApiGzipReadCloser) Read(p []byte) (int, error) { + return gzrc.gzip.Read(p) +} +func (gzrc *restoreApiGzipReadCloser) Close() error { + if err := gzrc.gzip.Close(); err != nil { + return err + } + return gzrc.underlying.Close() +} + +// RestoreApiService RestoreApi service +type RestoreApiService service + +type ApiPostRestoreBucketMetadataIdRequest struct { + ctx _context.Context + ApiService RestoreApi + bucketID string + bucketMetadataManifest *BucketMetadataManifest + zapTraceSpan *string +} + +func (r ApiPostRestoreBucketMetadataIdRequest) BucketID(bucketID string) ApiPostRestoreBucketMetadataIdRequest { + r.bucketID = bucketID + return r +} +func (r ApiPostRestoreBucketMetadataIdRequest) GetBucketID() string { + return r.bucketID +} + +func (r ApiPostRestoreBucketMetadataIdRequest) BucketMetadataManifest(bucketMetadataManifest BucketMetadataManifest) ApiPostRestoreBucketMetadataIdRequest { + r.bucketMetadataManifest = &bucketMetadataManifest + return r +} +func (r ApiPostRestoreBucketMetadataIdRequest) GetBucketMetadataManifest() *BucketMetadataManifest { + return r.bucketMetadataManifest +} + +func (r ApiPostRestoreBucketMetadataIdRequest) ZapTraceSpan(zapTraceSpan string) ApiPostRestoreBucketMetadataIdRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPostRestoreBucketMetadataIdRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPostRestoreBucketMetadataIdRequest) Execute() ([]BucketShardMapping, error) { + return r.ApiService.PostRestoreBucketMetadataIdExecute(r) +} + +/* + * PostRestoreBucketMetadataId 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(). + * @param bucketID The bucket ID. + * @return ApiPostRestoreBucketMetadataIdRequest + */ +func (a *RestoreApiService) PostRestoreBucketMetadataId(ctx _context.Context, bucketID string) ApiPostRestoreBucketMetadataIdRequest { + return ApiPostRestoreBucketMetadataIdRequest{ + ApiService: a, + ctx: ctx, + bucketID: bucketID, + } +} + +/* + * Execute executes the request + * @return []BucketShardMapping + */ +func (a *RestoreApiService) PostRestoreBucketMetadataIdExecute(r ApiPostRestoreBucketMetadataIdRequest) ([]BucketShardMapping, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []BucketShardMapping + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RestoreApiService.PostRestoreBucketMetadataId") + if err != nil { + return localVarReturnValue, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/restore/bucket-metadata/{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.bucketMetadataManifest == nil { + return localVarReturnValue, reportError("bucketMetadataManifest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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, "") + } + // body params + localVarPostBody = r.bucketMetadataManifest + 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 body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return localVarReturnValue, err + } + body = &restoreApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return localVarReturnValue, err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, newErr + } + newErr.model = &v + return localVarReturnValue, newErr + } + + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return localVarReturnValue, err + } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiPostRestoreKVRequest struct { + ctx _context.Context + ApiService RestoreApi + body **os.File + zapTraceSpan *string + contentEncoding *string +} + +func (r ApiPostRestoreKVRequest) Body(body *os.File) ApiPostRestoreKVRequest { + r.body = &body + return r +} +func (r ApiPostRestoreKVRequest) GetBody() **os.File { + return r.body +} + +func (r ApiPostRestoreKVRequest) ZapTraceSpan(zapTraceSpan string) ApiPostRestoreKVRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPostRestoreKVRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPostRestoreKVRequest) ContentEncoding(contentEncoding string) ApiPostRestoreKVRequest { + r.contentEncoding = &contentEncoding + return r +} +func (r ApiPostRestoreKVRequest) GetContentEncoding() *string { + return r.contentEncoding +} + +func (r ApiPostRestoreKVRequest) Execute() error { + return r.ApiService.PostRestoreKVExecute(r) +} + +/* + * PostRestoreKV Overwrite the embedded KV store on the server with a backed-up snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostRestoreKVRequest + */ +func (a *RestoreApiService) PostRestoreKV(ctx _context.Context) ApiPostRestoreKVRequest { + return ApiPostRestoreKVRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) error { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RestoreApiService.PostRestoreKV") + if err != nil { + return GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/restore/kv" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/octet-stream"} + + // 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.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = parameterToString(*r.contentEncoding, "") + } + // 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 err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return err + } + + var body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return err + } + body = &restoreApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return newErr + } + newErr.model = &v + return newErr + } + + return nil +} + +type ApiPostRestoreSQLRequest struct { + ctx _context.Context + ApiService RestoreApi + body **os.File + zapTraceSpan *string + contentEncoding *string +} + +func (r ApiPostRestoreSQLRequest) Body(body *os.File) ApiPostRestoreSQLRequest { + r.body = &body + return r +} +func (r ApiPostRestoreSQLRequest) GetBody() **os.File { + return r.body +} + +func (r ApiPostRestoreSQLRequest) ZapTraceSpan(zapTraceSpan string) ApiPostRestoreSQLRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPostRestoreSQLRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPostRestoreSQLRequest) ContentEncoding(contentEncoding string) ApiPostRestoreSQLRequest { + r.contentEncoding = &contentEncoding + return r +} +func (r ApiPostRestoreSQLRequest) GetContentEncoding() *string { + return r.contentEncoding +} + +func (r ApiPostRestoreSQLRequest) Execute() error { + return r.ApiService.PostRestoreSQLExecute(r) +} + +/* + * PostRestoreSQL Overwrite the embedded SQL store on the server with a backed-up snapshot. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostRestoreSQLRequest + */ +func (a *RestoreApiService) PostRestoreSQL(ctx _context.Context) ApiPostRestoreSQLRequest { + return ApiPostRestoreSQLRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *RestoreApiService) PostRestoreSQLExecute(r ApiPostRestoreSQLRequest) error { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RestoreApiService.PostRestoreSQL") + if err != nil { + return GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/restore/sql" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/octet-stream"} + + // 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.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = parameterToString(*r.contentEncoding, "") + } + // 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 err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return err + } + + var body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return err + } + body = &restoreApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return newErr + } + newErr.model = &v + return newErr + } + + return nil +} + +type ApiPostRestoreShardIdRequest struct { + ctx _context.Context + ApiService RestoreApi + shardID string + body **os.File + zapTraceSpan *string + contentEncoding *string +} + +func (r ApiPostRestoreShardIdRequest) ShardID(shardID string) ApiPostRestoreShardIdRequest { + r.shardID = shardID + return r +} +func (r ApiPostRestoreShardIdRequest) GetShardID() string { + return r.shardID +} + +func (r ApiPostRestoreShardIdRequest) Body(body *os.File) ApiPostRestoreShardIdRequest { + r.body = &body + return r +} +func (r ApiPostRestoreShardIdRequest) GetBody() **os.File { + return r.body +} + +func (r ApiPostRestoreShardIdRequest) ZapTraceSpan(zapTraceSpan string) ApiPostRestoreShardIdRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPostRestoreShardIdRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPostRestoreShardIdRequest) ContentEncoding(contentEncoding string) ApiPostRestoreShardIdRequest { + r.contentEncoding = &contentEncoding + return r +} +func (r ApiPostRestoreShardIdRequest) GetContentEncoding() *string { + return r.contentEncoding +} + +func (r ApiPostRestoreShardIdRequest) Execute() error { + return r.ApiService.PostRestoreShardIdExecute(r) +} + +/* + * PostRestoreShardId Restore a TSM snapshot into a shard. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param shardID The shard ID. + * @return ApiPostRestoreShardIdRequest + */ +func (a *RestoreApiService) PostRestoreShardId(ctx _context.Context, shardID string) ApiPostRestoreShardIdRequest { + return ApiPostRestoreShardIdRequest{ + ApiService: a, + ctx: ctx, + shardID: shardID, + } +} + +/* + * Execute executes the request + */ +func (a *RestoreApiService) PostRestoreShardIdExecute(r ApiPostRestoreShardIdRequest) error { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RestoreApiService.PostRestoreShardId") + if err != nil { + return GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/restore/shards/{shardID}" + localVarPath = strings.Replace(localVarPath, "{"+"shardID"+"}", _neturl.PathEscape(parameterToString(r.shardID, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/octet-stream"} + + // 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.contentEncoding != nil { + localVarHeaderParams["Content-Encoding"] = parameterToString(*r.contentEncoding, "") + } + // 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 err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return err + } + + var body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return err + } + body = &restoreApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return newErr + } + newErr.model = &v + return newErr + } + + return nil +} diff --git a/api/client.gen.go b/api/client.gen.go index 5e68fb5..0f2e22b 100644 --- a/api/client.gen.go +++ b/api/client.gen.go @@ -47,6 +47,8 @@ type APIClient struct { // API Services + BackupApi BackupApi + BucketSchemasApi BucketSchemasApi BucketsApi BucketsApi @@ -59,6 +61,8 @@ type APIClient struct { QueryApi QueryApi + RestoreApi RestoreApi + SetupApi SetupApi TasksApi TasksApi @@ -84,12 +88,14 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services + c.BackupApi = (*BackupApiService)(&c.common) c.BucketSchemasApi = (*BucketSchemasApiService)(&c.common) c.BucketsApi = (*BucketsApiService)(&c.common) c.DeleteApi = (*DeleteApiService)(&c.common) c.HealthApi = (*HealthApiService)(&c.common) c.OrganizationsApi = (*OrganizationsApiService)(&c.common) c.QueryApi = (*QueryApiService)(&c.common) + c.RestoreApi = (*RestoreApiService)(&c.common) c.SetupApi = (*SetupApiService)(&c.common) c.TasksApi = (*TasksApiService)(&c.common) c.UsersApi = (*UsersApiService)(&c.common) diff --git a/api/contract/cli.yml b/api/contract/cli.yml index eb4a0f0..5dd60d3 100644 --- a/api/contract/cli.yml +++ b/api/contract/cli.yml @@ -53,6 +53,18 @@ 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/metadata: + $ref: "./openapi/src/oss/paths/backup_metadata.yml" + /backup/shards/{shardID}: + $ref: "./openapi/src/oss/paths/backup_shards_shardID.yml" + /restore/kv: + $ref: "./openapi/src/oss/paths/restore_kv.yml" + /restore/sql: + $ref: "./openapi/src/oss/paths/restore_sql.yml" + /restore/bucket-metadata/{bucketID}: + $ref: "./openapi/src/oss/paths/restore_bucket-metadata_bucketID.yml" + /restore/shards/{shardID}: + $ref: "./openapi/src/oss/paths/restore_shards_shardID.yml" components: parameters: TraceSpan: @@ -183,3 +195,33 @@ components: $ref: "./openapi/src/common/schemas/Logs.yml" LogEvent: $ref: "./openapi/src/common/schemas/LogEvent.yml" + MetadataBackup: + $ref: "./openapi/src/oss/schemas/MetadataBackup.yml" + BucketMetadataManifests: + $ref: "./openapi/src/oss/schemas/BucketMetadataManifests.yml" + BucketMetadataManifest: + $ref: "./openapi/src/oss/schemas/BucketMetadataManifest.yml" + RetentionPolicyManifests: + $ref: "./openapi/src/oss/schemas/RetentionPolicyManifests.yml" + RetentionPolicyManifest: + $ref: "./openapi/src/oss/schemas/RetentionPolicyManifest.yml" + ShardGroupManifests: + $ref: "./openapi/src/oss/schemas/ShardGroupManifests.yml" + ShardGroupManifest: + $ref: "./openapi/src/oss/schemas/ShardGroupManifest.yml" + ShardManifests: + $ref: "./openapi/src/oss/schemas/ShardManifests.yml" + ShardManifest: + $ref: "./openapi/src/oss/schemas/ShardManifest.yml" + ShardOwners: + $ref: "./openapi/src/oss/schemas/ShardOwners.yml" + ShardOwner: + $ref: "./openapi/src/oss/schemas/ShardOwner.yml" + SubscriptionManifests: + $ref: "./openapi/src/oss/schemas/SubscriptionManifests.yml" + SubscriptionManifest: + $ref: "./openapi/src/oss/schemas/SubscriptionManifest.yml" + BucketShardMappings: + $ref: "./openapi/src/oss/schemas/BucketShardMappings.yml" + BucketShardMapping: + $ref: "./openapi/src/oss/schemas/BucketShardMapping.yml" diff --git a/api/contract/openapi b/api/contract/openapi index c18cced..ebb70c5 160000 --- a/api/contract/openapi +++ b/api/contract/openapi @@ -1 +1 @@ -Subproject commit c18cced83492e43c7c03e846d8eaf30bacf1ecdc +Subproject commit ebb70c5c53d946fdff97c492edc21ac70ad00cfd diff --git a/api/model_bucket_metadata_manifest.gen.go b/api/model_bucket_metadata_manifest.gen.go new file mode 100644 index 0000000..a349141 --- /dev/null +++ b/api/model_bucket_metadata_manifest.gen.go @@ -0,0 +1,251 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// BucketMetadataManifest struct for BucketMetadataManifest +type BucketMetadataManifest struct { + OrganizationID string `json:"organizationID"` + OrganizationName string `json:"organizationName"` + BucketID string `json:"bucketID"` + BucketName string `json:"bucketName"` + DefaultRetentionPolicy string `json:"defaultRetentionPolicy"` + RetentionPolicies []RetentionPolicyManifest `json:"retentionPolicies"` +} + +// NewBucketMetadataManifest instantiates a new BucketMetadataManifest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBucketMetadataManifest(organizationID string, organizationName string, bucketID string, bucketName string, defaultRetentionPolicy string, retentionPolicies []RetentionPolicyManifest) *BucketMetadataManifest { + this := BucketMetadataManifest{} + this.OrganizationID = organizationID + this.OrganizationName = organizationName + this.BucketID = bucketID + this.BucketName = bucketName + this.DefaultRetentionPolicy = defaultRetentionPolicy + this.RetentionPolicies = retentionPolicies + return &this +} + +// NewBucketMetadataManifestWithDefaults instantiates a new BucketMetadataManifest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBucketMetadataManifestWithDefaults() *BucketMetadataManifest { + this := BucketMetadataManifest{} + return &this +} + +// GetOrganizationID returns the OrganizationID field value +func (o *BucketMetadataManifest) GetOrganizationID() string { + if o == nil { + var ret string + return ret + } + + return o.OrganizationID +} + +// GetOrganizationIDOk returns a tuple with the OrganizationID field value +// and a boolean to check if the value has been set. +func (o *BucketMetadataManifest) GetOrganizationIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OrganizationID, true +} + +// SetOrganizationID sets field value +func (o *BucketMetadataManifest) SetOrganizationID(v string) { + o.OrganizationID = v +} + +// GetOrganizationName returns the OrganizationName field value +func (o *BucketMetadataManifest) GetOrganizationName() string { + if o == nil { + var ret string + return ret + } + + return o.OrganizationName +} + +// GetOrganizationNameOk returns a tuple with the OrganizationName field value +// and a boolean to check if the value has been set. +func (o *BucketMetadataManifest) GetOrganizationNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OrganizationName, true +} + +// SetOrganizationName sets field value +func (o *BucketMetadataManifest) SetOrganizationName(v string) { + o.OrganizationName = v +} + +// GetBucketID returns the BucketID field value +func (o *BucketMetadataManifest) GetBucketID() string { + if o == nil { + var ret string + return ret + } + + return o.BucketID +} + +// GetBucketIDOk returns a tuple with the BucketID field value +// and a boolean to check if the value has been set. +func (o *BucketMetadataManifest) GetBucketIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BucketID, true +} + +// SetBucketID sets field value +func (o *BucketMetadataManifest) SetBucketID(v string) { + o.BucketID = v +} + +// GetBucketName returns the BucketName field value +func (o *BucketMetadataManifest) GetBucketName() string { + if o == nil { + var ret string + return ret + } + + return o.BucketName +} + +// GetBucketNameOk returns a tuple with the BucketName field value +// and a boolean to check if the value has been set. +func (o *BucketMetadataManifest) GetBucketNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BucketName, true +} + +// SetBucketName sets field value +func (o *BucketMetadataManifest) SetBucketName(v string) { + o.BucketName = v +} + +// GetDefaultRetentionPolicy returns the DefaultRetentionPolicy field value +func (o *BucketMetadataManifest) GetDefaultRetentionPolicy() string { + if o == nil { + var ret string + return ret + } + + return o.DefaultRetentionPolicy +} + +// GetDefaultRetentionPolicyOk returns a tuple with the DefaultRetentionPolicy field value +// and a boolean to check if the value has been set. +func (o *BucketMetadataManifest) GetDefaultRetentionPolicyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DefaultRetentionPolicy, true +} + +// SetDefaultRetentionPolicy sets field value +func (o *BucketMetadataManifest) SetDefaultRetentionPolicy(v string) { + o.DefaultRetentionPolicy = v +} + +// GetRetentionPolicies returns the RetentionPolicies field value +func (o *BucketMetadataManifest) GetRetentionPolicies() []RetentionPolicyManifest { + if o == nil { + var ret []RetentionPolicyManifest + return ret + } + + return o.RetentionPolicies +} + +// GetRetentionPoliciesOk returns a tuple with the RetentionPolicies field value +// and a boolean to check if the value has been set. +func (o *BucketMetadataManifest) GetRetentionPoliciesOk() (*[]RetentionPolicyManifest, bool) { + if o == nil { + return nil, false + } + return &o.RetentionPolicies, true +} + +// SetRetentionPolicies sets field value +func (o *BucketMetadataManifest) SetRetentionPolicies(v []RetentionPolicyManifest) { + o.RetentionPolicies = v +} + +func (o BucketMetadataManifest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["organizationID"] = o.OrganizationID + } + if true { + toSerialize["organizationName"] = o.OrganizationName + } + if true { + toSerialize["bucketID"] = o.BucketID + } + if true { + toSerialize["bucketName"] = o.BucketName + } + if true { + toSerialize["defaultRetentionPolicy"] = o.DefaultRetentionPolicy + } + if true { + toSerialize["retentionPolicies"] = o.RetentionPolicies + } + return json.Marshal(toSerialize) +} + +type NullableBucketMetadataManifest struct { + value *BucketMetadataManifest + isSet bool +} + +func (v NullableBucketMetadataManifest) Get() *BucketMetadataManifest { + return v.value +} + +func (v *NullableBucketMetadataManifest) Set(val *BucketMetadataManifest) { + v.value = val + v.isSet = true +} + +func (v NullableBucketMetadataManifest) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketMetadataManifest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketMetadataManifest(val *BucketMetadataManifest) *NullableBucketMetadataManifest { + return &NullableBucketMetadataManifest{value: val, isSet: true} +} + +func (v NullableBucketMetadataManifest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketMetadataManifest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_bucket_shard_mapping.gen.go b/api/model_bucket_shard_mapping.gen.go new file mode 100644 index 0000000..0644fec --- /dev/null +++ b/api/model_bucket_shard_mapping.gen.go @@ -0,0 +1,149 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// BucketShardMapping struct for BucketShardMapping +type BucketShardMapping struct { + OldId *int64 `json:"oldId,omitempty"` + NewId *int64 `json:"newId,omitempty"` +} + +// NewBucketShardMapping instantiates a new BucketShardMapping object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBucketShardMapping() *BucketShardMapping { + this := BucketShardMapping{} + return &this +} + +// NewBucketShardMappingWithDefaults instantiates a new BucketShardMapping object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBucketShardMappingWithDefaults() *BucketShardMapping { + this := BucketShardMapping{} + return &this +} + +// GetOldId returns the OldId field value if set, zero value otherwise. +func (o *BucketShardMapping) GetOldId() int64 { + if o == nil || o.OldId == nil { + var ret int64 + return ret + } + return *o.OldId +} + +// GetOldIdOk returns a tuple with the OldId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BucketShardMapping) GetOldIdOk() (*int64, bool) { + if o == nil || o.OldId == nil { + return nil, false + } + return o.OldId, true +} + +// HasOldId returns a boolean if a field has been set. +func (o *BucketShardMapping) HasOldId() bool { + if o != nil && o.OldId != nil { + return true + } + + return false +} + +// SetOldId gets a reference to the given int64 and assigns it to the OldId field. +func (o *BucketShardMapping) SetOldId(v int64) { + o.OldId = &v +} + +// GetNewId returns the NewId field value if set, zero value otherwise. +func (o *BucketShardMapping) GetNewId() int64 { + if o == nil || o.NewId == nil { + var ret int64 + return ret + } + return *o.NewId +} + +// GetNewIdOk returns a tuple with the NewId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BucketShardMapping) GetNewIdOk() (*int64, bool) { + if o == nil || o.NewId == nil { + return nil, false + } + return o.NewId, true +} + +// HasNewId returns a boolean if a field has been set. +func (o *BucketShardMapping) HasNewId() bool { + if o != nil && o.NewId != nil { + return true + } + + return false +} + +// SetNewId gets a reference to the given int64 and assigns it to the NewId field. +func (o *BucketShardMapping) SetNewId(v int64) { + o.NewId = &v +} + +func (o BucketShardMapping) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.OldId != nil { + toSerialize["oldId"] = o.OldId + } + if o.NewId != nil { + toSerialize["newId"] = o.NewId + } + return json.Marshal(toSerialize) +} + +type NullableBucketShardMapping struct { + value *BucketShardMapping + isSet bool +} + +func (v NullableBucketShardMapping) Get() *BucketShardMapping { + return v.value +} + +func (v *NullableBucketShardMapping) Set(val *BucketShardMapping) { + v.value = val + v.isSet = true +} + +func (v NullableBucketShardMapping) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketShardMapping) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketShardMapping(val *BucketShardMapping) *NullableBucketShardMapping { + return &NullableBucketShardMapping{value: val, isSet: true} +} + +func (v NullableBucketShardMapping) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketShardMapping) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_metadata_backup.gen.go b/api/model_metadata_backup.gen.go new file mode 100644 index 0000000..1646344 --- /dev/null +++ b/api/model_metadata_backup.gen.go @@ -0,0 +1,165 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "os" +) + +// MetadataBackup struct for MetadataBackup +type MetadataBackup struct { + Kv *os.File `json:"kv"` + Sql *os.File `json:"sql"` + Buckets []BucketMetadataManifest `json:"buckets"` +} + +// NewMetadataBackup instantiates a new MetadataBackup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadataBackup(kv *os.File, sql *os.File, buckets []BucketMetadataManifest) *MetadataBackup { + this := MetadataBackup{} + this.Kv = kv + this.Sql = sql + this.Buckets = buckets + return &this +} + +// NewMetadataBackupWithDefaults instantiates a new MetadataBackup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataBackupWithDefaults() *MetadataBackup { + this := MetadataBackup{} + return &this +} + +// GetKv returns the Kv field value +func (o *MetadataBackup) GetKv() *os.File { + if o == nil { + var ret *os.File + return ret + } + + return o.Kv +} + +// GetKvOk returns a tuple with the Kv field value +// and a boolean to check if the value has been set. +func (o *MetadataBackup) GetKvOk() (**os.File, bool) { + if o == nil { + return nil, false + } + return &o.Kv, true +} + +// SetKv sets field value +func (o *MetadataBackup) SetKv(v *os.File) { + o.Kv = v +} + +// GetSql returns the Sql field value +func (o *MetadataBackup) GetSql() *os.File { + if o == nil { + var ret *os.File + return ret + } + + return o.Sql +} + +// GetSqlOk returns a tuple with the Sql field value +// and a boolean to check if the value has been set. +func (o *MetadataBackup) GetSqlOk() (**os.File, bool) { + if o == nil { + return nil, false + } + return &o.Sql, true +} + +// SetSql sets field value +func (o *MetadataBackup) SetSql(v *os.File) { + o.Sql = v +} + +// GetBuckets returns the Buckets field value +func (o *MetadataBackup) GetBuckets() []BucketMetadataManifest { + if o == nil { + var ret []BucketMetadataManifest + return ret + } + + return o.Buckets +} + +// GetBucketsOk returns a tuple with the Buckets field value +// and a boolean to check if the value has been set. +func (o *MetadataBackup) GetBucketsOk() (*[]BucketMetadataManifest, bool) { + if o == nil { + return nil, false + } + return &o.Buckets, true +} + +// SetBuckets sets field value +func (o *MetadataBackup) SetBuckets(v []BucketMetadataManifest) { + o.Buckets = v +} + +func (o MetadataBackup) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["kv"] = o.Kv + } + if true { + toSerialize["sql"] = o.Sql + } + if true { + toSerialize["buckets"] = o.Buckets + } + return json.Marshal(toSerialize) +} + +type NullableMetadataBackup struct { + value *MetadataBackup + isSet bool +} + +func (v NullableMetadataBackup) Get() *MetadataBackup { + return v.value +} + +func (v *NullableMetadataBackup) Set(val *MetadataBackup) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataBackup) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataBackup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataBackup(val *MetadataBackup) *NullableMetadataBackup { + return &NullableMetadataBackup{value: val, isSet: true} +} + +func (v NullableMetadataBackup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataBackup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_retention_policy_manifest.gen.go b/api/model_retention_policy_manifest.gen.go new file mode 100644 index 0000000..b920f39 --- /dev/null +++ b/api/model_retention_policy_manifest.gen.go @@ -0,0 +1,251 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// RetentionPolicyManifest struct for RetentionPolicyManifest +type RetentionPolicyManifest struct { + Name string `json:"name"` + ReplicaN int32 `json:"replicaN"` + Duration int64 `json:"duration"` + ShardGroupDuration int64 `json:"shardGroupDuration"` + ShardGroups []ShardGroupManifest `json:"shardGroups"` + Subscriptions []SubscriptionManifest `json:"subscriptions"` +} + +// NewRetentionPolicyManifest instantiates a new RetentionPolicyManifest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRetentionPolicyManifest(name string, replicaN int32, duration int64, shardGroupDuration int64, shardGroups []ShardGroupManifest, subscriptions []SubscriptionManifest) *RetentionPolicyManifest { + this := RetentionPolicyManifest{} + this.Name = name + this.ReplicaN = replicaN + this.Duration = duration + this.ShardGroupDuration = shardGroupDuration + this.ShardGroups = shardGroups + this.Subscriptions = subscriptions + return &this +} + +// NewRetentionPolicyManifestWithDefaults instantiates a new RetentionPolicyManifest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRetentionPolicyManifestWithDefaults() *RetentionPolicyManifest { + this := RetentionPolicyManifest{} + return &this +} + +// GetName returns the Name field value +func (o *RetentionPolicyManifest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RetentionPolicyManifest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *RetentionPolicyManifest) SetName(v string) { + o.Name = v +} + +// GetReplicaN returns the ReplicaN field value +func (o *RetentionPolicyManifest) GetReplicaN() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ReplicaN +} + +// GetReplicaNOk returns a tuple with the ReplicaN field value +// and a boolean to check if the value has been set. +func (o *RetentionPolicyManifest) GetReplicaNOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ReplicaN, true +} + +// SetReplicaN sets field value +func (o *RetentionPolicyManifest) SetReplicaN(v int32) { + o.ReplicaN = v +} + +// GetDuration returns the Duration field value +func (o *RetentionPolicyManifest) GetDuration() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value +// and a boolean to check if the value has been set. +func (o *RetentionPolicyManifest) GetDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Duration, true +} + +// SetDuration sets field value +func (o *RetentionPolicyManifest) SetDuration(v int64) { + o.Duration = v +} + +// GetShardGroupDuration returns the ShardGroupDuration field value +func (o *RetentionPolicyManifest) GetShardGroupDuration() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.ShardGroupDuration +} + +// GetShardGroupDurationOk returns a tuple with the ShardGroupDuration field value +// and a boolean to check if the value has been set. +func (o *RetentionPolicyManifest) GetShardGroupDurationOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.ShardGroupDuration, true +} + +// SetShardGroupDuration sets field value +func (o *RetentionPolicyManifest) SetShardGroupDuration(v int64) { + o.ShardGroupDuration = v +} + +// GetShardGroups returns the ShardGroups field value +func (o *RetentionPolicyManifest) GetShardGroups() []ShardGroupManifest { + if o == nil { + var ret []ShardGroupManifest + return ret + } + + return o.ShardGroups +} + +// GetShardGroupsOk returns a tuple with the ShardGroups field value +// and a boolean to check if the value has been set. +func (o *RetentionPolicyManifest) GetShardGroupsOk() (*[]ShardGroupManifest, bool) { + if o == nil { + return nil, false + } + return &o.ShardGroups, true +} + +// SetShardGroups sets field value +func (o *RetentionPolicyManifest) SetShardGroups(v []ShardGroupManifest) { + o.ShardGroups = v +} + +// GetSubscriptions returns the Subscriptions field value +func (o *RetentionPolicyManifest) GetSubscriptions() []SubscriptionManifest { + if o == nil { + var ret []SubscriptionManifest + return ret + } + + return o.Subscriptions +} + +// GetSubscriptionsOk returns a tuple with the Subscriptions field value +// and a boolean to check if the value has been set. +func (o *RetentionPolicyManifest) GetSubscriptionsOk() (*[]SubscriptionManifest, bool) { + if o == nil { + return nil, false + } + return &o.Subscriptions, true +} + +// SetSubscriptions sets field value +func (o *RetentionPolicyManifest) SetSubscriptions(v []SubscriptionManifest) { + o.Subscriptions = v +} + +func (o RetentionPolicyManifest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if true { + toSerialize["replicaN"] = o.ReplicaN + } + if true { + toSerialize["duration"] = o.Duration + } + if true { + toSerialize["shardGroupDuration"] = o.ShardGroupDuration + } + if true { + toSerialize["shardGroups"] = o.ShardGroups + } + if true { + toSerialize["subscriptions"] = o.Subscriptions + } + return json.Marshal(toSerialize) +} + +type NullableRetentionPolicyManifest struct { + value *RetentionPolicyManifest + isSet bool +} + +func (v NullableRetentionPolicyManifest) Get() *RetentionPolicyManifest { + return v.value +} + +func (v *NullableRetentionPolicyManifest) Set(val *RetentionPolicyManifest) { + v.value = val + v.isSet = true +} + +func (v NullableRetentionPolicyManifest) IsSet() bool { + return v.isSet +} + +func (v *NullableRetentionPolicyManifest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRetentionPolicyManifest(val *RetentionPolicyManifest) *NullableRetentionPolicyManifest { + return &NullableRetentionPolicyManifest{value: val, isSet: true} +} + +func (v NullableRetentionPolicyManifest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRetentionPolicyManifest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_shard_group_manifest.gen.go b/api/model_shard_group_manifest.gen.go new file mode 100644 index 0000000..43e7f27 --- /dev/null +++ b/api/model_shard_group_manifest.gen.go @@ -0,0 +1,266 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "time" +) + +// ShardGroupManifest struct for ShardGroupManifest +type ShardGroupManifest struct { + Id int64 `json:"id"` + StartTime time.Time `json:"startTime"` + EndTime time.Time `json:"endTime"` + DeletedAt *time.Time `json:"deletedAt,omitempty"` + TruncatedAt *time.Time `json:"truncatedAt,omitempty"` + Shards []ShardManifest `json:"shards"` +} + +// NewShardGroupManifest instantiates a new ShardGroupManifest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewShardGroupManifest(id int64, startTime time.Time, endTime time.Time, shards []ShardManifest) *ShardGroupManifest { + this := ShardGroupManifest{} + this.Id = id + this.StartTime = startTime + this.EndTime = endTime + this.Shards = shards + return &this +} + +// NewShardGroupManifestWithDefaults instantiates a new ShardGroupManifest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewShardGroupManifestWithDefaults() *ShardGroupManifest { + this := ShardGroupManifest{} + return &this +} + +// GetId returns the Id field value +func (o *ShardGroupManifest) GetId() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ShardGroupManifest) GetIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ShardGroupManifest) SetId(v int64) { + o.Id = v +} + +// GetStartTime returns the StartTime field value +func (o *ShardGroupManifest) GetStartTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.StartTime +} + +// GetStartTimeOk returns a tuple with the StartTime field value +// and a boolean to check if the value has been set. +func (o *ShardGroupManifest) GetStartTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.StartTime, true +} + +// SetStartTime sets field value +func (o *ShardGroupManifest) SetStartTime(v time.Time) { + o.StartTime = v +} + +// GetEndTime returns the EndTime field value +func (o *ShardGroupManifest) GetEndTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.EndTime +} + +// GetEndTimeOk returns a tuple with the EndTime field value +// and a boolean to check if the value has been set. +func (o *ShardGroupManifest) GetEndTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.EndTime, true +} + +// SetEndTime sets field value +func (o *ShardGroupManifest) SetEndTime(v time.Time) { + o.EndTime = v +} + +// GetDeletedAt returns the DeletedAt field value if set, zero value otherwise. +func (o *ShardGroupManifest) GetDeletedAt() time.Time { + if o == nil || o.DeletedAt == nil { + var ret time.Time + return ret + } + return *o.DeletedAt +} + +// GetDeletedAtOk returns a tuple with the DeletedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShardGroupManifest) GetDeletedAtOk() (*time.Time, bool) { + if o == nil || o.DeletedAt == nil { + return nil, false + } + return o.DeletedAt, true +} + +// HasDeletedAt returns a boolean if a field has been set. +func (o *ShardGroupManifest) HasDeletedAt() bool { + if o != nil && o.DeletedAt != nil { + return true + } + + return false +} + +// SetDeletedAt gets a reference to the given time.Time and assigns it to the DeletedAt field. +func (o *ShardGroupManifest) SetDeletedAt(v time.Time) { + o.DeletedAt = &v +} + +// GetTruncatedAt returns the TruncatedAt field value if set, zero value otherwise. +func (o *ShardGroupManifest) GetTruncatedAt() time.Time { + if o == nil || o.TruncatedAt == nil { + var ret time.Time + return ret + } + return *o.TruncatedAt +} + +// GetTruncatedAtOk returns a tuple with the TruncatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShardGroupManifest) GetTruncatedAtOk() (*time.Time, bool) { + if o == nil || o.TruncatedAt == nil { + return nil, false + } + return o.TruncatedAt, true +} + +// HasTruncatedAt returns a boolean if a field has been set. +func (o *ShardGroupManifest) HasTruncatedAt() bool { + if o != nil && o.TruncatedAt != nil { + return true + } + + return false +} + +// SetTruncatedAt gets a reference to the given time.Time and assigns it to the TruncatedAt field. +func (o *ShardGroupManifest) SetTruncatedAt(v time.Time) { + o.TruncatedAt = &v +} + +// GetShards returns the Shards field value +func (o *ShardGroupManifest) GetShards() []ShardManifest { + if o == nil { + var ret []ShardManifest + return ret + } + + return o.Shards +} + +// GetShardsOk returns a tuple with the Shards field value +// and a boolean to check if the value has been set. +func (o *ShardGroupManifest) GetShardsOk() (*[]ShardManifest, bool) { + if o == nil { + return nil, false + } + return &o.Shards, true +} + +// SetShards sets field value +func (o *ShardGroupManifest) SetShards(v []ShardManifest) { + o.Shards = v +} + +func (o ShardGroupManifest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["id"] = o.Id + } + if true { + toSerialize["startTime"] = o.StartTime + } + if true { + toSerialize["endTime"] = o.EndTime + } + if o.DeletedAt != nil { + toSerialize["deletedAt"] = o.DeletedAt + } + if o.TruncatedAt != nil { + toSerialize["truncatedAt"] = o.TruncatedAt + } + if true { + toSerialize["shards"] = o.Shards + } + return json.Marshal(toSerialize) +} + +type NullableShardGroupManifest struct { + value *ShardGroupManifest + isSet bool +} + +func (v NullableShardGroupManifest) Get() *ShardGroupManifest { + return v.value +} + +func (v *NullableShardGroupManifest) Set(val *ShardGroupManifest) { + v.value = val + v.isSet = true +} + +func (v NullableShardGroupManifest) IsSet() bool { + return v.isSet +} + +func (v *NullableShardGroupManifest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShardGroupManifest(val *ShardGroupManifest) *NullableShardGroupManifest { + return &NullableShardGroupManifest{value: val, isSet: true} +} + +func (v NullableShardGroupManifest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShardGroupManifest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_shard_manifest.gen.go b/api/model_shard_manifest.gen.go new file mode 100644 index 0000000..55cd155 --- /dev/null +++ b/api/model_shard_manifest.gen.go @@ -0,0 +1,135 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ShardManifest struct for ShardManifest +type ShardManifest struct { + Id int64 `json:"id"` + ShardOwners []ShardOwner `json:"shardOwners"` +} + +// NewShardManifest instantiates a new ShardManifest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewShardManifest(id int64, shardOwners []ShardOwner) *ShardManifest { + this := ShardManifest{} + this.Id = id + this.ShardOwners = shardOwners + return &this +} + +// NewShardManifestWithDefaults instantiates a new ShardManifest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewShardManifestWithDefaults() *ShardManifest { + this := ShardManifest{} + return &this +} + +// GetId returns the Id field value +func (o *ShardManifest) GetId() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ShardManifest) GetIdOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ShardManifest) SetId(v int64) { + o.Id = v +} + +// GetShardOwners returns the ShardOwners field value +func (o *ShardManifest) GetShardOwners() []ShardOwner { + if o == nil { + var ret []ShardOwner + return ret + } + + return o.ShardOwners +} + +// GetShardOwnersOk returns a tuple with the ShardOwners field value +// and a boolean to check if the value has been set. +func (o *ShardManifest) GetShardOwnersOk() (*[]ShardOwner, bool) { + if o == nil { + return nil, false + } + return &o.ShardOwners, true +} + +// SetShardOwners sets field value +func (o *ShardManifest) SetShardOwners(v []ShardOwner) { + o.ShardOwners = v +} + +func (o ShardManifest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["id"] = o.Id + } + if true { + toSerialize["shardOwners"] = o.ShardOwners + } + return json.Marshal(toSerialize) +} + +type NullableShardManifest struct { + value *ShardManifest + isSet bool +} + +func (v NullableShardManifest) Get() *ShardManifest { + return v.value +} + +func (v *NullableShardManifest) Set(val *ShardManifest) { + v.value = val + v.isSet = true +} + +func (v NullableShardManifest) IsSet() bool { + return v.isSet +} + +func (v *NullableShardManifest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShardManifest(val *ShardManifest) *NullableShardManifest { + return &NullableShardManifest{value: val, isSet: true} +} + +func (v NullableShardManifest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShardManifest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_shard_owner.gen.go b/api/model_shard_owner.gen.go new file mode 100644 index 0000000..b750e41 --- /dev/null +++ b/api/model_shard_owner.gen.go @@ -0,0 +1,107 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ShardOwner struct for ShardOwner +type ShardOwner struct { + // ID of the node that owns a shard. + NodeID int64 `json:"nodeID"` +} + +// NewShardOwner instantiates a new ShardOwner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewShardOwner(nodeID int64) *ShardOwner { + this := ShardOwner{} + this.NodeID = nodeID + return &this +} + +// NewShardOwnerWithDefaults instantiates a new ShardOwner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewShardOwnerWithDefaults() *ShardOwner { + this := ShardOwner{} + return &this +} + +// GetNodeID returns the NodeID field value +func (o *ShardOwner) GetNodeID() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.NodeID +} + +// GetNodeIDOk returns a tuple with the NodeID field value +// and a boolean to check if the value has been set. +func (o *ShardOwner) GetNodeIDOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.NodeID, true +} + +// SetNodeID sets field value +func (o *ShardOwner) SetNodeID(v int64) { + o.NodeID = v +} + +func (o ShardOwner) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["nodeID"] = o.NodeID + } + return json.Marshal(toSerialize) +} + +type NullableShardOwner struct { + value *ShardOwner + isSet bool +} + +func (v NullableShardOwner) Get() *ShardOwner { + return v.value +} + +func (v *NullableShardOwner) Set(val *ShardOwner) { + v.value = val + v.isSet = true +} + +func (v NullableShardOwner) IsSet() bool { + return v.isSet +} + +func (v *NullableShardOwner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShardOwner(val *ShardOwner) *NullableShardOwner { + return &NullableShardOwner{value: val, isSet: true} +} + +func (v NullableShardOwner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShardOwner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_subscription_manifest.gen.go b/api/model_subscription_manifest.gen.go new file mode 100644 index 0000000..1f1af2c --- /dev/null +++ b/api/model_subscription_manifest.gen.go @@ -0,0 +1,164 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// SubscriptionManifest struct for SubscriptionManifest +type SubscriptionManifest struct { + Name string `json:"name"` + Mode string `json:"mode"` + Destinations []string `json:"destinations"` +} + +// NewSubscriptionManifest instantiates a new SubscriptionManifest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSubscriptionManifest(name string, mode string, destinations []string) *SubscriptionManifest { + this := SubscriptionManifest{} + this.Name = name + this.Mode = mode + this.Destinations = destinations + return &this +} + +// NewSubscriptionManifestWithDefaults instantiates a new SubscriptionManifest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSubscriptionManifestWithDefaults() *SubscriptionManifest { + this := SubscriptionManifest{} + return &this +} + +// GetName returns the Name field value +func (o *SubscriptionManifest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SubscriptionManifest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SubscriptionManifest) SetName(v string) { + o.Name = v +} + +// GetMode returns the Mode field value +func (o *SubscriptionManifest) GetMode() string { + if o == nil { + var ret string + return ret + } + + return o.Mode +} + +// GetModeOk returns a tuple with the Mode field value +// and a boolean to check if the value has been set. +func (o *SubscriptionManifest) GetModeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Mode, true +} + +// SetMode sets field value +func (o *SubscriptionManifest) SetMode(v string) { + o.Mode = v +} + +// GetDestinations returns the Destinations field value +func (o *SubscriptionManifest) GetDestinations() []string { + if o == nil { + var ret []string + return ret + } + + return o.Destinations +} + +// GetDestinationsOk returns a tuple with the Destinations field value +// and a boolean to check if the value has been set. +func (o *SubscriptionManifest) GetDestinationsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Destinations, true +} + +// SetDestinations sets field value +func (o *SubscriptionManifest) SetDestinations(v []string) { + o.Destinations = v +} + +func (o SubscriptionManifest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["name"] = o.Name + } + if true { + toSerialize["mode"] = o.Mode + } + if true { + toSerialize["destinations"] = o.Destinations + } + return json.Marshal(toSerialize) +} + +type NullableSubscriptionManifest struct { + value *SubscriptionManifest + isSet bool +} + +func (v NullableSubscriptionManifest) Get() *SubscriptionManifest { + return v.value +} + +func (v *NullableSubscriptionManifest) Set(val *SubscriptionManifest) { + v.value = val + v.isSet = true +} + +func (v NullableSubscriptionManifest) IsSet() bool { + return v.isSet +} + +func (v *NullableSubscriptionManifest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSubscriptionManifest(val *SubscriptionManifest) *NullableSubscriptionManifest { + return &NullableSubscriptionManifest{value: val, isSet: true} +} + +func (v NullableSubscriptionManifest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSubscriptionManifest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}