fix: update openapi and regenerate to pull in fix for replications API (#280)

This commit is contained in:
Daniel Moran 2021-09-23 15:04:08 -04:00 committed by GitHub
parent 9076a65d1e
commit e609d4462d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 216 additions and 65 deletions

View File

@ -40,7 +40,7 @@ type DBRPsApi interface {
DeleteDBRPIDExecute(r ApiDeleteDBRPIDRequest) error
/*
* GetDBRPs List all database retention policy mappings
* GetDBRPs List database retention policy mappings
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetDBRPsRequest
*/
@ -365,7 +365,7 @@ func (r ApiGetDBRPsRequest) Execute() (DBRPs, error) {
}
/*
* GetDBRPs List all database retention policy mappings
* GetDBRPs List database retention policy mappings
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetDBRPsRequest
*/

View File

@ -26,7 +26,7 @@ var (
type DeleteApi interface {
/*
* PostDelete Delete time series data from InfluxDB
* PostDelete Delete data
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostDeleteRequest
*/
@ -125,7 +125,7 @@ func (r ApiPostDeleteRequest) Execute() error {
}
/*
* PostDelete Delete time series data from InfluxDB
* PostDelete Delete data
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostDeleteRequest
*/

View File

@ -62,8 +62,9 @@ type RestoreApi interface {
/*
* PostRestoreKVExecute executes the request
* @return PostRestoreKVResponse
*/
PostRestoreKVExecute(r ApiPostRestoreKVRequest) error
PostRestoreKVExecute(r ApiPostRestoreKVRequest) (PostRestoreKVResponse, error)
/*
* PostRestoreSQL Overwrite the embedded SQL store on the server with a backed-up snapshot.
@ -487,7 +488,7 @@ func (r ApiPostRestoreKVRequest) GetContentType() *string {
return r.contentType
}
func (r ApiPostRestoreKVRequest) Execute() error {
func (r ApiPostRestoreKVRequest) Execute() (PostRestoreKVResponse, error) {
return r.ApiService.PostRestoreKVExecute(r)
}
@ -505,19 +506,21 @@ func (a *RestoreApiService) PostRestoreKV(ctx _context.Context) ApiPostRestoreKV
/*
* Execute executes the request
* @return PostRestoreKVResponse
*/
func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) error {
func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) (PostRestoreKVResponse, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PostRestoreKVResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RestoreApiService.PostRestoreKV")
if err != nil {
return GenericOpenAPIError{error: err.Error()}
return localVarReturnValue, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/restore/kv"
@ -526,7 +529,7 @@ func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) erro
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.body == nil {
return reportError("body is required and must be specified")
return localVarReturnValue, reportError("body is required and must be specified")
}
// to determine the Content-Type header
@ -559,12 +562,12 @@ func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) erro
localVarPostBody = r.body
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return err
return localVarReturnValue, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return err
return localVarReturnValue, err
}
var errorPrefix string
@ -578,12 +581,12 @@ func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) erro
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
return _fmt.Errorf("%s%w", errorPrefix, err)
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
return _fmt.Errorf("%s%w", errorPrefix, err)
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
}
newErr := GenericOpenAPIError{
body: localVarBody,
@ -593,14 +596,33 @@ func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) erro
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
return newErr
return localVarReturnValue, newErr
}
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v
return newErr
return localVarReturnValue, newErr
}
return nil
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
return localVarReturnValue, _fmt.Errorf("%s%w", errorPrefix, err)
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: _fmt.Sprintf("%s%s", errorPrefix, err.Error()),
}
return localVarReturnValue, newErr
}
return localVarReturnValue, nil
}
type ApiPostRestoreSQLRequest struct {

View File

@ -26,10 +26,23 @@ var (
type WriteApi interface {
/*
* PostWrite Write time series data into InfluxDB
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostWriteRequest
*/
* PostWrite Write data
* Writes data to a bucket.
To write data into InfluxDB, you need the following:
- **organization** _See [View organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/view-orgs/#view-your-organization-id) for instructions on viewing your organization ID._
- **bucket** _See [View buckets]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/view-buckets/) for
instructions on viewing your bucket ID._
- **API token** _See [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)
for instructions on viewing your API token._
- **InfluxDB URL** _See [InfluxDB URLs]({{% INFLUXDB_DOCS_URL %}}/reference/urls/)_.
- data in [line protocol]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/line-protocol) format.
For more information and examples, see [Write data with the InfluxDB API]({{% INFLUXDB_DOCS_URL %}}/write-data/developer-tools/api).
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostWriteRequest
*/
PostWrite(ctx _context.Context) ApiPostWriteRequest
/*
@ -161,10 +174,23 @@ func (r ApiPostWriteRequest) Execute() error {
}
/*
* PostWrite Write time series data into InfluxDB
* PostWrite Write data
* Writes data to a bucket.
To write data into InfluxDB, you need the following:
- **organization** _See [View organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/view-orgs/#view-your-organization-id) for instructions on viewing your organization ID._
- **bucket** _See [View buckets]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/view-buckets/) for
instructions on viewing your bucket ID._
- **API token** _See [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)
for instructions on viewing your API token._
- **InfluxDB URL** _See [InfluxDB URLs]({{% INFLUXDB_DOCS_URL %}}/reference/urls/)_.
- data in [line protocol]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/line-protocol) format.
For more information and examples, see [Write data with the InfluxDB API]({{% INFLUXDB_DOCS_URL %}}/write-data/developer-tools/api).
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostWriteRequest
*/
*/
func (a *WriteApiService) PostWrite(ctx _context.Context) ApiPostWriteRequest {
return ApiPostWriteRequest{
ApiService: a,
@ -300,7 +326,7 @@ func (a *WriteApiService) PostWriteExecute(r ApiPostWriteRequest) error {
newErr.model = &v
return newErr
}
if localVarHTTPResponse.StatusCode == 403 {
if localVarHTTPResponse.StatusCode == 404 {
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {

View File

@ -109,7 +109,7 @@ func NewConfiguration() *Configuration {
OperationServers: map[string]ServerConfigurations{
"HealthApiService.GetHealth": {
{
URL: "",
URL: "/",
Description: "No description provided",
},
},

View File

@ -285,6 +285,8 @@ components:
$ref: "./openapi/src/oss/schemas/BucketShardMappings.yml"
BucketShardMapping:
$ref: "./openapi/src/oss/schemas/BucketShardMapping.yml"
PostRestoreKVResponse:
$ref: "./openapi/src/oss/schemas/PostRestoreKVResponse.yml"
Telegrafs:
$ref: "./openapi/src/common/schemas/Telegrafs.yml"
TelegrafRequest:

@ -1 +1 @@
Subproject commit 039f87e84d94f37cf286cedc66883e4a82a1805c
Subproject commit 1d9c78d7e367f1e1c16c376f71313fefb6d075fd

View File

@ -0,0 +1,114 @@
/*
* 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"
)
// PostRestoreKVResponse struct for PostRestoreKVResponse
type PostRestoreKVResponse struct {
// token is the root token for the instance after restore (this is overwritten during the restore)
Token *string `json:"token,omitempty" yaml:"token,omitempty"`
}
// NewPostRestoreKVResponse instantiates a new PostRestoreKVResponse 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 NewPostRestoreKVResponse() *PostRestoreKVResponse {
this := PostRestoreKVResponse{}
return &this
}
// NewPostRestoreKVResponseWithDefaults instantiates a new PostRestoreKVResponse 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 NewPostRestoreKVResponseWithDefaults() *PostRestoreKVResponse {
this := PostRestoreKVResponse{}
return &this
}
// GetToken returns the Token field value if set, zero value otherwise.
func (o *PostRestoreKVResponse) GetToken() string {
if o == nil || o.Token == nil {
var ret string
return ret
}
return *o.Token
}
// GetTokenOk returns a tuple with the Token field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PostRestoreKVResponse) GetTokenOk() (*string, bool) {
if o == nil || o.Token == nil {
return nil, false
}
return o.Token, true
}
// HasToken returns a boolean if a field has been set.
func (o *PostRestoreKVResponse) HasToken() bool {
if o != nil && o.Token != nil {
return true
}
return false
}
// SetToken gets a reference to the given string and assigns it to the Token field.
func (o *PostRestoreKVResponse) SetToken(v string) {
o.Token = &v
}
func (o PostRestoreKVResponse) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Token != nil {
toSerialize["token"] = o.Token
}
return json.Marshal(toSerialize)
}
type NullablePostRestoreKVResponse struct {
value *PostRestoreKVResponse
isSet bool
}
func (v NullablePostRestoreKVResponse) Get() *PostRestoreKVResponse {
return v.value
}
func (v *NullablePostRestoreKVResponse) Set(val *PostRestoreKVResponse) {
v.value = val
v.isSet = true
}
func (v NullablePostRestoreKVResponse) IsSet() bool {
return v.isSet
}
func (v *NullablePostRestoreKVResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullablePostRestoreKVResponse(val *PostRestoreKVResponse) *NullablePostRestoreKVResponse {
return &NullablePostRestoreKVResponse{value: val, isSet: true}
}
func (v NullablePostRestoreKVResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullablePostRestoreKVResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -20,8 +20,8 @@ type ReplicationCreationRequest struct {
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
OrgID string `json:"orgID" yaml:"orgID"`
RemoteID string `json:"remoteID" yaml:"remoteID"`
LocalBucketID *string `json:"localBucketID,omitempty" yaml:"localBucketID,omitempty"`
RemoteBucketID *string `json:"remoteBucketID,omitempty" yaml:"remoteBucketID,omitempty"`
LocalBucketID string `json:"localBucketID" yaml:"localBucketID"`
RemoteBucketID string `json:"remoteBucketID" yaml:"remoteBucketID"`
MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" yaml:"maxQueueSizeBytes"`
}
@ -29,11 +29,13 @@ type ReplicationCreationRequest struct {
// 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 NewReplicationCreationRequest(name string, orgID string, remoteID string, maxQueueSizeBytes int64) *ReplicationCreationRequest {
func NewReplicationCreationRequest(name string, orgID string, remoteID string, localBucketID string, remoteBucketID string, maxQueueSizeBytes int64) *ReplicationCreationRequest {
this := ReplicationCreationRequest{}
this.Name = name
this.OrgID = orgID
this.RemoteID = remoteID
this.LocalBucketID = localBucketID
this.RemoteBucketID = remoteBucketID
this.MaxQueueSizeBytes = maxQueueSizeBytes
return &this
}
@ -152,68 +154,52 @@ func (o *ReplicationCreationRequest) SetRemoteID(v string) {
o.RemoteID = v
}
// GetLocalBucketID returns the LocalBucketID field value if set, zero value otherwise.
// GetLocalBucketID returns the LocalBucketID field value
func (o *ReplicationCreationRequest) GetLocalBucketID() string {
if o == nil || o.LocalBucketID == nil {
if o == nil {
var ret string
return ret
}
return *o.LocalBucketID
return o.LocalBucketID
}
// GetLocalBucketIDOk returns a tuple with the LocalBucketID field value if set, nil otherwise
// GetLocalBucketIDOk returns a tuple with the LocalBucketID field value
// and a boolean to check if the value has been set.
func (o *ReplicationCreationRequest) GetLocalBucketIDOk() (*string, bool) {
if o == nil || o.LocalBucketID == nil {
if o == nil {
return nil, false
}
return o.LocalBucketID, true
return &o.LocalBucketID, true
}
// HasLocalBucketID returns a boolean if a field has been set.
func (o *ReplicationCreationRequest) HasLocalBucketID() bool {
if o != nil && o.LocalBucketID != nil {
return true
}
return false
}
// SetLocalBucketID gets a reference to the given string and assigns it to the LocalBucketID field.
// SetLocalBucketID sets field value
func (o *ReplicationCreationRequest) SetLocalBucketID(v string) {
o.LocalBucketID = &v
o.LocalBucketID = v
}
// GetRemoteBucketID returns the RemoteBucketID field value if set, zero value otherwise.
// GetRemoteBucketID returns the RemoteBucketID field value
func (o *ReplicationCreationRequest) GetRemoteBucketID() string {
if o == nil || o.RemoteBucketID == nil {
if o == nil {
var ret string
return ret
}
return *o.RemoteBucketID
return o.RemoteBucketID
}
// GetRemoteBucketIDOk returns a tuple with the RemoteBucketID field value if set, nil otherwise
// GetRemoteBucketIDOk returns a tuple with the RemoteBucketID field value
// and a boolean to check if the value has been set.
func (o *ReplicationCreationRequest) GetRemoteBucketIDOk() (*string, bool) {
if o == nil || o.RemoteBucketID == nil {
if o == nil {
return nil, false
}
return o.RemoteBucketID, true
return &o.RemoteBucketID, true
}
// HasRemoteBucketID returns a boolean if a field has been set.
func (o *ReplicationCreationRequest) HasRemoteBucketID() bool {
if o != nil && o.RemoteBucketID != nil {
return true
}
return false
}
// SetRemoteBucketID gets a reference to the given string and assigns it to the RemoteBucketID field.
// SetRemoteBucketID sets field value
func (o *ReplicationCreationRequest) SetRemoteBucketID(v string) {
o.RemoteBucketID = &v
o.RemoteBucketID = v
}
// GetMaxQueueSizeBytes returns the MaxQueueSizeBytes field value
@ -254,10 +240,10 @@ func (o ReplicationCreationRequest) MarshalJSON() ([]byte, error) {
if true {
toSerialize["remoteID"] = o.RemoteID
}
if o.LocalBucketID != nil {
if true {
toSerialize["localBucketID"] = o.LocalBucketID
}
if o.RemoteBucketID != nil {
if true {
toSerialize["remoteBucketID"] = o.RemoteBucketID
}
if true {

View File

@ -169,7 +169,8 @@ func (c Client) fullRestore(ctx context.Context, path string, legacy bool) error
if !legacy {
kvReq = kvReq.ContentEncoding("gzip")
}
if err := kvReq.Execute(); err != nil {
// TODO: Use the response object for something here.
if _, err := kvReq.Execute(); err != nil {
return fmt.Errorf("failed to restore KV snapshot: %w", err)
}