697 lines
21 KiB
Go
697 lines
21 KiB
Go
/*
|
|
* 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
|
|
}
|