diff --git a/api/api_authorizations.gen.go b/api/api_authorizations.gen.go index 3867936..50d6a30 100644 --- a/api/api_authorizations.gen.go +++ b/api/api_authorizations.gen.go @@ -208,7 +208,7 @@ func (a *AuthorizationsApiService) DeleteAuthorizationsIDExecuteWithHttpInfo(r A return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/authorizations/{authID}" + localVarPath := localBasePath + "/api/v2/authorizations/{authID}" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -378,7 +378,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGet return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/authorizations" + localVarPath := localBasePath + "/api/v2/authorizations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -553,7 +553,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsIDExecuteWithHttpInfo(r ApiG return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/authorizations/{authID}" + localVarPath := localBasePath + "/api/v2/authorizations/{authID}" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -726,7 +726,7 @@ func (a *AuthorizationsApiService) PatchAuthorizationsIDExecuteWithHttpInfo(r Ap return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/authorizations/{authID}" + localVarPath := localBasePath + "/api/v2/authorizations/{authID}" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -893,7 +893,7 @@ func (a *AuthorizationsApiService) PostAuthorizationsExecuteWithHttpInfo(r ApiPo return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/authorizations" + localVarPath := localBasePath + "/api/v2/authorizations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_backup.gen.go b/api/api_backup.gen.go index d2df67b..ffbc0b9 100644 --- a/api/api_backup.gen.go +++ b/api/api_backup.gen.go @@ -159,7 +159,7 @@ func (a *BackupApiService) GetBackupKVExecuteWithHttpInfo(r ApiGetBackupKVReques return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/backup/kv" + localVarPath := localBasePath + "/api/v2/backup/kv" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -303,7 +303,7 @@ func (a *BackupApiService) GetBackupMetadataExecuteWithHttpInfo(r ApiGetBackupMe return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/backup/metadata" + localVarPath := localBasePath + "/api/v2/backup/metadata" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -470,7 +470,7 @@ func (a *BackupApiService) GetBackupShardIdExecuteWithHttpInfo(r ApiGetBackupSha return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/backup/shards/{shardID}" + localVarPath := localBasePath + "/api/v2/backup/shards/{shardID}" localVarPath = strings.Replace(localVarPath, "{"+"shardID"+"}", _neturl.PathEscape(parameterToString(r.shardID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_bucket_schemas.gen.go b/api/api_bucket_schemas.gen.go index 0d67167..5efb6ed 100644 --- a/api/api_bucket_schemas.gen.go +++ b/api/api_bucket_schemas.gen.go @@ -213,7 +213,7 @@ func (a *BucketSchemasApiService) CreateMeasurementSchemaExecuteWithHttpInfo(r A return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}/schema/measurements" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -404,7 +404,7 @@ func (a *BucketSchemasApiService) GetMeasurementSchemaExecuteWithHttpInfo(r ApiG return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements/{measurementID}" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}/schema/measurements/{measurementID}" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"measurementID"+"}", _neturl.PathEscape(parameterToString(r.measurementID, "")), -1) @@ -582,7 +582,7 @@ func (a *BucketSchemasApiService) GetMeasurementSchemasExecuteWithHttpInfo(r Api return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}/schema/measurements" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -783,7 +783,7 @@ func (a *BucketSchemasApiService) UpdateMeasurementSchemaExecuteWithHttpInfo(r A return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements/{measurementID}" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}/schema/measurements/{measurementID}" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"measurementID"+"}", _neturl.PathEscape(parameterToString(r.measurementID, "")), -1) diff --git a/api/api_buckets.gen.go b/api/api_buckets.gen.go index 1e06d3f..8cedb99 100644 --- a/api/api_buckets.gen.go +++ b/api/api_buckets.gen.go @@ -208,7 +208,7 @@ func (a *BucketsApiService) DeleteBucketsIDExecuteWithHttpInfo(r ApiDeleteBucket return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -416,7 +416,7 @@ func (a *BucketsApiService) GetBucketsExecuteWithHttpInfo(r ApiGetBucketsRequest return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets" + localVarPath := localBasePath + "/api/v2/buckets" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -600,7 +600,7 @@ func (a *BucketsApiService) GetBucketsIDExecuteWithHttpInfo(r ApiGetBucketsIDReq return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -773,7 +773,7 @@ func (a *BucketsApiService) PatchBucketsIDExecuteWithHttpInfo(r ApiPatchBucketsI return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets/{bucketID}" + localVarPath := localBasePath + "/api/v2/buckets/{bucketID}" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -940,7 +940,7 @@ func (a *BucketsApiService) PostBucketsExecuteWithHttpInfo(r ApiPostBucketsReque return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/buckets" + localVarPath := localBasePath + "/api/v2/buckets" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_config.gen.go b/api/api_config.gen.go index 1394a3a..c86fc0a 100644 --- a/api/api_config.gen.go +++ b/api/api_config.gen.go @@ -26,10 +26,19 @@ var ( type ConfigApi interface { /* - * GetConfig Get the run-time configuration of the instance - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetConfigRequest - */ + * GetConfig Retrieve runtime configuration + * Returns the active runtime configuration of the InfluxDB instance. + + In InfluxDB v2.2+, use this endpoint to view your active runtime configuration, + including flags and environment variables. + + #### Related guides + + - [View your runtime server configuration]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/#view-your-runtime-server-configuration) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetConfigRequest + */ GetConfig(ctx _context.Context) ApiGetConfigRequest /* @@ -73,10 +82,19 @@ func (r ApiGetConfigRequest) ExecuteWithHttpInfo() (Config, *_nethttp.Response, } /* - * GetConfig Get the run-time configuration of the instance + * GetConfig Retrieve runtime configuration + * Returns the active runtime configuration of the InfluxDB instance. + +In InfluxDB v2.2+, use this endpoint to view your active runtime configuration, +including flags and environment variables. + +#### Related guides + +- [View your runtime server configuration]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/#view-your-runtime-server-configuration) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetConfigRequest - */ +*/ func (a *ConfigApiService) GetConfig(ctx _context.Context) ApiGetConfigRequest { return ApiGetConfigRequest{ ApiService: a, @@ -114,7 +132,7 @@ func (a *ConfigApiService) GetConfigExecuteWithHttpInfo(r ApiGetConfigRequest) ( return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/config" + localVarPath := localBasePath + "/api/v2/config" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_dashboards.gen.go b/api/api_dashboards.gen.go index 9c9f6aa..721d720 100644 --- a/api/api_dashboards.gen.go +++ b/api/api_dashboards.gen.go @@ -187,7 +187,7 @@ func (a *DashboardsApiService) GetDashboardsExecuteWithHttpInfo(r ApiGetDashboar return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/dashboards" + localVarPath := localBasePath + "/api/v2/dashboards" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_dbrps.gen.go b/api/api_dbrps.gen.go index 1b72dc8..0eb77ef 100644 --- a/api/api_dbrps.gen.go +++ b/api/api_dbrps.gen.go @@ -226,7 +226,7 @@ func (a *DBRPsApiService) DeleteDBRPIDExecuteWithHttpInfo(r ApiDeleteDBRPIDReque return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/dbrps/{dbrpID}" + localVarPath := localBasePath + "/api/v2/dbrps/{dbrpID}" localVarPath = strings.Replace(localVarPath, "{"+"dbrpID"+"}", _neturl.PathEscape(parameterToString(r.dbrpID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -440,7 +440,7 @@ func (a *DBRPsApiService) GetDBRPsExecuteWithHttpInfo(r ApiGetDBRPsRequest) (DBR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/dbrps" + localVarPath := localBasePath + "/api/v2/dbrps" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -653,7 +653,7 @@ func (a *DBRPsApiService) GetDBRPsIDExecuteWithHttpInfo(r ApiGetDBRPsIDRequest) return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/dbrps/{dbrpID}" + localVarPath := localBasePath + "/api/v2/dbrps/{dbrpID}" localVarPath = strings.Replace(localVarPath, "{"+"dbrpID"+"}", _neturl.PathEscape(parameterToString(r.dbrpID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -861,7 +861,7 @@ func (a *DBRPsApiService) PatchDBRPIDExecuteWithHttpInfo(r ApiPatchDBRPIDRequest return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/dbrps/{dbrpID}" + localVarPath := localBasePath + "/api/v2/dbrps/{dbrpID}" localVarPath = strings.Replace(localVarPath, "{"+"dbrpID"+"}", _neturl.PathEscape(parameterToString(r.dbrpID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1056,7 +1056,7 @@ func (a *DBRPsApiService) PostDBRPExecuteWithHttpInfo(r ApiPostDBRPRequest) (DBR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/dbrps" + localVarPath := localBasePath + "/api/v2/dbrps" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_delete.gen.go b/api/api_delete.gen.go index 6ae45ad..f4367a5 100644 --- a/api/api_delete.gen.go +++ b/api/api_delete.gen.go @@ -26,10 +26,45 @@ var ( type DeleteApi interface { /* - * PostDelete Delete data - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostDeleteRequest - */ + * PostDelete Delete data + * Deletes data from a bucket. + + Use this endpoint to delete points from a bucket in a specified time range. + + #### InfluxDB Cloud + + - Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns _success_ if queued; _error_ otherwise. + 3. Handles the delete asynchronously. + + #### InfluxDB OSS + + - Validates the request, handles the delete synchronously, + and then responds with success or failure. + + #### Required permissions + + - `write-buckets` or `write-bucket BUCKET_ID`. + + `BUCKET_ID` is the ID of the destination bucket. + + #### Rate limits (with InfluxDB Cloud) + + `write` rate limits apply. + For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + + #### Related guides + + - [Delete data]({{% INFLUXDB_DOCS_URL %}}/write-data/delete-data/). + - Learn how to use [delete predicate syntax]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/delete-predicate/). + - Learn how InfluxDB handles [deleted tags](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementtagkeys/) + and [deleted fields](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementfieldkeys/). + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostDeleteRequest + */ PostDelete(ctx _context.Context) ApiPostDeleteRequest /* @@ -117,9 +152,44 @@ func (r ApiPostDeleteRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) /* * PostDelete Delete data + * Deletes data from a bucket. + +Use this endpoint to delete points from a bucket in a specified time range. + +#### InfluxDB Cloud + +- Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns _success_ if queued; _error_ otherwise. + 3. Handles the delete asynchronously. + +#### InfluxDB OSS + +- Validates the request, handles the delete synchronously, + and then responds with success or failure. + +#### Required permissions + +- `write-buckets` or `write-bucket BUCKET_ID`. + + `BUCKET_ID` is the ID of the destination bucket. + +#### Rate limits (with InfluxDB Cloud) + +`write` rate limits apply. +For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + +#### Related guides + +- [Delete data]({{% INFLUXDB_DOCS_URL %}}/write-data/delete-data/). +- Learn how to use [delete predicate syntax]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/delete-predicate/). +- Learn how InfluxDB handles [deleted tags](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementtagkeys/) + and [deleted fields](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementfieldkeys/). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostDeleteRequest - */ +*/ func (a *DeleteApiService) PostDelete(ctx _context.Context) ApiPostDeleteRequest { return ApiPostDeleteRequest{ ApiService: a, @@ -154,7 +224,7 @@ func (a *DeleteApiService) PostDeleteExecuteWithHttpInfo(r ApiPostDeleteRequest) return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/delete" + localVarPath := localBasePath + "/api/v2/delete" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -237,28 +307,6 @@ func (a *DeleteApiService) PostDeleteExecuteWithHttpInfo(r ApiPostDeleteRequest) newErr.model = &v return localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) - return localVarHTTPResponse, newErr - } - v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) - newErr.model = &v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) - return localVarHTTPResponse, newErr - } - v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) - newErr.model = &v - return localVarHTTPResponse, newErr - } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_health.gen.go b/api/api_health.gen.go index d2b64d7..5f29976 100644 --- a/api/api_health.gen.go +++ b/api/api_health.gen.go @@ -26,7 +26,8 @@ var ( type HealthApi interface { /* - * GetHealth Get the health of an instance + * GetHealth Retrieve the health of the instance + * Returns the health of the instance. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetHealthRequest */ @@ -73,7 +74,8 @@ func (r ApiGetHealthRequest) ExecuteWithHttpInfo() (HealthCheck, *_nethttp.Respo } /* - * GetHealth Get the health of an instance + * GetHealth Retrieve the health of the instance + * Returns the health of the instance. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetHealthRequest */ diff --git a/api/api_legacy_authorizations.gen.go b/api/api_legacy_authorizations.gen.go index c307b0f..c128607 100644 --- a/api/api_legacy_authorizations.gen.go +++ b/api/api_legacy_authorizations.gen.go @@ -228,7 +228,7 @@ func (a *LegacyAuthorizationsApiService) DeleteLegacyAuthorizationsIDExecuteWith return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/legacy/authorizations/{authID}" + localVarPath := localBasePath + "/private/legacy/authorizations/{authID}" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -416,7 +416,7 @@ func (a *LegacyAuthorizationsApiService) GetLegacyAuthorizationsExecuteWithHttpI return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/legacy/authorizations" + localVarPath := localBasePath + "/private/legacy/authorizations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -597,7 +597,7 @@ func (a *LegacyAuthorizationsApiService) GetLegacyAuthorizationsIDExecuteWithHtt return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/legacy/authorizations/{authID}" + localVarPath := localBasePath + "/private/legacy/authorizations/{authID}" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -770,7 +770,7 @@ func (a *LegacyAuthorizationsApiService) PatchLegacyAuthorizationsIDExecuteWithH return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/legacy/authorizations/{authID}" + localVarPath := localBasePath + "/private/legacy/authorizations/{authID}" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -937,7 +937,7 @@ func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizationsExecuteWithHttp return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/legacy/authorizations" + localVarPath := localBasePath + "/private/legacy/authorizations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1122,7 +1122,7 @@ func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizationsIDPasswordExecu return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/legacy/authorizations/{authID}/password" + localVarPath := localBasePath + "/private/legacy/authorizations/{authID}/password" localVarPath = strings.Replace(localVarPath, "{"+"authID"+"}", _neturl.PathEscape(parameterToString(r.authID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_legacy_query.gen.go b/api/api_legacy_query.gen.go new file mode 100644 index 0000000..73744ec --- /dev/null +++ b/api/api_legacy_query.gen.go @@ -0,0 +1,315 @@ +/* + * 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 ( + _context "context" + _fmt "fmt" + _io "io" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +type LegacyQueryApi interface { + + /* + * GetLegacyQuery Query with the 1.x compatibility API + * Queries InfluxDB using InfluxQL. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetLegacyQueryRequest + */ + GetLegacyQuery(ctx _context.Context) ApiGetLegacyQueryRequest + + /* + * GetLegacyQueryExecute executes the request + * @return string + */ + GetLegacyQueryExecute(r ApiGetLegacyQueryRequest) (string, error) + + /* + * GetLegacyQueryExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not + * available on the returned HTTP response as it will have already been read and closed; access to the response body + * content should be achieved through the returned response model if applicable. + * @return string + */ + GetLegacyQueryExecuteWithHttpInfo(r ApiGetLegacyQueryRequest) (string, *_nethttp.Response, error) +} + +// LegacyQueryApiService LegacyQueryApi service +type LegacyQueryApiService service + +type ApiGetLegacyQueryRequest struct { + ctx _context.Context + ApiService LegacyQueryApi + db *string + q *string + zapTraceSpan *string + accept *string + acceptEncoding *string + contentType *string + u *string + p *string + rp *string + epoch *string +} + +func (r ApiGetLegacyQueryRequest) Db(db string) ApiGetLegacyQueryRequest { + r.db = &db + return r +} +func (r ApiGetLegacyQueryRequest) GetDb() *string { + return r.db +} + +func (r ApiGetLegacyQueryRequest) Q(q string) ApiGetLegacyQueryRequest { + r.q = &q + return r +} +func (r ApiGetLegacyQueryRequest) GetQ() *string { + return r.q +} + +func (r ApiGetLegacyQueryRequest) ZapTraceSpan(zapTraceSpan string) ApiGetLegacyQueryRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiGetLegacyQueryRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiGetLegacyQueryRequest) Accept(accept string) ApiGetLegacyQueryRequest { + r.accept = &accept + return r +} +func (r ApiGetLegacyQueryRequest) GetAccept() *string { + return r.accept +} + +func (r ApiGetLegacyQueryRequest) AcceptEncoding(acceptEncoding string) ApiGetLegacyQueryRequest { + r.acceptEncoding = &acceptEncoding + return r +} +func (r ApiGetLegacyQueryRequest) GetAcceptEncoding() *string { + return r.acceptEncoding +} + +func (r ApiGetLegacyQueryRequest) ContentType(contentType string) ApiGetLegacyQueryRequest { + r.contentType = &contentType + return r +} +func (r ApiGetLegacyQueryRequest) GetContentType() *string { + return r.contentType +} + +func (r ApiGetLegacyQueryRequest) U(u string) ApiGetLegacyQueryRequest { + r.u = &u + return r +} +func (r ApiGetLegacyQueryRequest) GetU() *string { + return r.u +} + +func (r ApiGetLegacyQueryRequest) P(p string) ApiGetLegacyQueryRequest { + r.p = &p + return r +} +func (r ApiGetLegacyQueryRequest) GetP() *string { + return r.p +} + +func (r ApiGetLegacyQueryRequest) Rp(rp string) ApiGetLegacyQueryRequest { + r.rp = &rp + return r +} +func (r ApiGetLegacyQueryRequest) GetRp() *string { + return r.rp +} + +func (r ApiGetLegacyQueryRequest) Epoch(epoch string) ApiGetLegacyQueryRequest { + r.epoch = &epoch + return r +} +func (r ApiGetLegacyQueryRequest) GetEpoch() *string { + return r.epoch +} + +func (r ApiGetLegacyQueryRequest) Execute() (string, error) { + return r.ApiService.GetLegacyQueryExecute(r) +} + +func (r ApiGetLegacyQueryRequest) ExecuteWithHttpInfo() (string, *_nethttp.Response, error) { + return r.ApiService.GetLegacyQueryExecuteWithHttpInfo(r) +} + +/* + * GetLegacyQuery Query with the 1.x compatibility API + * Queries InfluxDB using InfluxQL. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetLegacyQueryRequest + */ +func (a *LegacyQueryApiService) GetLegacyQuery(ctx _context.Context) ApiGetLegacyQueryRequest { + return ApiGetLegacyQueryRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return string + */ +func (a *LegacyQueryApiService) GetLegacyQueryExecute(r ApiGetLegacyQueryRequest) (string, error) { + returnVal, _, err := a.GetLegacyQueryExecuteWithHttpInfo(r) + return returnVal, err +} + +/* + * ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the + * returned HTTP response as it will have already been read and closed; access to the response body content should be + * achieved through the returned response model if applicable. + * @return string + */ +func (a *LegacyQueryApiService) GetLegacyQueryExecuteWithHttpInfo(r ApiGetLegacyQueryRequest) (string, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LegacyQueryApiService.GetLegacyQuery") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.db == nil { + return localVarReturnValue, nil, reportError("db is required and must be specified") + } + if r.q == nil { + return localVarReturnValue, nil, reportError("q is required and must be specified") + } + + if r.u != nil { + localVarQueryParams.Add("u", parameterToString(*r.u, "")) + } + if r.p != nil { + localVarQueryParams.Add("p", parameterToString(*r.p, "")) + } + localVarQueryParams.Add("db", parameterToString(*r.db, "")) + if r.rp != nil { + localVarQueryParams.Add("rp", parameterToString(*r.rp, "")) + } + localVarQueryParams.Add("q", parameterToString(*r.q, "")) + if r.epoch != nil { + localVarQueryParams.Add("epoch", parameterToString(*r.epoch, "")) + } + // 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{"text/csv", "application/csv", "application/json", "application/x-msgpack"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.zapTraceSpan != nil { + localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "") + } + if r.accept != nil { + localVarHeaderParams["Accept"] = parameterToString(*r.accept, "") + } + if r.acceptEncoding != nil { + localVarHeaderParams["Accept-Encoding"] = parameterToString(*r.acceptEncoding, "") + } + if r.contentType != nil { + localVarHeaderParams["Content-Type"] = parameterToString(*r.contentType, "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + newErr := GenericOpenAPIError{ + buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"), + } + + if localVarHTTPResponse.StatusCode >= 300 { + body, err := GunzipIfNeeded(localVarHTTPResponse) + if err != nil { + body.Close() + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + localVarBody, err := _io.ReadAll(body) + body.Close() + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.body = localVarBody + newErr.error = localVarHTTPResponse.Status + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + body, err := GunzipIfNeeded(localVarHTTPResponse) + if err != nil { + body.Close() + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + localVarBody, err := _io.ReadAll(body) + body.Close() + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.body = localVarBody + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/api/api_legacy_write.gen.go b/api/api_legacy_write.gen.go new file mode 100644 index 0000000..e7a3bfe --- /dev/null +++ b/api/api_legacy_write.gen.go @@ -0,0 +1,310 @@ +/* + * 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 ( + _context "context" + _fmt "fmt" + _io "io" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +type LegacyWriteApi interface { + + /* + * PostLegacyWrite Write time series data into InfluxDB in a V1-compatible format + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostLegacyWriteRequest + */ + PostLegacyWrite(ctx _context.Context) ApiPostLegacyWriteRequest + + /* + * PostLegacyWriteExecute executes the request + */ + PostLegacyWriteExecute(r ApiPostLegacyWriteRequest) error + + /* + * PostLegacyWriteExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not + * available on the returned HTTP response as it will have already been read and closed; access to the response body + * content should be achieved through the returned response model if applicable. + */ + PostLegacyWriteExecuteWithHttpInfo(r ApiPostLegacyWriteRequest) (*_nethttp.Response, error) +} + +// LegacyWriteApiService LegacyWriteApi service +type LegacyWriteApiService service + +type ApiPostLegacyWriteRequest struct { + ctx _context.Context + ApiService LegacyWriteApi + db *string + body *string + zapTraceSpan *string + u *string + p *string + rp *string + precision *string + contentEncoding *string +} + +func (r ApiPostLegacyWriteRequest) Db(db string) ApiPostLegacyWriteRequest { + r.db = &db + return r +} +func (r ApiPostLegacyWriteRequest) GetDb() *string { + return r.db +} + +func (r ApiPostLegacyWriteRequest) Body(body string) ApiPostLegacyWriteRequest { + r.body = &body + return r +} +func (r ApiPostLegacyWriteRequest) GetBody() *string { + return r.body +} + +func (r ApiPostLegacyWriteRequest) ZapTraceSpan(zapTraceSpan string) ApiPostLegacyWriteRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPostLegacyWriteRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPostLegacyWriteRequest) U(u string) ApiPostLegacyWriteRequest { + r.u = &u + return r +} +func (r ApiPostLegacyWriteRequest) GetU() *string { + return r.u +} + +func (r ApiPostLegacyWriteRequest) P(p string) ApiPostLegacyWriteRequest { + r.p = &p + return r +} +func (r ApiPostLegacyWriteRequest) GetP() *string { + return r.p +} + +func (r ApiPostLegacyWriteRequest) Rp(rp string) ApiPostLegacyWriteRequest { + r.rp = &rp + return r +} +func (r ApiPostLegacyWriteRequest) GetRp() *string { + return r.rp +} + +func (r ApiPostLegacyWriteRequest) Precision(precision string) ApiPostLegacyWriteRequest { + r.precision = &precision + return r +} +func (r ApiPostLegacyWriteRequest) GetPrecision() *string { + return r.precision +} + +func (r ApiPostLegacyWriteRequest) ContentEncoding(contentEncoding string) ApiPostLegacyWriteRequest { + r.contentEncoding = &contentEncoding + return r +} +func (r ApiPostLegacyWriteRequest) GetContentEncoding() *string { + return r.contentEncoding +} + +func (r ApiPostLegacyWriteRequest) Execute() error { + return r.ApiService.PostLegacyWriteExecute(r) +} + +func (r ApiPostLegacyWriteRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { + return r.ApiService.PostLegacyWriteExecuteWithHttpInfo(r) +} + +/* + * PostLegacyWrite Write time series data into InfluxDB in a V1-compatible format + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostLegacyWriteRequest + */ +func (a *LegacyWriteApiService) PostLegacyWrite(ctx _context.Context) ApiPostLegacyWriteRequest { + return ApiPostLegacyWriteRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *LegacyWriteApiService) PostLegacyWriteExecute(r ApiPostLegacyWriteRequest) error { + _, err := a.PostLegacyWriteExecuteWithHttpInfo(r) + return err +} + +/* + * ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the + * returned HTTP response as it will have already been read and closed; access to the response body content should be + * achieved through the returned response model if applicable. + */ +func (a *LegacyWriteApiService) PostLegacyWriteExecuteWithHttpInfo(r ApiPostLegacyWriteRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LegacyWriteApiService.PostLegacyWrite") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/write" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.db == nil { + return nil, reportError("db is required and must be specified") + } + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + if r.u != nil { + localVarQueryParams.Add("u", parameterToString(*r.u, "")) + } + if r.p != nil { + localVarQueryParams.Add("p", parameterToString(*r.p, "")) + } + localVarQueryParams.Add("db", parameterToString(*r.db, "")) + if r.rp != nil { + localVarQueryParams.Add("rp", parameterToString(*r.rp, "")) + } + if r.precision != nil { + localVarQueryParams.Add("precision", parameterToString(*r.precision, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"text/plain"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.zapTraceSpan != nil { + localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "") + } + if r.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 nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + newErr := GenericOpenAPIError{ + buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"), + } + + if localVarHTTPResponse.StatusCode >= 300 { + body, err := GunzipIfNeeded(localVarHTTPResponse) + if err != nil { + body.Close() + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + localVarBody, err := _io.ReadAll(body) + body.Close() + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.body = localVarBody + newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + var v LineProtocolError + 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 localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 413 { + var v LineProtocolLengthError + 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 localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/api/api_organizations.gen.go b/api/api_organizations.gen.go index 413d64e..7a6bdea 100644 --- a/api/api_organizations.gen.go +++ b/api/api_organizations.gen.go @@ -273,7 +273,7 @@ func (a *OrganizationsApiService) DeleteOrgsIDExecuteWithHttpInfo(r ApiDeleteOrg return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -437,7 +437,7 @@ func (a *OrganizationsApiService) DeleteOrgsIDMembersIDExecuteWithHttpInfo(r Api return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}/members/{userID}" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}/members/{userID}" localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) @@ -626,7 +626,7 @@ func (a *OrganizationsApiService) GetOrgsExecuteWithHttpInfo(r ApiGetOrgsRequest return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs" + localVarPath := localBasePath + "/api/v2/orgs" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -807,7 +807,7 @@ func (a *OrganizationsApiService) GetOrgsIDExecuteWithHttpInfo(r ApiGetOrgsIDReq return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -971,7 +971,7 @@ func (a *OrganizationsApiService) GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOr return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}/members" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}/members" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1155,7 +1155,7 @@ func (a *OrganizationsApiService) PatchOrgsIDExecuteWithHttpInfo(r ApiPatchOrgsI return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1322,7 +1322,7 @@ func (a *OrganizationsApiService) PostOrgsExecuteWithHttpInfo(r ApiPostOrgsReque return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs" + localVarPath := localBasePath + "/api/v2/orgs" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1499,7 +1499,7 @@ func (a *OrganizationsApiService) PostOrgsIDMembersExecuteWithHttpInfo(r ApiPost return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}/members" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}/members" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_ping.gen.go b/api/api_ping.gen.go new file mode 100644 index 0000000..0b99ac0 --- /dev/null +++ b/api/api_ping.gen.go @@ -0,0 +1,291 @@ +/* + * 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 ( + _context "context" + _io "io" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +type PingApi interface { + + /* + * GetPing Get the status and version of the instance + * Returns the status and InfluxDB version of the instance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetPingRequest + */ + GetPing(ctx _context.Context) ApiGetPingRequest + + /* + * GetPingExecute executes the request + */ + GetPingExecute(r ApiGetPingRequest) error + + /* + * GetPingExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not + * available on the returned HTTP response as it will have already been read and closed; access to the response body + * content should be achieved through the returned response model if applicable. + */ + GetPingExecuteWithHttpInfo(r ApiGetPingRequest) (*_nethttp.Response, error) + + /* + * HeadPing Get the status and version of the instance + * Returns the status and InfluxDB version of the instance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiHeadPingRequest + */ + HeadPing(ctx _context.Context) ApiHeadPingRequest + + /* + * HeadPingExecute executes the request + */ + HeadPingExecute(r ApiHeadPingRequest) error + + /* + * HeadPingExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not + * available on the returned HTTP response as it will have already been read and closed; access to the response body + * content should be achieved through the returned response model if applicable. + */ + HeadPingExecuteWithHttpInfo(r ApiHeadPingRequest) (*_nethttp.Response, error) +} + +// PingApiService PingApi service +type PingApiService service + +type ApiGetPingRequest struct { + ctx _context.Context + ApiService PingApi +} + +func (r ApiGetPingRequest) Execute() error { + return r.ApiService.GetPingExecute(r) +} + +func (r ApiGetPingRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { + return r.ApiService.GetPingExecuteWithHttpInfo(r) +} + +/* + * GetPing Get the status and version of the instance + * Returns the status and InfluxDB version of the instance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetPingRequest + */ +func (a *PingApiService) GetPing(ctx _context.Context) ApiGetPingRequest { + return ApiGetPingRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *PingApiService) GetPingExecute(r ApiGetPingRequest) error { + _, err := a.GetPingExecuteWithHttpInfo(r) + return err +} + +/* + * ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the + * returned HTTP response as it will have already been read and closed; access to the response body content should be + * achieved through the returned response model if applicable. + */ +func (a *PingApiService) GetPingExecuteWithHttpInfo(r ApiGetPingRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PingApiService.GetPing") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ping" + + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + newErr := GenericOpenAPIError{ + buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"), + } + + if localVarHTTPResponse.StatusCode >= 300 { + body, err := GunzipIfNeeded(localVarHTTPResponse) + if err != nil { + body.Close() + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + localVarBody, err := _io.ReadAll(body) + body.Close() + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.body = localVarBody + newErr.error = localVarHTTPResponse.Status + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiHeadPingRequest struct { + ctx _context.Context + ApiService PingApi +} + +func (r ApiHeadPingRequest) Execute() error { + return r.ApiService.HeadPingExecute(r) +} + +func (r ApiHeadPingRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { + return r.ApiService.HeadPingExecuteWithHttpInfo(r) +} + +/* + * HeadPing Get the status and version of the instance + * Returns the status and InfluxDB version of the instance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiHeadPingRequest + */ +func (a *PingApiService) HeadPing(ctx _context.Context) ApiHeadPingRequest { + return ApiHeadPingRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + */ +func (a *PingApiService) HeadPingExecute(r ApiHeadPingRequest) error { + _, err := a.HeadPingExecuteWithHttpInfo(r) + return err +} + +/* + * ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the + * returned HTTP response as it will have already been read and closed; access to the response body content should be + * achieved through the returned response model if applicable. + */ +func (a *PingApiService) HeadPingExecuteWithHttpInfo(r ApiHeadPingRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodHead + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PingApiService.HeadPing") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ping" + + 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + newErr := GenericOpenAPIError{ + buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"), + } + + if localVarHTTPResponse.StatusCode >= 300 { + body, err := GunzipIfNeeded(localVarHTTPResponse) + if err != nil { + body.Close() + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + localVarBody, err := _io.ReadAll(body) + body.Close() + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.body = localVarBody + newErr.error = localVarHTTPResponse.Status + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/api/api_query.gen.go b/api/api_query.gen.go index 23cd762..55c5a30 100644 --- a/api/api_query.gen.go +++ b/api/api_query.gen.go @@ -159,7 +159,7 @@ func (a *QueryApiService) PostQueryExecuteWithHttpInfo(r ApiPostQueryRequest) (* return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/query" + localVarPath := localBasePath + "/api/v2/query" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_remote_connections.gen.go b/api/api_remote_connections.gen.go index a0a7f2d..a1b0475 100644 --- a/api/api_remote_connections.gen.go +++ b/api/api_remote_connections.gen.go @@ -208,7 +208,7 @@ func (a *RemoteConnectionsApiService) DeleteRemoteConnectionByIDExecuteWithHttpI return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/remotes/{remoteID}" + localVarPath := localBasePath + "/api/v2/remotes/{remoteID}" localVarPath = strings.Replace(localVarPath, "{"+"remoteID"+"}", _neturl.PathEscape(parameterToString(r.remoteID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -364,7 +364,7 @@ func (a *RemoteConnectionsApiService) GetRemoteConnectionByIDExecuteWithHttpInfo return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/remotes/{remoteID}" + localVarPath := localBasePath + "/api/v2/remotes/{remoteID}" localVarPath = strings.Replace(localVarPath, "{"+"remoteID"+"}", _neturl.PathEscape(parameterToString(r.remoteID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -555,7 +555,7 @@ func (a *RemoteConnectionsApiService) GetRemoteConnectionsExecuteWithHttpInfo(r return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/remotes" + localVarPath := localBasePath + "/api/v2/remotes" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -748,7 +748,7 @@ func (a *RemoteConnectionsApiService) PatchRemoteConnectionByIDExecuteWithHttpIn return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/remotes/{remoteID}" + localVarPath := localBasePath + "/api/v2/remotes/{remoteID}" localVarPath = strings.Replace(localVarPath, "{"+"remoteID"+"}", _neturl.PathEscape(parameterToString(r.remoteID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -928,7 +928,7 @@ func (a *RemoteConnectionsApiService) PostRemoteConnectionExecuteWithHttpInfo(r return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/remotes" + localVarPath := localBasePath + "/api/v2/remotes" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_replications.gen.go b/api/api_replications.gen.go index 80edec8..d0196b9 100644 --- a/api/api_replications.gen.go +++ b/api/api_replications.gen.go @@ -228,7 +228,7 @@ func (a *ReplicationsApiService) DeleteReplicationByIDExecuteWithHttpInfo(r ApiD return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/replications/{replicationID}" + localVarPath := localBasePath + "/api/v2/replications/{replicationID}" localVarPath = strings.Replace(localVarPath, "{"+"replicationID"+"}", _neturl.PathEscape(parameterToString(r.replicationID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -384,7 +384,7 @@ func (a *ReplicationsApiService) GetReplicationByIDExecuteWithHttpInfo(r ApiGetR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/replications/{replicationID}" + localVarPath := localBasePath + "/api/v2/replications/{replicationID}" localVarPath = strings.Replace(localVarPath, "{"+"replicationID"+"}", _neturl.PathEscape(parameterToString(r.replicationID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -584,7 +584,7 @@ func (a *ReplicationsApiService) GetReplicationsExecuteWithHttpInfo(r ApiGetRepl return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/replications" + localVarPath := localBasePath + "/api/v2/replications" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -789,7 +789,7 @@ func (a *ReplicationsApiService) PatchReplicationByIDExecuteWithHttpInfo(r ApiPa return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/replications/{replicationID}" + localVarPath := localBasePath + "/api/v2/replications/{replicationID}" localVarPath = strings.Replace(localVarPath, "{"+"replicationID"+"}", _neturl.PathEscape(parameterToString(r.replicationID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -990,7 +990,7 @@ func (a *ReplicationsApiService) PostReplicationExecuteWithHttpInfo(r ApiPostRep return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/replications" + localVarPath := localBasePath + "/api/v2/replications" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1169,7 +1169,7 @@ func (a *ReplicationsApiService) PostValidateReplicationByIDExecuteWithHttpInfo( return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/replications/{replicationID}/validate" + localVarPath := localBasePath + "/api/v2/replications/{replicationID}/validate" localVarPath = strings.Replace(localVarPath, "{"+"replicationID"+"}", _neturl.PathEscape(parameterToString(r.replicationID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_resources.gen.go b/api/api_resources.gen.go index 68b14c6..9bc5cbe 100644 --- a/api/api_resources.gen.go +++ b/api/api_resources.gen.go @@ -114,7 +114,7 @@ func (a *ResourcesApiService) GetResourcesExecuteWithHttpInfo(r ApiGetResourcesR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/resources" + localVarPath := localBasePath + "/api/v2/resources" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_restore.gen.go b/api/api_restore.gen.go index f5d2112..8af46c6 100644 --- a/api/api_restore.gen.go +++ b/api/api_restore.gen.go @@ -226,7 +226,7 @@ func (a *RestoreApiService) PostRestoreBucketIDExecuteWithHttpInfo(r ApiPostRest return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/restore/buckets/{bucketID}" + localVarPath := localBasePath + "/api/v2/restore/buckets/{bucketID}" localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -396,7 +396,7 @@ func (a *RestoreApiService) PostRestoreBucketMetadataExecuteWithHttpInfo(r ApiPo return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/restore/bucketMetadata" + localVarPath := localBasePath + "/api/v2/restore/bucketMetadata" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -580,7 +580,7 @@ func (a *RestoreApiService) PostRestoreKVExecuteWithHttpInfo(r ApiPostRestoreKVR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/restore/kv" + localVarPath := localBasePath + "/api/v2/restore/kv" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -767,7 +767,7 @@ func (a *RestoreApiService) PostRestoreSQLExecuteWithHttpInfo(r ApiPostRestoreSQ return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/restore/sql" + localVarPath := localBasePath + "/api/v2/restore/sql" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -946,7 +946,7 @@ func (a *RestoreApiService) PostRestoreShardIdExecuteWithHttpInfo(r ApiPostResto return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/restore/shards/{shardID}" + localVarPath := localBasePath + "/api/v2/restore/shards/{shardID}" localVarPath = strings.Replace(localVarPath, "{"+"shardID"+"}", _neturl.PathEscape(parameterToString(r.shardID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_secrets.gen.go b/api/api_secrets.gen.go index 98aa8d2..6fd12cd 100644 --- a/api/api_secrets.gen.go +++ b/api/api_secrets.gen.go @@ -167,7 +167,7 @@ func (a *SecretsApiService) GetOrgsIDSecretsExecuteWithHttpInfo(r ApiGetOrgsIDSe return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}/secrets" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}/secrets" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -337,7 +337,7 @@ func (a *SecretsApiService) PatchOrgsIDSecretsExecuteWithHttpInfo(r ApiPatchOrgs return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}/secrets" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}/secrets" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -493,7 +493,7 @@ func (a *SecretsApiService) PostOrgsIDSecretsExecuteWithHttpInfo(r ApiPostOrgsID return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/orgs/{orgID}/secrets/{delete}" + localVarPath := localBasePath + "/api/v2/orgs/{orgID}/secrets/{delete}" localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_setup.gen.go b/api/api_setup.gen.go index 615cceb..f495a0b 100644 --- a/api/api_setup.gen.go +++ b/api/api_setup.gen.go @@ -138,7 +138,7 @@ func (a *SetupApiService) GetSetupExecuteWithHttpInfo(r ApiGetSetupRequest) (Inl return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/setup" + localVarPath := localBasePath + "/api/v2/setup" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -292,7 +292,7 @@ func (a *SetupApiService) PostSetupExecuteWithHttpInfo(r ApiPostSetupRequest) (O return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/setup" + localVarPath := localBasePath + "/api/v2/setup" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_stacks.gen.go b/api/api_stacks.gen.go index d0f585a..e73b8e6 100644 --- a/api/api_stacks.gen.go +++ b/api/api_stacks.gen.go @@ -201,7 +201,7 @@ func (a *StacksApiService) CreateStackExecuteWithHttpInfo(r ApiCreateStackReques return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/stacks" + localVarPath := localBasePath + "/api/v2/stacks" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -363,7 +363,7 @@ func (a *StacksApiService) DeleteStackExecuteWithHttpInfo(r ApiDeleteStackReques return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/stacks/{stack_id}" + localVarPath := localBasePath + "/api/v2/stacks/{stack_id}" localVarPath = strings.Replace(localVarPath, "{"+"stack_id"+"}", _neturl.PathEscape(parameterToString(r.stackId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -516,7 +516,7 @@ func (a *StacksApiService) ListStacksExecuteWithHttpInfo(r ApiListStacksRequest) return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/stacks" + localVarPath := localBasePath + "/api/v2/stacks" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -693,7 +693,7 @@ func (a *StacksApiService) ReadStackExecuteWithHttpInfo(r ApiReadStackRequest) ( return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/stacks/{stack_id}" + localVarPath := localBasePath + "/api/v2/stacks/{stack_id}" localVarPath = strings.Replace(localVarPath, "{"+"stack_id"+"}", _neturl.PathEscape(parameterToString(r.stackId, "")), -1) localVarHeaderParams := make(map[string]string) @@ -854,7 +854,7 @@ func (a *StacksApiService) UpdateStackExecuteWithHttpInfo(r ApiUpdateStackReques return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/stacks/{stack_id}" + localVarPath := localBasePath + "/api/v2/stacks/{stack_id}" localVarPath = strings.Replace(localVarPath, "{"+"stack_id"+"}", _neturl.PathEscape(parameterToString(r.stackId, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_tasks.gen.go b/api/api_tasks.gen.go index 67ebeaa..df20a41 100644 --- a/api/api_tasks.gen.go +++ b/api/api_tasks.gen.go @@ -49,7 +49,7 @@ type TasksApi interface { DeleteTasksIDExecuteWithHttpInfo(r ApiDeleteTasksIDRequest) (*_nethttp.Response, error) /* - * DeleteTasksIDRunsID Cancel a running task + * DeleteTasksIDRunsID Cancel a running task. #### InfluxDB Cloud - Doesn't support this operation. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID The task ID. * @param runID The run ID. @@ -157,7 +157,7 @@ type TasksApi interface { GetTasksIDRunsExecuteWithHttpInfo(r ApiGetTasksIDRunsRequest) (Runs, *_nethttp.Response, error) /* - * GetTasksIDRunsID Retrieve a single run for a task + * GetTasksIDRunsID Retrieve a single run for a task. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID The task ID. * @param runID The run ID. @@ -368,7 +368,7 @@ func (a *TasksApiService) DeleteTasksIDExecuteWithHttpInfo(r ApiDeleteTasksIDReq return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -479,7 +479,7 @@ func (r ApiDeleteTasksIDRunsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response } /* - * DeleteTasksIDRunsID Cancel a running task + * DeleteTasksIDRunsID Cancel a running task. #### InfluxDB Cloud - Doesn't support this operation. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID The task ID. * @param runID The run ID. @@ -521,7 +521,7 @@ func (a *TasksApiService) DeleteTasksIDRunsIDExecuteWithHttpInfo(r ApiDeleteTask return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/runs/{runID}" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/runs/{runID}" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"runID"+"}", _neturl.PathEscape(parameterToString(r.runID, "")), -1) @@ -578,6 +578,17 @@ func (a *TasksApiService) DeleteTasksIDRunsIDExecuteWithHttpInfo(r ApiDeleteTask } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 405 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -728,7 +739,7 @@ func (a *TasksApiService) GetTasksExecuteWithHttpInfo(r ApiGetTasksRequest) (Tas return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks" + localVarPath := localBasePath + "/api/v2/tasks" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -915,7 +926,7 @@ func (a *TasksApiService) GetTasksIDExecuteWithHttpInfo(r ApiGetTasksIDRequest) return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1079,7 +1090,7 @@ func (a *TasksApiService) GetTasksIDLogsExecuteWithHttpInfo(r ApiGetTasksIDLogsR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/logs" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/logs" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1279,7 +1290,7 @@ func (a *TasksApiService) GetTasksIDRunsExecuteWithHttpInfo(r ApiGetTasksIDRunsR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/runs" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/runs" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1421,7 +1432,7 @@ func (r ApiGetTasksIDRunsIDRequest) ExecuteWithHttpInfo() (Run, *_nethttp.Respon } /* - * GetTasksIDRunsID Retrieve a single run for a task + * GetTasksIDRunsID Retrieve a single run for a task. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID The task ID. * @param runID The run ID. @@ -1466,7 +1477,7 @@ func (a *TasksApiService) GetTasksIDRunsIDExecuteWithHttpInfo(r ApiGetTasksIDRun return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/runs/{runID}" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/runs/{runID}" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"runID"+"}", _neturl.PathEscape(parameterToString(r.runID, "")), -1) @@ -1642,7 +1653,7 @@ func (a *TasksApiService) GetTasksIDRunsIDLogsExecuteWithHttpInfo(r ApiGetTasksI return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/runs/{runID}/logs" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/runs/{runID}/logs" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"runID"+"}", _neturl.PathEscape(parameterToString(r.runID, "")), -1) @@ -1817,7 +1828,7 @@ func (a *TasksApiService) PatchTasksIDExecuteWithHttpInfo(r ApiPatchTasksIDReque return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -1984,7 +1995,7 @@ func (a *TasksApiService) PostTasksExecuteWithHttpInfo(r ApiPostTasksRequest) (T return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks" + localVarPath := localBasePath + "/api/v2/tasks" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2161,7 +2172,7 @@ func (a *TasksApiService) PostTasksIDRunsExecuteWithHttpInfo(r ApiPostTasksIDRun return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/runs" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/runs" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -2347,7 +2358,7 @@ func (a *TasksApiService) PostTasksIDRunsIDRetryExecuteWithHttpInfo(r ApiPostTas return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/tasks/{taskID}/runs/{runID}/retry" + localVarPath := localBasePath + "/api/v2/tasks/{taskID}/runs/{runID}/retry" localVarPath = strings.Replace(localVarPath, "{"+"taskID"+"}", _neturl.PathEscape(parameterToString(r.taskID, "")), -1) localVarPath = strings.Replace(localVarPath, "{"+"runID"+"}", _neturl.PathEscape(parameterToString(r.runID, "")), -1) diff --git a/api/api_telegrafs.gen.go b/api/api_telegrafs.gen.go index 5538d40..02461de 100644 --- a/api/api_telegrafs.gen.go +++ b/api/api_telegrafs.gen.go @@ -208,7 +208,7 @@ func (a *TelegrafsApiService) DeleteTelegrafsIDExecuteWithHttpInfo(r ApiDeleteTe return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/telegrafs/{telegrafID}" + localVarPath := localBasePath + "/api/v2/telegrafs/{telegrafID}" localVarPath = strings.Replace(localVarPath, "{"+"telegrafID"+"}", _neturl.PathEscape(parameterToString(r.telegrafID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -351,7 +351,7 @@ func (a *TelegrafsApiService) GetTelegrafsExecuteWithHttpInfo(r ApiGetTelegrafsR return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/telegrafs" + localVarPath := localBasePath + "/api/v2/telegrafs" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -526,7 +526,7 @@ func (a *TelegrafsApiService) GetTelegrafsIDExecuteWithHttpInfo(r ApiGetTelegraf return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/telegrafs/{telegrafID}" + localVarPath := localBasePath + "/api/v2/telegrafs/{telegrafID}" localVarPath = strings.Replace(localVarPath, "{"+"telegrafID"+"}", _neturl.PathEscape(parameterToString(r.telegrafID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -691,7 +691,7 @@ func (a *TelegrafsApiService) PostTelegrafsExecuteWithHttpInfo(r ApiPostTelegraf return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/telegrafs" + localVarPath := localBasePath + "/api/v2/telegrafs" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -868,7 +868,7 @@ func (a *TelegrafsApiService) PutTelegrafsIDExecuteWithHttpInfo(r ApiPutTelegraf return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/telegrafs/{telegrafID}" + localVarPath := localBasePath + "/api/v2/telegrafs/{telegrafID}" localVarPath = strings.Replace(localVarPath, "{"+"telegrafID"+"}", _neturl.PathEscape(parameterToString(r.telegrafID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_templates.gen.go b/api/api_templates.gen.go index 522d92b..f546aec 100644 --- a/api/api_templates.gen.go +++ b/api/api_templates.gen.go @@ -135,7 +135,7 @@ func (a *TemplatesApiService) ApplyTemplateExecuteWithHttpInfo(r ApiApplyTemplat return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/templates/apply" + localVarPath := localBasePath + "/api/v2/templates/apply" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -300,7 +300,7 @@ func (a *TemplatesApiService) ExportTemplateExecuteWithHttpInfo(r ApiExportTempl return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/templates/export" + localVarPath := localBasePath + "/api/v2/templates/export" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/api_users.gen.go b/api/api_users.gen.go index 2440cf0..8f27915 100644 --- a/api/api_users.gen.go +++ b/api/api_users.gen.go @@ -228,7 +228,7 @@ func (a *UsersApiService) DeleteUsersIDExecuteWithHttpInfo(r ApiDeleteUsersIDReq return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/users/{userID}" + localVarPath := localBasePath + "/api/v2/users/{userID}" localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -407,7 +407,7 @@ func (a *UsersApiService) GetUsersExecuteWithHttpInfo(r ApiGetUsersRequest) (Use return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/users" + localVarPath := localBasePath + "/api/v2/users" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -585,7 +585,7 @@ func (a *UsersApiService) GetUsersIDExecuteWithHttpInfo(r ApiGetUsersIDRequest) return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/users/{userID}" + localVarPath := localBasePath + "/api/v2/users/{userID}" localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -758,7 +758,7 @@ func (a *UsersApiService) PatchUsersIDExecuteWithHttpInfo(r ApiPatchUsersIDReque return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/users/{userID}" + localVarPath := localBasePath + "/api/v2/users/{userID}" localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1) localVarHeaderParams := make(map[string]string) @@ -925,7 +925,7 @@ func (a *UsersApiService) PostUsersExecuteWithHttpInfo(r ApiPostUsersRequest) (U return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/users" + localVarPath := localBasePath + "/api/v2/users" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1099,7 +1099,7 @@ func (a *UsersApiService) PostUsersIDPasswordExecuteWithHttpInfo(r ApiPostUsersI return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/users/{userID}/password" + localVarPath := localBasePath + "/api/v2/users/{userID}/password" localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1) localVarHeaderParams := make(map[string]string) diff --git a/api/api_write.gen.go b/api/api_write.gen.go index 2fb8383..55855db 100644 --- a/api/api_write.gen.go +++ b/api/api_write.gen.go @@ -29,19 +29,43 @@ type WriteApi interface { * PostWrite Write data * Writes data to a bucket. - To write data into InfluxDB, you need the following: + Use this endpoint to send data in [line protocol]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/line-protocol/) format to InfluxDB. - - **organization name or ID** โ€“ _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. + #### InfluxDB Cloud - InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. + - Takes the following steps when you send a write request: + + 1. Validates the request and queues the write. + 2. If the write is queued, responds with an HTTP `204` status code. + 3. Handles the write asynchronously and reaches eventual consistency. + + An HTTP `2xx` status code acknowledges that the write or delete is queued. + To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, + wait for a response before you send the next request. + + Because writes are asynchronous, data might not yet be written + when you receive the response. + + #### InfluxDB OSS + + - Validates the request, handles the write synchronously, + and then responds with success or failure. + - If all points were written successfully, returns `204`, + otherwise returns the first line that failed. + + #### Required permissions + + - `write-buckets` or `write-bucket BUCKET_ID`. + + `BUCKET_ID` is the ID of the destination bucket. + + #### Rate limits (with InfluxDB Cloud) + + `write` rate limits apply. + For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + + #### Related guides - For more information and examples, see the following: - [Write data with the InfluxDB API]({{% INFLUXDB_DOCS_URL %}}/write-data/developer-tools/api). - [Optimize writes to InfluxDB]({{% INFLUXDB_DOCS_URL %}}/write-data/best-practices/optimize-writes/). - [Troubleshoot issues writing data]({{% INFLUXDB_DOCS_URL %}}/write-data/troubleshoot/) @@ -174,19 +198,43 @@ func (r ApiPostWriteRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { * PostWrite Write data * Writes data to a bucket. -To write data into InfluxDB, you need the following: +Use this endpoint to send data in [line protocol]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/line-protocol/) format to InfluxDB. -- **organization name or ID** โ€“ _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. +#### InfluxDB Cloud -InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. +- Takes the following steps when you send a write request: + + 1. Validates the request and queues the write. + 2. If the write is queued, responds with an HTTP `204` status code. + 3. Handles the write asynchronously and reaches eventual consistency. + + An HTTP `2xx` status code acknowledges that the write or delete is queued. + To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, + wait for a response before you send the next request. + + Because writes are asynchronous, data might not yet be written + when you receive the response. + +#### InfluxDB OSS + +- Validates the request, handles the write synchronously, + and then responds with success or failure. +- If all points were written successfully, returns `204`, + otherwise returns the first line that failed. + +#### Required permissions + +- `write-buckets` or `write-bucket BUCKET_ID`. + + `BUCKET_ID` is the ID of the destination bucket. + +#### Rate limits (with InfluxDB Cloud) + +`write` rate limits apply. +For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + +#### Related guides -For more information and examples, see the following: - [Write data with the InfluxDB API]({{% INFLUXDB_DOCS_URL %}}/write-data/developer-tools/api). - [Optimize writes to InfluxDB]({{% INFLUXDB_DOCS_URL %}}/write-data/best-practices/optimize-writes/). - [Troubleshoot issues writing data]({{% INFLUXDB_DOCS_URL %}}/write-data/troubleshoot/) @@ -228,7 +276,7 @@ func (a *WriteApiService) PostWriteExecuteWithHttpInfo(r ApiPostWriteRequest) (* return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/write" + localVarPath := localBasePath + "/api/v2/write" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} diff --git a/api/client.gen.go b/api/client.gen.go index d0c3fae..170f5a3 100644 --- a/api/client.gen.go +++ b/api/client.gen.go @@ -66,8 +66,14 @@ type APIClient struct { LegacyAuthorizationsApi LegacyAuthorizationsApi + LegacyQueryApi LegacyQueryApi + + LegacyWriteApi LegacyWriteApi + OrganizationsApi OrganizationsApi + PingApi PingApi + QueryApi QueryApi RemoteConnectionsApi RemoteConnectionsApi @@ -123,7 +129,10 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.DeleteApi = (*DeleteApiService)(&c.common) c.HealthApi = (*HealthApiService)(&c.common) c.LegacyAuthorizationsApi = (*LegacyAuthorizationsApiService)(&c.common) + c.LegacyQueryApi = (*LegacyQueryApiService)(&c.common) + c.LegacyWriteApi = (*LegacyWriteApiService)(&c.common) c.OrganizationsApi = (*OrganizationsApiService)(&c.common) + c.PingApi = (*PingApiService)(&c.common) c.QueryApi = (*QueryApiService)(&c.common) c.RemoteConnectionsApi = (*RemoteConnectionsApiService)(&c.common) c.ReplicationsApi = (*ReplicationsApiService)(&c.common) diff --git a/api/configuration.gen.go b/api/configuration.gen.go index 71f8fc0..97fa99e 100644 --- a/api/configuration.gen.go +++ b/api/configuration.gen.go @@ -102,7 +102,7 @@ func NewConfiguration() *Configuration { Debug: false, Servers: ServerConfigurations{ { - URL: "/api/v2", + URL: "", Description: "No description provided", }, }, @@ -113,39 +113,15 @@ func NewConfiguration() *Configuration { Description: "No description provided", }, }, - "LegacyAuthorizationsApiService.DeleteLegacyAuthorizationsID": { + "PingApiService.GetPing": { { - URL: "/private", + URL: "", Description: "No description provided", }, }, - "LegacyAuthorizationsApiService.GetLegacyAuthorizations": { + "PingApiService.HeadPing": { { - URL: "/private", - Description: "No description provided", - }, - }, - "LegacyAuthorizationsApiService.GetLegacyAuthorizationsID": { - { - URL: "/private", - Description: "No description provided", - }, - }, - "LegacyAuthorizationsApiService.PatchLegacyAuthorizationsID": { - { - URL: "/private", - Description: "No description provided", - }, - }, - "LegacyAuthorizationsApiService.PostLegacyAuthorizations": { - { - URL: "/private", - Description: "No description provided", - }, - }, - "LegacyAuthorizationsApiService.PostLegacyAuthorizationsIDPassword": { - { - URL: "/private", + URL: "", Description: "No description provided", }, }, diff --git a/api/contract/cli.yml b/api/contract/cli.yml index b1cc855..b5fd205 100644 --- a/api/contract/cli.yml +++ b/api/contract/cli.yml @@ -3,123 +3,121 @@ info: title: Subset of Influx API covered by Influx CLI version: 2.0.0 servers: - - url: /api/v2 + - url: / paths: - /health: - servers: - - url: '' - $ref: "./openapi/src/oss/paths/health.yml" - /setup: - $ref: "./openapi/src/common/paths/setup.yml" - /write: - $ref: "./openapi/src/common/paths/write.yml" - /buckets: - $ref: "./openapi/src/common/paths/buckets.yml" - /buckets/{bucketID}: - $ref: "./openapi/src/common/paths/buckets_bucketID.yml" - /orgs: - $ref: "./openapi/src/common/paths/orgs.yml" - /orgs/{orgID}: - $ref: "./openapi/src/common/paths/orgs_orgID.yml" - /orgs/{orgID}/members: - $ref: "./openapi/src/common/paths/orgs_orgID_members.yml" - /orgs/{orgID}/members/{userID}: - $ref: "./openapi/src/common/paths/orgs_orgID_members_userID.yml" - /orgs/{orgID}/secrets: - $ref: "./openapi/src/common/paths/orgs_orgID_secrets.yml" - /orgs/{orgID}/secrets/{delete}: - $ref: "./openapi/src/common/paths/orgs_orgID_secrets_delete.yml" - /buckets/{bucketID}/schema/measurements: - $ref: "./openapi/src/cloud/paths/measurements.yml" - /buckets/{bucketID}/schema/measurements/{measurementID}: - $ref: "./openapi/src/cloud/paths/measurements_measurementID.yml" /query: + $ref: "./openapi/src/legacy/paths/query.yml" + /write: + $ref: "./openapi/src/legacy/paths/write.yml" + /health: + $ref: "./openapi/src/oss/paths/health.yml" + /ping: + $ref: "./openapi/src/common/paths/ping.yml" + /private/legacy/authorizations: + $ref: "./openapi/src/legacy/paths/legacy_authorizations.yml" + /private/legacy/authorizations/{authID}: + $ref: "./openapi/src/legacy/paths/legacy_authorizations_authID.yml" + /private/legacy/authorizations/{authID}/password: + $ref: "./openapi/src/legacy/paths/legacy_authorizations_authID_password.yml" + /api/v2/setup: + $ref: "./openapi/src/common/paths/setup.yml" + /api/v2/write: + $ref: "./openapi/src/common/paths/write.yml" + /api/v2/buckets: + $ref: "./openapi/src/common/paths/buckets.yml" + /api/v2/buckets/{bucketID}: + $ref: "./openapi/src/common/paths/buckets_bucketID.yml" + /api/v2/orgs: + $ref: "./openapi/src/common/paths/orgs.yml" + /api/v2/orgs/{orgID}: + $ref: "./openapi/src/common/paths/orgs_orgID.yml" + /api/v2/orgs/{orgID}/members: + $ref: "./openapi/src/common/paths/orgs_orgID_members.yml" + /api/v2/orgs/{orgID}/members/{userID}: + $ref: "./openapi/src/common/paths/orgs_orgID_members_userID.yml" + /api/v2/orgs/{orgID}/secrets: + $ref: "./openapi/src/common/paths/orgs_orgID_secrets.yml" + /api/v2/orgs/{orgID}/secrets/{delete}: + $ref: "./openapi/src/common/paths/orgs_orgID_secrets_delete.yml" + /api/v2/buckets/{bucketID}/schema/measurements: + $ref: "./openapi/src/cloud/paths/measurements.yml" + /api/v2/buckets/{bucketID}/schema/measurements/{measurementID}: + $ref: "./openapi/src/cloud/paths/measurements_measurementID.yml" + /api/v2/query: $ref: "./overrides/paths/query.yml" - /users: + /api/v2/users: $ref: "./openapi/src/common/paths/users.yml" - /users/{userID}: + /api/v2/users/{userID}: $ref: "./openapi/src/common/paths/users_userID.yml" - "/users/{userID}/password": + "/api/v2/users/{userID}/password": $ref: "./openapi/src/common/paths/users_userID_password.yml" - /delete: + /api/v2/delete: $ref: "./openapi/src/common/paths/delete.yml" - /tasks: + /api/v2/tasks: $ref: "./openapi/src/common/paths/tasks.yml" - /tasks/{taskID}: + /api/v2/tasks/{taskID}: $ref: "./openapi/src/common/paths/tasks_taskID.yml" - /tasks/{taskID}/runs: + /api/v2/tasks/{taskID}/runs: $ref: "./openapi/src/common/paths/tasks_taskID_runs.yml" - /tasks/{taskID}/runs/{runID}: + /api/v2/tasks/{taskID}/runs/{runID}: $ref: "./openapi/src/common/paths/tasks_taskID_runs_runID.yml" - /tasks/{taskID}/runs/{runID}/retry: + /api/v2/tasks/{taskID}/runs/{runID}/retry: $ref: "./openapi/src/common/paths/tasks_taskID_runs_runID_retry.yml" - /tasks/{taskID}/logs: + /api/v2/tasks/{taskID}/logs: $ref: "./openapi/src/common/paths/tasks_taskID_logs.yml" - /tasks/{taskID}/runs/{runID}/logs: + /api/v2/tasks/{taskID}/runs/{runID}/logs: $ref: "./openapi/src/common/paths/tasks_taskID_runs_runID_logs.yml" - /backup/kv: + /api/v2/backup/kv: $ref: "./openapi/src/oss/paths/backup_kv.yml" - /backup/metadata: + /api/v2/backup/metadata: $ref: "./overrides/paths/backup_metadata.yml" - /backup/shards/{shardID}: + /api/v2/backup/shards/{shardID}: $ref: "./openapi/src/oss/paths/backup_shards_shardID.yml" - /resources: + /api/v2/resources: $ref: "./openapi/src/common/paths/resources.yml" - /restore/kv: + /api/v2/restore/kv: $ref: "./openapi/src/oss/paths/restore_kv.yml" - /restore/sql: + /api/v2/restore/sql: $ref: "./openapi/src/oss/paths/restore_sql.yml" - /restore/buckets/{bucketID}: + /api/v2/restore/buckets/{bucketID}: $ref: "./openapi/src/oss/paths/restore_bucket_bucketID.yml" - /restore/bucketMetadata: + /api/v2/restore/bucketMetadata: $ref: "./openapi/src/oss/paths/restore_bucketMetadata.yml" - /restore/shards/{shardID}: + /api/v2/restore/shards/{shardID}: $ref: "./openapi/src/oss/paths/restore_shards_shardID.yml" - "/telegrafs": + "/api/v2/telegrafs": $ref: "./openapi/src/common/paths/telegrafs.yml" - "/telegrafs/{telegrafID}": + "/api/v2/telegrafs/{telegrafID}": $ref: "./overrides/paths/telegrafs_telegrafID.yml" - /dashboards: + /api/v2/dashboards: $ref: "./overrides/paths/dashboards.yml" - /templates/export: + /api/v2/templates/export: $ref: "./overrides/paths/templates_export.yml" - /templates/apply: + /api/v2/templates/apply: $ref: "./overrides/paths/templates_apply.yml" - /stacks: + /api/v2/stacks: $ref: "./overrides/paths/stacks.yml" - /stacks/{stack_id}: + /api/v2/stacks/{stack_id}: $ref: "./overrides/paths/stacks_stack_id.yml" - /dbrps: + /api/v2/dbrps: $ref: "./openapi/src/common/paths/dbrps.yml" - "/dbrps/{dbrpID}": + "/api/v2/dbrps/{dbrpID}": $ref: "./openapi/src/common/paths/dbrps_dbrpID.yml" - /legacy/authorizations: - servers: - - url: "/private" - $ref: "./openapi/src/oss/paths/legacy_authorizations.yml" - /legacy/authorizations/{authID}: - servers: - - url: "/private" - $ref: "./openapi/src/oss/paths/legacy_authorizations_authID.yml" - /legacy/authorizations/{authID}/password: - servers: - - url: "/private" - $ref: "./openapi/src/oss/paths/legacy_authorizations_authID_password.yml" - /authorizations: + /api/v2/authorizations: $ref: "./openapi/src/common/paths/authorizations.yml" - /authorizations/{authID}: + /api/v2/authorizations/{authID}: $ref: "./openapi/src/common/paths/authorizations_authID.yml" - /remotes: + /api/v2/remotes: $ref: "./openapi/src/oss/paths/remotes.yml" - /remotes/{remoteID}: + /api/v2/remotes/{remoteID}: $ref: "./openapi/src/oss/paths/remotes_remoteID.yml" - /replications: + /api/v2/replications: $ref: "./openapi/src/oss/paths/replications.yml" - /replications/{replicationID}: + /api/v2/replications/{replicationID}: $ref: "./openapi/src/oss/paths/replications_replicationID.yml" - /replications/{replicationID}/validate: + /api/v2/replications/{replicationID}/validate: $ref: "./openapi/src/oss/paths/replications_replicationID_validate.yml" - /config: + /api/v2/config: $ref: "./openapi/src/oss/paths/config.yml" components: parameters: @@ -229,6 +227,10 @@ components: $ref: "./openapi/src/cloud/schemas/MeasurementSchemaUpdateRequest.yml" Query: $ref: "./overrides/schemas/Query.yml" + InfluxqlCsvResponse: + $ref: "./openapi/src/legacy/schemas/InfluxqlCsvResponse.yml" + InfluxqlJsonResponse: + $ref: "./openapi/src/legacy/schemas/InfluxqlJsonResponse.yml" Dialect: $ref: "./openapi/src/common/schemas/Dialect.yml" Extern: @@ -434,7 +436,7 @@ components: Authorizations: $ref: "./openapi/src/common/schemas/Authorizations.yml" LegacyAuthorizationPostRequest: - $ref: "./openapi/src/oss/schemas/LegacyAuthorizationPostRequest.yml" + $ref: "./openapi/src/legacy/schemas/LegacyAuthorizationPostRequest.yml" AuthorizationPostRequest: $ref: "./openapi/src/common/schemas/AuthorizationPostRequest.yml" RemoteConnection: diff --git a/api/contract/openapi b/api/contract/openapi index 6ea7df4..9b93b9e 160000 --- a/api/contract/openapi +++ b/api/contract/openapi @@ -1 +1 @@ -Subproject commit 6ea7df4daa5735a063be3db60d0165b34b26c096 +Subproject commit 9b93b9e414c45537f6ebed0757ff4f764518e2b5 diff --git a/api/model_delete_predicate_request.gen.go b/api/model_delete_predicate_request.gen.go index 75c64d3..da6390f 100644 --- a/api/model_delete_predicate_request.gen.go +++ b/api/model_delete_predicate_request.gen.go @@ -17,11 +17,11 @@ import ( // DeletePredicateRequest The delete predicate request. type DeletePredicateRequest struct { - // RFC3339Nano + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax)). Start time.Time `json:"start" yaml:"start"` - // RFC3339Nano + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax)). Stop time.Time `json:"stop" yaml:"stop"` - // InfluxQL-like delete statement + // An expression in [delete predicate syntax]({{% INFLUXDB_DOCS_URL %}}/reference/syntax/delete-predicate/). Predicate *string `json:"predicate,omitempty" yaml:"predicate,omitempty"` } diff --git a/api/model_influxql_json_response.gen.go b/api/model_influxql_json_response.gen.go new file mode 100644 index 0000000..ac4d5b9 --- /dev/null +++ b/api/model_influxql_json_response.gen.go @@ -0,0 +1,113 @@ +/* + * 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" +) + +// InfluxqlJsonResponse JSON Response to InfluxQL Query +type InfluxqlJsonResponse struct { + Results *[]InfluxqlJsonResponseResults `json:"results,omitempty" yaml:"results,omitempty"` +} + +// NewInfluxqlJsonResponse instantiates a new InfluxqlJsonResponse 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 NewInfluxqlJsonResponse() *InfluxqlJsonResponse { + this := InfluxqlJsonResponse{} + return &this +} + +// NewInfluxqlJsonResponseWithDefaults instantiates a new InfluxqlJsonResponse 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 NewInfluxqlJsonResponseWithDefaults() *InfluxqlJsonResponse { + this := InfluxqlJsonResponse{} + return &this +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *InfluxqlJsonResponse) GetResults() []InfluxqlJsonResponseResults { + if o == nil || o.Results == nil { + var ret []InfluxqlJsonResponseResults + return ret + } + return *o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponse) GetResultsOk() (*[]InfluxqlJsonResponseResults, bool) { + if o == nil || o.Results == nil { + return nil, false + } + return o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *InfluxqlJsonResponse) HasResults() bool { + if o != nil && o.Results != nil { + return true + } + + return false +} + +// SetResults gets a reference to the given []InfluxqlJsonResponseResults and assigns it to the Results field. +func (o *InfluxqlJsonResponse) SetResults(v []InfluxqlJsonResponseResults) { + o.Results = &v +} + +func (o InfluxqlJsonResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Results != nil { + toSerialize["results"] = o.Results + } + return json.Marshal(toSerialize) +} + +type NullableInfluxqlJsonResponse struct { + value *InfluxqlJsonResponse + isSet bool +} + +func (v NullableInfluxqlJsonResponse) Get() *InfluxqlJsonResponse { + return v.value +} + +func (v *NullableInfluxqlJsonResponse) Set(val *InfluxqlJsonResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInfluxqlJsonResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInfluxqlJsonResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInfluxqlJsonResponse(val *InfluxqlJsonResponse) *NullableInfluxqlJsonResponse { + return &NullableInfluxqlJsonResponse{value: val, isSet: true} +} + +func (v NullableInfluxqlJsonResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInfluxqlJsonResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_influxql_json_response_results.gen.go b/api/model_influxql_json_response_results.gen.go new file mode 100644 index 0000000..20557a9 --- /dev/null +++ b/api/model_influxql_json_response_results.gen.go @@ -0,0 +1,185 @@ +/* + * 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" +) + +// InfluxqlJsonResponseResults struct for InfluxqlJsonResponseResults +type InfluxqlJsonResponseResults struct { + StatementId *int32 `json:"statement_id,omitempty" yaml:"statement_id,omitempty"` + Error *string `json:"error,omitempty" yaml:"error,omitempty"` + Series *[]InfluxqlJsonResponseSeries `json:"series,omitempty" yaml:"series,omitempty"` +} + +// NewInfluxqlJsonResponseResults instantiates a new InfluxqlJsonResponseResults 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 NewInfluxqlJsonResponseResults() *InfluxqlJsonResponseResults { + this := InfluxqlJsonResponseResults{} + return &this +} + +// NewInfluxqlJsonResponseResultsWithDefaults instantiates a new InfluxqlJsonResponseResults 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 NewInfluxqlJsonResponseResultsWithDefaults() *InfluxqlJsonResponseResults { + this := InfluxqlJsonResponseResults{} + return &this +} + +// GetStatementId returns the StatementId field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseResults) GetStatementId() int32 { + if o == nil || o.StatementId == nil { + var ret int32 + return ret + } + return *o.StatementId +} + +// GetStatementIdOk returns a tuple with the StatementId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseResults) GetStatementIdOk() (*int32, bool) { + if o == nil || o.StatementId == nil { + return nil, false + } + return o.StatementId, true +} + +// HasStatementId returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseResults) HasStatementId() bool { + if o != nil && o.StatementId != nil { + return true + } + + return false +} + +// SetStatementId gets a reference to the given int32 and assigns it to the StatementId field. +func (o *InfluxqlJsonResponseResults) SetStatementId(v int32) { + o.StatementId = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseResults) GetError() string { + if o == nil || o.Error == nil { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseResults) GetErrorOk() (*string, bool) { + if o == nil || o.Error == nil { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseResults) HasError() bool { + if o != nil && o.Error != nil { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *InfluxqlJsonResponseResults) SetError(v string) { + o.Error = &v +} + +// GetSeries returns the Series field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseResults) GetSeries() []InfluxqlJsonResponseSeries { + if o == nil || o.Series == nil { + var ret []InfluxqlJsonResponseSeries + return ret + } + return *o.Series +} + +// GetSeriesOk returns a tuple with the Series field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseResults) GetSeriesOk() (*[]InfluxqlJsonResponseSeries, bool) { + if o == nil || o.Series == nil { + return nil, false + } + return o.Series, true +} + +// HasSeries returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseResults) HasSeries() bool { + if o != nil && o.Series != nil { + return true + } + + return false +} + +// SetSeries gets a reference to the given []InfluxqlJsonResponseSeries and assigns it to the Series field. +func (o *InfluxqlJsonResponseResults) SetSeries(v []InfluxqlJsonResponseSeries) { + o.Series = &v +} + +func (o InfluxqlJsonResponseResults) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.StatementId != nil { + toSerialize["statement_id"] = o.StatementId + } + if o.Error != nil { + toSerialize["error"] = o.Error + } + if o.Series != nil { + toSerialize["series"] = o.Series + } + return json.Marshal(toSerialize) +} + +type NullableInfluxqlJsonResponseResults struct { + value *InfluxqlJsonResponseResults + isSet bool +} + +func (v NullableInfluxqlJsonResponseResults) Get() *InfluxqlJsonResponseResults { + return v.value +} + +func (v *NullableInfluxqlJsonResponseResults) Set(val *InfluxqlJsonResponseResults) { + v.value = val + v.isSet = true +} + +func (v NullableInfluxqlJsonResponseResults) IsSet() bool { + return v.isSet +} + +func (v *NullableInfluxqlJsonResponseResults) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInfluxqlJsonResponseResults(val *InfluxqlJsonResponseResults) *NullableInfluxqlJsonResponseResults { + return &NullableInfluxqlJsonResponseResults{value: val, isSet: true} +} + +func (v NullableInfluxqlJsonResponseResults) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInfluxqlJsonResponseResults) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_influxql_json_response_series.gen.go b/api/model_influxql_json_response_series.gen.go new file mode 100644 index 0000000..1368342 --- /dev/null +++ b/api/model_influxql_json_response_series.gen.go @@ -0,0 +1,257 @@ +/* + * 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" +) + +// InfluxqlJsonResponseSeries struct for InfluxqlJsonResponseSeries +type InfluxqlJsonResponseSeries struct { + Name *string `json:"name,omitempty" yaml:"name,omitempty"` + Tags *map[string]string `json:"tags,omitempty" yaml:"tags,omitempty"` + Partial *bool `json:"partial,omitempty" yaml:"partial,omitempty"` + Columns *[]string `json:"columns,omitempty" yaml:"columns,omitempty"` + Values *[][]interface{} `json:"values,omitempty" yaml:"values,omitempty"` +} + +// NewInfluxqlJsonResponseSeries instantiates a new InfluxqlJsonResponseSeries 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 NewInfluxqlJsonResponseSeries() *InfluxqlJsonResponseSeries { + this := InfluxqlJsonResponseSeries{} + return &this +} + +// NewInfluxqlJsonResponseSeriesWithDefaults instantiates a new InfluxqlJsonResponseSeries 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 NewInfluxqlJsonResponseSeriesWithDefaults() *InfluxqlJsonResponseSeries { + this := InfluxqlJsonResponseSeries{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseSeries) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseSeries) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseSeries) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *InfluxqlJsonResponseSeries) SetName(v string) { + o.Name = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseSeries) GetTags() map[string]string { + if o == nil || o.Tags == nil { + var ret map[string]string + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseSeries) GetTagsOk() (*map[string]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseSeries) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given map[string]string and assigns it to the Tags field. +func (o *InfluxqlJsonResponseSeries) SetTags(v map[string]string) { + o.Tags = &v +} + +// GetPartial returns the Partial field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseSeries) GetPartial() bool { + if o == nil || o.Partial == nil { + var ret bool + return ret + } + return *o.Partial +} + +// GetPartialOk returns a tuple with the Partial field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseSeries) GetPartialOk() (*bool, bool) { + if o == nil || o.Partial == nil { + return nil, false + } + return o.Partial, true +} + +// HasPartial returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseSeries) HasPartial() bool { + if o != nil && o.Partial != nil { + return true + } + + return false +} + +// SetPartial gets a reference to the given bool and assigns it to the Partial field. +func (o *InfluxqlJsonResponseSeries) SetPartial(v bool) { + o.Partial = &v +} + +// GetColumns returns the Columns field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseSeries) GetColumns() []string { + if o == nil || o.Columns == nil { + var ret []string + return ret + } + return *o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseSeries) GetColumnsOk() (*[]string, bool) { + if o == nil || o.Columns == nil { + return nil, false + } + return o.Columns, true +} + +// HasColumns returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseSeries) HasColumns() bool { + if o != nil && o.Columns != nil { + return true + } + + return false +} + +// SetColumns gets a reference to the given []string and assigns it to the Columns field. +func (o *InfluxqlJsonResponseSeries) SetColumns(v []string) { + o.Columns = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *InfluxqlJsonResponseSeries) GetValues() [][]interface{} { + if o == nil || o.Values == nil { + var ret [][]interface{} + return ret + } + return *o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InfluxqlJsonResponseSeries) GetValuesOk() (*[][]interface{}, bool) { + if o == nil || o.Values == nil { + return nil, false + } + return o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *InfluxqlJsonResponseSeries) HasValues() bool { + if o != nil && o.Values != nil { + return true + } + + return false +} + +// SetValues gets a reference to the given [][]interface{} and assigns it to the Values field. +func (o *InfluxqlJsonResponseSeries) SetValues(v [][]interface{}) { + o.Values = &v +} + +func (o InfluxqlJsonResponseSeries) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Partial != nil { + toSerialize["partial"] = o.Partial + } + if o.Columns != nil { + toSerialize["columns"] = o.Columns + } + if o.Values != nil { + toSerialize["values"] = o.Values + } + return json.Marshal(toSerialize) +} + +type NullableInfluxqlJsonResponseSeries struct { + value *InfluxqlJsonResponseSeries + isSet bool +} + +func (v NullableInfluxqlJsonResponseSeries) Get() *InfluxqlJsonResponseSeries { + return v.value +} + +func (v *NullableInfluxqlJsonResponseSeries) Set(val *InfluxqlJsonResponseSeries) { + v.value = val + v.isSet = true +} + +func (v NullableInfluxqlJsonResponseSeries) IsSet() bool { + return v.isSet +} + +func (v *NullableInfluxqlJsonResponseSeries) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInfluxqlJsonResponseSeries(val *InfluxqlJsonResponseSeries) *NullableInfluxqlJsonResponseSeries { + return &NullableInfluxqlJsonResponseSeries{value: val, isSet: true} +} + +func (v NullableInfluxqlJsonResponseSeries) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInfluxqlJsonResponseSeries) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_post_organization_request.gen.go b/api/model_post_organization_request.gen.go index 153644c..a070469 100644 --- a/api/model_post_organization_request.gen.go +++ b/api/model_post_organization_request.gen.go @@ -18,6 +18,8 @@ import ( type PostOrganizationRequest struct { Name string `json:"name" yaml:"name"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` + // An optional list of email address's to be invited to the organization + Users *[]string `json:"users,omitempty" yaml:"users,omitempty"` } // NewPostOrganizationRequest instantiates a new PostOrganizationRequest object @@ -94,6 +96,38 @@ func (o *PostOrganizationRequest) SetDescription(v string) { o.Description = &v } +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *PostOrganizationRequest) GetUsers() []string { + if o == nil || o.Users == nil { + var ret []string + return ret + } + return *o.Users +} + +// GetUsersOk returns a tuple with the Users field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PostOrganizationRequest) GetUsersOk() (*[]string, bool) { + if o == nil || o.Users == nil { + return nil, false + } + return o.Users, true +} + +// HasUsers returns a boolean if a field has been set. +func (o *PostOrganizationRequest) HasUsers() bool { + if o != nil && o.Users != nil { + return true + } + + return false +} + +// SetUsers gets a reference to the given []string and assigns it to the Users field. +func (o *PostOrganizationRequest) SetUsers(v []string) { + o.Users = &v +} + func (o PostOrganizationRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if true { @@ -102,6 +136,9 @@ func (o PostOrganizationRequest) MarshalJSON() ([]byte, error) { if o.Description != nil { toSerialize["description"] = o.Description } + if o.Users != nil { + toSerialize["users"] = o.Users + } return json.Marshal(toSerialize) } diff --git a/api/model_task.gen.go b/api/model_task.gen.go index 06b9747..c0689f3 100644 --- a/api/model_task.gen.go +++ b/api/model_task.gen.go @@ -18,31 +18,31 @@ import ( // Task struct for Task type Task struct { Id string `json:"id" yaml:"id"` - // Type of the task, useful for filtering a task list. + // The type of the task, useful for filtering a task list. Type *string `json:"type,omitempty" yaml:"type,omitempty"` - // ID of the organization that owns the task. + // The ID of the organization that owns the task. OrgID string `json:"orgID" yaml:"orgID"` - // Name of the organization that owns the task. + // The name of the organization that owns the task. Org *string `json:"org,omitempty" yaml:"org,omitempty"` - // Name of the task. + // The name of the task. Name string `json:"name" yaml:"name"` - // ID of the user who owns this Task. + // The ID of the user who owns this Task. OwnerID *string `json:"ownerID,omitempty" yaml:"ownerID,omitempty"` - // Description of the task. + // The description of the task. Description *string `json:"description,omitempty" yaml:"description,omitempty"` Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"` Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"` - // ID of the authorization used when the task communicates with the query engine. + // The ID of the authorization used when the task communicates with the query engine. AuthorizationID *string `json:"authorizationID,omitempty" yaml:"authorizationID,omitempty"` - // Flux script to run for this task. + // The Flux script to run for this task. Flux string `json:"flux" yaml:"flux"` - // Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)). + // An interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. `every` also determines when the task first runs, depending on the specified time. Every *string `json:"every,omitempty" yaml:"every,omitempty"` - // [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview). + // [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time. Cron *string `json:"cron,omitempty" yaml:"cron,omitempty"` - // [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals). + // A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. Offset *string `json:"offset,omitempty" yaml:"offset,omitempty"` - // Timestamp of the latest scheduled and completed run. Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax). + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax)) of the latest scheduled and completed run. LatestCompleted *time.Time `json:"latestCompleted,omitempty" yaml:"latestCompleted,omitempty"` LastRunStatus *string `json:"lastRunStatus,omitempty" yaml:"lastRunStatus,omitempty"` LastRunError *string `json:"lastRunError,omitempty" yaml:"lastRunError,omitempty"` diff --git a/clients/v1_repl/gopher.go b/clients/v1_repl/gopher.go new file mode 100644 index 0000000..201095d --- /dev/null +++ b/clients/v1_repl/gopher.go @@ -0,0 +1,54 @@ +package v1repl + +var Gopher string = ` + .-::-::://:-::- .:/++/' + '://:-''/oo+//++o+/.://o- ./+: + .:-. '++- .o/ '+yydhy' o- + .:/. .h: :osoys .smMN- :/ + -/:.' s- /MMMymh. '/y/ s' + -+s:'''' d -mMMms// '-/o: + -/++/++/////:. o: '... s- :s. + :+-+s-' ':/' 's- /+ 'o: + '+-'o: /ydhsh. '//. '-o- o- + .y. o: .MMMdm+y ':+++:::/+:.' s: + .-h/ y- 'sdmds'h -+ydds:::-.' 'h. + .//-.d' o: '.' 'dsNMMMNh:.:++' :y + +y. 'd 's. .s:mddds: ++ o/ + 'N- odd 'o/. './o-s-' .---+++' o- + 'N' yNd .://:/:::::. -s -+/s/./s' 'o/' + so' .h '''' ////s: '+. .s +y' + os/-.y' 's' 'y::+ +d' + '.:o/ -+:-:.' so.---.' + o' 'd-.''/s' + .s' :y.''.y + -s mo:::' + :: yh + // '''' /M' + o+ .s///:/. 'N: + :+ /: -s' ho + 's- -/s/:+/.+h' +h + ys' ':' '-. -d + oh .h + /o .s + s. .h + -y .d + m/ -h + +d /o + 'N- y: + h: m. + s- -d + o- s+ + +- 'm' + s/ oo--. + y- /s ':+' + s' 'od--' .d: + -+ ':o: ':+-/+ + y- .:+- ' + //o- '.:+/. + .-:+/' ''-/+/. + ./:' ''.:o+/-' + .+o:/:/+-' ''.-+ooo/-' + o: -h///++////-. + /: .o/ + //+ 'y + ./sooy.` diff --git a/clients/v1_repl/v1_repl.go b/clients/v1_repl/v1_repl.go new file mode 100644 index 0000000..bcbe0ae --- /dev/null +++ b/clients/v1_repl/v1_repl.go @@ -0,0 +1,789 @@ +package v1repl + +import ( + "bufio" + "bytes" + "compress/gzip" + "context" + "encoding/csv" + "encoding/json" + "errors" + "fmt" + "os" + "reflect" + "regexp" + "sort" + "strings" + "text/tabwriter" + + "github.com/fatih/color" + "github.com/influxdata/influx-cli/v2/api" + "github.com/influxdata/influx-cli/v2/clients" +) + +type Client struct { + clients.CLI + PersistentQueryParams + api.LegacyQueryApi + api.PingApi + api.OrganizationsApi + api.LegacyWriteApi + api.DBRPsApi +} + +type PersistentQueryParams struct { + clients.OrgParams + Database string + RetentionPolicy string + Precision string + Format FormatType + Pretty bool + // Autocompletion Storage + Databases []string + RetentionPolicies []string + Measurements []string +} + +func (c *Client) clear(cmd string) { + args := strings.Split(strings.TrimSuffix(strings.TrimSpace(cmd), ";"), " ") + v := strings.ToLower(strings.Join(args[1:], " ")) + switch v { + case "database", "db": + c.Database = "" + c.RetentionPolicies = []string{} + fmt.Println("database context cleared") + return + case "retention policy", "rp": + c.RetentionPolicy = "" + fmt.Println("retention policy context cleared") + return + default: + if len(args) > 1 { + fmt.Printf("invalid command %q.\n", v) + } + fmt.Println(`Possible commands for 'clear' are: + # Clear the database context + clear database + clear db + + # Clear the retention policy context + clear retention policy + clear rp + `) + } +} + +func DefaultPersistentQueryParams() PersistentQueryParams { + return PersistentQueryParams{ + Format: ColumnFormat, + Precision: "ns", + } +} + +func (c *Client) Create(ctx context.Context) error { + res, err := c.GetPing(ctx).ExecuteWithHttpInfo() + if err != nil { + color.Red("Unable to connect to InfluxDB") + return err + } + build := res.Header.Get("X-Influxdb-Build") + version := res.Header.Get("X-Influxdb-Version") + color.Cyan("Connected to InfluxDB %s %s", build, version) + + c.Databases, _ = c.GetDatabases(ctx) + color.Cyan("InfluxQL Shell") + + scanner := bufio.NewScanner(os.Stdin) + fmt.Printf("%s", color.GreenString("> ")) + for scanner.Scan() { + c.executor(scanner.Text()) + fmt.Printf("%s", color.GreenString("> ")) + } + return nil +} + +func (c *Client) gopher() { + color.Cyan(Gopher) +} + +// The logic for the main prompt that is run in the REPL loop +func (c *Client) executor(cmd string) { + if cmd == "" { + return + } + cmdArgs := strings.Split(cmd, " ") + switch strings.ToLower(cmdArgs[0]) { + case "quit", "exit": + color.HiBlack("Goodbye!") + os.Exit(0) + case "gopher": + c.gopher() + case "node": + color.Yellow("The 'node' command is enterprise only, not available in the influx 2.x CLI - were you looking for the 1.x InfluxDB CLI?") + case "consistency": + color.Yellow("The 'consistency' command is not available in the influx 2.x CLI - were you looking for the 1.x InfluxDB CLI?") + case "help": + c.help() + case "history": + color.Yellow("The 'history' command is not yet implemented in 2.x") + case "format": + c.setFormat(cmdArgs) + case "precision": + c.setPrecision(cmdArgs) + case "settings": + c.settings() + case "pretty": + c.togglePretty() + case "use": + c.use(cmdArgs) + case "insert": + c.insert(cmd) + case "clear": + c.clear(cmd) + default: + c.runAndShowQuery(cmd) + } +} + +// Create a regex string for a named InfluxQL identifier, quoted or unquoted +func identRegex(name string) string { + return `((?P<` + name + `>\w+)|(\"(?P<` + name + `_quote>.+?)\"))` +} + +// Get the value of a named InfluxQL identifier from a regex match map. +// Returns empty string if no match +func getIdentFromMatches(matches *map[string]string, name string) string { + if val, ok := (*matches)[name]; ok && val != "" { + return val + } else if val, ok := (*matches)[name+"_quote"]; ok && val != "" { + return val + } + return "" +} + +// Create a regex match map from a regexp with named groups. +// Returns nil if no match. +func reSubMatchMap(r *regexp.Regexp, str string) *map[string]string { + match := r.FindStringSubmatch(str) + if match == nil { + return nil + } + subMatchMap := make(map[string]string) + for i, name := range r.SubexpNames() { + if i != 0 { + subMatchMap[name] = match[i] + } + } + return &subMatchMap +} + +// Returns parsed database, retention policy, point, and if the command was an INSERT statement +// if db and rp are both blank and command was INSERT statement, it was an "INSERT " statement +func ParseInsert(cmd string) (string, string, string, bool) { + // the (?i) clause makes the regex match case-insensitive + var insertIntoStart string = `^(?i)INSERT(\s+)INTO` + var insertIntoRegex string = insertIntoStart + `(\s+)` + identRegex("db") + `(\.` + identRegex("rp") + `)?(\s+)(?P.+)$` + var insertRegex string = `^(?i)INSERT(\s+)(?P.+)$` + var db string + var rp string + var point string + insertRgx := regexp.MustCompile(insertRegex) + insertIntoStartRgx := regexp.MustCompile(insertIntoStart) + insertIntoRgx := regexp.MustCompile(insertIntoRegex) + insertMatches := reSubMatchMap(insertRgx, cmd) + insertIntoMatches := reSubMatchMap(insertIntoRgx, cmd) + if insertIntoMatches != nil { + db = getIdentFromMatches(insertIntoMatches, "db") + rp = getIdentFromMatches(insertIntoMatches, "rp") + point = getIdentFromMatches(insertIntoMatches, "point") + } else if !insertIntoStartRgx.Match([]byte(cmd)) && insertMatches != nil { + point = getIdentFromMatches(insertMatches, "point") + } else { + return "", "", "", false + } + return db, rp, point, true +} + +func (c Client) insert(cmd string) { + db, rp, point, isInsertCmd := ParseInsert(cmd) + if !isInsertCmd || point == "" { + color.Red("Expected \"INSERT INTO . \" OR \"INSERT \".") + return + } else if db == "" && rp == "" { // this is an "INSERT " command + db = c.Database + rp = c.RetentionPolicy + } + buf := bytes.Buffer{} + gzw := gzip.NewWriter(&buf) + + _, err := gzw.Write([]byte(point)) + gzw.Close() + if err != nil { + color.Red("Failed to gzip points") + return + } + + switch c.Precision { + case "h", "m", "rfc3339": + color.Red("Current precision %q unsupported for writes. Use [s, ms, ns, us]", c.Precision) + return + } + ctx := context.Background() + writeReq := c.PostLegacyWrite(ctx). + Db(db). + Rp(rp). + Precision(c.Precision). + ContentEncoding("gzip"). + Body(buf.String()) + + if err := writeReq.Execute(); err != nil { + if err.Error() == "" { + err = ctx.Err() + if err == context.Canceled { + err = errors.New("aborted by user") + } else if err == nil { + err = errors.New("no data received") + } + } + color.Red("ERR: %v", err) + if c.Database == "" { + color.Yellow("Note: error may be due to not setting a database or retention policy.") + color.Yellow(`Please set a database with the command "use "`) + return + } + } +} + +type FormatType string +type FormatFunc func(api.InfluxqlJsonResponse) + +var ( + CsvFormat FormatType = "csv" + JsonFormat FormatType = "json" + ColumnFormat FormatType = "column" +) + +func (c *Client) runAndShowQuery(query string) { + // TODO: guide users trying to use deprecated InfluxQL queries: https://github.com/influxdata/influx-cli/issues/397 + ctx := context.Background() + responseStr, err := c.query(ctx, query) + if err != nil { + if err.Error() == "" { + err = ctx.Err() + if err == context.Canceled { + err = errors.New("aborted by user") + } else if err == nil { + err = errors.New("no data received") + } + } + color.Red("ERR: %v", err) + return + } + var response api.InfluxqlJsonResponse + if err := json.Unmarshal([]byte(responseStr), &response); err != nil { + color.Red("Failed to parse JSON response: %v", err) + if c.Database == "" { + color.Yellow("Warning: It is possible this error is due to not setting a database.") + color.Yellow(`Please set a database with the command "use ".`) + } + return + } + displayMap := map[FormatType]FormatFunc{ + CsvFormat: c.outputCsv, + JsonFormat: c.outputJson, + ColumnFormat: c.outputColumns, + } + displayFunc := displayMap[c.Format] + displayFunc(response) +} + +func (c *Client) help() { + fmt.Println(`Usage: + pretty toggles pretty print for the json format + use sets current database + format specifies the format of the server responses: json, csv, column + precision specifies the format of the timestamp: rfc3339, h, m, s, ms, u or ns + history displays command history + settings outputs the current settings for the shell + clear clears settings such as database or retention policy. run 'clear' for help + exit/quit/ctrl+d quits the influx shell + + show databases show database names + show series show series information + show measurements show measurement information + show tag keys show tag key information + show field keys show field key information + insert insert point into currently-used database + + A full list of influxql commands can be found at: + https://docs.influxdata.com/influxdb/latest/query_language/spec/ + + Keybindings: + exit + clear screen + previous command + next command`) +} + +func (c *Client) settings() { + w := new(tabwriter.Writer) + w.Init(os.Stdout, 0, 1, 1, ' ', 0) + fmt.Fprintln(w, "Setting\tValue") + fmt.Fprintln(w, "--------\t--------") + fmt.Fprintf(w, "Database\t%s\n", c.Database) + fmt.Fprintf(w, "RetentionPolicy\t%s\n", c.RetentionPolicy) + fmt.Fprintf(w, "Pretty\t%v\n", c.Pretty) + fmt.Fprintf(w, "Format\t%s\n", c.Format) + fmt.Fprintf(w, "Precision\t%s\n", c.Precision) + fmt.Fprintln(w) + w.Flush() +} + +func (c *Client) query(ctx context.Context, query string) (string, error) { + res := c.GetLegacyQuery(ctx). + Db(c.Database). + Q(query). + Rp(c.RetentionPolicy). + Accept("application/json") + // when precision is blank, the API uses RFC339 timestamps + if c.Precision != "rfc3339" && c.Precision != "" { + res = res.Epoch(c.Precision) + } + resBody, err := res.Execute() + if err != nil { + return "", err + } + return resBody, nil +} + +func (c *Client) setFormat(args []string) { + // args[0] is "format" + if len(args) != 2 { + color.Red("Expected a format [csv, json, column]") + return + } + newFormat := FormatType(args[1]) + switch newFormat { + case CsvFormat, JsonFormat, ColumnFormat: + c.Format = newFormat + default: + color.HiRed("Unimplemented format %q, keeping %s format.", newFormat, c.Format) + color.HiBlack("Choose a format from [csv, json, column]") + } +} + +func (c *Client) setPrecision(args []string) { + // args[0] is "precision" + if len(args) != 2 { + color.Red("Expected a precision [rfc3339, ns, u, ms, s, m, or h]") + return + } + precision := args[1] + switch precision { + case "rfc3339", "ns", "u", "ยต", "ms", "s", "m", "h": + c.Precision = precision + default: + color.HiRed("Unimplemented precision %q, keeping %s precision.", precision, c.Precision) + color.HiBlack("Choose a precision from [rfc3339, ns, u, ms, s, m, or h]") + } +} + +func tagsEqual(prev, current map[string]string) bool { + return reflect.DeepEqual(prev, current) +} + +func columnsEqual(prev, current []string) bool { + return reflect.DeepEqual(prev, current) +} + +func headersEqual(prev, current api.InfluxqlJsonResponseSeries) bool { + if prev.Name != current.Name { + return false + } + return tagsEqual(prev.GetTags(), current.GetTags()) && columnsEqual(prev.GetColumns(), current.GetColumns()) +} + +// formatResults will behave differently if you are formatting for columns or csv +func (c *Client) formatResults(result api.InfluxqlJsonResponseResults, separator string, suppressHeaders bool) []string { + rows := []string{} + // Create a tabbed writer for each result as they won't always line up + for i, row := range result.GetSeries() { + // gather tags + tags := []string{} + for k, v := range row.GetTags() { + tags = append(tags, fmt.Sprintf("%s=%s", k, v)) + sort.Strings(tags) + } + columnNames := []string{} + // Only put name/tags in a column if format is csv + if c.Format == CsvFormat { + if len(tags) > 0 { + columnNames = append([]string{"tags"}, columnNames...) + } + + if row.GetName() != "" { + columnNames = append([]string{"name"}, columnNames...) + } + } + columnNames = append(columnNames, row.GetColumns()...) + // Output a line separator if we have more than one set or results and format is column + if i > 0 && c.Format == ColumnFormat && !suppressHeaders { + rows = append(rows, "") + } + // If we are column format, we break out the name/tag to separate lines + if c.Format == ColumnFormat && !suppressHeaders { + if row.GetName() != "" { + n := fmt.Sprintf("name: %s", row.GetName()) + rows = append(rows, n) + } + if len(tags) > 0 { + t := fmt.Sprintf("tags: %s", (strings.Join(tags, ", "))) + rows = append(rows, t) + } + } + if !suppressHeaders { + rows = append(rows, strings.Join(columnNames, separator)) + } + // if format is column, write dashes under each column + if c.Format == ColumnFormat && !suppressHeaders { + lines := []string{} + for _, columnName := range columnNames { + lines = append(lines, strings.Repeat("-", len(columnName))) + } + rows = append(rows, strings.Join(lines, separator)) + } + for _, v := range row.GetValues() { + var values []string + if c.Format == CsvFormat { + if row.GetName() != "" { + values = append(values, row.GetName()) + } + if len(tags) > 0 { + values = append(values, strings.Join(tags, ",")) + } + } + for _, vv := range v { + values = append(values, interfaceToString(vv)) + } + rows = append(rows, strings.Join(values, separator)) + } + } + return rows +} + +func interfaceToString(v interface{}) string { + switch t := v.(type) { + case nil: + return "" + case bool: + return fmt.Sprintf("%v", v) + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr: + return fmt.Sprintf("%d", t) + case float32, float64: + return fmt.Sprintf("%v", t) + default: + return fmt.Sprintf("%v", t) + } +} + +func (c *Client) outputCsv(response api.InfluxqlJsonResponse) { + csvw := csv.NewWriter(os.Stdout) + var previousHeaders api.InfluxqlJsonResponseSeries + for _, result := range response.GetResults() { + if result.Error != nil { + color.Red("Query Error: %v", result.GetError()) + continue + } + series := result.GetSeries() + suppressHeaders := len(series) > 0 && headersEqual(previousHeaders, series[0]) + if !suppressHeaders && len(result.GetSeries()) > 0 { + previousHeaders = result.GetSeries()[0] + } + // Create a tabbed writer for each result as they won't always line up + rows := c.formatResults(result, "\t", suppressHeaders) + for _, r := range rows { + csvw.Write(strings.Split(r, "\t")) + } + } + csvw.Flush() +} + +func (c *Client) outputJson(response api.InfluxqlJsonResponse) { + var data []byte + var err error + if c.Pretty { + data, err = json.MarshalIndent(response, "", " ") + } else { + data, err = json.Marshal(response) + } + if err != nil { + color.Red("Unable to parse json: %s\n", err) + return + } + fmt.Println(string(data)) +} + +func (c *Client) outputColumns(response api.InfluxqlJsonResponse) { + // Create a tabbed writer for each result as they won't always line up + writer := new(tabwriter.Writer) + writer.Init(os.Stdin, 0, 8, 1, ' ', 0) + + var previousHeaders api.InfluxqlJsonResponseSeries + for i, result := range response.GetResults() { + if result.Error != nil { + color.Red("Query Error: %v", result.GetError()) + continue + } + + // Check to see if the headers are the same as the previous row. If so, suppress them in the output + suppressHeaders := len(result.GetSeries()) > 0 && headersEqual(previousHeaders, result.GetSeries()[0]) + if !suppressHeaders && len(result.GetSeries()) > 0 { + previousHeaders = result.GetSeries()[0] + } + + // If we are suppressing headers, don't output the extra line return. If we + // aren't suppressing headers, then we put out line returns between results + // (not before the first result, and not after the last result). + if !suppressHeaders && i > 0 { + fmt.Fprintln(writer, "") + } + + rows := c.formatResults(result, "\t", suppressHeaders) + for _, r := range rows { + fmt.Fprintln(writer, r) + } + } + writer.Flush() +} + +func (c *Client) togglePretty() { + c.Pretty = !c.Pretty + color.HiBlack("Pretty: %v", c.Pretty) +} + +func (c *Client) use(args []string) { + if len(args) != 2 { + color.Red("wrong number of args for \"use \"") + return + } + parsedDb, parsedRp, err := parseDatabaseAndRetentionPolicy([]byte(args[1])) + if err != nil { + color.Red("Unable to parse: %v", err) + return + } + dbs, err := c.GetDatabases(context.Background()) + if err != nil { + color.Red("Unable to check databases: %v", err) + return + } + // discover if the parsedDb is a valid database + for _, db := range dbs { + if parsedDb == db { + exists := false + prevDb := c.Database + c.Database = parsedDb + rps, _ := c.getRetentionPolicies(context.Background()) + // discover if the parsedRp is a valid retention policy + for _, rp := range rps { + switch parsedRp { + case "": + c.RetentionPolicy, _ = c.getDefaultRetentionPolicy(context.Background(), c.Database) + case rp: + c.RetentionPolicy = parsedRp + default: + continue + } + c.RetentionPolicies = rps + exists = true + c.Measurements, _ = c.GetMeasurements(context.Background()) + break + } + if !exists { + color.Red("No such retention policy %q exists on %q", parsedRp, c.Database) + color.HiBlack("Available retention policies on %q:", parsedDb) + for _, rp := range rps { + color.HiBlack("- %q", rp) + } + c.Database = prevDb + return + } + c.Database = parsedDb + c.Databases = dbs + + return + } + } + color.Red("No such database %q exists", parsedDb) + color.HiBlack("Available databases:") + for _, db := range dbs { + color.HiBlack("- %q", db) + } + +} + +// Get retention policies from the currently used database +func (c *Client) getRetentionPolicies(ctx context.Context) ([]string, error) { + singleSeries, err := c.getDataSingleSeries(ctx, + fmt.Sprintf("SHOW RETENTION POLICIES ON %q", c.Database)) + if err != nil { + return []string{}, err + } + nameIndex := -1 + for i, colName := range singleSeries.GetColumns() { + if colName == "name" { + nameIndex = i + } + } + if nameIndex == -1 { + return []string{}, fmt.Errorf("expected a \"name\" column for retention policies") + } + var retentionPolicies []string + for _, value := range singleSeries.GetValues() { + if name, ok := value[nameIndex].(string); ok { + retentionPolicies = append(retentionPolicies, name) + } else { + return []string{}, fmt.Errorf("expected \"name\" column to contain string value") + } + } + return retentionPolicies, nil +} + +// Get the default retention policy for a given database +func (c *Client) getDefaultRetentionPolicy(ctx context.Context, db string) (string, error) { + singleSeries, err := c.getDataSingleSeries(ctx, + fmt.Sprintf("SHOW RETENTION POLICIES ON %q", db)) + if err != nil { + return "", err + } + nameIndex := -1 + defaultIndex := -1 + for i, colName := range singleSeries.GetColumns() { + if colName == "default" { + defaultIndex = i + } else if colName == "name" { + nameIndex = i + } + } + if nameIndex == -1 { + return "", fmt.Errorf("expected a \"name\" column for retention policies") + } + if defaultIndex == -1 { + return "", fmt.Errorf("expected a \"default\" column for retention policies") + } + for _, value := range singleSeries.GetValues() { + isDefault := value[defaultIndex] + if isDefault, ok := isDefault.(bool); ok { + if isDefault { + if name, ok := value[nameIndex].(string); ok { + return name, nil + } else { + return "", fmt.Errorf("expected \"name\" column to contain string value") + } + } + } else { + return "", fmt.Errorf("expected \"default\" column to contain boolean value") + } + } + return "", fmt.Errorf("no default retention policy") +} + +// Get list of database names +func (c *Client) GetDatabases(ctx context.Context) ([]string, error) { + singleSeries, err := c.getDataSingleSeries(ctx, "SHOW DATABASES") + if err != nil { + return []string{}, err + } + values := singleSeries.GetValues() + var databases []string + for _, value := range values { + for _, db := range value { + if db, ok := db.(string); ok { + databases = append(databases, db) + } else { + return []string{}, fmt.Errorf("expected database names to be strings") + } + } + } + return databases, nil +} + +// Get list of measurements for currently used database and retention policy +func (c *Client) GetMeasurements(ctx context.Context) ([]string, error) { + singleSeries, err := c.getDataSingleSeries(ctx, "SHOW MEASUREMENTS") + if err != nil { + return []string{}, err + } + var measures []string + for _, measureArr := range singleSeries.GetValues() { + if len(measureArr) != 1 { + return []string{}, fmt.Errorf("expected a single measurement name in each array in values array") + } + if measure, ok := measureArr[0].(string); ok { + measures = append(measures, measure) + } else { + return []string{}, fmt.Errorf("expected measurement name to be a string") + } + } + return measures, nil +} + +// Helper function to execute query & parse response, expecting a single series +func (c *Client) getDataSingleSeries(ctx context.Context, query string) (*api.InfluxqlJsonResponseSeries, error) { + res := c.GetLegacyQuery(ctx). + Db(c.Database). + Q(query). + Rp(c.RetentionPolicy). + Accept("application/json") + // when c.Precision is empty, the API returns timestamps in RFC3339 format + if c.Precision != "rfc3339" && c.Precision != "" { + res.Epoch(c.Precision) + } + resBody, err := res.Execute() + if err != nil { + return nil, err + } + var responses api.InfluxqlJsonResponse + if err := json.Unmarshal([]byte(resBody), &responses); err != nil { + return nil, err + } + results := responses.GetResults() + if len(results) != 1 { + return nil, fmt.Errorf("expected a single result from single query") + } + result := results[0] + series := result.GetSeries() + if len(series) != 1 { + return nil, fmt.Errorf("expected a single series from single result") + } + return &series[0], nil +} + +// Parse database and retention policy from byte slice. +// Expects format like "db"."rp", db.rp, db, "db". +func parseDatabaseAndRetentionPolicy(stmt []byte) (string, string, error) { + var db, rp []byte + var quoted bool + var seperatorCount int + + stmt = bytes.TrimSpace(stmt) + + for _, b := range stmt { + if b == '"' { + quoted = !quoted + continue + } + if b == '.' && !quoted { + seperatorCount++ + if seperatorCount > 1 { + return "", "", fmt.Errorf("unable to parse database and retention policy from %s", string(stmt)) + } + continue + } + if seperatorCount == 1 { + rp = append(rp, b) + continue + } + db = append(db, b) + } + return string(db), string(rp), nil +} diff --git a/clients/v1_repl/v1_repl_test.go b/clients/v1_repl/v1_repl_test.go new file mode 100644 index 0000000..33e96c7 --- /dev/null +++ b/clients/v1_repl/v1_repl_test.go @@ -0,0 +1,142 @@ +package v1repl_test + +import ( + "testing" + + v1repl "github.com/influxdata/influx-cli/v2/clients/v1_repl" +) + +var point = `weather,location=us-midwest temperature=82 1465839830100400200` +var db = "test_database" +var quotedDb = `"test_database"` +var rp = "test_retention_policy" +var quotedRp = `"test_retention_policy"` + +type InsertTestCase struct { + cmd string + expectedDb string + expectedRp string + expectedPoint string +} + +func (it *InsertTestCase) Test(t *testing.T) { + db, rp, point, isInsert := v1repl.ParseInsert(it.cmd) + if !isInsert { + t.Errorf("%q should be a valid INSERT command", it.cmd) + } else { + if db != it.expectedDb { + t.Errorf("Db mismatch: expected: %s, got: %s", it.expectedDb, db) + } + if rp != it.expectedRp { + t.Errorf("Rp mismatch: expected: %s, got: %s", it.expectedRp, rp) + } + if point != it.expectedPoint { + t.Errorf("Point mismatch: expected: %s, got: %s", it.expectedPoint, point) + } + } +} + +var insertIntoCmds = []InsertTestCase{ + { + cmd: `insert into ` + quotedDb + " " + point, + expectedDb: db, + expectedRp: "", + expectedPoint: point, + }, + { + cmd: `insert into ` + quotedDb + "." + quotedRp + " " + point, + expectedDb: db, + expectedRp: rp, + expectedPoint: point, + }, + { + cmd: `insert into ` + quotedDb + " " + point, + expectedDb: db, + expectedRp: "", + expectedPoint: point, + }, + { + cmd: `insert into ` + quotedDb + "." + quotedRp + " " + point, + expectedDb: db, + expectedRp: rp, + expectedPoint: point, + }, + { + cmd: `insert into ` + quotedDb + " " + point, + expectedDb: db, + expectedRp: "", + expectedPoint: point, + }, + { + cmd: `InSeRt INtO ` + quotedDb + "." + quotedRp + " " + point, + expectedDb: db, + expectedRp: rp, + expectedPoint: point, + }, + { + cmd: `INSERT INTO ` + quotedDb + "." + quotedRp + " " + point, + expectedDb: db, + expectedRp: rp, + expectedPoint: point, + }, +} + +var insertCmds = []InsertTestCase{ + { + cmd: `INSERT ` + point, + expectedDb: "", + expectedRp: "", + expectedPoint: point, + }, + { + cmd: `insert ` + point, + expectedDb: "", + expectedRp: "", + expectedPoint: point, + }, + { + cmd: `INSERT ` + point, + expectedDb: "", + expectedRp: "", + expectedPoint: point, + }, + { + cmd: `insert ` + point, + expectedDb: "", + expectedRp: "", + expectedPoint: point, + }, +} + +var invalidCmds = []string{ + `insert` + point, + `insert into ` + point, + `INSERT` + point, + `insert into . ` + point, + `insert into ` + quotedDb + `. ` + point, + `insertinto ` + quotedDb + ` ` + point, + `insert into ` + quotedDb + `.` + quotedRp + ". " + point, +} + +func TestParseInsert(t *testing.T) { + t.Parallel() + for _, insertCmd := range insertCmds { + insertCmd.Test(t) + } +} + +func TestParseInsertInto(t *testing.T) { + t.Parallel() + for _, insertIntoCmd := range insertIntoCmds { + insertIntoCmd.Test(t) + } +} + +func TestParseInsertInvalid(t *testing.T) { + t.Parallel() + for _, cmd := range invalidCmds { + if _, _, _, isValid := v1repl.ParseInsert(cmd); isValid { + t.Errorf("%q should be an invalid INSERT command", cmd) + } + } +} diff --git a/cmd/influx/v1_commands.go b/cmd/influx/v1_commands.go index 5e2470a..d8086d4 100644 --- a/cmd/influx/v1_commands.go +++ b/cmd/influx/v1_commands.go @@ -13,6 +13,7 @@ func newV1SubCommand() cli.Command { Subcommands: []cli.Command{ newV1DBRPCmd(), newV1AuthCommand(), + newV1ReplCmd(), }, } } diff --git a/cmd/influx/v1_repl.go b/cmd/influx/v1_repl.go new file mode 100644 index 0000000..2b0ae9b --- /dev/null +++ b/cmd/influx/v1_repl.go @@ -0,0 +1,44 @@ +package main + +import ( + "github.com/fatih/color" + "github.com/influxdata/influx-cli/v2/api" + "github.com/influxdata/influx-cli/v2/clients" + repl "github.com/influxdata/influx-cli/v2/clients/v1_repl" + "github.com/influxdata/influx-cli/v2/pkg/cli/middleware" + "github.com/urfave/cli" +) + +type Client struct { + clients.CLI + api.LegacyQueryApi +} + +func newV1ReplCmd() cli.Command { + var orgParams clients.OrgParams + persistentQueryParams := repl.DefaultPersistentQueryParams() + return cli.Command{ + Name: "repl", + Usage: "Start an InfluxQL REPL", + Description: "Start an InfluxQL REPL", + Before: middleware.WithBeforeFns(withCli(), withApi(true)), + Flags: append(commonFlagsNoPrint(), getOrgFlags(&orgParams)...), + Action: func(ctx *cli.Context) error { + if err := checkOrgFlags(&orgParams); err != nil { + return err + } + api := getAPI(ctx) + c := repl.Client{ + CLI: getCLI(ctx), + PersistentQueryParams: persistentQueryParams, + PingApi: api.PingApi, + LegacyQueryApi: api.LegacyQueryApi, + OrganizationsApi: api.OrganizationsApi, + LegacyWriteApi: api.LegacyWriteApi, + DBRPsApi: api.DBRPsApi, + } + color.Cyan("InfluxQL Shell %s", version) + return c.Create(getContext(ctx)) + }, + } +} diff --git a/go.mod b/go.mod index 274b7e9..1276f5a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/influxdata/influx-cli/v2 go 1.18 require ( - github.com/AlecAivazis/survey/v2 v2.2.9 + github.com/AlecAivazis/survey/v2 v2.3.4 github.com/BurntSushi/toml v0.4.1 github.com/MakeNowJust/heredoc/v2 v2.0.1 github.com/daixiang0/gci v0.2.8 @@ -12,7 +12,7 @@ require ( github.com/gocarina/gocsv v0.0.0-20210408192840-02d7211d929d github.com/golang/mock v1.5.0 github.com/google/go-jsonnet v0.17.0 - github.com/mattn/go-isatty v0.0.13 + github.com/mattn/go-isatty v0.0.14 github.com/olekukonko/tablewriter v0.0.5 github.com/stretchr/testify v1.7.0 github.com/urfave/cli v1.22.5 @@ -28,18 +28,18 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/mattn/go-colorable v0.1.4 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/russross/blackfriday/v2 v2.0.1 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/stretchr/objx v0.1.0 // indirect - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect - golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect ) diff --git a/go.sum b/go.sum index 96cdf68..abf0fa3 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,16 @@ -github.com/AlecAivazis/survey/v2 v2.2.9 h1:LWvJtUswz/W9/zVVXELrmlvdwWcKE60ZAw0FWV9vssk= -github.com/AlecAivazis/survey/v2 v2.2.9/go.mod h1:9DYvHgXtiXm6nCn+jXnOXLKbH+Yo9u8fAS/SduGdoPk= +github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazskAMd9Ng= +github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/MakeNowJust/heredoc/v2 v2.0.1 h1:rlCHh70XXXv7toz95ajQWOWQnN4WNLt0TdpZYIR/J6A= github.com/MakeNowJust/heredoc/v2 v2.0.1/go.mod h1:6/2Abh5s+hc3g9nbWLe9ObDIOhaRrqsyY9MWy+4JdRM= -github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= -github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= +github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= +github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= +github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/daixiang0/gci v0.2.8 h1:1mrIGMBQsBu0P7j7m1M8Lb+ZeZxsZL+jyGX4YoMJJpg= github.com/daixiang0/gci v0.2.8/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -29,32 +31,34 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-jsonnet v0.17.0 h1:/9NIEfhK1NQRKl3sP2536b2+x5HnZMdql7x3yK/l8JY= github.com/google/go-jsonnet v0.17.0/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw= -github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ= -github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= +github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= +github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ= -github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= -github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= @@ -63,8 +67,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5I github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= @@ -73,11 +77,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e h1:qyrTQ++p1afMkO4DPEeLGq/3oTsdlvdH4vqZUBWzUKM= golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -91,16 +92,17 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= +golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 h1:EH1Deb8WZJ0xc0WK//leUHXcX9aLE5SymusoTmMZye8= +golang.org/x/term v0.0.0-20220411215600-e5f449aeb171/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=