From 6cd06e78cb80f57939f3a575f67ff033f4f0f379 Mon Sep 17 00:00:00 2001 From: DStrand1 Date: Tue, 25 Oct 2022 14:00:08 -0500 Subject: [PATCH 1/4] chore: update openapi, regenerate --- api/api_authorizations.gen.go | 147 +++- api/api_bucket_schemas.gen.go | 211 ++++- api/api_buckets.gen.go | 324 ++++++-- api/api_delete.gen.go | 39 +- api/api_invokable_scripts.gen.go | 201 +++-- api/api_legacy_authorizations.gen.go | 37 +- api/api_organizations.gen.go | 750 ++++++++++++++++-- api/api_ping.gen.go | 78 +- api/api_signin.gen.go | 64 +- api/api_tasks.gen.go | 460 +++++++++-- api/api_users.gen.go | 555 ++++++++++++- api/api_write.gen.go | 52 +- api/contract/cli-extras.yml | 2 +- api/contract/cli.yml | 6 +- api/contract/openapi | 2 +- api/extras/model_resource_enum_cloud.gen.go | 9 +- api/extras/model_resource_enum_oss.gen.go | 12 +- api/model_authorization.gen.go | 15 +- api/model_authorization_all_of.gen.go | 15 +- api/model_authorization_post_request.gen.go | 6 +- ...l_authorization_post_request_all_of.gen.go | 6 +- api/model_bucket.gen.go | 2 +- api/model_dbrp.gen.go | 6 +- api/model_dbrp_create.gen.go | 6 +- api/model_inline_response_200.gen.go | 2 +- ...l_legacy_authorization_post_request.gen.go | 8 +- ...y_authorization_post_request_all_of.gen.go | 8 +- api/model_measurement_schema.gen.go | 4 +- ...l_measurement_schema_create_request.gen.go | 1 + api/model_patch_bucket_request.gen.go | 6 +- api/model_patch_organization_request.gen.go | 6 +- api/model_patch_retention_rule.gen.go | 76 +- api/model_permission_resource.gen.go | 9 +- api/model_post_bucket_request.gen.go | 8 +- api/model_post_organization_request.gen.go | 4 +- api/model_remote_connection.gen.go | 33 +- ..._remote_connection_creation_request.gen.go | 33 +- api/model_resource_member.gen.go | 6 +- api/model_resource_owner.gen.go | 6 +- api/model_script.gen.go | 41 +- api/model_script_language.gen.go | 5 +- api/model_shard_owner.gen.go | 2 +- api/model_task.gen.go | 16 +- ...template_summary_diff_bucket_fields.gen.go | 2 +- api/model_unauthorized_request_error.gen.go | 151 ++++ api/model_user.gen.go | 9 +- api/model_user_response.gen.go | 6 +- 47 files changed, 2874 insertions(+), 573 deletions(-) create mode 100644 api/model_unauthorized_request_error.gen.go diff --git a/api/api_authorizations.gen.go b/api/api_authorizations.gen.go index 50d6a30d..f833d7e4 100644 --- a/api/api_authorizations.gen.go +++ b/api/api_authorizations.gen.go @@ -47,10 +47,30 @@ type AuthorizationsApi interface { DeleteAuthorizationsIDExecuteWithHttpInfo(r ApiDeleteAuthorizationsIDRequest) (*_nethttp.Response, error) /* - * GetAuthorizations List all authorizations - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetAuthorizationsRequest - */ + * GetAuthorizations List authorizations + * Retrieves a list of authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations. + + #### InfluxDB OSS + + - Returns + [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations. + - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, + InfluxDB OSS returns authorizations for all organizations in the instance. + + #### Required permissions + + - InfluxDB OSS requires an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + + #### Related guides + + - [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetAuthorizationsRequest + */ GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest /* @@ -112,10 +132,36 @@ type AuthorizationsApi interface { PatchAuthorizationsIDExecuteWithHttpInfo(r ApiPatchAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) /* - * PostAuthorizations Create an authorization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostAuthorizationsRequest - */ + * PostAuthorizations Create an authorization + * Creates an authorization. + + Use this endpoint to create an authorization, which generates an API token + with permissions to `read` or `write` to a specific resource or `type` of resource. + The response contains the new authorization with the generated API token. + + Keep the following in mind when creating and updating authorizations: + + - To apply a permission to a specific resource, specify the resource `id` field. + - To apply a permission to all resources with the type, omit the resource `id`. + - To scope an authorization to a specific user, provide the `userID` property. + + #### Limitations + + - In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any + user with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_. + - Even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + - Tokens stop working when the user who created the token is deleted. + + We recommend creating a generic user to create and manage tokens for writing data. + + #### Related guides + + - [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostAuthorizationsRequest + */ PostAuthorizations(ctx _context.Context) ApiPostAuthorizationsRequest /* @@ -337,10 +383,30 @@ func (r ApiGetAuthorizationsRequest) ExecuteWithHttpInfo() (Authorizations, *_ne } /* - * GetAuthorizations List all authorizations + * GetAuthorizations List authorizations + * Retrieves a list of authorizations. + +To limit which authorizations are returned, pass query parameters in your request. +If no query parameters are passed, InfluxDB returns all authorizations. + +#### InfluxDB OSS + +- Returns + [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations. +- If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, + InfluxDB OSS returns authorizations for all organizations in the instance. + +#### Required permissions + +- InfluxDB OSS requires an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + +#### Related guides + +- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetAuthorizationsRequest - */ +*/ func (a *AuthorizationsApiService) GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest { return ApiGetAuthorizationsRequest{ ApiService: a, @@ -445,6 +511,28 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGet } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -853,9 +941,35 @@ func (r ApiPostAuthorizationsRequest) ExecuteWithHttpInfo() (Authorization, *_ne /* * PostAuthorizations Create an authorization + * Creates an authorization. + +Use this endpoint to create an authorization, which generates an API token +with permissions to `read` or `write` to a specific resource or `type` of resource. +The response contains the new authorization with the generated API token. + +Keep the following in mind when creating and updating authorizations: + +- To apply a permission to a specific resource, specify the resource `id` field. +- To apply a permission to all resources with the type, omit the resource `id`. +- To scope an authorization to a specific user, provide the `userID` property. + +#### Limitations + +- In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any + user with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_. +- Even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. +- Tokens stop working when the user who created the token is deleted. + +We recommend creating a generic user to create and manage tokens for writing data. + +#### Related guides + +- [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostAuthorizationsRequest - */ +*/ func (a *AuthorizationsApiService) PostAuthorizations(ctx _context.Context) ApiPostAuthorizationsRequest { return ApiPostAuthorizationsRequest{ ApiService: a, @@ -964,6 +1078,17 @@ func (a *AuthorizationsApiService) PostAuthorizationsExecuteWithHttpInfo(r ApiPo newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_bucket_schemas.gen.go b/api/api_bucket_schemas.gen.go index 5efb6ede..edfd8c8d 100644 --- a/api/api_bucket_schemas.gen.go +++ b/api/api_bucket_schemas.gen.go @@ -27,11 +27,32 @@ var ( type BucketSchemasApi interface { /* - * CreateMeasurementSchema Create a measurement schema for a bucket - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. - * @return ApiCreateMeasurementSchemaRequest - */ + * CreateMeasurementSchema Create a measurement schema for a bucket + * Creates an _explict_ measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema) + for a bucket. + + _Explicit_ schemas are used to enforce column names, tags, fields, and data + types for your data. + + By default, buckets have an _implicit_ schema-type (`"schemaType": "implicit"`) + that conforms to your data. + + Use this endpoint to create schemas that prevent non-conforming write requests. + + #### Limitations + + - Buckets must be created with the "explict" `schemaType` in order to use + schemas. + + #### Related guides + + - [Manage bucket schemas]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/bucket-schema/). + - [Create a bucket with an explicit schema]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/#create-a-bucket-with-an-explicit-schema) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bucketID A bucket ID. Adds a schema for the specified bucket. + * @return ApiCreateMeasurementSchemaRequest + */ CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest /* @@ -49,10 +70,12 @@ type BucketSchemasApi interface { CreateMeasurementSchemaExecuteWithHttpInfo(r ApiCreateMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) /* - * GetMeasurementSchema Retrieve measurement schema information + * GetMeasurementSchema Retrieve a measurement schema + * Retrieves an explicit measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. - * @param measurementID The identifier of the measurement. + * @param bucketID A bucket ID. Retrieves schemas for the specified bucket. + * @param measurementID The measurement schema ID. Specifies the measurement schema to retrieve. * @return ApiGetMeasurementSchemaRequest */ GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiGetMeasurementSchemaRequest @@ -72,11 +95,25 @@ type BucketSchemasApi interface { GetMeasurementSchemaExecuteWithHttpInfo(r ApiGetMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) /* - * GetMeasurementSchemas List all measurement schemas of a bucket - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. - * @return ApiGetMeasurementSchemasRequest - */ + * GetMeasurementSchemas List measurement schemas of a bucket + * Retrieves a list of _explicit_ + [schemas]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema) + (`"schemaType": "explicit"`) for a bucket. + + _Explicit_ schemas are used to enforce column names, tags, fields, and data + types for your data. + + By default, buckets have an _implicit_ schema-type (`"schemaType": "implicit"`) + that conforms to your data. + + #### Related guides + + - [Using bucket schemas](https://www.influxdata.com/blog/new-bucket-schema-option-protect-from-unwanted-schema-changes/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bucketID A bucket ID. Lists measurement schemas for the specified bucket. + * @return ApiGetMeasurementSchemasRequest + */ GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest /* @@ -94,12 +131,26 @@ type BucketSchemasApi interface { GetMeasurementSchemasExecuteWithHttpInfo(r ApiGetMeasurementSchemasRequest) (MeasurementSchemaList, *_nethttp.Response, error) /* - * UpdateMeasurementSchema Update a measurement schema - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. - * @param measurementID The identifier of the measurement. - * @return ApiUpdateMeasurementSchemaRequest - */ + * UpdateMeasurementSchema Update a measurement schema + * Updates a measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema). + + Use this endpoint to update the fields (`name`, `type`, and `dataType`) of a + measurement schema. + + #### Limitations + + - You can't update the `name` of a measurement. + + #### Related guides + + - [Manage bucket schemas]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/bucket-schema/). + - [Using bucket schemas](https://www.influxdata.com/blog/new-bucket-schema-option-protect-from-unwanted-schema-changes/). + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bucketID A bucket ID. Specifies the bucket to retrieve schemas for. + * @param measurementID A measurement schema ID. Retrieves the specified measurement schema. + * @return ApiUpdateMeasurementSchemaRequest + */ UpdateMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiUpdateMeasurementSchemaRequest /* @@ -171,10 +222,31 @@ func (r ApiCreateMeasurementSchemaRequest) ExecuteWithHttpInfo() (MeasurementSch /* * CreateMeasurementSchema Create a measurement schema for a bucket + * Creates an _explict_ measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema) +for a bucket. + +_Explicit_ schemas are used to enforce column names, tags, fields, and data +types for your data. + +By default, buckets have an _implicit_ schema-type (`"schemaType": "implicit"`) +that conforms to your data. + +Use this endpoint to create schemas that prevent non-conforming write requests. + +#### Limitations + +- Buckets must be created with the "explict" `schemaType` in order to use +schemas. + +#### Related guides + +- [Manage bucket schemas]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/bucket-schema/). +- [Create a bucket with an explicit schema]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/#create-a-bucket-with-an-explicit-schema) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. + * @param bucketID A bucket ID. Adds a schema for the specified bucket. * @return ApiCreateMeasurementSchemaRequest - */ +*/ func (a *BucketSchemasApiService) CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest { return ApiCreateMeasurementSchemaRequest{ ApiService: a, @@ -283,6 +355,18 @@ func (a *BucketSchemasApiService) CreateMeasurementSchemaExecuteWithHttpInfo(r A } v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -359,10 +443,12 @@ func (r ApiGetMeasurementSchemaRequest) ExecuteWithHttpInfo() (MeasurementSchema } /* - * GetMeasurementSchema Retrieve measurement schema information + * GetMeasurementSchema Retrieve a measurement schema + * Retrieves an explicit measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. - * @param measurementID The identifier of the measurement. + * @param bucketID A bucket ID. Retrieves schemas for the specified bucket. + * @param measurementID The measurement schema ID. Specifies the measurement schema to retrieve. * @return ApiGetMeasurementSchemaRequest */ func (a *BucketSchemasApiService) GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiGetMeasurementSchemaRequest { @@ -464,6 +550,17 @@ func (a *BucketSchemasApiService) GetMeasurementSchemaExecuteWithHttpInfo(r ApiG } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -539,11 +636,25 @@ func (r ApiGetMeasurementSchemasRequest) ExecuteWithHttpInfo() (MeasurementSchem } /* - * GetMeasurementSchemas List all measurement schemas of a bucket + * GetMeasurementSchemas List measurement schemas of a bucket + * Retrieves a list of _explicit_ +[schemas]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema) +(`"schemaType": "explicit"`) for a bucket. + +_Explicit_ schemas are used to enforce column names, tags, fields, and data +types for your data. + +By default, buckets have an _implicit_ schema-type (`"schemaType": "implicit"`) +that conforms to your data. + +#### Related guides + +- [Using bucket schemas](https://www.influxdata.com/blog/new-bucket-schema-option-protect-from-unwanted-schema-changes/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. + * @param bucketID A bucket ID. Lists measurement schemas for the specified bucket. * @return ApiGetMeasurementSchemasRequest - */ +*/ func (a *BucketSchemasApiService) GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest { return ApiGetMeasurementSchemasRequest{ ApiService: a, @@ -644,7 +755,7 @@ func (a *BucketSchemasApiService) GetMeasurementSchemasExecuteWithHttpInfo(r Api } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 400 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -653,6 +764,18 @@ func (a *BucketSchemasApiService) GetMeasurementSchemasExecuteWithHttpInfo(r Api } v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -739,11 +862,25 @@ func (r ApiUpdateMeasurementSchemaRequest) ExecuteWithHttpInfo() (MeasurementSch /* * UpdateMeasurementSchema Update a measurement schema + * Updates a measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema). + +Use this endpoint to update the fields (`name`, `type`, and `dataType`) of a +measurement schema. + +#### Limitations + +- You can't update the `name` of a measurement. + +#### Related guides + +- [Manage bucket schemas]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/bucket-schema/). +- [Using bucket schemas](https://www.influxdata.com/blog/new-bucket-schema-option-protect-from-unwanted-schema-changes/). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The identifier of the bucket. - * @param measurementID The identifier of the measurement. + * @param bucketID A bucket ID. Specifies the bucket to retrieve schemas for. + * @param measurementID A measurement schema ID. Retrieves the specified measurement schema. * @return ApiUpdateMeasurementSchemaRequest - */ +*/ func (a *BucketSchemasApiService) UpdateMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiUpdateMeasurementSchemaRequest { return ApiUpdateMeasurementSchemaRequest{ ApiService: a, @@ -854,6 +991,18 @@ func (a *BucketSchemasApiService) UpdateMeasurementSchemaExecuteWithHttpInfo(r A } v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 } return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/api/api_buckets.gen.go b/api/api_buckets.gen.go index 4632a512..c43f422b 100644 --- a/api/api_buckets.gen.go +++ b/api/api_buckets.gen.go @@ -27,11 +27,34 @@ var ( type BucketsApi interface { /* - * DeleteBucketsID Delete a bucket - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The ID of the bucket to delete. - * @return ApiDeleteBucketsIDRequest - */ + * DeleteBucketsID Delete a bucket + * Deletes a bucket and all associated records. + + #### InfluxDB Cloud + + - Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns an HTTP `204` status code 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. + + #### Limitations + + - Only one bucket can be deleted per request. + + #### Related Guides + + - [Delete a bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/delete-bucket/#delete-a-bucket-in-the-influxdb-ui) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bucketID Bucket ID. The ID of the bucket to delete. + * @return ApiDeleteBucketsIDRequest + */ DeleteBucketsID(ctx _context.Context, bucketID string) ApiDeleteBucketsIDRequest /* @@ -50,29 +73,32 @@ type BucketsApi interface { * GetBuckets List buckets * Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). + InfluxDB retrieves buckets owned by the + [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) + associated with the authorization + ([API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)). To limit which buckets are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all buckets up to the default `limit`. - #### Limitations + #### InfluxDB Cloud - - Paging with an `offset` greater than the number of records will result in - an empty list of buckets--for example: + - Doesn't use `org` or `orgID` parameters. - The following request is paging to the 50th record, but the user only has - 10 buckets. + #### InfluxDB OSS + + - If you use an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_ + to authenticate your request, InfluxDB retrieves resources for _all + organizations_ in the instance. + To retrieve resources for only a specific organization, use the + `org` parameter or the `orgID` parameter to specify the organization. - ```sh - $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" + #### Required permissions - $ { - "links": { - "prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", - "self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" - }, - "buckets": [] - } - ``` + | Action | Permission required | + |:--------------------------|:--------------------| + | Retrieve _user buckets_ | `read-buckets` | + | Retrieve [_system buckets_]({{% INFLUXDB_DOCS_URL %}}/reference/internals/system-buckets/) | `read-orgs` | #### Related Guides @@ -98,11 +124,15 @@ type BucketsApi interface { GetBucketsExecuteWithHttpInfo(r ApiGetBucketsRequest) (Buckets, *_nethttp.Response, error) /* - * GetBucketsID Retrieve a bucket - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The bucket ID. - * @return ApiGetBucketsIDRequest - */ + * GetBucketsID Retrieve a bucket + * Retrieves a bucket. + + Use this endpoint to retrieve information for a specific bucket. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bucketID The ID of the bucket to retrieve. + * @return ApiGetBucketsIDRequest + */ GetBucketsID(ctx _context.Context, bucketID string) ApiGetBucketsIDRequest /* @@ -120,11 +150,29 @@ type BucketsApi interface { GetBucketsIDExecuteWithHttpInfo(r ApiGetBucketsIDRequest) (Bucket, *_nethttp.Response, error) /* - * PatchBucketsID Update a bucket - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The bucket ID. - * @return ApiPatchBucketsIDRequest - */ + * PatchBucketsID Update a bucket + * Updates a bucket. + + Use this endpoint to update properties + (`name`, `description`, and `retentionRules`) of a bucket. + + #### InfluxDB Cloud + + - Requires the `retentionRules` property in the request body. If you don't + provide `retentionRules`, InfluxDB responds with an HTTP `403` status code. + + #### InfluxDB OSS + + - Doesn't require `retentionRules`. + + #### Related Guides + + - [Update a bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/update-bucket/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param bucketID The bucket ID. + * @return ApiPatchBucketsIDRequest + */ PatchBucketsID(ctx _context.Context, bucketID string) ApiPatchBucketsIDRequest /* @@ -144,15 +192,16 @@ type BucketsApi interface { /* * PostBuckets Create a bucket * Creates a [bucket]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket) - and returns the created bucket along with metadata. The default data + and returns the bucket resource. + The default data [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period) is 30 days. #### InfluxDB OSS - A single InfluxDB OSS instance supports active writes or queries for - approximately 20 buckets across all organizations at a given time. Reading - or writing to more than 20 buckets at a time can adversely affect + approximately 20 buckets across all organizations at a given time. + Reading or writing to more than 20 buckets at a time can adversely affect performance. #### Limitations @@ -164,7 +213,7 @@ type BucketsApi interface { #### Related Guides - - [Create bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/) + - [Create a bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/) - [Create bucket CLI reference]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/bucket/create) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -223,10 +272,33 @@ func (r ApiDeleteBucketsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, er /* * DeleteBucketsID Delete a bucket + * Deletes a bucket and all associated records. + +#### InfluxDB Cloud + +- Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns an HTTP `204` status code 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. + +#### Limitations + +- Only one bucket can be deleted per request. + +#### Related Guides + +- [Delete a bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/delete-bucket/#delete-a-bucket-in-the-influxdb-ui) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The ID of the bucket to delete. + * @param bucketID Bucket ID. The ID of the bucket to delete. * @return ApiDeleteBucketsIDRequest - */ +*/ func (a *BucketsApiService) DeleteBucketsID(ctx _context.Context, bucketID string) ApiDeleteBucketsIDRequest { return ApiDeleteBucketsIDRequest{ ApiService: a, @@ -318,6 +390,28 @@ func (a *BucketsApiService) DeleteBucketsIDExecuteWithHttpInfo(r ApiDeleteBucket } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 == 401 { + var v UnauthorizedRequestError + 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")) @@ -432,29 +526,32 @@ func (r ApiGetBucketsRequest) ExecuteWithHttpInfo() (Buckets, *_nethttp.Response * GetBuckets List buckets * Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). +InfluxDB retrieves buckets owned by the +[organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) +associated with the authorization +([API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)). To limit which buckets are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all buckets up to the default `limit`. -#### Limitations +#### InfluxDB Cloud -- Paging with an `offset` greater than the number of records will result in -an empty list of buckets--for example: +- Doesn't use `org` or `orgID` parameters. - The following request is paging to the 50th record, but the user only has - 10 buckets. +#### InfluxDB OSS - ```sh - $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" +- If you use an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_ + to authenticate your request, InfluxDB retrieves resources for _all + organizations_ in the instance. + To retrieve resources for only a specific organization, use the + `org` parameter or the `orgID` parameter to specify the organization. - $ { - "links": { - "prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", - "self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" - }, - "buckets": [] - } - ``` +#### Required permissions + +| Action | Permission required | +|:--------------------------|:--------------------| +| Retrieve _user buckets_ | `read-buckets` | +| Retrieve [_system buckets_]({{% INFLUXDB_DOCS_URL %}}/reference/internals/system-buckets/) | `read-orgs` | #### Related Guides @@ -576,6 +673,17 @@ func (a *BucketsApiService) GetBucketsExecuteWithHttpInfo(r ApiGetBucketsRequest } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -642,10 +750,14 @@ func (r ApiGetBucketsIDRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Respons /* * GetBucketsID Retrieve a bucket + * Retrieves a bucket. + +Use this endpoint to retrieve information for a specific bucket. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param bucketID The bucket ID. + * @param bucketID The ID of the bucket to retrieve. * @return ApiGetBucketsIDRequest - */ +*/ func (a *BucketsApiService) GetBucketsID(ctx _context.Context, bucketID string) ApiGetBucketsIDRequest { return ApiGetBucketsIDRequest{ ApiService: a, @@ -740,6 +852,28 @@ func (a *BucketsApiService) GetBucketsIDExecuteWithHttpInfo(r ApiGetBucketsIDReq } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } + 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -815,10 +949,28 @@ func (r ApiPatchBucketsIDRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Respo /* * PatchBucketsID Update a bucket + * Updates a bucket. + +Use this endpoint to update properties +(`name`, `description`, and `retentionRules`) of a bucket. + +#### InfluxDB Cloud + +- Requires the `retentionRules` property in the request body. If you don't +provide `retentionRules`, InfluxDB responds with an HTTP `403` status code. + +#### InfluxDB OSS + +- Doesn't require `retentionRules`. + +#### Related Guides + +- [Update a bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/update-bucket/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param bucketID The bucket ID. * @return ApiPatchBucketsIDRequest - */ +*/ func (a *BucketsApiService) PatchBucketsID(ctx _context.Context, bucketID string) ApiPatchBucketsIDRequest { return ApiPatchBucketsIDRequest{ ApiService: a, @@ -918,6 +1070,50 @@ func (a *BucketsApiService) PatchBucketsIDExecuteWithHttpInfo(r ApiPatchBucketsI } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } + 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -985,15 +1181,16 @@ func (r ApiPostBucketsRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Response /* * PostBuckets Create a bucket * Creates a [bucket]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket) -and returns the created bucket along with metadata. The default data +and returns the bucket resource. +The default data [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period) is 30 days. #### InfluxDB OSS - A single InfluxDB OSS instance supports active writes or queries for -approximately 20 buckets across all organizations at a given time. Reading -or writing to more than 20 buckets at a time can adversely affect +approximately 20 buckets across all organizations at a given time. +Reading or writing to more than 20 buckets at a time can adversely affect performance. #### Limitations @@ -1005,7 +1202,7 @@ For additional information regarding InfluxDB Cloud offerings, see #### Related Guides -- [Create bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/) +- [Create a bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/) - [Create bucket CLI reference]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/bucket/create) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -1119,6 +1316,17 @@ func (a *BucketsApiService) PostBucketsExecuteWithHttpInfo(r ApiPostBucketsReque newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } if localVarHTTPResponse.StatusCode == 403 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) diff --git a/api/api_delete.gen.go b/api/api_delete.gen.go index f4367a51..520d80ed 100644 --- a/api/api_delete.gen.go +++ b/api/api_delete.gen.go @@ -36,8 +36,14 @@ type DeleteApi interface { - 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. + 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise. + 3. Handles the delete asynchronously and reaches eventual consistency. + + To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, + wait for a success response (HTTP `2xx` status code) before you send the next request. + + Because writes and deletes are asynchronous, your change might not yet be readable + when you receive the response. #### InfluxDB OSS @@ -48,7 +54,7 @@ type DeleteApi interface { - `write-buckets` or `write-bucket BUCKET_ID`. - `BUCKET_ID` is the ID of the destination bucket. + *`BUCKET_ID`* is the ID of the destination bucket. #### Rate limits (with InfluxDB Cloud) @@ -57,7 +63,7 @@ type DeleteApi interface { #### Related guides - - [Delete data]({{% INFLUXDB_DOCS_URL %}}/write-data/delete-data/). + - [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/). @@ -161,8 +167,14 @@ Use this endpoint to delete points from a bucket in a specified time range. - 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. + 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise. + 3. Handles the delete asynchronously and reaches eventual consistency. + +To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, +wait for a success response (HTTP `2xx` status code) before you send the next request. + +Because writes and deletes are asynchronous, your change might not yet be readable +when you receive the response. #### InfluxDB OSS @@ -173,7 +185,7 @@ Use this endpoint to delete points from a bucket in a specified time range. - `write-buckets` or `write-bucket BUCKET_ID`. - `BUCKET_ID` is the ID of the destination bucket. +*`BUCKET_ID`* is the ID of the destination bucket. #### Rate limits (with InfluxDB Cloud) @@ -182,7 +194,7 @@ For more information, see [limits and adjustable quotas](https://docs.influxdata #### Related guides -- [Delete data]({{% INFLUXDB_DOCS_URL %}}/write-data/delete-data/). +- [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/). @@ -307,6 +319,17 @@ func (a *DeleteApiService) PostDeleteExecuteWithHttpInfo(r ApiPostDeleteRequest) newErr.model = &v return localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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_invokable_scripts.gen.go b/api/api_invokable_scripts.gen.go index 7edffd17..331b130b 100644 --- a/api/api_invokable_scripts.gen.go +++ b/api/api_invokable_scripts.gen.go @@ -16,6 +16,7 @@ import ( _io "io" _nethttp "net/http" _neturl "net/url" + "reflect" "strings" ) @@ -28,9 +29,9 @@ type InvokableScriptsApi interface { /* * DeleteScriptsID Delete a script - * Deletes a script and all associated records. + * Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID The ID of the script to delete. + * @param scriptID A script ID. Deletes the specified script. * @return ApiDeleteScriptsIDRequest */ DeleteScriptsID(ctx _context.Context, scriptID string) ApiDeleteScriptsIDRequest @@ -51,21 +52,7 @@ type InvokableScriptsApi interface { * GetScripts List scripts * Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). - #### Limitations - - - Paging with an `offset` greater than the number of records will result in - an empty response--for example: - - The following request is paging to the 50th record, but the user has only - created two scripts. - - ```sh - $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" - - $ {"scripts":[]} - ``` - - #### Related Guides + #### Related guides - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) @@ -90,9 +77,10 @@ type InvokableScriptsApi interface { /* * GetScriptsID Retrieve a script - * Uses script ID to retrieve details of an invokable script. + * Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID The script ID. + * @param scriptID A script ID. Retrieves the specified script. * @return ApiGetScriptsIDRequest */ GetScriptsID(ctx _context.Context, scriptID string) ApiGetScriptsIDRequest @@ -112,13 +100,15 @@ type InvokableScriptsApi interface { GetScriptsIDExecuteWithHttpInfo(r ApiGetScriptsIDRequest) (Script, *_nethttp.Response, error) /* - * PatchScriptsID Update a script - * Updates properties (`name`, `description`, and `script`) of an invokable script. + * PatchScriptsID Update a script + * Updates a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and returns the script. - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID The script ID. - * @return ApiPatchScriptsIDRequest - */ + Use this endpoint to update the properties (`name`, `description`, and `script`) of an invokable script. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptID A script ID. Updates the specified script. + * @return ApiPatchScriptsIDRequest + */ PatchScriptsID(ctx _context.Context, scriptID string) ApiPatchScriptsIDRequest /* @@ -138,12 +128,12 @@ type InvokableScriptsApi interface { /* * PostScripts Create a script * Creates an [invokable script](https://docs.influxdata.com/resources/videos/api-invokable-scripts/) - and returns the created script. + and returns the script. - #### Related Guides + #### Related guides - - [Invokable scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). - - [Creating custom InfluxDB endpoints](https://docs.influxdata.com/resources/videos/api-invokable-scripts/). + - [Invokable scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) + - [Creating custom InfluxDB endpoints](https://docs.influxdata.com/resources/videos/api-invokable-scripts/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostScriptsRequest @@ -215,9 +205,9 @@ func (r ApiDeleteScriptsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, er /* * DeleteScriptsID Delete a script - * Deletes a script and all associated records. + * Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID The ID of the script to delete. + * @param scriptID A script ID. Deletes the specified script. * @return ApiDeleteScriptsIDRequest */ func (a *InvokableScriptsApiService) DeleteScriptsID(ctx _context.Context, scriptID string) ApiDeleteScriptsIDRequest { @@ -308,6 +298,17 @@ func (a *InvokableScriptsApiService) DeleteScriptsIDExecuteWithHttpInfo(r ApiDel } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 { @@ -323,10 +324,21 @@ func (a *InvokableScriptsApiService) DeleteScriptsIDExecuteWithHttpInfo(r ApiDel } type ApiGetScriptsRequest struct { - ctx _context.Context - ApiService InvokableScriptsApi - limit *int32 - offset *int32 + ctx _context.Context + ApiService InvokableScriptsApi + offset *int32 + limit *int32 + name *string + labelNames *[]string + labelContains *string +} + +func (r ApiGetScriptsRequest) Offset(offset int32) ApiGetScriptsRequest { + r.offset = &offset + return r +} +func (r ApiGetScriptsRequest) GetOffset() *int32 { + return r.offset } func (r ApiGetScriptsRequest) Limit(limit int32) ApiGetScriptsRequest { @@ -337,12 +349,28 @@ func (r ApiGetScriptsRequest) GetLimit() *int32 { return r.limit } -func (r ApiGetScriptsRequest) Offset(offset int32) ApiGetScriptsRequest { - r.offset = &offset +func (r ApiGetScriptsRequest) Name(name string) ApiGetScriptsRequest { + r.name = &name return r } -func (r ApiGetScriptsRequest) GetOffset() *int32 { - return r.offset +func (r ApiGetScriptsRequest) GetName() *string { + return r.name +} + +func (r ApiGetScriptsRequest) LabelNames(labelNames []string) ApiGetScriptsRequest { + r.labelNames = &labelNames + return r +} +func (r ApiGetScriptsRequest) GetLabelNames() *[]string { + return r.labelNames +} + +func (r ApiGetScriptsRequest) LabelContains(labelContains string) ApiGetScriptsRequest { + r.labelContains = &labelContains + return r +} +func (r ApiGetScriptsRequest) GetLabelContains() *string { + return r.labelContains } func (r ApiGetScriptsRequest) Execute() (Scripts, error) { @@ -357,21 +385,7 @@ func (r ApiGetScriptsRequest) ExecuteWithHttpInfo() (Scripts, *_nethttp.Response * GetScripts List scripts * Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). -#### Limitations - -- Paging with an `offset` greater than the number of records will result in -an empty response--for example: - - The following request is paging to the 50th record, but the user has only - created two scripts. - - ```sh - $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" - - $ {"scripts":[]} - ``` - -#### Related Guides +#### Related guides - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) @@ -421,11 +435,28 @@ func (a *InvokableScriptsApiService) GetScriptsExecuteWithHttpInfo(r ApiGetScrip localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } if r.limit != nil { localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) } - if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + if r.name != nil { + localVarQueryParams.Add("name", parameterToString(*r.name, "")) + } + if r.labelNames != nil { + t := *r.labelNames + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("labelNames", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("labelNames", parameterToString(t, "multi")) + } + } + if r.labelContains != nil { + localVarQueryParams.Add("labelContains", parameterToString(*r.labelContains, "")) } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -484,6 +515,17 @@ func (a *InvokableScriptsApiService) GetScriptsExecuteWithHttpInfo(r ApiGetScrip newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -541,9 +583,10 @@ func (r ApiGetScriptsIDRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Respons /* * GetScriptsID Retrieve a script - * Uses script ID to retrieve details of an invokable script. + * Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID The script ID. + * @param scriptID A script ID. Retrieves the specified script. * @return ApiGetScriptsIDRequest */ func (a *InvokableScriptsApiService) GetScriptsID(ctx _context.Context, scriptID string) ApiGetScriptsIDRequest { @@ -637,6 +680,17 @@ func (a *InvokableScriptsApiService) GetScriptsIDExecuteWithHttpInfo(r ApiGetScr } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -703,12 +757,14 @@ func (r ApiPatchScriptsIDRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Respo /* * PatchScriptsID Update a script - * Updates properties (`name`, `description`, and `script`) of an invokable script. + * Updates a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and returns the script. + +Use this endpoint to update the properties (`name`, `description`, and `script`) of an invokable script. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID The script ID. + * @param scriptID A script ID. Updates the specified script. * @return ApiPatchScriptsIDRequest - */ +*/ func (a *InvokableScriptsApiService) PatchScriptsID(ctx _context.Context, scriptID string) ApiPatchScriptsIDRequest { return ApiPatchScriptsIDRequest{ ApiService: a, @@ -805,6 +861,17 @@ func (a *InvokableScriptsApiService) PatchScriptsIDExecuteWithHttpInfo(r ApiPatc } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -863,12 +930,12 @@ func (r ApiPostScriptsRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Response /* * PostScripts Create a script * Creates an [invokable script](https://docs.influxdata.com/resources/videos/api-invokable-scripts/) -and returns the created script. +and returns the script. -#### Related Guides +#### Related guides -- [Invokable scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). -- [Creating custom InfluxDB endpoints](https://docs.influxdata.com/resources/videos/api-invokable-scripts/). +- [Invokable scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) +- [Creating custom InfluxDB endpoints](https://docs.influxdata.com/resources/videos/api-invokable-scripts/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostScriptsRequest @@ -967,8 +1034,8 @@ func (a *InvokableScriptsApiService) PostScriptsExecuteWithHttpInfo(r ApiPostScr } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status - if localVarHTTPResponse.StatusCode == 400 { - var v Error + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) diff --git a/api/api_legacy_authorizations.gen.go b/api/api_legacy_authorizations.gen.go index c128607e..e7b428a5 100644 --- a/api/api_legacy_authorizations.gen.go +++ b/api/api_legacy_authorizations.gen.go @@ -112,10 +112,18 @@ type LegacyAuthorizationsApi interface { PatchLegacyAuthorizationsIDExecuteWithHttpInfo(r ApiPatchLegacyAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) /* - * PostLegacyAuthorizations Create a legacy authorization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostLegacyAuthorizationsRequest - */ + * PostLegacyAuthorizations Create a legacy authorization + * Creates a legacy authorization and returns the legacy authorization. + + #### Required permissions + + - `write-users USER_ID` if you pass the `userID` property in the request body. + + *`USER_ID`* is the ID of the user that you want to scope the authorization to. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostLegacyAuthorizationsRequest + */ PostLegacyAuthorizations(ctx _context.Context) ApiPostLegacyAuthorizationsRequest /* @@ -897,9 +905,17 @@ func (r ApiPostLegacyAuthorizationsRequest) ExecuteWithHttpInfo() (Authorization /* * PostLegacyAuthorizations Create a legacy authorization + * Creates a legacy authorization and returns the legacy authorization. + +#### Required permissions + +- `write-users USER_ID` if you pass the `userID` property in the request body. + +*`USER_ID`* is the ID of the user that you want to scope the authorization to. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostLegacyAuthorizationsRequest - */ +*/ func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizations(ctx _context.Context) ApiPostLegacyAuthorizationsRequest { return ApiPostLegacyAuthorizationsRequest{ ApiService: a, @@ -1008,6 +1024,17 @@ func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizationsExecuteWithHttp newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_organizations.gen.go b/api/api_organizations.gen.go index 32ded941..f3e6e003 100644 --- a/api/api_organizations.gen.go +++ b/api/api_organizations.gen.go @@ -27,11 +27,37 @@ var ( type OrganizationsApi interface { /* - * DeleteOrgsID Delete an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The ID of the organization to delete. - * @return ApiDeleteOrgsIDRequest - */ + * DeleteOrgsID Delete an organization + * Deletes an organization. + + Deleting an organization from InfluxDB Cloud can't be undone. + Once deleted, all data associated with the organization is removed. + + #### InfluxDB Cloud + + - Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns an HTTP `204` status code 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. + + #### Limitations + + - Only one organization can be deleted per request. + + #### Related guides + + - [Delete organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/delete-orgs/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization to delete. + * @return ApiDeleteOrgsIDRequest + */ DeleteOrgsID(ctx _context.Context, orgID string) ApiDeleteOrgsIDRequest /* @@ -47,12 +73,38 @@ type OrganizationsApi interface { DeleteOrgsIDExecuteWithHttpInfo(r ApiDeleteOrgsIDRequest) (*_nethttp.Response, error) /* - * DeleteOrgsIDMembersID Remove a member from an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the member to remove. - * @param orgID The organization ID. - * @return ApiDeleteOrgsIDMembersIDRequest - */ + * DeleteOrgsIDMembersID Remove a member from an organization + * Removes a member from an organization. + + Use this endpoint to remove a user's member privileges from a bucket. This + removes the user's `read` and `write` permissions from the organization. + + #### InfluxDB Cloud + + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Limitations + + - Member permissions are separate from API token permissions. + - Member permissions are used in the context of the InfluxDB UI. + + #### Required permissions + + - `write-orgs INFLUX_ORG_ID` + + *`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an + owner from. + + #### Related guides + + - [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID The ID of the user to remove. + * @param orgID The ID of the organization to remove a user from. + * @return ApiDeleteOrgsIDMembersIDRequest + */ DeleteOrgsIDMembersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDMembersIDRequest /* @@ -68,12 +120,37 @@ type OrganizationsApi interface { DeleteOrgsIDMembersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDMembersIDRequest) (*_nethttp.Response, error) /* - * DeleteOrgsIDOwnersID Remove an owner from an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the owner to remove. - * @param orgID The organization ID. - * @return ApiDeleteOrgsIDOwnersIDRequest - */ + * DeleteOrgsIDOwnersID Remove an owner from an organization + * Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from + the organization. + + Organization owners have permission to delete organizations and remove user and member + permissions from the organization. + + #### InfluxDB Cloud + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Limitations + + - Owner permissions are separate from API token permissions. + - Owner permissions are used in the context of the InfluxDB UI. + + #### Required permissions + + - `write-orgs INFLUX_ORG_ID` + + *`INFLUX_ORG_ID`* is the ID of the organization that you want to + remove an owner from. + + #### Related endpoints + - [Authorizations](#tag/Authorizations) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID The ID of the user to remove. + * @param orgID The ID of the organization to remove an owner from. + * @return ApiDeleteOrgsIDOwnersIDRequest + */ DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest /* @@ -89,10 +166,23 @@ type OrganizationsApi interface { DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDOwnersIDRequest) (*_nethttp.Response, error) /* - * GetOrgs List all organizations - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetOrgsRequest - */ + * GetOrgs List organizations + * Retrieves a list of [organizations]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization/). + + To limit which organizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all organizations up to the default `limit`. + + #### InfluxDB Cloud + + - Only returns the organization that owns the token passed in the request. + + #### Related guides + + - [View organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/view-orgs/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetOrgsRequest + */ GetOrgs(ctx _context.Context) ApiGetOrgsRequest /* @@ -110,11 +200,19 @@ type OrganizationsApi interface { GetOrgsExecuteWithHttpInfo(r ApiGetOrgsRequest) (Organizations, *_nethttp.Response, error) /* - * GetOrgsID Retrieve an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The ID of the organization to get. - * @return ApiGetOrgsIDRequest - */ + * GetOrgsID Retrieve an organization + * Retrieves an organization. + + Use this endpoint to retrieve information for a specific organization. + + #### Related guides + + - [View organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/view-orgs/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization to retrieve. + * @return ApiGetOrgsIDRequest + */ GetOrgsID(ctx _context.Context, orgID string) ApiGetOrgsIDRequest /* @@ -132,11 +230,41 @@ type OrganizationsApi interface { GetOrgsIDExecuteWithHttpInfo(r ApiGetOrgsIDRequest) (Organization, *_nethttp.Response, error) /* - * GetOrgsIDMembers List all members of an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. - * @return ApiGetOrgsIDMembersRequest - */ + * GetOrgsIDMembers List all members of an organization + * Retrieves a list of all users that belong to an organization. + + InfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have + permission to access InfluxDB. + + [Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users + within the organization. + + #### InfluxDB Cloud + + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Limitations + + - Member permissions are separate from API token permissions. + - Member permissions are used in the context of the InfluxDB UI. + + #### Required permissions + + - `read-orgs INFLUX_ORG_ID` + + *`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve + members for. + + #### Related guides + + - [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/) + - [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization to retrieve users for. + * @return ApiGetOrgsIDMembersRequest + */ GetOrgsIDMembers(ctx _context.Context, orgID string) ApiGetOrgsIDMembersRequest /* @@ -154,11 +282,25 @@ type OrganizationsApi interface { GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOrgsIDMembersRequest) (ResourceMembers, *_nethttp.Response, error) /* - * GetOrgsIDOwners List all owners of an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. - * @return ApiGetOrgsIDOwnersRequest - */ + * GetOrgsIDOwners List all owners of an organization + * Retrieves a list of all owners of an organization. + + #### InfluxDB Cloud + + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Required permissions + + - `read-orgs INFLUX_ORG_ID` + + *`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a + list of owners from. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization to list owners for. + * @return ApiGetOrgsIDOwnersRequest + */ GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest /* @@ -176,11 +318,32 @@ type OrganizationsApi interface { GetOrgsIDOwnersExecuteWithHttpInfo(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, *_nethttp.Response, error) /* - * PatchOrgsID Update an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The ID of the organization to get. - * @return ApiPatchOrgsIDRequest - */ + * PatchOrgsID Update an organization + * Updates an organization. + + Use this endpoint to update properties + (`name`, `description`) of an organization. + + Updating an organization’s name affects all resources that reference the + organization by name, including the following: + + - Queries + - Dashboards + - Tasks + - Telegraf configurations + - Templates + + If you change an organization name, be sure to update the organization name + in these resources as well. + + #### Related Guides + + - [Update an organization]({{% INFLUXDB_DOCS_URL %}}/organizations/update-org/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization to update. + * @return ApiPatchOrgsIDRequest + */ PatchOrgsID(ctx _context.Context, orgID string) ApiPatchOrgsIDRequest /* @@ -198,10 +361,21 @@ type OrganizationsApi interface { PatchOrgsIDExecuteWithHttpInfo(r ApiPatchOrgsIDRequest) (Organization, *_nethttp.Response, error) /* - * PostOrgs Create an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostOrgsRequest - */ + * PostOrgs Create an organization + * Creates an [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) + and returns the newly created organization. + + #### InfluxDB Cloud + + - Doesn't allow you to use this endpoint to create organizations. + + #### Related guides + + - [Manage organizations]({{% INFLUXDB_DOCS_URL %}}/organizations) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostOrgsRequest + */ PostOrgs(ctx _context.Context) ApiPostOrgsRequest /* @@ -219,11 +393,39 @@ type OrganizationsApi interface { PostOrgsExecuteWithHttpInfo(r ApiPostOrgsRequest) (Organization, *_nethttp.Response, error) /* - * PostOrgsIDMembers Add a member to an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. - * @return ApiPostOrgsIDMembersRequest - */ + * PostOrgsIDMembers Add a member to an organization + * Add a user to an organization. + + InfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have + permission to access InfluxDB. + + [Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users + within the organization. + + #### InfluxDB Cloud + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Limitations + + - Member permissions are separate from API token permissions. + - Member permissions are used in the context of the InfluxDB UI. + + #### Required permissions + + - `write-orgs INFLUX_ORG_ID` + + *`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to. + + #### Related guides + + - [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/) + - [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization. + * @return ApiPostOrgsIDMembersRequest + */ PostOrgsIDMembers(ctx _context.Context, orgID string) ApiPostOrgsIDMembersRequest /* @@ -241,11 +443,30 @@ type OrganizationsApi interface { PostOrgsIDMembersExecuteWithHttpInfo(r ApiPostOrgsIDMembersRequest) (ResourceMember, *_nethttp.Response, error) /* - * PostOrgsIDOwners Add an owner to an organization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. - * @return ApiPostOrgsIDOwnersRequest - */ + * PostOrgsIDOwners Add an owner to an organization + * Adds an owner to an organization. + + Use this endpoint to assign the organization `owner` role to a user. + + #### InfluxDB Cloud + + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Required permissions + + - `write-orgs INFLUX_ORG_ID` + + *`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for. + + #### Related endpoints + + - [Authorizations](#tag/Authorizations) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param orgID The ID of the organization that you want to add an owner for. + * @return ApiPostOrgsIDOwnersRequest + */ PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest /* @@ -299,10 +520,36 @@ func (r ApiDeleteOrgsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error /* * DeleteOrgsID Delete an organization + * Deletes an organization. + +Deleting an organization from InfluxDB Cloud can't be undone. +Once deleted, all data associated with the organization is removed. + +#### InfluxDB Cloud + +- Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns an HTTP `204` status code 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. + +#### Limitations + +- Only one organization can be deleted per request. + +#### Related guides + +- [Delete organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/delete-orgs/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param orgID The ID of the organization to delete. * @return ApiDeleteOrgsIDRequest - */ +*/ func (a *OrganizationsApiService) DeleteOrgsID(ctx _context.Context, orgID string) ApiDeleteOrgsIDRequest { return ApiDeleteOrgsIDRequest{ ApiService: a, @@ -394,6 +641,17 @@ func (a *OrganizationsApiService) DeleteOrgsIDExecuteWithHttpInfo(r ApiDeleteOrg } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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")) @@ -461,11 +719,37 @@ func (r ApiDeleteOrgsIDMembersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Respon /* * DeleteOrgsIDMembersID Remove a member from an organization + * Removes a member from an organization. + +Use this endpoint to remove a user's member privileges from a bucket. This +removes the user's `read` and `write` permissions from the organization. + +#### InfluxDB Cloud + +- Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + +#### Limitations + +- Member permissions are separate from API token permissions. +- Member permissions are used in the context of the InfluxDB UI. + +#### Required permissions + +- `write-orgs INFLUX_ORG_ID` + +*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an +owner from. + +#### Related guides + +- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the member to remove. - * @param orgID The organization ID. + * @param userID The ID of the user to remove. + * @param orgID The ID of the organization to remove a user from. * @return ApiDeleteOrgsIDMembersIDRequest - */ +*/ func (a *OrganizationsApiService) DeleteOrgsIDMembersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDMembersIDRequest { return ApiDeleteOrgsIDMembersIDRequest{ ApiService: a, @@ -559,6 +843,17 @@ func (a *OrganizationsApiService) DeleteOrgsIDMembersIDExecuteWithHttpInfo(r Api } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 { @@ -615,11 +910,36 @@ func (r ApiDeleteOrgsIDOwnersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Respons /* * DeleteOrgsIDOwnersID Remove an owner from an organization + * Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from +the organization. + +Organization owners have permission to delete organizations and remove user and member +permissions from the organization. + +#### InfluxDB Cloud +- Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + +#### Limitations + +- Owner permissions are separate from API token permissions. +- Owner permissions are used in the context of the InfluxDB UI. + +#### Required permissions + +- `write-orgs INFLUX_ORG_ID` + +*`INFLUX_ORG_ID`* is the ID of the organization that you want to +remove an owner from. + +#### Related endpoints +- [Authorizations](#tag/Authorizations) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the owner to remove. - * @param orgID The organization ID. + * @param userID The ID of the user to remove. + * @param orgID The ID of the organization to remove an owner from. * @return ApiDeleteOrgsIDOwnersIDRequest - */ +*/ func (a *OrganizationsApiService) DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest { return ApiDeleteOrgsIDOwnersIDRequest{ ApiService: a, @@ -713,6 +1033,17 @@ func (a *OrganizationsApiService) DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiD } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 { @@ -804,10 +1135,23 @@ func (r ApiGetOrgsRequest) ExecuteWithHttpInfo() (Organizations, *_nethttp.Respo } /* - * GetOrgs List all organizations + * GetOrgs List organizations + * Retrieves a list of [organizations]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization/). + +To limit which organizations are returned, pass query parameters in your request. +If no query parameters are passed, InfluxDB returns all organizations up to the default `limit`. + +#### InfluxDB Cloud + +- Only returns the organization that owns the token passed in the request. + +#### Related guides + +- [View organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/view-orgs/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetOrgsRequest - */ +*/ func (a *OrganizationsApiService) GetOrgs(ctx _context.Context) ApiGetOrgsRequest { return ApiGetOrgsRequest{ ApiService: a, @@ -918,6 +1262,50 @@ func (a *OrganizationsApiService) GetOrgsExecuteWithHttpInfo(r ApiGetOrgsRequest } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } + 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -984,10 +1372,18 @@ func (r ApiGetOrgsIDRequest) ExecuteWithHttpInfo() (Organization, *_nethttp.Resp /* * GetOrgsID Retrieve an organization + * Retrieves an organization. + +Use this endpoint to retrieve information for a specific organization. + +#### Related guides + +- [View organizations]({{% INFLUXDB_DOCS_URL %}}/organizations/view-orgs/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The ID of the organization to get. + * @param orgID The ID of the organization to retrieve. * @return ApiGetOrgsIDRequest - */ +*/ func (a *OrganizationsApiService) GetOrgsID(ctx _context.Context, orgID string) ApiGetOrgsIDRequest { return ApiGetOrgsIDRequest{ ApiService: a, @@ -1082,6 +1478,28 @@ func (a *OrganizationsApiService) GetOrgsIDExecuteWithHttpInfo(r ApiGetOrgsIDReq } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } + 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1148,10 +1566,40 @@ func (r ApiGetOrgsIDMembersRequest) ExecuteWithHttpInfo() (ResourceMembers, *_ne /* * GetOrgsIDMembers List all members of an organization + * Retrieves a list of all users that belong to an organization. + +InfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have +permission to access InfluxDB. + +[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users +within the organization. + +#### InfluxDB Cloud + +- Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + +#### Limitations + +- Member permissions are separate from API token permissions. +- Member permissions are used in the context of the InfluxDB UI. + +#### Required permissions + +- `read-orgs INFLUX_ORG_ID` + +*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve +members for. + +#### Related guides + +- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/) +- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. + * @param orgID The ID of the organization to retrieve users for. * @return ApiGetOrgsIDMembersRequest - */ +*/ func (a *OrganizationsApiService) GetOrgsIDMembers(ctx _context.Context, orgID string) ApiGetOrgsIDMembersRequest { return ApiGetOrgsIDMembersRequest{ ApiService: a, @@ -1246,6 +1694,17 @@ func (a *OrganizationsApiService) GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOr } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1323,10 +1782,24 @@ func (r ApiGetOrgsIDOwnersRequest) ExecuteWithHttpInfo() (ResourceOwners, *_neth /* * GetOrgsIDOwners List all owners of an organization + * Retrieves a list of all owners of an organization. + +#### InfluxDB Cloud + +- Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + +#### Required permissions + +- `read-orgs INFLUX_ORG_ID` + +*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a +list of owners from. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. + * @param orgID The ID of the organization to list owners for. * @return ApiGetOrgsIDOwnersRequest - */ +*/ func (a *OrganizationsApiService) GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest { return ApiGetOrgsIDOwnersRequest{ ApiService: a, @@ -1507,10 +1980,31 @@ func (r ApiPatchOrgsIDRequest) ExecuteWithHttpInfo() (Organization, *_nethttp.Re /* * PatchOrgsID Update an organization + * Updates an organization. + +Use this endpoint to update properties +(`name`, `description`) of an organization. + +Updating an organization’s name affects all resources that reference the +organization by name, including the following: + +- Queries +- Dashboards +- Tasks +- Telegraf configurations +- Templates + +If you change an organization name, be sure to update the organization name +in these resources as well. + +#### Related Guides + +- [Update an organization]({{% INFLUXDB_DOCS_URL %}}/organizations/update-org/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The ID of the organization to get. + * @param orgID The ID of the organization to update. * @return ApiPatchOrgsIDRequest - */ +*/ func (a *OrganizationsApiService) PatchOrgsID(ctx _context.Context, orgID string) ApiPatchOrgsIDRequest { return ApiPatchOrgsIDRequest{ ApiService: a, @@ -1610,6 +2104,17 @@ func (a *OrganizationsApiService) PatchOrgsIDExecuteWithHttpInfo(r ApiPatchOrgsI } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1676,9 +2181,20 @@ func (r ApiPostOrgsRequest) ExecuteWithHttpInfo() (Organization, *_nethttp.Respo /* * PostOrgs Create an organization + * Creates an [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) +and returns the newly created organization. + +#### InfluxDB Cloud + +- Doesn't allow you to use this endpoint to create organizations. + +#### Related guides + +- [Manage organizations]({{% INFLUXDB_DOCS_URL %}}/organizations) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostOrgsRequest - */ +*/ func (a *OrganizationsApiService) PostOrgs(ctx _context.Context) ApiPostOrgsRequest { return ApiPostOrgsRequest{ ApiService: a, @@ -1776,6 +2292,17 @@ func (a *OrganizationsApiService) PostOrgsExecuteWithHttpInfo(r ApiPostOrgsReque } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1851,10 +2378,38 @@ func (r ApiPostOrgsIDMembersRequest) ExecuteWithHttpInfo() (ResourceMember, *_ne /* * PostOrgsIDMembers Add a member to an organization + * Add a user to an organization. + +InfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have +permission to access InfluxDB. + +[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users +within the organization. + +#### InfluxDB Cloud +- Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + +#### Limitations + +- Member permissions are separate from API token permissions. +- Member permissions are used in the context of the InfluxDB UI. + +#### Required permissions + +- `write-orgs INFLUX_ORG_ID` + +*`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to. + +#### Related guides + +- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/) +- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. + * @param orgID The ID of the organization. * @return ApiPostOrgsIDMembersRequest - */ +*/ func (a *OrganizationsApiService) PostOrgsIDMembers(ctx _context.Context, orgID string) ApiPostOrgsIDMembersRequest { return ApiPostOrgsIDMembersRequest{ ApiService: a, @@ -1954,6 +2509,17 @@ func (a *OrganizationsApiService) PostOrgsIDMembersExecuteWithHttpInfo(r ApiPost } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2029,10 +2595,29 @@ func (r ApiPostOrgsIDOwnersRequest) ExecuteWithHttpInfo() (ResourceOwner, *_neth /* * PostOrgsIDOwners Add an owner to an organization + * Adds an owner to an organization. + +Use this endpoint to assign the organization `owner` role to a user. + +#### InfluxDB Cloud + +- Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + +#### Required permissions + +- `write-orgs INFLUX_ORG_ID` + +*`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for. + +#### Related endpoints + +- [Authorizations](#tag/Authorizations) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param orgID The organization ID. + * @param orgID The ID of the organization that you want to add an owner for. * @return ApiPostOrgsIDOwnersRequest - */ +*/ func (a *OrganizationsApiService) PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest { return ApiPostOrgsIDOwnersRequest{ ApiService: a, @@ -2132,6 +2717,17 @@ func (a *OrganizationsApiService) PostOrgsIDOwnersExecuteWithHttpInfo(r ApiPostO } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_ping.gen.go b/api/api_ping.gen.go index 0b99ac02..1e61b641 100644 --- a/api/api_ping.gen.go +++ b/api/api_ping.gen.go @@ -25,11 +25,23 @@ var ( 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 Get the status of the instance + * Retrieves the status and InfluxDB version of the instance. + + Use this endpoint to monitor uptime for the InfluxDB instance. The response + returns a HTTP `204` status code to inform you the instance is available. + + #### InfluxDB Cloud + + - Isn't versioned and doesn't return `X-Influxdb-Version` in the headers. + + #### Related guides + + - [Influx ping]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/ping/) + + * @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 /* @@ -45,11 +57,23 @@ type PingApi interface { 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 Get the status of the instance + * Returns the status and InfluxDB version of the instance. + + Use this endpoint to monitor uptime for the InfluxDB instance. The response + returns a HTTP `204` status code to inform you the instance is available. + + #### InfluxDB Cloud + + - Isn't versioned and doesn't return `X-Influxdb-Version` in the headers. + + #### Related guides + + - [Influx ping]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/ping/) + + * @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 /* @@ -82,11 +106,23 @@ func (r ApiGetPingRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { } /* - * GetPing Get the status and version of the instance - * Returns the status and InfluxDB version of the instance. + * GetPing Get the status of the instance + * Retrieves the status and InfluxDB version of the instance. + +Use this endpoint to monitor uptime for the InfluxDB instance. The response +returns a HTTP `204` status code to inform you the instance is available. + +#### InfluxDB Cloud + +- Isn't versioned and doesn't return `X-Influxdb-Version` in the headers. + +#### Related guides + +- [Influx ping]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/ping/) + * @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, @@ -193,11 +229,23 @@ func (r ApiHeadPingRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { } /* - * HeadPing Get the status and version of the instance + * HeadPing Get the status of the instance * Returns the status and InfluxDB version of the instance. + +Use this endpoint to monitor uptime for the InfluxDB instance. The response +returns a HTTP `204` status code to inform you the instance is available. + +#### InfluxDB Cloud + +- Isn't versioned and doesn't return `X-Influxdb-Version` in the headers. + +#### Related guides + +- [Influx ping]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/ping/) + * @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, diff --git a/api/api_signin.gen.go b/api/api_signin.gen.go index 3091579b..a2ba528b 100644 --- a/api/api_signin.gen.go +++ b/api/api_signin.gen.go @@ -26,11 +26,36 @@ var ( type SigninApi interface { /* - * PostSignin Create a user session. - * Authenticates ***Basic Auth*** credentials for a user. If successful, creates a new UI session for the user. - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostSigninRequest - */ + * PostSignin Create a user session. + * Authenticates [Basic authentication credentials](#section/Authentication/BasicAuthentication) + for a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user), + and then, if successful, generates a user session. + + To authenticate a user, pass the HTTP `Authorization` header with the + `Basic` scheme and the base64-encoded username and password. + For syntax and more information, see [Basic Authentication](#section/Authentication/BasicAuthentication) for + syntax and more information. + + If authentication is successful, InfluxDB creates a new session for the user + and then returns the session cookie in the `Set-Cookie` response header. + + User sessions exist only in memory. + They expire within ten minutes and during restarts of the InfluxDB instance. + + #### User sessions with authorizations + + - In InfluxDB Cloud, a user session inherits all the user's permissions for + the organization. + - In InfluxDB OSS, a user session inherits all the user's permissions for all + the organizations that the user belongs to. + + #### Related endpoints + + - [Signout](#tag/Signout) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostSigninRequest + */ PostSignin(ctx _context.Context) ApiPostSigninRequest /* @@ -73,10 +98,35 @@ func (r ApiPostSigninRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) /* * PostSignin Create a user session. - * Authenticates ***Basic Auth*** credentials for a user. If successful, creates a new UI session for the user. + * Authenticates [Basic authentication credentials](#section/Authentication/BasicAuthentication) +for a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user), +and then, if successful, generates a user session. + +To authenticate a user, pass the HTTP `Authorization` header with the +`Basic` scheme and the base64-encoded username and password. +For syntax and more information, see [Basic Authentication](#section/Authentication/BasicAuthentication) for +syntax and more information. + +If authentication is successful, InfluxDB creates a new session for the user +and then returns the session cookie in the `Set-Cookie` response header. + +User sessions exist only in memory. +They expire within ten minutes and during restarts of the InfluxDB instance. + +#### User sessions with authorizations + +- In InfluxDB Cloud, a user session inherits all the user's permissions for + the organization. +- In InfluxDB OSS, a user session inherits all the user's permissions for all + the organizations that the user belongs to. + +#### Related endpoints + +- [Signout](#tag/Signout) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostSigninRequest - */ +*/ func (a *SigninApiService) PostSignin(ctx _context.Context) ApiPostSigninRequest { return ApiPostSigninRequest{ ApiService: a, diff --git a/api/api_tasks.gen.go b/api/api_tasks.gen.go index 08ed4f46..ce8662e4 100644 --- a/api/api_tasks.gen.go +++ b/api/api_tasks.gen.go @@ -29,7 +29,7 @@ type TasksApi interface { /* * DeleteTasksID Delete a task - * Deletes a task and associated records. + * Deletes a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and associated records. Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. @@ -37,7 +37,7 @@ type TasksApi interface { If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param taskID The ID of the task to delete. + * @param taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to delete. * @return ApiDeleteTasksIDRequest */ DeleteTasksID(ctx _context.Context, taskID string) ApiDeleteTasksIDRequest @@ -62,10 +62,10 @@ type TasksApi interface { #### InfluxDB Cloud - - Doesn't support this operation. + - 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 taskID The ID of the task to cancel. * @param runID The ID of the task run to cancel. * @return ApiDeleteTasksIDRunsIDRequest */ @@ -85,7 +85,7 @@ type TasksApi interface { /* * GetTasks List all tasks - * Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/). + * Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. @@ -110,14 +110,13 @@ type TasksApi interface { GetTasksExecuteWithHttpInfo(r ApiGetTasksRequest) (Tasks, *_nethttp.Response, error) /* - * GetTasksID Retrieve a task - * Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - by ID. + * GetTasksID Retrieve a task + * Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param taskID The ID of the task to retrieve. - * @return ApiGetTasksIDRequest - */ + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to retrieve. + * @return ApiGetTasksIDRequest + */ GetTasksID(ctx _context.Context, taskID string) ApiGetTasksIDRequest /* @@ -198,8 +197,8 @@ type TasksApi interface { Use this endpoint to retrieve detail and logs for a specific task run. * @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. + * @param taskID The ID of the task to retrieve runs for. + * @param runID The ID of the run to retrieve. * @return ApiGetTasksIDRunsIDRequest */ GetTasksIDRunsID(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDRequest @@ -219,12 +218,17 @@ type TasksApi interface { GetTasksIDRunsIDExecuteWithHttpInfo(r ApiGetTasksIDRunsIDRequest) (Run, *_nethttp.Response, error) /* - * GetTasksIDRunsIDLogs Retrieve all logs for a run - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param taskID The ID of the task to get logs for. - * @param runID The ID of the run to get logs for. - * @return ApiGetTasksIDRunsIDLogsRequest - */ + * GetTasksIDRunsIDLogs Retrieve all logs for a run + * Retrieves all logs for a task run. + A log is a list of run events with `runID`, `time`, and `message` properties. + + Use this endpoint to help analyze task performance and troubleshoot failed task runs. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param taskID The ID of the task to get logs for. + * @param runID The ID of the run to get logs for. + * @return ApiGetTasksIDRunsIDLogsRequest + */ GetTasksIDRunsIDLogs(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDLogsRequest /* @@ -243,17 +247,63 @@ type TasksApi interface { /* * PatchTasksID Update a task - * Updates a task and then cancels all scheduled runs of the task. + * Updates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), + and then cancels all scheduled runs of the task. - Use this endpoint to modify task properties (for example: `cron`, `name`, `flux`, `status`). + Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. + #### InfluxDB Cloud + + - Use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same 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 taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to update. * @return ApiPatchTasksIDRequest */ PatchTasksID(ctx _context.Context, taskID string) ApiPatchTasksIDRequest @@ -274,17 +324,54 @@ type TasksApi interface { /* * PostTasks Create a task - * Creates a [task]({{% INFLUXDB_DOCS_URL %}}/process-data/) and returns the created task. + * Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. Use this endpoint to create a scheduled task that runs a Flux script. - In your task, provide one of the following: - - - _`flux`_ property with an inline Flux script - - _`scriptID`_ property with an [invokable script](#tag/Invokable-Scripts) ID #### InfluxDB Cloud - - Requires either _`flux`_ (Flux query) or _`scriptID`_ (invokable script ID) in the task. + - You can use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. #### Related guides @@ -317,6 +404,11 @@ type TasksApi interface { * Schedules a task run to start immediately, ignoring scheduled runs. Use this endpoint to manually start a task run. + Scheduled runs will continue to run as scheduled. + This may result in concurrently running tasks. + + To _retry_ a previous run (and avoid creating a new run), + use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID @@ -339,12 +431,22 @@ type TasksApi interface { PostTasksIDRunsExecuteWithHttpInfo(r ApiPostTasksIDRunsRequest) (Run, *_nethttp.Response, error) /* - * PostTasksIDRunsIDRetry Retry a task run - * @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. - * @return ApiPostTasksIDRunsIDRetryRequest - */ + * PostTasksIDRunsIDRetry Retry a task run + * Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to + retry and returns the scheduled run. + + To manually start a _new_ task run, use the + [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). + + #### Limitations + + - The task must be _active_ (`status: "active"`). + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to retry. + * @param runID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the [`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns) to list task runs. + * @return ApiPostTasksIDRunsIDRetryRequest + */ PostTasksIDRunsIDRetry(ctx _context.Context, taskID string, runID string) ApiPostTasksIDRunsIDRetryRequest /* @@ -398,7 +500,7 @@ func (r ApiDeleteTasksIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, erro /* * DeleteTasksID Delete a task - * Deletes a task and associated records. + * Deletes a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and associated records. Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. @@ -406,7 +508,7 @@ Once the task is deleted, InfluxDB cancels all scheduled runs of the task. If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param taskID The ID of the task to delete. + * @param taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to delete. * @return ApiDeleteTasksIDRequest */ func (a *TasksApiService) DeleteTasksID(ctx _context.Context, taskID string) ApiDeleteTasksIDRequest { @@ -500,6 +602,17 @@ func (a *TasksApiService) DeleteTasksIDExecuteWithHttpInfo(r ApiDeleteTasksIDReq } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 { @@ -562,10 +675,10 @@ Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud - - Doesn't support this operation. +- 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 taskID The ID of the task to cancel. * @param runID The ID of the task run to cancel. * @return ApiDeleteTasksIDRunsIDRequest */ @@ -662,6 +775,17 @@ func (a *TasksApiService) DeleteTasksIDRunsIDExecuteWithHttpInfo(r ApiDeleteTask } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 == 405 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -810,7 +934,7 @@ func (r ApiGetTasksRequest) ExecuteWithHttpInfo() (Tasks, *_nethttp.Response, er /* * GetTasks List all tasks - * Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/). + * Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. @@ -944,18 +1068,7 @@ func (a *TasksApiService) GetTasksExecuteWithHttpInfo(r ApiGetTasksRequest) (Tas newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status 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 localVarReturnValue, localVarHTTPResponse, newErr - } - v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) - newErr.model = &v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v Error + var v UnauthorizedRequestError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) @@ -1031,13 +1144,12 @@ func (r ApiGetTasksIDRequest) ExecuteWithHttpInfo() (Task, *_nethttp.Response, e /* * GetTasksID Retrieve a task - * Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) -by ID. + * Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param taskID The ID of the task to retrieve. + * @param taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to retrieve. * @return ApiGetTasksIDRequest -*/ + */ func (a *TasksApiService) GetTasksID(ctx _context.Context, taskID string) ApiGetTasksIDRequest { return ApiGetTasksIDRequest{ ApiService: a, @@ -1132,8 +1244,8 @@ func (a *TasksApiService) GetTasksIDExecuteWithHttpInfo(r ApiGetTasksIDRequest) } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status - if localVarHTTPResponse.StatusCode == 400 { - var v Error + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) @@ -1315,6 +1427,17 @@ func (a *TasksApiService) GetTasksIDLogsExecuteWithHttpInfo(r ApiGetTasksIDLogsR } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1532,6 +1655,17 @@ func (a *TasksApiService) GetTasksIDRunsExecuteWithHttpInfo(r ApiGetTasksIDRunsR } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1612,8 +1746,8 @@ func (r ApiGetTasksIDRunsIDRequest) ExecuteWithHttpInfo() (Run, *_nethttp.Respon Use this endpoint to retrieve detail and logs for a specific task run. * @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. + * @param taskID The ID of the task to retrieve runs for. + * @param runID The ID of the run to retrieve. * @return ApiGetTasksIDRunsIDRequest */ func (a *TasksApiService) GetTasksIDRunsID(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDRequest { @@ -1712,6 +1846,17 @@ func (a *TasksApiService) GetTasksIDRunsIDExecuteWithHttpInfo(r ApiGetTasksIDRun } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1787,11 +1932,16 @@ func (r ApiGetTasksIDRunsIDLogsRequest) ExecuteWithHttpInfo() (Logs, *_nethttp.R /* * GetTasksIDRunsIDLogs Retrieve all logs for a run + * Retrieves all logs for a task run. +A log is a list of run events with `runID`, `time`, and `message` properties. + +Use this endpoint to help analyze task performance and troubleshoot failed task runs. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID The ID of the task to get logs for. * @param runID The ID of the run to get logs for. * @return ApiGetTasksIDRunsIDLogsRequest - */ +*/ func (a *TasksApiService) GetTasksIDRunsIDLogs(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDLogsRequest { return ApiGetTasksIDRunsIDLogsRequest{ ApiService: a, @@ -1888,6 +2038,17 @@ func (a *TasksApiService) GetTasksIDRunsIDLogsExecuteWithHttpInfo(r ApiGetTasksI } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1963,17 +2124,63 @@ func (r ApiPatchTasksIDRequest) ExecuteWithHttpInfo() (Task, *_nethttp.Response, /* * PatchTasksID Update a task - * Updates a task and then cancels all scheduled runs of the task. + * Updates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), +and then cancels all scheduled runs of the task. -Use this endpoint to modify task properties (for example: `cron`, `name`, `flux`, `status`). +Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. +#### InfluxDB Cloud + +- Use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + +#### Limitations: + +- You can't use `flux` and `scriptID` for the same 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 taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to update. * @return ApiPatchTasksIDRequest */ func (a *TasksApiService) PatchTasksID(ctx _context.Context, taskID string) ApiPatchTasksIDRequest { @@ -2075,6 +2282,17 @@ func (a *TasksApiService) PatchTasksIDExecuteWithHttpInfo(r ApiPatchTasksIDReque } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2141,17 +2359,54 @@ func (r ApiPostTasksRequest) ExecuteWithHttpInfo() (Task, *_nethttp.Response, er /* * PostTasks Create a task - * Creates a [task]({{% INFLUXDB_DOCS_URL %}}/process-data/) and returns the created task. + * Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. Use this endpoint to create a scheduled task that runs a Flux script. -In your task, provide one of the following: - - - _`flux`_ property with an inline Flux script - - _`scriptID`_ property with an [invokable script](#tag/Invokable-Scripts) ID #### InfluxDB Cloud - - Requires either _`flux`_ (Flux query) or _`scriptID`_ (invokable script ID) in the task. +- You can use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + +#### Limitations: + +- You can't use `flux` and `scriptID` for the same task. #### Related guides @@ -2271,6 +2526,17 @@ func (a *TasksApiService) PostTasksExecuteWithHttpInfo(r ApiPostTasksRequest) (T newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2349,6 +2615,11 @@ func (r ApiPostTasksIDRunsRequest) ExecuteWithHttpInfo() (Run, *_nethttp.Respons * Schedules a task run to start immediately, ignoring scheduled runs. Use this endpoint to manually start a task run. +Scheduled runs will continue to run as scheduled. +This may result in concurrently running tasks. + +To _retry_ a previous run (and avoid creating a new run), +use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param taskID @@ -2450,6 +2721,17 @@ func (a *TasksApiService) PostTasksIDRunsExecuteWithHttpInfo(r ApiPostTasksIDRun } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2534,11 +2816,21 @@ func (r ApiPostTasksIDRunsIDRetryRequest) ExecuteWithHttpInfo() (Run, *_nethttp. /* * PostTasksIDRunsIDRetry Retry a task run + * Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to +retry and returns the scheduled run. + +To manually start a _new_ task run, use the +[`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). + +#### Limitations + +- The task must be _active_ (`status: "active"`). + * @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. + * @param taskID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to retry. + * @param runID A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the [`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns) to list task runs. * @return ApiPostTasksIDRunsIDRetryRequest - */ +*/ func (a *TasksApiService) PostTasksIDRunsIDRetry(ctx _context.Context, taskID string, runID string) ApiPostTasksIDRunsIDRetryRequest { return ApiPostTasksIDRunsIDRetryRequest{ ApiService: a, @@ -2637,6 +2929,28 @@ func (a *TasksApiService) PostTasksIDRunsIDRetryExecuteWithHttpInfo(r ApiPostTas } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_users.gen.go b/api/api_users.gen.go index c36fe6ba..0d72c970 100644 --- a/api/api_users.gen.go +++ b/api/api_users.gen.go @@ -27,11 +27,25 @@ var ( type UsersApi interface { /* - * DeleteUsersID Delete a user - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the user to delete. - * @return ApiDeleteUsersIDRequest - */ + * DeleteUsersID Delete a user + * Deletes a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + + #### Required permissions + + | Action | Permission required | + |:------------|:-----------------------------------------------| + | Delete a user | `write-users` or `write-user USER_ID` | + + *`USER_ID`* is the ID of the user that you want to delete. + + #### Related guides + + - [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID A user ID. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) to delete. + * @return ApiDeleteUsersIDRequest + */ DeleteUsersID(ctx _context.Context, userID string) ApiDeleteUsersIDRequest /* @@ -47,10 +61,24 @@ type UsersApi interface { DeleteUsersIDExecuteWithHttpInfo(r ApiDeleteUsersIDRequest) (*_nethttp.Response, error) /* - * GetUsers List all users - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetUsersRequest - */ + * GetUsers List users + * Retrieves a list of [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + Default limit is `20`. + + To limit which users are returned, pass query parameters in your request. + + #### Required permissions for InfluxDB OSS + + | Action | Permission required | Restriction | + |:-------|:--------------------|:------------| + | List all users | _[Operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_ | | + | List a specific user | `read-users` or `read-user USER_ID` | | + + *`USER_ID`* is the ID of the user that you want to retrieve. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetUsersRequest + */ GetUsers(ctx _context.Context) ApiGetUsersRequest /* @@ -68,11 +96,17 @@ type UsersApi interface { GetUsersExecuteWithHttpInfo(r ApiGetUsersRequest) (Users, *_nethttp.Response, error) /* - * GetUsersID Retrieve a user - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The user ID. - * @return ApiGetUsersIDRequest - */ + * GetUsersID Retrieve a user + * Retrieves a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + + #### Related guides + + - [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID A user ID. Retrieves the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + * @return ApiGetUsersIDRequest + */ GetUsersID(ctx _context.Context, userID string) ApiGetUsersIDRequest /* @@ -90,11 +124,25 @@ type UsersApi interface { GetUsersIDExecuteWithHttpInfo(r ApiGetUsersIDRequest) (UserResponse, *_nethttp.Response, error) /* - * PatchUsersID Update a user - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the user to update. - * @return ApiPatchUsersIDRequest - */ + * PatchUsersID Update a user + * Updates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) and returns the user. + + #### Required permissions + + | Action | Permission required | + |:------------|:-----------------------------------------------| + | Update a user | `write-users` or `write-user USER_ID` | + + *`USER_ID`* is the ID of the user that you want to update. + + #### Related guides + + - [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID A user ID. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) to update. + * @return ApiPatchUsersIDRequest + */ PatchUsersID(ctx _context.Context, userID string) ApiPatchUsersIDRequest /* @@ -112,10 +160,39 @@ type UsersApi interface { PatchUsersIDExecuteWithHttpInfo(r ApiPatchUsersIDRequest) (UserResponse, *_nethttp.Response, error) /* - * PostUsers Create a user - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostUsersRequest - */ + * PostUsers Create a user + * Creates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that can access InfluxDB. + Returns the user. + + Use this endpoint to create a user that can sign in to start a user session + through one of the following interfaces: + + - InfluxDB UI + - `/api/v2/signin` InfluxDB API endpoint + - InfluxDB CLI + + This endpoint represents the first two steps in a four-step process to allow a user + to authenticate with a username and password, and then access data in an organization: + + 1. Create a user: send a `POST` request to `POST /api/v2/users`. `name` is required. + 2. Extract the user ID (`id`) value from the API response for _step 1_. + 3. Create an authorization (and API token) for the user: send a `POST` request to [`POST /api/v2/authorizations`](#operation/PostAuthorizations), passing the user ID (`id`) from _step 2_. + 4. Create a password for the user: send a `POST` request to [`POST /api/v2/users/USER_ID/password`](#operation/PostUsersIDPassword), passing the user ID from _step 2_. + + #### Required permissions + + | Action | Permission required | Restriction | + |:-------|:--------------------|:------------| + | Create a user | _[Operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_ | | + + #### Related guides + + - [Create a user](https://docs.influxdata.com/influxdb/latest/users/create-user/) + - [Create an API token scoped to a user](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostUsersRequest + */ PostUsers(ctx _context.Context) ApiPostUsersRequest /* @@ -134,13 +211,20 @@ type UsersApi interface { /* * PostUsersIDPassword Update a password - * #### InfluxDB Cloud + * Updates a user password. + + #### InfluxDB Cloud + + - Doesn't allow you to manage user passwords through the API. + Use the InfluxDB Cloud user interface (UI) to update a password. + + #### Related guides - InfluxDB Cloud does not support changing user passwords through the API. - Use the InfluxDB Cloud user interface to update your password. + - [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) + - [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/latest/users/change-password/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The user ID. + * @param userID The ID of the user to set the password for. * @return ApiPostUsersIDPasswordRequest */ PostUsersIDPassword(ctx _context.Context, userID string) ApiPostUsersIDPasswordRequest @@ -156,6 +240,42 @@ type UsersApi interface { * content should be achieved through the returned response model if applicable. */ PostUsersIDPasswordExecuteWithHttpInfo(r ApiPostUsersIDPasswordRequest) (*_nethttp.Response, error) + + /* + * PutUsersIDPassword Update a password + * Updates a user password. + + Use this endpoint to let a user authenticate with + [Basic authentication credentials](#section/Authentication/BasicAuthentication) + and set a new password. + + #### InfluxDB Cloud + + - Doesn't allow you to manage user passwords through the API. + Use the InfluxDB Cloud user interface (UI) to update a password. + + #### Related guides + + - [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) + - [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/latest/users/change-password/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID The ID of the user to set the password for. + * @return ApiPutUsersIDPasswordRequest + */ + PutUsersIDPassword(ctx _context.Context, userID string) ApiPutUsersIDPasswordRequest + + /* + * PutUsersIDPasswordExecute executes the request + */ + PutUsersIDPasswordExecute(r ApiPutUsersIDPasswordRequest) error + + /* + * PutUsersIDPasswordExecuteWithHttpInfo 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. + */ + PutUsersIDPasswordExecuteWithHttpInfo(r ApiPutUsersIDPasswordRequest) (*_nethttp.Response, error) } // UsersApiService UsersApi service @@ -194,10 +314,24 @@ func (r ApiDeleteUsersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, erro /* * DeleteUsersID Delete a user + * Deletes a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + +#### Required permissions + +| Action | Permission required | +|:------------|:-----------------------------------------------| +| Delete a user | `write-users` or `write-user USER_ID` | + +*`USER_ID`* is the ID of the user that you want to delete. + +#### Related guides + +- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the user to delete. + * @param userID A user ID. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) to delete. * @return ApiDeleteUsersIDRequest - */ +*/ func (a *UsersApiService) DeleteUsersID(ctx _context.Context, userID string) ApiDeleteUsersIDRequest { return ApiDeleteUsersIDRequest{ ApiService: a, @@ -289,6 +423,28 @@ func (a *UsersApiService) DeleteUsersIDExecuteWithHttpInfo(r ApiDeleteUsersIDReq } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 == 401 { + var v UnauthorizedRequestError + 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 { @@ -371,10 +527,24 @@ func (r ApiGetUsersRequest) ExecuteWithHttpInfo() (Users, *_nethttp.Response, er } /* - * GetUsers List all users + * GetUsers List users + * Retrieves a list of [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). +Default limit is `20`. + +To limit which users are returned, pass query parameters in your request. + +#### Required permissions for InfluxDB OSS + +| Action | Permission required | Restriction | +|:-------|:--------------------|:------------| +| List all users | _[Operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_ | | +| List a specific user | `read-users` or `read-user USER_ID` | | + +*`USER_ID`* is the ID of the user that you want to retrieve. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetUsersRequest - */ +*/ func (a *UsersApiService) GetUsers(ctx _context.Context) ApiGetUsersRequest { return ApiGetUsersRequest{ ApiService: a, @@ -482,6 +652,28 @@ func (a *UsersApiService) GetUsersExecuteWithHttpInfo(r ApiGetUsersRequest) (Use } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -548,10 +740,16 @@ func (r ApiGetUsersIDRequest) ExecuteWithHttpInfo() (UserResponse, *_nethttp.Res /* * GetUsersID Retrieve a user + * Retrieves a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + +#### Related guides + +- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The user ID. + * @param userID A user ID. Retrieves the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). * @return ApiGetUsersIDRequest - */ +*/ func (a *UsersApiService) GetUsersID(ctx _context.Context, userID string) ApiGetUsersIDRequest { return ApiGetUsersIDRequest{ ApiService: a, @@ -721,10 +919,24 @@ func (r ApiPatchUsersIDRequest) ExecuteWithHttpInfo() (UserResponse, *_nethttp.R /* * PatchUsersID Update a user + * Updates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) and returns the user. + +#### Required permissions + +| Action | Permission required | +|:------------|:-----------------------------------------------| +| Update a user | `write-users` or `write-user USER_ID` | + +*`USER_ID`* is the ID of the user that you want to update. + +#### Related guides + +- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The ID of the user to update. + * @param userID A user ID. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) to update. * @return ApiPatchUsersIDRequest - */ +*/ func (a *UsersApiService) PatchUsersID(ctx _context.Context, userID string) ApiPatchUsersIDRequest { return ApiPatchUsersIDRequest{ ApiService: a, @@ -824,6 +1036,17 @@ func (a *UsersApiService) PatchUsersIDExecuteWithHttpInfo(r ApiPatchUsersIDReque } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -890,9 +1113,38 @@ func (r ApiPostUsersRequest) ExecuteWithHttpInfo() (UserResponse, *_nethttp.Resp /* * PostUsers Create a user + * Creates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that can access InfluxDB. +Returns the user. + +Use this endpoint to create a user that can sign in to start a user session +through one of the following interfaces: + + - InfluxDB UI + - `/api/v2/signin` InfluxDB API endpoint + - InfluxDB CLI + +This endpoint represents the first two steps in a four-step process to allow a user +to authenticate with a username and password, and then access data in an organization: + + 1. Create a user: send a `POST` request to `POST /api/v2/users`. `name` is required. + 2. Extract the user ID (`id`) value from the API response for _step 1_. + 3. Create an authorization (and API token) for the user: send a `POST` request to [`POST /api/v2/authorizations`](#operation/PostAuthorizations), passing the user ID (`id`) from _step 2_. + 4. Create a password for the user: send a `POST` request to [`POST /api/v2/users/USER_ID/password`](#operation/PostUsersIDPassword), passing the user ID from _step 2_. + +#### Required permissions + +| Action | Permission required | Restriction | +|:-------|:--------------------|:------------| +| Create a user | _[Operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_ | | + +#### Related guides + +- [Create a user](https://docs.influxdata.com/influxdb/latest/users/create-user/) +- [Create an API token scoped to a user](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostUsersRequest - */ +*/ func (a *UsersApiService) PostUsers(ctx _context.Context) ApiPostUsersRequest { return ApiPostUsersRequest{ ApiService: a, @@ -990,6 +1242,28 @@ func (a *UsersApiService) PostUsersExecuteWithHttpInfo(r ApiPostUsersRequest) (U } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + 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 localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + 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 + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1065,13 +1339,20 @@ func (r ApiPostUsersIDPasswordRequest) ExecuteWithHttpInfo() (*_nethttp.Response /* * PostUsersIDPassword Update a password - * #### InfluxDB Cloud + * Updates a user password. + +#### InfluxDB Cloud + +- Doesn't allow you to manage user passwords through the API. + Use the InfluxDB Cloud user interface (UI) to update a password. + +#### Related guides -InfluxDB Cloud does not support changing user passwords through the API. -Use the InfluxDB Cloud user interface to update your password. +- [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) +- [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/latest/users/change-password/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param userID The user ID. + * @param userID The ID of the user to set the password for. * @return ApiPostUsersIDPasswordRequest */ func (a *UsersApiService) PostUsersIDPassword(ctx _context.Context, userID string) ApiPostUsersIDPasswordRequest { @@ -1170,6 +1451,200 @@ func (a *UsersApiService) PostUsersIDPasswordExecuteWithHttpInfo(r ApiPostUsersI } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + 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 { + 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 +} + +type ApiPutUsersIDPasswordRequest struct { + ctx _context.Context + ApiService UsersApi + userID string + passwordResetBody *PasswordResetBody + zapTraceSpan *string +} + +func (r ApiPutUsersIDPasswordRequest) UserID(userID string) ApiPutUsersIDPasswordRequest { + r.userID = userID + return r +} +func (r ApiPutUsersIDPasswordRequest) GetUserID() string { + return r.userID +} + +func (r ApiPutUsersIDPasswordRequest) PasswordResetBody(passwordResetBody PasswordResetBody) ApiPutUsersIDPasswordRequest { + r.passwordResetBody = &passwordResetBody + return r +} +func (r ApiPutUsersIDPasswordRequest) GetPasswordResetBody() *PasswordResetBody { + return r.passwordResetBody +} + +func (r ApiPutUsersIDPasswordRequest) ZapTraceSpan(zapTraceSpan string) ApiPutUsersIDPasswordRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPutUsersIDPasswordRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPutUsersIDPasswordRequest) Execute() error { + return r.ApiService.PutUsersIDPasswordExecute(r) +} + +func (r ApiPutUsersIDPasswordRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) { + return r.ApiService.PutUsersIDPasswordExecuteWithHttpInfo(r) +} + +/* + * PutUsersIDPassword Update a password + * Updates a user password. + +Use this endpoint to let a user authenticate with +[Basic authentication credentials](#section/Authentication/BasicAuthentication) +and set a new password. + +#### InfluxDB Cloud + +- Doesn't allow you to manage user passwords through the API. + Use the InfluxDB Cloud user interface (UI) to update a password. + +#### Related guides + +- [InfluxDB Cloud - Change your password](https://docs.influxdata.com/influxdb/cloud/account-management/change-password/) +- [InfluxDB OSS - Change your password](https://docs.influxdata.com/influxdb/latest/users/change-password/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userID The ID of the user to set the password for. + * @return ApiPutUsersIDPasswordRequest +*/ +func (a *UsersApiService) PutUsersIDPassword(ctx _context.Context, userID string) ApiPutUsersIDPasswordRequest { + return ApiPutUsersIDPasswordRequest{ + ApiService: a, + ctx: ctx, + userID: userID, + } +} + +/* + * Execute executes the request + */ +func (a *UsersApiService) PutUsersIDPasswordExecute(r ApiPutUsersIDPasswordRequest) error { + _, err := a.PutUsersIDPasswordExecuteWithHttpInfo(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 *UsersApiService) PutUsersIDPasswordExecuteWithHttpInfo(r ApiPutUsersIDPasswordRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.PutUsersIDPassword") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/users/{userID}/password" + localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.passwordResetBody == nil { + return nil, reportError("passwordResetBody is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.zapTraceSpan != nil { + localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "") + } + // body params + localVarPostBody = r.passwordResetBody + 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 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_write.gen.go b/api/api_write.gen.go index e32ab8dc..1f80861f 100644 --- a/api/api_write.gen.go +++ b/api/api_write.gen.go @@ -33,31 +33,29 @@ type WriteApi interface { #### InfluxDB Cloud - - Takes the following steps when you send a write request: + - Does the following 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. + 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise. + 3. Handles the delete 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. + wait for a success response (HTTP `2xx` status code) before you send the next request. - Because writes are asynchronous, data might not yet be written + Because writes and deletes are asynchronous, your change might not yet be readable 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. + - Validates the request and handles the write synchronously. + - If all points were written successfully, responds with HTTP `2xx` status code; + 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. + *`BUCKET_ID`* is the ID of the destination bucket. #### Rate limits (with InfluxDB Cloud) @@ -66,8 +64,8 @@ type WriteApi interface { #### Related guides - - [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/). + - [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/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -202,31 +200,29 @@ Use this endpoint to send data in [line protocol]({{% INFLUXDB_DOCS_URL %}}/refe #### InfluxDB Cloud -- Takes the following steps when you send a write request: +- Does the following 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. + 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise. + 3. Handles the delete 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. + wait for a success response (HTTP `2xx` status code) before you send the next request. - Because writes are asynchronous, data might not yet be written + Because writes and deletes are asynchronous, your change might not yet be readable 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. +- Validates the request and handles the write synchronously. +- If all points were written successfully, responds with HTTP `2xx` status code; + 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. + *`BUCKET_ID`* is the ID of the destination bucket. #### Rate limits (with InfluxDB Cloud) @@ -235,8 +231,8 @@ For more information, see [limits and adjustable quotas](https://docs.influxdata #### Related guides -- [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/). +- [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/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -373,8 +369,8 @@ func (a *WriteApiService) PostWriteExecuteWithHttpInfo(r ApiPostWriteRequest) (* newErr.model = &v return localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v Error + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) diff --git a/api/contract/cli-extras.yml b/api/contract/cli-extras.yml index 007d2a67..d0957e11 100644 --- a/api/contract/cli-extras.yml +++ b/api/contract/cli-extras.yml @@ -7,7 +7,7 @@ paths: {} components: schemas: ResourceEnumOSS: - $ref: "./openapi/src/common/schemas/Resource.yml#/properties/type" + $ref: "./openapi/src/oss/schemas/Resource.yml#/properties/type" ResourceEnumCloud: $ref: "./openapi/src/cloud/schemas/Resource.yml#/properties/type" diff --git a/api/contract/cli.yml b/api/contract/cli.yml index 7e1019bd..f1092062 100644 --- a/api/contract/cli.yml +++ b/api/contract/cli.yml @@ -146,6 +146,8 @@ components: responses: ServerError: $ref: "./openapi/src/common/responses/ServerError.yml" + AuthorizationError: + $ref: "./openapi/src/common/responses/AuthorizationError.yml" schemas: Error: $ref: "./openapi/src/common/schemas/Error.yml" @@ -486,4 +488,6 @@ components: ScriptHTTPResponseData: $ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptHTTPResponseData.yml" ScriptLanguage: - $ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptLanguage.yml" \ No newline at end of file + $ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptLanguage.yml" + UnauthorizedRequestError: + $ref: "./openapi/src/common/schemas/UnauthorizedRequestError.yml" \ No newline at end of file diff --git a/api/contract/openapi b/api/contract/openapi index dbb87002..aa6a5a48 160000 --- a/api/contract/openapi +++ b/api/contract/openapi @@ -1 +1 @@ -Subproject commit dbb87002dfc346133d95af9776b84d6669044e7b +Subproject commit aa6a5a48509ffeb49d61593b5a6e70bf6e888b4f diff --git a/api/extras/model_resource_enum_cloud.gen.go b/api/extras/model_resource_enum_cloud.gen.go index dc8aca46..5517c393 100644 --- a/api/extras/model_resource_enum_cloud.gen.go +++ b/api/extras/model_resource_enum_cloud.gen.go @@ -15,7 +15,7 @@ import ( "fmt" ) -// ResourceEnumCloud the model 'ResourceEnumCloud' +// ResourceEnumCloud The type of resource. In a `permission`, applies the permission to all resources of this type. type ResourceEnumCloud string // List of ResourceEnumCloud @@ -36,13 +36,14 @@ const ( RESOURCEENUMCLOUD_NOTIFICATION_ENDPOINTS ResourceEnumCloud = "notificationEndpoints" RESOURCEENUMCLOUD_CHECKS ResourceEnumCloud = "checks" RESOURCEENUMCLOUD_DBRP ResourceEnumCloud = "dbrp" - RESOURCEENUMCLOUD_FLOWS ResourceEnumCloud = "flows" RESOURCEENUMCLOUD_ANNOTATIONS ResourceEnumCloud = "annotations" + RESOURCEENUMCLOUD_FLOWS ResourceEnumCloud = "flows" RESOURCEENUMCLOUD_FUNCTIONS ResourceEnumCloud = "functions" + RESOURCEENUMCLOUD_SUBSCRIPTIONS ResourceEnumCloud = "subscriptions" ) func ResourceEnumCloudValues() []ResourceEnumCloud { - return []ResourceEnumCloud{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "flows", "annotations", "functions"} + return []ResourceEnumCloud{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "annotations", "flows", "functions", "subscriptions"} } func (v *ResourceEnumCloud) UnmarshalJSON(src []byte) error { @@ -52,7 +53,7 @@ func (v *ResourceEnumCloud) UnmarshalJSON(src []byte) error { return err } enumTypeValue := ResourceEnumCloud(value) - for _, existing := range []ResourceEnumCloud{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "flows", "annotations", "functions"} { + for _, existing := range []ResourceEnumCloud{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "annotations", "flows", "functions", "subscriptions"} { if existing == enumTypeValue { *v = enumTypeValue return nil diff --git a/api/extras/model_resource_enum_oss.gen.go b/api/extras/model_resource_enum_oss.gen.go index 86b06c8c..b786a11d 100644 --- a/api/extras/model_resource_enum_oss.gen.go +++ b/api/extras/model_resource_enum_oss.gen.go @@ -15,7 +15,7 @@ import ( "fmt" ) -// ResourceEnumOSS the model 'ResourceEnumOSS' +// ResourceEnumOSS The type of resource. In a `permission`, applies the permission to all resources of this type. type ResourceEnumOSS string // List of ResourceEnumOSS @@ -24,12 +24,10 @@ const ( RESOURCEENUMOSS_BUCKETS ResourceEnumOSS = "buckets" RESOURCEENUMOSS_DASHBOARDS ResourceEnumOSS = "dashboards" RESOURCEENUMOSS_ORGS ResourceEnumOSS = "orgs" - RESOURCEENUMOSS_SOURCES ResourceEnumOSS = "sources" RESOURCEENUMOSS_TASKS ResourceEnumOSS = "tasks" RESOURCEENUMOSS_TELEGRAFS ResourceEnumOSS = "telegrafs" RESOURCEENUMOSS_USERS ResourceEnumOSS = "users" RESOURCEENUMOSS_VARIABLES ResourceEnumOSS = "variables" - RESOURCEENUMOSS_SCRAPERS ResourceEnumOSS = "scrapers" RESOURCEENUMOSS_SECRETS ResourceEnumOSS = "secrets" RESOURCEENUMOSS_LABELS ResourceEnumOSS = "labels" RESOURCEENUMOSS_VIEWS ResourceEnumOSS = "views" @@ -38,15 +36,17 @@ const ( RESOURCEENUMOSS_NOTIFICATION_ENDPOINTS ResourceEnumOSS = "notificationEndpoints" RESOURCEENUMOSS_CHECKS ResourceEnumOSS = "checks" RESOURCEENUMOSS_DBRP ResourceEnumOSS = "dbrp" - RESOURCEENUMOSS_NOTEBOOKS ResourceEnumOSS = "notebooks" RESOURCEENUMOSS_ANNOTATIONS ResourceEnumOSS = "annotations" + RESOURCEENUMOSS_SOURCES ResourceEnumOSS = "sources" + RESOURCEENUMOSS_SCRAPERS ResourceEnumOSS = "scrapers" + RESOURCEENUMOSS_NOTEBOOKS ResourceEnumOSS = "notebooks" RESOURCEENUMOSS_REMOTES ResourceEnumOSS = "remotes" RESOURCEENUMOSS_REPLICATIONS ResourceEnumOSS = "replications" RESOURCEENUMOSS_INSTANCE ResourceEnumOSS = "instance" ) func ResourceEnumOSSValues() []ResourceEnumOSS { - return []ResourceEnumOSS{"authorizations", "buckets", "dashboards", "orgs", "sources", "tasks", "telegrafs", "users", "variables", "scrapers", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "notebooks", "annotations", "remotes", "replications", "instance"} + return []ResourceEnumOSS{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "annotations", "sources", "scrapers", "notebooks", "remotes", "replications", "instance"} } func (v *ResourceEnumOSS) UnmarshalJSON(src []byte) error { @@ -56,7 +56,7 @@ func (v *ResourceEnumOSS) UnmarshalJSON(src []byte) error { return err } enumTypeValue := ResourceEnumOSS(value) - for _, existing := range []ResourceEnumOSS{"authorizations", "buckets", "dashboards", "orgs", "sources", "tasks", "telegrafs", "users", "variables", "scrapers", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "notebooks", "annotations", "remotes", "replications", "instance"} { + for _, existing := range []ResourceEnumOSS{"authorizations", "buckets", "dashboards", "orgs", "tasks", "telegrafs", "users", "variables", "secrets", "labels", "views", "documents", "notificationRules", "notificationEndpoints", "checks", "dbrp", "annotations", "sources", "scrapers", "notebooks", "remotes", "replications", "instance"} { if existing == enumTypeValue { *v = enumTypeValue return nil diff --git a/api/model_authorization.gen.go b/api/model_authorization.gen.go index f296356b..c499aa67 100644 --- a/api/model_authorization.gen.go +++ b/api/model_authorization.gen.go @@ -23,18 +23,19 @@ type Authorization struct { Description *string `json:"description,omitempty" yaml:"description,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` - // ID of the organization that the authorization is scoped to. + // The organization ID. Specifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that the authorization is scoped to. OrgID string `json:"orgID" yaml:"orgID"` - // List of permissions for an authorization. An authorization must have at least one permission. + // The list of permissions. An authorization must have at least one permission. Permissions []Permission `json:"permissions" yaml:"permissions"` - Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // Token used to authenticate API requests. + // The authorization ID. + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The API token. The token value is unique to the authorization. [API tokens]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) are used to authenticate and authorize InfluxDB API requests and `influx` CLI commands--after receiving the request, InfluxDB checks that the token is valid and that the `permissions` allow the requested action(s). Token *string `json:"token,omitempty" yaml:"token,omitempty"` - // ID of the user that created and owns the token. + // The user ID. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the authorization. If _scoped_, the user that the authorization is scoped to; otherwise, the creator of the authorization. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // Name of the user that created and owns the token. + // The user name. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the authorization. If the authorization is _scoped_ to a user, the user; otherwise, the creator of the authorization. User *string `json:"user,omitempty" yaml:"user,omitempty"` - // Name of the organization that the token is scoped to. + // The organization name. Specifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that the token is scoped to. Org *string `json:"org,omitempty" yaml:"org,omitempty"` Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"` } diff --git a/api/model_authorization_all_of.gen.go b/api/model_authorization_all_of.gen.go index c8416cc4..7db64182 100644 --- a/api/model_authorization_all_of.gen.go +++ b/api/model_authorization_all_of.gen.go @@ -19,18 +19,19 @@ import ( type AuthorizationAllOf struct { CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` - // ID of the organization that the authorization is scoped to. + // The organization ID. Specifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that the authorization is scoped to. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // List of permissions for an authorization. An authorization must have at least one permission. + // The list of permissions. An authorization must have at least one permission. Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` - Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // Token used to authenticate API requests. + // The authorization ID. + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The API token. The token value is unique to the authorization. [API tokens]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) are used to authenticate and authorize InfluxDB API requests and `influx` CLI commands--after receiving the request, InfluxDB checks that the token is valid and that the `permissions` allow the requested action(s). Token *string `json:"token,omitempty" yaml:"token,omitempty"` - // ID of the user that created and owns the token. + // The user ID. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the authorization. If _scoped_, the user that the authorization is scoped to; otherwise, the creator of the authorization. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // Name of the user that created and owns the token. + // The user name. Specifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the authorization. If the authorization is _scoped_ to a user, the user; otherwise, the creator of the authorization. User *string `json:"user,omitempty" yaml:"user,omitempty"` - // Name of the organization that the token is scoped to. + // The organization name. Specifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that the token is scoped to. Org *string `json:"org,omitempty" yaml:"org,omitempty"` Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"` } diff --git a/api/model_authorization_post_request.gen.go b/api/model_authorization_post_request.gen.go index e264f177..96a4375e 100644 --- a/api/model_authorization_post_request.gen.go +++ b/api/model_authorization_post_request.gen.go @@ -20,11 +20,11 @@ type AuthorizationPostRequest struct { Status *string `json:"status,omitempty" yaml:"status,omitempty"` // A description of the token. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // ID of org that authorization is scoped to. + // The ID of the organization that owns the authorization. OrgID string `json:"orgID" yaml:"orgID"` - // ID of user that authorization is scoped to. + // The ID of the user that the authorization is scoped to. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // List of permissions for an auth. An auth must have at least one Permission. + // A list of permissions for an authorization. An authorization must have at least one permission. Permissions []Permission `json:"permissions" yaml:"permissions"` } diff --git a/api/model_authorization_post_request_all_of.gen.go b/api/model_authorization_post_request_all_of.gen.go index 91e1394c..6e108120 100644 --- a/api/model_authorization_post_request_all_of.gen.go +++ b/api/model_authorization_post_request_all_of.gen.go @@ -16,11 +16,11 @@ import ( // AuthorizationPostRequestAllOf struct for AuthorizationPostRequestAllOf type AuthorizationPostRequestAllOf struct { - // ID of org that authorization is scoped to. + // The ID of the organization that owns the authorization. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // ID of user that authorization is scoped to. + // The ID of the user that the authorization is scoped to. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // List of permissions for an auth. An auth must have at least one Permission. + // A list of permissions for an authorization. An authorization must have at least one permission. Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` } diff --git a/api/model_bucket.gen.go b/api/model_bucket.gen.go index 76442887..72be8da5 100644 --- a/api/model_bucket.gen.go +++ b/api/model_bucket.gen.go @@ -27,7 +27,7 @@ type Bucket struct { SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` - // Rules to expire or retain data. No rules means data never expires. + // Retention rules to expire or retain data. The InfluxDB `/api/v2` API uses `RetentionRules` to configure the [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period). #### InfluxDB Cloud - `retentionRules` is required. #### InfluxDB OSS - `retentionRules` isn't required. RetentionRules []RetentionRule `json:"retentionRules" yaml:"retentionRules"` Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"` } diff --git a/api/model_dbrp.gen.go b/api/model_dbrp.gen.go index c254913e..47fcf3c1 100644 --- a/api/model_dbrp.gen.go +++ b/api/model_dbrp.gen.go @@ -16,11 +16,11 @@ import ( // DBRP struct for DBRP type DBRP struct { - // ID of the DBRP mapping. + // The ID of the DBRP mapping. Id string `json:"id" yaml:"id"` - // ID of the organization that owns this mapping. + // The ID of the organization. OrgID string `json:"orgID" yaml:"orgID"` - // ID of the bucket used as the target for the translation. + // The ID of the bucket used as the target for the translation. BucketID string `json:"bucketID" yaml:"bucketID"` // InfluxDB v1 database Database string `json:"database" yaml:"database"` diff --git a/api/model_dbrp_create.gen.go b/api/model_dbrp_create.gen.go index 58285b4b..d776a4a9 100644 --- a/api/model_dbrp_create.gen.go +++ b/api/model_dbrp_create.gen.go @@ -16,11 +16,11 @@ import ( // DBRPCreate struct for DBRPCreate type DBRPCreate struct { - // ID of the organization that owns this mapping. + // The ID of the organization. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // Name of the organization that owns this mapping. + // The name of the organization that owns this mapping. Org *string `json:"org,omitempty" yaml:"org,omitempty"` - // ID of the bucket used as the target for the translation. + // The ID of the bucket used as the target for the translation. BucketID string `json:"bucketID" yaml:"bucketID"` // InfluxDB v1 database Database string `json:"database" yaml:"database"` diff --git a/api/model_inline_response_200.gen.go b/api/model_inline_response_200.gen.go index 6b2c1c6b..ecce2cdd 100644 --- a/api/model_inline_response_200.gen.go +++ b/api/model_inline_response_200.gen.go @@ -16,7 +16,7 @@ import ( // InlineResponse200 struct for InlineResponse200 type InlineResponse200 struct { - // True means that the influxdb instance has NOT had initial setup; false means that the database has been setup. + // If `true`, the InfluxDB instance hasn't had initial setup; `false` otherwise. Allowed *bool `json:"allowed,omitempty" yaml:"allowed,omitempty"` } diff --git a/api/model_legacy_authorization_post_request.gen.go b/api/model_legacy_authorization_post_request.gen.go index 68096411..b0110d1e 100644 --- a/api/model_legacy_authorization_post_request.gen.go +++ b/api/model_legacy_authorization_post_request.gen.go @@ -20,13 +20,13 @@ type LegacyAuthorizationPostRequest struct { Status *string `json:"status,omitempty" yaml:"status,omitempty"` // A description of the token. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // ID of org that authorization is scoped to. + // The ID of the organization that the authorization is scoped to. OrgID string `json:"orgID" yaml:"orgID"` - // ID of user that authorization is scoped to. + // The ID of the user that the authorization is scoped to. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // Token (name) of the authorization + // A name that you provide for the authorization. Token *string `json:"token,omitempty" yaml:"token,omitempty"` - // List of permissions for an auth. An auth must have at least one Permission. + // A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. Permissions []Permission `json:"permissions" yaml:"permissions"` } diff --git a/api/model_legacy_authorization_post_request_all_of.gen.go b/api/model_legacy_authorization_post_request_all_of.gen.go index 70663d7c..25d7a566 100644 --- a/api/model_legacy_authorization_post_request_all_of.gen.go +++ b/api/model_legacy_authorization_post_request_all_of.gen.go @@ -16,13 +16,13 @@ import ( // LegacyAuthorizationPostRequestAllOf struct for LegacyAuthorizationPostRequestAllOf type LegacyAuthorizationPostRequestAllOf struct { - // ID of org that authorization is scoped to. + // The ID of the organization that the authorization is scoped to. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // ID of user that authorization is scoped to. + // The ID of the user that the authorization is scoped to. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // Token (name) of the authorization + // A name that you provide for the authorization. Token *string `json:"token,omitempty" yaml:"token,omitempty"` - // List of permissions for an auth. An auth must have at least one Permission. + // A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` } diff --git a/api/model_measurement_schema.gen.go b/api/model_measurement_schema.gen.go index 551f34ff..0cd31fb4 100644 --- a/api/model_measurement_schema.gen.go +++ b/api/model_measurement_schema.gen.go @@ -18,9 +18,9 @@ import ( // MeasurementSchema Definition of a measurement schema. type MeasurementSchema struct { Id string `json:"id" yaml:"id"` - // ID of the organization that the measurement schema is associated with. + // The ID of the organization. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // ID of the bucket that the measurement schema is associated with. + // The ID of the bucket that the measurement schema is associated with. BucketID *string `json:"bucketID,omitempty" yaml:"bucketID,omitempty"` Name string `json:"name" yaml:"name"` // Ordered collection of column definitions. diff --git a/api/model_measurement_schema_create_request.gen.go b/api/model_measurement_schema_create_request.gen.go index 6fecf48e..804db3db 100644 --- a/api/model_measurement_schema_create_request.gen.go +++ b/api/model_measurement_schema_create_request.gen.go @@ -16,6 +16,7 @@ import ( // MeasurementSchemaCreateRequest Create a new measurement schema. type MeasurementSchemaCreateRequest struct { + // The [measurement]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#measurement) name. Name string `json:"name" yaml:"name"` // Ordered collection of column definitions. Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"` diff --git a/api/model_patch_bucket_request.gen.go b/api/model_patch_bucket_request.gen.go index 6c504f67..deb605ee 100644 --- a/api/model_patch_bucket_request.gen.go +++ b/api/model_patch_bucket_request.gen.go @@ -14,9 +14,11 @@ import ( "encoding/json" ) -// PatchBucketRequest Updates to an existing bucket resource. +// PatchBucketRequest An object that contains updated bucket properties to apply. type PatchBucketRequest struct { - Name *string `json:"name,omitempty" yaml:"name,omitempty"` + // The name of the bucket. + Name *string `json:"name,omitempty" yaml:"name,omitempty"` + // A description of the bucket. Description *string `json:"description,omitempty" yaml:"description,omitempty"` // Updates to rules to expire or retain data. No rules means no updates. RetentionRules *[]PatchRetentionRule `json:"retentionRules,omitempty" yaml:"retentionRules,omitempty"` diff --git a/api/model_patch_organization_request.gen.go b/api/model_patch_organization_request.gen.go index 38ca4199..3808c0dc 100644 --- a/api/model_patch_organization_request.gen.go +++ b/api/model_patch_organization_request.gen.go @@ -14,11 +14,11 @@ import ( "encoding/json" ) -// PatchOrganizationRequest struct for PatchOrganizationRequest +// PatchOrganizationRequest An object that contains updated organization properties to apply. type PatchOrganizationRequest struct { - // New name to set on the organization + // The name of the organization. Name *string `json:"name,omitempty" yaml:"name,omitempty"` - // New description to set on the organization + // The description of the organization. Description *string `json:"description,omitempty" yaml:"description,omitempty"` } diff --git a/api/model_patch_retention_rule.gen.go b/api/model_patch_retention_rule.gen.go index 7b465c8c..9732f231 100644 --- a/api/model_patch_retention_rule.gen.go +++ b/api/model_patch_retention_rule.gen.go @@ -14,12 +14,12 @@ import ( "encoding/json" ) -// PatchRetentionRule Updates to a rule to expire or retain data. +// PatchRetentionRule struct for PatchRetentionRule type PatchRetentionRule struct { - Type string `json:"type" yaml:"type"` - // Duration in seconds for how long data will be kept in the database. 0 means infinite. - EverySeconds *int64 `json:"everySeconds,omitempty" yaml:"everySeconds,omitempty"` - // Shard duration measured in seconds. + Type *string `json:"type,omitempty" yaml:"type,omitempty"` + // The number of seconds to keep data. Default duration is `2592000` (30 days). `0` represents infinite retention. + EverySeconds int64 `json:"everySeconds" yaml:"everySeconds"` + // The [shard group duration]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#shard). The number of seconds that each shard group covers. #### InfluxDB Cloud - Doesn't use `shardGroupDurationsSeconds`. #### InfluxDB OSS - Default value depends on the [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration). #### Related guides - InfluxDB [shards and shard groups]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/) ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty" yaml:"shardGroupDurationSeconds,omitempty"` } @@ -27,9 +27,11 @@ type PatchRetentionRule struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewPatchRetentionRule(type_ string) *PatchRetentionRule { +func NewPatchRetentionRule(everySeconds int64) *PatchRetentionRule { this := PatchRetentionRule{} - this.Type = type_ + var type_ string = "expire" + this.Type = &type_ + this.EverySeconds = everySeconds return &this } @@ -39,64 +41,66 @@ func NewPatchRetentionRule(type_ string) *PatchRetentionRule { func NewPatchRetentionRuleWithDefaults() *PatchRetentionRule { this := PatchRetentionRule{} var type_ string = "expire" - this.Type = type_ + this.Type = &type_ + var everySeconds int64 = 2592000 + this.EverySeconds = everySeconds return &this } -// GetType returns the Type field value +// GetType returns the Type field value if set, zero value otherwise. func (o *PatchRetentionRule) GetType() string { - if o == nil { + if o == nil || o.Type == nil { var ret string return ret } - - return o.Type + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PatchRetentionRule) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || o.Type == nil { return nil, false } - return &o.Type, true + return o.Type, true } -// SetType sets field value +// HasType returns a boolean if a field has been set. +func (o *PatchRetentionRule) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. func (o *PatchRetentionRule) SetType(v string) { - o.Type = v + o.Type = &v } -// GetEverySeconds returns the EverySeconds field value if set, zero value otherwise. +// GetEverySeconds returns the EverySeconds field value func (o *PatchRetentionRule) GetEverySeconds() int64 { - if o == nil || o.EverySeconds == nil { + if o == nil { var ret int64 return ret } - return *o.EverySeconds + + return o.EverySeconds } -// GetEverySecondsOk returns a tuple with the EverySeconds field value if set, nil otherwise +// GetEverySecondsOk returns a tuple with the EverySeconds field value // and a boolean to check if the value has been set. func (o *PatchRetentionRule) GetEverySecondsOk() (*int64, bool) { - if o == nil || o.EverySeconds == nil { + if o == nil { return nil, false } - return o.EverySeconds, true -} - -// HasEverySeconds returns a boolean if a field has been set. -func (o *PatchRetentionRule) HasEverySeconds() bool { - if o != nil && o.EverySeconds != nil { - return true - } - - return false + return &o.EverySeconds, true } -// SetEverySeconds gets a reference to the given int64 and assigns it to the EverySeconds field. +// SetEverySeconds sets field value func (o *PatchRetentionRule) SetEverySeconds(v int64) { - o.EverySeconds = &v + o.EverySeconds = v } // GetShardGroupDurationSeconds returns the ShardGroupDurationSeconds field value if set, zero value otherwise. @@ -133,10 +137,10 @@ func (o *PatchRetentionRule) SetShardGroupDurationSeconds(v int64) { func (o PatchRetentionRule) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { + if o.Type != nil { toSerialize["type"] = o.Type } - if o.EverySeconds != nil { + if true { toSerialize["everySeconds"] = o.EverySeconds } if o.ShardGroupDurationSeconds != nil { diff --git a/api/model_permission_resource.gen.go b/api/model_permission_resource.gen.go index 55eec284..617a7ad9 100644 --- a/api/model_permission_resource.gen.go +++ b/api/model_permission_resource.gen.go @@ -16,14 +16,15 @@ import ( // PermissionResource struct for PermissionResource type PermissionResource struct { + // The type of resource. In a `permission`, applies the permission to all resources of this type. Type string `json:"type" yaml:"type"` - // If ID is set that is a permission for a specific resource. if it is not set it is a permission for all resources of that resource type. + // The ID of a specific resource. In a `permission`, applies the permission to only the resource with this ID. Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // Optional name of the resource if the resource has a name field. + // Optional: A name for the resource. Not all resource types have a name field. Name *string `json:"name,omitempty" yaml:"name,omitempty"` - // If orgID is set that is a permission for all resources owned my that org. if it is not set it is a permission for all resources of that resource type. + // The ID of the organization that owns the resource. In a `permission`, applies the permission to all resources of `type` owned by this organization. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // Optional name of the organization of the organization with orgID. + // Optional: The name of the organization with `orgID`. Org *string `json:"org,omitempty" yaml:"org,omitempty"` } diff --git a/api/model_post_bucket_request.gen.go b/api/model_post_bucket_request.gen.go index e741e0d4..afb65ab9 100644 --- a/api/model_post_bucket_request.gen.go +++ b/api/model_post_bucket_request.gen.go @@ -16,15 +16,15 @@ import ( // PostBucketRequest struct for PostBucketRequest type PostBucketRequest struct { - // Organization ID. The ID of the organization. + // The organization ID. Specifies the organization that owns the bucket. OrgID string `json:"orgID" yaml:"orgID"` - // The name of the bucket. + // The bucket name. Name string `json:"name" yaml:"name"` // A description of the bucket. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // Retention policy is an InfluxDB 1.x concept that represents the duration of time that each data point in the retention policy persists. Use `rp` for compatibility with InfluxDB 1.x. The InfluxDB 2.x and Cloud equivalent is [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period). + // The retention policy for the bucket. For InfluxDB 1.x, specifies the duration of time that each data point in the retention policy persists. If you need compatibility with InfluxDB 1.x, specify a value for the `rp` property; otherwise, see the `retentionRules` property. [Retention policy](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#retention-policy-rp) is an InfluxDB 1.x concept. The InfluxDB 2.x and Cloud equivalent is [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period). The InfluxDB `/api/v2` API uses `RetentionRules` to configure the retention period. Rp *string `json:"rp,omitempty" yaml:"rp,omitempty"` - // Rules to expire or retain data. No rules means data never expires. + // Retention rules to expire or retain data. The InfluxDB `/api/v2` API uses `RetentionRules` to configure the [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period). #### InfluxDB Cloud - `retentionRules` is required. #### InfluxDB OSS - `retentionRules` isn't required. RetentionRules *[]RetentionRule `json:"retentionRules,omitempty" yaml:"retentionRules,omitempty"` SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` } diff --git a/api/model_post_organization_request.gen.go b/api/model_post_organization_request.gen.go index 153644c6..43efd977 100644 --- a/api/model_post_organization_request.gen.go +++ b/api/model_post_organization_request.gen.go @@ -16,7 +16,9 @@ import ( // PostOrganizationRequest struct for PostOrganizationRequest type PostOrganizationRequest struct { - Name string `json:"name" yaml:"name"` + // The name of the organization. + Name string `json:"name" yaml:"name"` + // The description of the organization. Description *string `json:"description,omitempty" yaml:"description,omitempty"` } diff --git a/api/model_remote_connection.gen.go b/api/model_remote_connection.gen.go index aab451e4..389ea099 100644 --- a/api/model_remote_connection.gen.go +++ b/api/model_remote_connection.gen.go @@ -21,7 +21,7 @@ type RemoteConnection struct { OrgID string `json:"orgID" yaml:"orgID"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` RemoteURL string `json:"remoteURL" yaml:"remoteURL"` - RemoteOrgID string `json:"remoteOrgID" yaml:"remoteOrgID"` + RemoteOrgID *string `json:"remoteOrgID,omitempty" yaml:"remoteOrgID,omitempty"` AllowInsecureTLS bool `json:"allowInsecureTLS" yaml:"allowInsecureTLS"` } @@ -29,13 +29,12 @@ type RemoteConnection struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRemoteConnection(id string, name string, orgID string, remoteURL string, remoteOrgID string, allowInsecureTLS bool) *RemoteConnection { +func NewRemoteConnection(id string, name string, orgID string, remoteURL string, allowInsecureTLS bool) *RemoteConnection { this := RemoteConnection{} this.Id = id this.Name = name this.OrgID = orgID this.RemoteURL = remoteURL - this.RemoteOrgID = remoteOrgID this.AllowInsecureTLS = allowInsecureTLS return &this } @@ -178,28 +177,36 @@ func (o *RemoteConnection) SetRemoteURL(v string) { o.RemoteURL = v } -// GetRemoteOrgID returns the RemoteOrgID field value +// GetRemoteOrgID returns the RemoteOrgID field value if set, zero value otherwise. func (o *RemoteConnection) GetRemoteOrgID() string { - if o == nil { + if o == nil || o.RemoteOrgID == nil { var ret string return ret } - - return o.RemoteOrgID + return *o.RemoteOrgID } -// GetRemoteOrgIDOk returns a tuple with the RemoteOrgID field value +// GetRemoteOrgIDOk returns a tuple with the RemoteOrgID field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RemoteConnection) GetRemoteOrgIDOk() (*string, bool) { - if o == nil { + if o == nil || o.RemoteOrgID == nil { return nil, false } - return &o.RemoteOrgID, true + return o.RemoteOrgID, true +} + +// HasRemoteOrgID returns a boolean if a field has been set. +func (o *RemoteConnection) HasRemoteOrgID() bool { + if o != nil && o.RemoteOrgID != nil { + return true + } + + return false } -// SetRemoteOrgID sets field value +// SetRemoteOrgID gets a reference to the given string and assigns it to the RemoteOrgID field. func (o *RemoteConnection) SetRemoteOrgID(v string) { - o.RemoteOrgID = v + o.RemoteOrgID = &v } // GetAllowInsecureTLS returns the AllowInsecureTLS field value @@ -243,7 +250,7 @@ func (o RemoteConnection) MarshalJSON() ([]byte, error) { if true { toSerialize["remoteURL"] = o.RemoteURL } - if true { + if o.RemoteOrgID != nil { toSerialize["remoteOrgID"] = o.RemoteOrgID } if true { diff --git a/api/model_remote_connection_creation_request.gen.go b/api/model_remote_connection_creation_request.gen.go index dfcde92b..f8f785fd 100644 --- a/api/model_remote_connection_creation_request.gen.go +++ b/api/model_remote_connection_creation_request.gen.go @@ -21,7 +21,7 @@ type RemoteConnectionCreationRequest struct { OrgID string `json:"orgID" yaml:"orgID"` RemoteURL string `json:"remoteURL" yaml:"remoteURL"` RemoteAPIToken string `json:"remoteAPIToken" yaml:"remoteAPIToken"` - RemoteOrgID string `json:"remoteOrgID" yaml:"remoteOrgID"` + RemoteOrgID *string `json:"remoteOrgID,omitempty" yaml:"remoteOrgID,omitempty"` AllowInsecureTLS bool `json:"allowInsecureTLS" yaml:"allowInsecureTLS"` } @@ -29,13 +29,12 @@ type RemoteConnectionCreationRequest struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRemoteConnectionCreationRequest(name string, orgID string, remoteURL string, remoteAPIToken string, remoteOrgID string, allowInsecureTLS bool) *RemoteConnectionCreationRequest { +func NewRemoteConnectionCreationRequest(name string, orgID string, remoteURL string, remoteAPIToken string, allowInsecureTLS bool) *RemoteConnectionCreationRequest { this := RemoteConnectionCreationRequest{} this.Name = name this.OrgID = orgID this.RemoteURL = remoteURL this.RemoteAPIToken = remoteAPIToken - this.RemoteOrgID = remoteOrgID this.AllowInsecureTLS = allowInsecureTLS return &this } @@ -178,28 +177,36 @@ func (o *RemoteConnectionCreationRequest) SetRemoteAPIToken(v string) { o.RemoteAPIToken = v } -// GetRemoteOrgID returns the RemoteOrgID field value +// GetRemoteOrgID returns the RemoteOrgID field value if set, zero value otherwise. func (o *RemoteConnectionCreationRequest) GetRemoteOrgID() string { - if o == nil { + if o == nil || o.RemoteOrgID == nil { var ret string return ret } - - return o.RemoteOrgID + return *o.RemoteOrgID } -// GetRemoteOrgIDOk returns a tuple with the RemoteOrgID field value +// GetRemoteOrgIDOk returns a tuple with the RemoteOrgID field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RemoteConnectionCreationRequest) GetRemoteOrgIDOk() (*string, bool) { - if o == nil { + if o == nil || o.RemoteOrgID == nil { return nil, false } - return &o.RemoteOrgID, true + return o.RemoteOrgID, true +} + +// HasRemoteOrgID returns a boolean if a field has been set. +func (o *RemoteConnectionCreationRequest) HasRemoteOrgID() bool { + if o != nil && o.RemoteOrgID != nil { + return true + } + + return false } -// SetRemoteOrgID sets field value +// SetRemoteOrgID gets a reference to the given string and assigns it to the RemoteOrgID field. func (o *RemoteConnectionCreationRequest) SetRemoteOrgID(v string) { - o.RemoteOrgID = v + o.RemoteOrgID = &v } // GetAllowInsecureTLS returns the AllowInsecureTLS field value @@ -243,7 +250,7 @@ func (o RemoteConnectionCreationRequest) MarshalJSON() ([]byte, error) { if true { toSerialize["remoteAPIToken"] = o.RemoteAPIToken } - if true { + if o.RemoteOrgID != nil { toSerialize["remoteOrgID"] = o.RemoteOrgID } if true { diff --git a/api/model_resource_member.gen.go b/api/model_resource_member.gen.go index cb03bbba..4d6039d2 100644 --- a/api/model_resource_member.gen.go +++ b/api/model_resource_member.gen.go @@ -16,11 +16,11 @@ import ( // ResourceMember struct for ResourceMember type ResourceMember struct { - // The ID of the user. + // The user ID. Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // The name of the user. + // The user name. Name string `json:"name" yaml:"name"` - // The status of a user. An inactive user won't have access to resources. + // The status of a user. An inactive user can't read or write resources. Status *string `json:"status,omitempty" yaml:"status,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Role *string `json:"role,omitempty" yaml:"role,omitempty"` diff --git a/api/model_resource_owner.gen.go b/api/model_resource_owner.gen.go index eca2dd2e..73df91f2 100644 --- a/api/model_resource_owner.gen.go +++ b/api/model_resource_owner.gen.go @@ -16,11 +16,11 @@ import ( // ResourceOwner struct for ResourceOwner type ResourceOwner struct { - // The ID of the user. + // The user ID. Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // The name of the user. + // The user name. Name string `json:"name" yaml:"name"` - // The status of a user. An inactive user won't have access to resources. + // The status of a user. An inactive user can't read or write resources. Status *string `json:"status,omitempty" yaml:"status,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Role *string `json:"role,omitempty" yaml:"role,omitempty"` diff --git a/api/model_script.gen.go b/api/model_script.gen.go index 26d6482f..ac71c06f 100644 --- a/api/model_script.gen.go +++ b/api/model_script.gen.go @@ -21,13 +21,15 @@ type Script struct { Name string `json:"name" yaml:"name"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` OrgID string `json:"orgID" yaml:"orgID"` - // script to be executed + // The script to execute. Script string `json:"script" yaml:"script"` Language *ScriptLanguage `json:"language,omitempty" yaml:"language,omitempty"` - // invocation endpoint address + // The invocation endpoint address. Url *string `json:"url,omitempty" yaml:"url,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` + // The list of label names associated with the script. + Labels *[]string `json:"labels,omitempty" yaml:"labels,omitempty"` } // NewScript instantiates a new Script object @@ -314,6 +316,38 @@ func (o *Script) SetUpdatedAt(v time.Time) { o.UpdatedAt = &v } +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Script) GetLabels() []string { + if o == nil || o.Labels == nil { + var ret []string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Script) GetLabelsOk() (*[]string, bool) { + if o == nil || o.Labels == nil { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Script) HasLabels() bool { + if o != nil && o.Labels != nil { + return true + } + + return false +} + +// SetLabels gets a reference to the given []string and assigns it to the Labels field. +func (o *Script) SetLabels(v []string) { + o.Labels = &v +} + func (o Script) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { @@ -343,6 +377,9 @@ func (o Script) MarshalJSON() ([]byte, error) { if o.UpdatedAt != nil { toSerialize["updatedAt"] = o.UpdatedAt } + if o.Labels != nil { + toSerialize["labels"] = o.Labels + } return json.Marshal(toSerialize) } diff --git a/api/model_script_language.gen.go b/api/model_script_language.gen.go index 5bcc654d..d3ef9660 100644 --- a/api/model_script_language.gen.go +++ b/api/model_script_language.gen.go @@ -21,10 +21,11 @@ type ScriptLanguage string // List of ScriptLanguage const ( SCRIPTLANGUAGE_FLUX ScriptLanguage = "flux" + SCRIPTLANGUAGE_SQL ScriptLanguage = "sql" ) func ScriptLanguageValues() []ScriptLanguage { - return []ScriptLanguage{"flux"} + return []ScriptLanguage{"flux", "sql"} } func (v *ScriptLanguage) UnmarshalJSON(src []byte) error { @@ -34,7 +35,7 @@ func (v *ScriptLanguage) UnmarshalJSON(src []byte) error { return err } enumTypeValue := ScriptLanguage(value) - for _, existing := range []ScriptLanguage{"flux"} { + for _, existing := range []ScriptLanguage{"flux", "sql"} { if existing == enumTypeValue { *v = enumTypeValue return nil diff --git a/api/model_shard_owner.gen.go b/api/model_shard_owner.gen.go index c3ec1205..19feca3a 100644 --- a/api/model_shard_owner.gen.go +++ b/api/model_shard_owner.gen.go @@ -16,7 +16,7 @@ import ( // ShardOwner struct for ShardOwner type ShardOwner struct { - // ID of the node that owns a shard. + // The ID of the node that owns the shard. NodeID int64 `json:"nodeID" yaml:"nodeID"` } diff --git a/api/model_task.gen.go b/api/model_task.gen.go index 19630d55..5a8e0fc9 100644 --- a/api/model_task.gen.go +++ b/api/model_task.gen.go @@ -18,21 +18,21 @@ import ( // Task struct for Task type Task struct { Id string `json:"id" yaml:"id"` - // The ID of the organization that owns the task. + // An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. Specifies the organization that owns the task. OrgID string `json:"orgID" yaml:"orgID"` - // The name of the organization that owns the task. + // An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. Specifies the organization that owns the task. Org *string `json:"org,omitempty" yaml:"org,omitempty"` // The name of the task. Name string `json:"name" yaml:"name"` - // The ID of the user who owns the task. + // A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. Specifies the owner of the task. To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. OwnerID *string `json:"ownerID,omitempty" yaml:"ownerID,omitempty"` - // The description of the task. + // A 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"` - // The ID of the authorization used when the task communicates with the query engine. + // An authorization ID. Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to list authorizations. AuthorizationID *string `json:"authorizationID,omitempty" yaml:"authorizationID,omitempty"` - // The Flux script that the task runs. #### Limitations - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + // The Flux script that the task executes. #### Limitations - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. Flux *string `json:"flux,omitempty" yaml:"flux,omitempty"` // The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) 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"` @@ -47,9 +47,9 @@ type Task struct { CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` Links *TaskLinks `json:"links,omitempty" yaml:"links,omitempty"` - // The ID of the script that the task runs. #### Limitations - If you use the `scriptID` property, you can't use the `flux` property. + // A script ID. Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes. #### Limitations - If you use the `scriptID` property, you can't use the `flux` property. #### Related guides - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) ScriptID *string `json:"scriptID,omitempty" yaml:"scriptID,omitempty"` - // The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run. #### Limitations - `scriptParameters` requires `scriptID`. - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + // Key-value pairs for `params` in the script. Defines the invocation parameter values passed to the script specified by `scriptID`. When running the task, InfluxDB executes the script with the parameters you provide. #### Limitations - To use `scriptParameters`, you must provide a `scriptID`. - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. ScriptParameters *map[string]interface{} `json:"scriptParameters,omitempty" yaml:"scriptParameters,omitempty"` } diff --git a/api/model_template_summary_diff_bucket_fields.gen.go b/api/model_template_summary_diff_bucket_fields.gen.go index ff233c43..4fcb2099 100644 --- a/api/model_template_summary_diff_bucket_fields.gen.go +++ b/api/model_template_summary_diff_bucket_fields.gen.go @@ -18,7 +18,7 @@ import ( type TemplateSummaryDiffBucketFields struct { Name string `json:"name" yaml:"name"` Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // Rules to expire or retain data. No rules means data never expires. + // Retention rules to expire or retain data. The InfluxDB `/api/v2` API uses `RetentionRules` to configure the [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period). #### InfluxDB Cloud - `retentionRules` is required. #### InfluxDB OSS - `retentionRules` isn't required. RetentionRules []RetentionRule `json:"retentionRules" yaml:"retentionRules"` SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` MeasurementSchemas []map[string]interface{} `json:"measurementSchemas" yaml:"measurementSchemas"` diff --git a/api/model_unauthorized_request_error.gen.go b/api/model_unauthorized_request_error.gen.go new file mode 100644 index 00000000..4643fd3b --- /dev/null +++ b/api/model_unauthorized_request_error.gen.go @@ -0,0 +1,151 @@ +/* + * 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" +) + +// UnauthorizedRequestError struct for UnauthorizedRequestError +type UnauthorizedRequestError struct { + // The HTTP status code description. Default is `unauthorized`. + Code *string `json:"code,omitempty" yaml:"code,omitempty"` + // A human-readable message that may contain detail about the error. + Message *string `json:"message,omitempty" yaml:"message,omitempty"` +} + +// NewUnauthorizedRequestError instantiates a new UnauthorizedRequestError 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 NewUnauthorizedRequestError() *UnauthorizedRequestError { + this := UnauthorizedRequestError{} + return &this +} + +// NewUnauthorizedRequestErrorWithDefaults instantiates a new UnauthorizedRequestError 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 NewUnauthorizedRequestErrorWithDefaults() *UnauthorizedRequestError { + this := UnauthorizedRequestError{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *UnauthorizedRequestError) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedRequestError) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *UnauthorizedRequestError) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *UnauthorizedRequestError) SetCode(v string) { + o.Code = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *UnauthorizedRequestError) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedRequestError) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *UnauthorizedRequestError) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *UnauthorizedRequestError) SetMessage(v string) { + o.Message = &v +} + +func (o UnauthorizedRequestError) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + return json.Marshal(toSerialize) +} + +type NullableUnauthorizedRequestError struct { + value *UnauthorizedRequestError + isSet bool +} + +func (v NullableUnauthorizedRequestError) Get() *UnauthorizedRequestError { + return v.value +} + +func (v *NullableUnauthorizedRequestError) Set(val *UnauthorizedRequestError) { + v.value = val + v.isSet = true +} + +func (v NullableUnauthorizedRequestError) IsSet() bool { + return v.isSet +} + +func (v *NullableUnauthorizedRequestError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUnauthorizedRequestError(val *UnauthorizedRequestError) *NullableUnauthorizedRequestError { + return &NullableUnauthorizedRequestError{value: val, isSet: true} +} + +func (v NullableUnauthorizedRequestError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUnauthorizedRequestError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/model_user.gen.go b/api/model_user.gen.go index 37325ce3..926b6fcc 100644 --- a/api/model_user.gen.go +++ b/api/model_user.gen.go @@ -16,10 +16,13 @@ import ( // User struct for User type User struct { - Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The user ID. + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The OAuth ID. OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"` - Name string `json:"name" yaml:"name"` - // If inactive the user is inactive. + // The user name. + Name string `json:"name" yaml:"name"` + // If `inactive`, the user is inactive. Default is `active`. Status *string `json:"status,omitempty" yaml:"status,omitempty"` } diff --git a/api/model_user_response.gen.go b/api/model_user_response.gen.go index 6809cb79..a0039ada 100644 --- a/api/model_user_response.gen.go +++ b/api/model_user_response.gen.go @@ -16,11 +16,11 @@ import ( // UserResponse struct for UserResponse type UserResponse struct { - // The ID of the user. + // The user ID. Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // The name of the user. + // The user name. Name string `json:"name" yaml:"name"` - // The status of a user. An inactive user won't have access to resources. + // The status of a user. An inactive user can't read or write resources. Status *string `json:"status,omitempty" yaml:"status,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` } From e23b6f066cd7dd620f885d4306c136cf0ca10af2 Mon Sep 17 00:00:00 2001 From: DStrand1 Date: Tue, 25 Oct 2022 14:04:50 -0500 Subject: [PATCH 2/4] chore: fix misc errors --- api/error.go | 8 +++++++ clients/bucket/update_test.go | 2 +- internal/mock/api_users.gen.go | 43 ++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/api/error.go b/api/error.go index 70c8b654..47888f8e 100644 --- a/api/error.go +++ b/api/error.go @@ -126,3 +126,11 @@ func (o *TemplateSummaryError) Error() string { func (o *TemplateSummaryError) ErrorCode() ErrorCode { return ErrorCode(o.Code) } + +func (o *UnauthorizedRequestError) Error() string { + return o.GetMessage() +} + +func (o *UnauthorizedRequestError) ErrorCode() ErrorCode { + return ErrorCode(o.GetCode()) +} diff --git a/clients/bucket/update_test.go b/clients/bucket/update_test.go index f63f15e1..8c8c061c 100644 --- a/clients/bucket/update_test.go +++ b/clients/bucket/update_test.go @@ -94,7 +94,7 @@ func TestBucketsUpdate(t *testing.T) { assert.Nil(t, body.Description) && assert.Len(t, body.GetRetentionRules(), 1) && assert.Nil(t, body.GetRetentionRules()[0].ShardGroupDurationSeconds) && - assert.Equal(t, int64(3*7*24*3600), *body.GetRetentionRules()[0].EverySeconds) + assert.Equal(t, int64(3*7*24*3600), body.GetRetentionRules()[0].EverySeconds) })).Return(api.Bucket{ Id: api.PtrString("123"), Name: "my-bucket", diff --git a/internal/mock/api_users.gen.go b/internal/mock/api_users.gen.go index de562b72..074b09fd 100644 --- a/internal/mock/api_users.gen.go +++ b/internal/mock/api_users.gen.go @@ -301,3 +301,46 @@ func (mr *MockUsersApiMockRecorder) PostUsersIDPasswordExecuteWithHttpInfo(arg0 mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PostUsersIDPasswordExecuteWithHttpInfo", reflect.TypeOf((*MockUsersApi)(nil).PostUsersIDPasswordExecuteWithHttpInfo), arg0) } + +// PutUsersIDPassword mocks base method. +func (m *MockUsersApi) PutUsersIDPassword(arg0 context.Context, arg1 string) api.ApiPutUsersIDPasswordRequest { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUsersIDPassword", arg0, arg1) + ret0, _ := ret[0].(api.ApiPutUsersIDPasswordRequest) + return ret0 +} + +// PutUsersIDPassword indicates an expected call of PutUsersIDPassword. +func (mr *MockUsersApiMockRecorder) PutUsersIDPassword(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUsersIDPassword", reflect.TypeOf((*MockUsersApi)(nil).PutUsersIDPassword), arg0, arg1) +} + +// PutUsersIDPasswordExecute mocks base method. +func (m *MockUsersApi) PutUsersIDPasswordExecute(arg0 api.ApiPutUsersIDPasswordRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUsersIDPasswordExecute", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// PutUsersIDPasswordExecute indicates an expected call of PutUsersIDPasswordExecute. +func (mr *MockUsersApiMockRecorder) PutUsersIDPasswordExecute(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUsersIDPasswordExecute", reflect.TypeOf((*MockUsersApi)(nil).PutUsersIDPasswordExecute), arg0) +} + +// PutUsersIDPasswordExecuteWithHttpInfo mocks base method. +func (m *MockUsersApi) PutUsersIDPasswordExecuteWithHttpInfo(arg0 api.ApiPutUsersIDPasswordRequest) (*http.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PutUsersIDPasswordExecuteWithHttpInfo", arg0) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PutUsersIDPasswordExecuteWithHttpInfo indicates an expected call of PutUsersIDPasswordExecuteWithHttpInfo. +func (mr *MockUsersApiMockRecorder) PutUsersIDPasswordExecuteWithHttpInfo(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutUsersIDPasswordExecuteWithHttpInfo", reflect.TypeOf((*MockUsersApi)(nil).PutUsersIDPasswordExecuteWithHttpInfo), arg0) +} From c9ed697f929081d8826f191ad6977d540cd88d2a Mon Sep 17 00:00:00 2001 From: DStrand1 Date: Tue, 25 Oct 2022 14:07:09 -0500 Subject: [PATCH 3/4] chore: do not require `remoteOrgID` for remote creation --- clients/remote/remote.go | 9 +++++++-- cmd/influx/remote.go | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/clients/remote/remote.go b/clients/remote/remote.go index e584d3c7..3f044e00 100644 --- a/clients/remote/remote.go +++ b/clients/remote/remote.go @@ -44,13 +44,18 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error { OrgID: orgID, RemoteURL: params.RemoteURL, RemoteAPIToken: params.RemoteAPIToken, - RemoteOrgID: params.RemoteOrgID, AllowInsecureTLS: params.AllowInsecureTLS, } if params.Description != "" { body.Description = ¶ms.Description } + if params.RemoteOrgID != "" { + body.RemoteOrgID = ¶ms.RemoteOrgID + } else { + fmt.Fprintln(c.StdIO, "RemoteOrgID is required for remote connections to Cloud or OSS 2.x!") + fmt.Fprintln(c.StdIO, "Ignore this message if this remote connection is to a 1.x instance") + } // send post request res, err := c.PostRemoteConnection(ctx).RemoteConnectionCreationRequest(body).Execute() @@ -215,7 +220,7 @@ func (c Client) printRemote(opts printRemoteOpts) error { "Name": r.GetName(), "Org ID": r.OrgID, "Remote URL": r.RemoteURL, - "Remote Org ID": r.RemoteOrgID, + "Remote Org ID": r.GetRemoteOrgID(), "Allow Insecure TLS": r.AllowInsecureTLS, } if opts.deleted { diff --git a/cmd/influx/remote.go b/cmd/influx/remote.go index 350e8b81..eb745637 100644 --- a/cmd/influx/remote.go +++ b/cmd/influx/remote.go @@ -57,7 +57,6 @@ func newRemoteCreateCmd() cli.Command { &cli.StringFlag{ Name: "remote-org-id", Usage: "The ID of the remote organization", - Required: true, Destination: ¶ms.RemoteOrgID, }, &cli.BoolFlag{ From d7b824f7249245d1d1f5b0d5044a77169490e7cb Mon Sep 17 00:00:00 2001 From: DStrand1 Date: Tue, 25 Oct 2022 14:22:49 -0500 Subject: [PATCH 4/4] chore: fix bucket update test failure --- clients/bucket/update_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/clients/bucket/update_test.go b/clients/bucket/update_test.go index 8c8c061c..96324ed8 100644 --- a/clients/bucket/update_test.go +++ b/clients/bucket/update_test.go @@ -122,7 +122,6 @@ func TestBucketsUpdate(t *testing.T) { assert.Nil(t, body.Name) && assert.Nil(t, body.Description) && assert.Len(t, body.GetRetentionRules(), 1) && - assert.Nil(t, body.GetRetentionRules()[0].EverySeconds) && assert.Equal(t, int64(10*3600+30*60), *body.GetRetentionRules()[0].ShardGroupDurationSeconds) })).Return(api.Bucket{ Id: api.PtrString("123"),