fix: do not require remoteOrgID for remote connection creation (#451)

This commit is contained in:
Dane Strandboge
2022-10-28 11:16:53 -05:00
committed by GitHub
parent 121864a550
commit 3285a03e9e
52 changed files with 2942 additions and 587 deletions

View File

@ -47,10 +47,30 @@ type AuthorizationsApi interface {
DeleteAuthorizationsIDExecuteWithHttpInfo(r ApiDeleteAuthorizationsIDRequest) (*_nethttp.Response, error) DeleteAuthorizationsIDExecuteWithHttpInfo(r ApiDeleteAuthorizationsIDRequest) (*_nethttp.Response, error)
/* /*
* GetAuthorizations List all authorizations * GetAuthorizations List authorizations
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves a list of authorizations.
* @return ApiGetAuthorizationsRequest
*/ 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 GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest
/* /*
@ -112,10 +132,36 @@ type AuthorizationsApi interface {
PatchAuthorizationsIDExecuteWithHttpInfo(r ApiPatchAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) PatchAuthorizationsIDExecuteWithHttpInfo(r ApiPatchAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error)
/* /*
* PostAuthorizations Create an authorization * PostAuthorizations Create an authorization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Creates an authorization.
* @return ApiPostAuthorizationsRequest
*/ 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 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetAuthorizationsRequest * @return ApiGetAuthorizationsRequest
*/ */
func (a *AuthorizationsApiService) GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest { func (a *AuthorizationsApiService) GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest {
return ApiGetAuthorizationsRequest{ return ApiGetAuthorizationsRequest{
ApiService: a, ApiService: a,
@ -445,6 +511,28 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGet
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -853,9 +941,35 @@ func (r ApiPostAuthorizationsRequest) ExecuteWithHttpInfo() (Authorization, *_ne
/* /*
* PostAuthorizations Create an authorization * 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostAuthorizationsRequest * @return ApiPostAuthorizationsRequest
*/ */
func (a *AuthorizationsApiService) PostAuthorizations(ctx _context.Context) ApiPostAuthorizationsRequest { func (a *AuthorizationsApiService) PostAuthorizations(ctx _context.Context) ApiPostAuthorizationsRequest {
return ApiPostAuthorizationsRequest{ return ApiPostAuthorizationsRequest{
ApiService: a, ApiService: a,
@ -964,6 +1078,17 @@ func (a *AuthorizationsApiService) PostAuthorizationsExecuteWithHttpInfo(r ApiPo
newErr.model = &v newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {

View File

@ -27,11 +27,32 @@ var (
type BucketSchemasApi interface { type BucketSchemasApi interface {
/* /*
* CreateMeasurementSchema Create a measurement schema for a bucket * 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(). * Creates an _explict_ measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema)
* @param bucketID The identifier of the bucket. for a bucket.
* @return ApiCreateMeasurementSchemaRequest
*/ _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 CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest
/* /*
@ -49,10 +70,12 @@ type BucketSchemasApi interface {
CreateMeasurementSchemaExecuteWithHttpInfo(r ApiCreateMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) 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 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. Retrieves schemas for the specified bucket.
* @param measurementID The identifier of the measurement. * @param measurementID The measurement schema ID. Specifies the measurement schema to retrieve.
* @return ApiGetMeasurementSchemaRequest * @return ApiGetMeasurementSchemaRequest
*/ */
GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiGetMeasurementSchemaRequest GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiGetMeasurementSchemaRequest
@ -72,11 +95,25 @@ type BucketSchemasApi interface {
GetMeasurementSchemaExecuteWithHttpInfo(r ApiGetMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) GetMeasurementSchemaExecuteWithHttpInfo(r ApiGetMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error)
/* /*
* GetMeasurementSchemas List all measurement schemas of a bucket * GetMeasurementSchemas List measurement schemas of a bucket
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves a list of _explicit_
* @param bucketID The identifier of the bucket. [schemas]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema)
* @return ApiGetMeasurementSchemasRequest (`"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 GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest
/* /*
@ -94,12 +131,26 @@ type BucketSchemasApi interface {
GetMeasurementSchemasExecuteWithHttpInfo(r ApiGetMeasurementSchemasRequest) (MeasurementSchemaList, *_nethttp.Response, error) GetMeasurementSchemasExecuteWithHttpInfo(r ApiGetMeasurementSchemasRequest) (MeasurementSchemaList, *_nethttp.Response, error)
/* /*
* UpdateMeasurementSchema Update a measurement schema * UpdateMeasurementSchema Update a measurement schema
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Updates a measurement [schema]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema).
* @param bucketID The identifier of the bucket.
* @param measurementID The identifier of the measurement. Use this endpoint to update the fields (`name`, `type`, and `dataType`) of a
* @return ApiUpdateMeasurementSchemaRequest 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 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 * 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 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 * @return ApiCreateMeasurementSchemaRequest
*/ */
func (a *BucketSchemasApiService) CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest { func (a *BucketSchemasApiService) CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest {
return ApiCreateMeasurementSchemaRequest{ return ApiCreateMeasurementSchemaRequest{
ApiService: a, ApiService: a,
@ -283,6 +355,18 @@ func (a *BucketSchemasApiService) CreateMeasurementSchemaExecuteWithHttpInfo(r A
} }
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v 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 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 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. Retrieves schemas for the specified bucket.
* @param measurementID The identifier of the measurement. * @param measurementID The measurement schema ID. Specifies the measurement schema to retrieve.
* @return ApiGetMeasurementSchemaRequest * @return ApiGetMeasurementSchemaRequest
*/ */
func (a *BucketSchemasApiService) GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 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 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 * @return ApiGetMeasurementSchemasRequest
*/ */
func (a *BucketSchemasApiService) GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest { func (a *BucketSchemasApiService) GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest {
return ApiGetMeasurementSchemasRequest{ return ApiGetMeasurementSchemasRequest{
ApiService: a, ApiService: a,
@ -644,7 +755,7 @@ func (a *BucketSchemasApiService) GetMeasurementSchemasExecuteWithHttpInfo(r Api
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status newErr.error = localVarHTTPResponse.Status
if localVarHTTPResponse.StatusCode == 404 { if localVarHTTPResponse.StatusCode == 400 {
var v Error var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -653,6 +764,18 @@ func (a *BucketSchemasApiService) GetMeasurementSchemasExecuteWithHttpInfo(r Api
} }
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v 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 return localVarReturnValue, localVarHTTPResponse, newErr
} }
@ -739,11 +862,25 @@ func (r ApiUpdateMeasurementSchemaRequest) ExecuteWithHttpInfo() (MeasurementSch
/* /*
* UpdateMeasurementSchema Update a measurement schema * 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 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. Specifies the bucket to retrieve schemas for.
* @param measurementID The identifier of the measurement. * @param measurementID A measurement schema ID. Retrieves the specified measurement schema.
* @return ApiUpdateMeasurementSchemaRequest * @return ApiUpdateMeasurementSchemaRequest
*/ */
func (a *BucketSchemasApiService) UpdateMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiUpdateMeasurementSchemaRequest { func (a *BucketSchemasApiService) UpdateMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiUpdateMeasurementSchemaRequest {
return ApiUpdateMeasurementSchemaRequest{ return ApiUpdateMeasurementSchemaRequest{
ApiService: a, ApiService: a,
@ -854,6 +991,18 @@ func (a *BucketSchemasApiService) UpdateMeasurementSchemaExecuteWithHttpInfo(r A
} }
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v 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 return localVarReturnValue, localVarHTTPResponse, newErr
} }

View File

@ -27,11 +27,34 @@ var (
type BucketsApi interface { type BucketsApi interface {
/* /*
* DeleteBucketsID Delete a bucket * DeleteBucketsID Delete a bucket
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Deletes a bucket and all associated records.
* @param bucketID The ID of the bucket to delete.
* @return ApiDeleteBucketsIDRequest #### 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 DeleteBucketsID(ctx _context.Context, bucketID string) ApiDeleteBucketsIDRequest
/* /*
@ -50,29 +73,32 @@ type BucketsApi interface {
* GetBuckets List buckets * GetBuckets List buckets
* Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). * 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. 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 If no query parameters are passed, InfluxDB returns all buckets up to the
default `limit`. default `limit`.
#### Limitations #### InfluxDB Cloud
- Paging with an `offset` greater than the number of records will result in - Doesn't use `org` or `orgID` parameters.
an empty list of buckets--for example:
The following request is paging to the 50th record, but the user only has #### InfluxDB OSS
10 buckets.
```sh - If you use an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_
$ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" 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.
$ { #### Required permissions
"links": {
"prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", | Action | Permission required |
"self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" |:--------------------------|:--------------------|
}, | Retrieve _user buckets_ | `read-buckets` |
"buckets": [] | Retrieve [_system buckets_]({{% INFLUXDB_DOCS_URL %}}/reference/internals/system-buckets/) | `read-orgs` |
}
```
#### Related Guides #### Related Guides
@ -98,11 +124,15 @@ type BucketsApi interface {
GetBucketsExecuteWithHttpInfo(r ApiGetBucketsRequest) (Buckets, *_nethttp.Response, error) GetBucketsExecuteWithHttpInfo(r ApiGetBucketsRequest) (Buckets, *_nethttp.Response, error)
/* /*
* GetBucketsID Retrieve a bucket * GetBucketsID Retrieve a bucket
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves a bucket.
* @param bucketID The bucket ID.
* @return ApiGetBucketsIDRequest 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 GetBucketsID(ctx _context.Context, bucketID string) ApiGetBucketsIDRequest
/* /*
@ -120,11 +150,29 @@ type BucketsApi interface {
GetBucketsIDExecuteWithHttpInfo(r ApiGetBucketsIDRequest) (Bucket, *_nethttp.Response, error) GetBucketsIDExecuteWithHttpInfo(r ApiGetBucketsIDRequest) (Bucket, *_nethttp.Response, error)
/* /*
* PatchBucketsID Update a bucket * PatchBucketsID Update a bucket
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Updates a bucket.
* @param bucketID The bucket ID.
* @return ApiPatchBucketsIDRequest 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 PatchBucketsID(ctx _context.Context, bucketID string) ApiPatchBucketsIDRequest
/* /*
@ -144,15 +192,16 @@ type BucketsApi interface {
/* /*
* PostBuckets Create a bucket * PostBuckets Create a bucket
* Creates a [bucket]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#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) [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period)
is 30 days. is 30 days.
#### InfluxDB OSS #### InfluxDB OSS
- A single InfluxDB OSS instance supports active writes or queries for - A single InfluxDB OSS instance supports active writes or queries for
approximately 20 buckets across all organizations at a given time. Reading approximately 20 buckets across all organizations at a given time.
or writing to more than 20 buckets at a time can adversely affect Reading or writing to more than 20 buckets at a time can adversely affect
performance. performance.
#### Limitations #### Limitations
@ -164,7 +213,7 @@ type BucketsApi interface {
#### Related Guides #### 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) - [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(). * @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 * 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 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 * @return ApiDeleteBucketsIDRequest
*/ */
func (a *BucketsApiService) DeleteBucketsID(ctx _context.Context, bucketID string) ApiDeleteBucketsIDRequest { func (a *BucketsApiService) DeleteBucketsID(ctx _context.Context, bucketID string) ApiDeleteBucketsIDRequest {
return ApiDeleteBucketsIDRequest{ return ApiDeleteBucketsIDRequest{
ApiService: a, ApiService: a,
@ -318,6 +390,28 @@ func (a *BucketsApiService) DeleteBucketsIDExecuteWithHttpInfo(r ApiDeleteBucket
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 { if localVarHTTPResponse.StatusCode == 404 {
var v Error var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 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 * GetBuckets List buckets
* Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). * 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. 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 If no query parameters are passed, InfluxDB returns all buckets up to the
default `limit`. default `limit`.
#### Limitations #### InfluxDB Cloud
- Paging with an `offset` greater than the number of records will result in - Doesn't use `org` or `orgID` parameters.
an empty list of buckets--for example:
The following request is paging to the 50th record, but the user only has #### InfluxDB OSS
10 buckets.
```sh - If you use an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_
$ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" 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.
$ { #### Required permissions
"links": {
"prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", | Action | Permission required |
"self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" |:--------------------------|:--------------------|
}, | Retrieve _user buckets_ | `read-buckets` |
"buckets": [] | Retrieve [_system buckets_]({{% INFLUXDB_DOCS_URL %}}/reference/internals/system-buckets/) | `read-orgs` |
}
```
#### Related Guides #### Related Guides
@ -576,6 +673,17 @@ func (a *BucketsApiService) GetBucketsExecuteWithHttpInfo(r ApiGetBucketsRequest
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -642,10 +750,14 @@ func (r ApiGetBucketsIDRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Respons
/* /*
* GetBucketsID Retrieve a bucket * 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 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 * @return ApiGetBucketsIDRequest
*/ */
func (a *BucketsApiService) GetBucketsID(ctx _context.Context, bucketID string) ApiGetBucketsIDRequest { func (a *BucketsApiService) GetBucketsID(ctx _context.Context, bucketID string) ApiGetBucketsIDRequest {
return ApiGetBucketsIDRequest{ return ApiGetBucketsIDRequest{
ApiService: a, ApiService: a,
@ -740,6 +852,28 @@ func (a *BucketsApiService) GetBucketsIDExecuteWithHttpInfo(r ApiGetBucketsIDReq
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -815,10 +949,28 @@ func (r ApiPatchBucketsIDRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Respo
/* /*
* PatchBucketsID Update a bucket * 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 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 bucket ID.
* @return ApiPatchBucketsIDRequest * @return ApiPatchBucketsIDRequest
*/ */
func (a *BucketsApiService) PatchBucketsID(ctx _context.Context, bucketID string) ApiPatchBucketsIDRequest { func (a *BucketsApiService) PatchBucketsID(ctx _context.Context, bucketID string) ApiPatchBucketsIDRequest {
return ApiPatchBucketsIDRequest{ return ApiPatchBucketsIDRequest{
ApiService: a, ApiService: a,
@ -918,6 +1070,50 @@ func (a *BucketsApiService) PatchBucketsIDExecuteWithHttpInfo(r ApiPatchBucketsI
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -985,15 +1181,16 @@ func (r ApiPostBucketsRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Response
/* /*
* PostBuckets Create a bucket * PostBuckets Create a bucket
* Creates a [bucket]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#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) [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period)
is 30 days. is 30 days.
#### InfluxDB OSS #### InfluxDB OSS
- A single InfluxDB OSS instance supports active writes or queries for - A single InfluxDB OSS instance supports active writes or queries for
approximately 20 buckets across all organizations at a given time. Reading approximately 20 buckets across all organizations at a given time.
or writing to more than 20 buckets at a time can adversely affect Reading or writing to more than 20 buckets at a time can adversely affect
performance. performance.
#### Limitations #### Limitations
@ -1005,7 +1202,7 @@ For additional information regarding InfluxDB Cloud offerings, see
#### Related Guides #### 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) - [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(). * @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 newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr 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 { if localVarHTTPResponse.StatusCode == 403 {
var v Error var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))

View File

@ -36,8 +36,14 @@ type DeleteApi interface {
- Does the following when you send a delete request: - Does the following when you send a delete request:
1. Validates the request and queues the delete. 1. Validates the request and queues the delete.
2. Returns _success_ if queued; _error_ otherwise. 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise.
3. Handles the delete asynchronously. 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 #### InfluxDB OSS
@ -48,7 +54,7 @@ type DeleteApi interface {
- `write-buckets` or `write-bucket BUCKET_ID`. - `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) #### Rate limits (with InfluxDB Cloud)
@ -57,7 +63,7 @@ type DeleteApi interface {
#### Related guides #### 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 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/) - 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/). 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: - Does the following when you send a delete request:
1. Validates the request and queues the delete. 1. Validates the request and queues the delete.
2. Returns _success_ if queued; _error_ otherwise. 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise.
3. Handles the delete asynchronously. 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 #### 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`. - `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) #### Rate limits (with InfluxDB Cloud)
@ -182,7 +194,7 @@ For more information, see [limits and adjustable quotas](https://docs.influxdata
#### Related guides #### 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 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/) - 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/). 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 newErr.model = &v
return localVarHTTPResponse, newErr 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {

View File

@ -16,6 +16,7 @@ import (
_io "io" _io "io"
_nethttp "net/http" _nethttp "net/http"
_neturl "net/url" _neturl "net/url"
"reflect"
"strings" "strings"
) )
@ -28,9 +29,9 @@ type InvokableScriptsApi interface {
/* /*
* DeleteScriptsID Delete a script * 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 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 * @return ApiDeleteScriptsIDRequest
*/ */
DeleteScriptsID(ctx _context.Context, scriptID string) ApiDeleteScriptsIDRequest DeleteScriptsID(ctx _context.Context, scriptID string) ApiDeleteScriptsIDRequest
@ -51,21 +52,7 @@ type InvokableScriptsApi interface {
* GetScripts List scripts * GetScripts List scripts
* Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). * Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/).
#### Limitations #### Related guides
- 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
- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) - [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 * 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 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 * @return ApiGetScriptsIDRequest
*/ */
GetScriptsID(ctx _context.Context, scriptID string) ApiGetScriptsIDRequest GetScriptsID(ctx _context.Context, scriptID string) ApiGetScriptsIDRequest
@ -112,13 +100,15 @@ type InvokableScriptsApi interface {
GetScriptsIDExecuteWithHttpInfo(r ApiGetScriptsIDRequest) (Script, *_nethttp.Response, error) GetScriptsIDExecuteWithHttpInfo(r ApiGetScriptsIDRequest) (Script, *_nethttp.Response, error)
/* /*
* PatchScriptsID Update a script * 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.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). Use this endpoint to update the properties (`name`, `description`, and `script`) of an invokable script.
* @param scriptID The script ID.
* @return ApiPatchScriptsIDRequest * @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 PatchScriptsID(ctx _context.Context, scriptID string) ApiPatchScriptsIDRequest
/* /*
@ -138,12 +128,12 @@ type InvokableScriptsApi interface {
/* /*
* PostScripts Create a script * PostScripts Create a script
* Creates an [invokable script](https://docs.influxdata.com/resources/videos/api-invokable-scripts/) * 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/). - [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/). - [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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostScriptsRequest * @return ApiPostScriptsRequest
@ -215,9 +205,9 @@ func (r ApiDeleteScriptsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, er
/* /*
* DeleteScriptsID Delete a script * 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 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 * @return ApiDeleteScriptsIDRequest
*/ */
func (a *InvokableScriptsApiService) DeleteScriptsID(ctx _context.Context, scriptID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -323,10 +324,21 @@ func (a *InvokableScriptsApiService) DeleteScriptsIDExecuteWithHttpInfo(r ApiDel
} }
type ApiGetScriptsRequest struct { type ApiGetScriptsRequest struct {
ctx _context.Context ctx _context.Context
ApiService InvokableScriptsApi ApiService InvokableScriptsApi
limit *int32 offset *int32
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 { func (r ApiGetScriptsRequest) Limit(limit int32) ApiGetScriptsRequest {
@ -337,12 +349,28 @@ func (r ApiGetScriptsRequest) GetLimit() *int32 {
return r.limit return r.limit
} }
func (r ApiGetScriptsRequest) Offset(offset int32) ApiGetScriptsRequest { func (r ApiGetScriptsRequest) Name(name string) ApiGetScriptsRequest {
r.offset = &offset r.name = &name
return r return r
} }
func (r ApiGetScriptsRequest) GetOffset() *int32 { func (r ApiGetScriptsRequest) GetName() *string {
return r.offset 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) { func (r ApiGetScriptsRequest) Execute() (Scripts, error) {
@ -357,21 +385,7 @@ func (r ApiGetScriptsRequest) ExecuteWithHttpInfo() (Scripts, *_nethttp.Response
* GetScripts List scripts * GetScripts List scripts
* Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). * Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/).
#### Limitations #### Related guides
- 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
- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) - [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{} localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{} localVarFormParams := _neturl.Values{}
if r.offset != nil {
localVarQueryParams.Add("offset", parameterToString(*r.offset, ""))
}
if r.limit != nil { if r.limit != nil {
localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) localVarQueryParams.Add("limit", parameterToString(*r.limit, ""))
} }
if r.offset != nil { if r.name != nil {
localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) 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 // to determine the Content-Type header
localVarHTTPContentTypes := []string{} localVarHTTPContentTypes := []string{}
@ -484,6 +515,17 @@ func (a *InvokableScriptsApiService) GetScriptsExecuteWithHttpInfo(r ApiGetScrip
newErr.model = &v newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -541,9 +583,10 @@ func (r ApiGetScriptsIDRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Respons
/* /*
* GetScriptsID Retrieve a script * 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 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 * @return ApiGetScriptsIDRequest
*/ */
func (a *InvokableScriptsApiService) GetScriptsID(ctx _context.Context, scriptID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -703,12 +757,14 @@ func (r ApiPatchScriptsIDRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Respo
/* /*
* PatchScriptsID Update a script * 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 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 * @return ApiPatchScriptsIDRequest
*/ */
func (a *InvokableScriptsApiService) PatchScriptsID(ctx _context.Context, scriptID string) ApiPatchScriptsIDRequest { func (a *InvokableScriptsApiService) PatchScriptsID(ctx _context.Context, scriptID string) ApiPatchScriptsIDRequest {
return ApiPatchScriptsIDRequest{ return ApiPatchScriptsIDRequest{
ApiService: a, ApiService: a,
@ -805,6 +861,17 @@ func (a *InvokableScriptsApiService) PatchScriptsIDExecuteWithHttpInfo(r ApiPatc
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -863,12 +930,12 @@ func (r ApiPostScriptsRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Response
/* /*
* PostScripts Create a script * PostScripts Create a script
* Creates an [invokable script](https://docs.influxdata.com/resources/videos/api-invokable-scripts/) * 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/). - [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/). - [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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostScriptsRequest * @return ApiPostScriptsRequest
@ -967,8 +1034,8 @@ func (a *InvokableScriptsApiService) PostScriptsExecuteWithHttpInfo(r ApiPostScr
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status newErr.error = localVarHTTPResponse.Status
if localVarHTTPResponse.StatusCode == 400 { if localVarHTTPResponse.StatusCode == 401 {
var v Error var v UnauthorizedRequestError
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())

View File

@ -112,10 +112,18 @@ type LegacyAuthorizationsApi interface {
PatchLegacyAuthorizationsIDExecuteWithHttpInfo(r ApiPatchLegacyAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) PatchLegacyAuthorizationsIDExecuteWithHttpInfo(r ApiPatchLegacyAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error)
/* /*
* PostLegacyAuthorizations Create a legacy authorization * PostLegacyAuthorizations Create a legacy authorization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Creates a legacy authorization and returns the legacy authorization.
* @return ApiPostLegacyAuthorizationsRequest
*/ #### 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 PostLegacyAuthorizations(ctx _context.Context) ApiPostLegacyAuthorizationsRequest
/* /*
@ -897,9 +905,17 @@ func (r ApiPostLegacyAuthorizationsRequest) ExecuteWithHttpInfo() (Authorization
/* /*
* PostLegacyAuthorizations Create a legacy 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostLegacyAuthorizationsRequest * @return ApiPostLegacyAuthorizationsRequest
*/ */
func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizations(ctx _context.Context) ApiPostLegacyAuthorizationsRequest { func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizations(ctx _context.Context) ApiPostLegacyAuthorizationsRequest {
return ApiPostLegacyAuthorizationsRequest{ return ApiPostLegacyAuthorizationsRequest{
ApiService: a, ApiService: a,
@ -1008,6 +1024,17 @@ func (a *LegacyAuthorizationsApiService) PostLegacyAuthorizationsExecuteWithHttp
newErr.model = &v newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {

View File

@ -27,11 +27,37 @@ var (
type OrganizationsApi interface { type OrganizationsApi interface {
/* /*
* DeleteOrgsID Delete an organization * DeleteOrgsID Delete an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Deletes an organization.
* @param orgID The ID of the organization to delete.
* @return ApiDeleteOrgsIDRequest 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 DeleteOrgsID(ctx _context.Context, orgID string) ApiDeleteOrgsIDRequest
/* /*
@ -47,12 +73,38 @@ type OrganizationsApi interface {
DeleteOrgsIDExecuteWithHttpInfo(r ApiDeleteOrgsIDRequest) (*_nethttp.Response, error) DeleteOrgsIDExecuteWithHttpInfo(r ApiDeleteOrgsIDRequest) (*_nethttp.Response, error)
/* /*
* DeleteOrgsIDMembersID Remove a member from an organization * 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(). * Removes a member from an organization.
* @param userID The ID of the member to remove.
* @param orgID The organization ID. Use this endpoint to remove a user's member privileges from a bucket. This
* @return ApiDeleteOrgsIDMembersIDRequest 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 DeleteOrgsIDMembersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDMembersIDRequest
/* /*
@ -68,12 +120,37 @@ type OrganizationsApi interface {
DeleteOrgsIDMembersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDMembersIDRequest) (*_nethttp.Response, error) DeleteOrgsIDMembersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDMembersIDRequest) (*_nethttp.Response, error)
/* /*
* DeleteOrgsIDOwnersID Remove an owner from an organization * 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(). * Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from
* @param userID The ID of the owner to remove. the organization.
* @param orgID The organization ID.
* @return ApiDeleteOrgsIDOwnersIDRequest 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 DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest
/* /*
@ -89,10 +166,23 @@ type OrganizationsApi interface {
DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDOwnersIDRequest) (*_nethttp.Response, error) DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDOwnersIDRequest) (*_nethttp.Response, error)
/* /*
* GetOrgs List all organizations * GetOrgs List organizations
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves a list of [organizations]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization/).
* @return ApiGetOrgsRequest
*/ 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 GetOrgs(ctx _context.Context) ApiGetOrgsRequest
/* /*
@ -110,11 +200,19 @@ type OrganizationsApi interface {
GetOrgsExecuteWithHttpInfo(r ApiGetOrgsRequest) (Organizations, *_nethttp.Response, error) GetOrgsExecuteWithHttpInfo(r ApiGetOrgsRequest) (Organizations, *_nethttp.Response, error)
/* /*
* GetOrgsID Retrieve an organization * GetOrgsID Retrieve an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves an organization.
* @param orgID The ID of the organization to get.
* @return ApiGetOrgsIDRequest 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 GetOrgsID(ctx _context.Context, orgID string) ApiGetOrgsIDRequest
/* /*
@ -132,11 +230,41 @@ type OrganizationsApi interface {
GetOrgsIDExecuteWithHttpInfo(r ApiGetOrgsIDRequest) (Organization, *_nethttp.Response, error) GetOrgsIDExecuteWithHttpInfo(r ApiGetOrgsIDRequest) (Organization, *_nethttp.Response, error)
/* /*
* GetOrgsIDMembers List all members of an organization * 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(). * Retrieves a list of all users that belong to an organization.
* @param orgID The organization ID.
* @return ApiGetOrgsIDMembersRequest 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 GetOrgsIDMembers(ctx _context.Context, orgID string) ApiGetOrgsIDMembersRequest
/* /*
@ -154,11 +282,25 @@ type OrganizationsApi interface {
GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOrgsIDMembersRequest) (ResourceMembers, *_nethttp.Response, error) GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOrgsIDMembersRequest) (ResourceMembers, *_nethttp.Response, error)
/* /*
* GetOrgsIDOwners List all owners of an organization * 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(). * Retrieves a list of all owners of an organization.
* @param orgID The organization ID.
* @return ApiGetOrgsIDOwnersRequest #### 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 GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest
/* /*
@ -176,11 +318,32 @@ type OrganizationsApi interface {
GetOrgsIDOwnersExecuteWithHttpInfo(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, *_nethttp.Response, error) GetOrgsIDOwnersExecuteWithHttpInfo(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, *_nethttp.Response, error)
/* /*
* PatchOrgsID Update an organization * PatchOrgsID Update an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Updates an organization.
* @param orgID The ID of the organization to get.
* @return ApiPatchOrgsIDRequest 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 PatchOrgsID(ctx _context.Context, orgID string) ApiPatchOrgsIDRequest
/* /*
@ -198,10 +361,21 @@ type OrganizationsApi interface {
PatchOrgsIDExecuteWithHttpInfo(r ApiPatchOrgsIDRequest) (Organization, *_nethttp.Response, error) PatchOrgsIDExecuteWithHttpInfo(r ApiPatchOrgsIDRequest) (Organization, *_nethttp.Response, error)
/* /*
* PostOrgs Create an organization * PostOrgs Create an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Creates an [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization)
* @return ApiPostOrgsRequest 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 PostOrgs(ctx _context.Context) ApiPostOrgsRequest
/* /*
@ -219,11 +393,39 @@ type OrganizationsApi interface {
PostOrgsExecuteWithHttpInfo(r ApiPostOrgsRequest) (Organization, *_nethttp.Response, error) PostOrgsExecuteWithHttpInfo(r ApiPostOrgsRequest) (Organization, *_nethttp.Response, error)
/* /*
* PostOrgsIDMembers Add a member to an organization * 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(). * Add a user to an organization.
* @param orgID The organization ID.
* @return ApiPostOrgsIDMembersRequest 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 PostOrgsIDMembers(ctx _context.Context, orgID string) ApiPostOrgsIDMembersRequest
/* /*
@ -241,11 +443,30 @@ type OrganizationsApi interface {
PostOrgsIDMembersExecuteWithHttpInfo(r ApiPostOrgsIDMembersRequest) (ResourceMember, *_nethttp.Response, error) PostOrgsIDMembersExecuteWithHttpInfo(r ApiPostOrgsIDMembersRequest) (ResourceMember, *_nethttp.Response, error)
/* /*
* PostOrgsIDOwners Add an owner to an organization * 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(). * Adds an owner to an organization.
* @param orgID The organization ID.
* @return ApiPostOrgsIDOwnersRequest 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 PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest
/* /*
@ -299,10 +520,36 @@ func (r ApiDeleteOrgsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error
/* /*
* DeleteOrgsID Delete an organization * 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 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. * @param orgID The ID of the organization to delete.
* @return ApiDeleteOrgsIDRequest * @return ApiDeleteOrgsIDRequest
*/ */
func (a *OrganizationsApiService) DeleteOrgsID(ctx _context.Context, orgID string) ApiDeleteOrgsIDRequest { func (a *OrganizationsApiService) DeleteOrgsID(ctx _context.Context, orgID string) ApiDeleteOrgsIDRequest {
return ApiDeleteOrgsIDRequest{ return ApiDeleteOrgsIDRequest{
ApiService: a, ApiService: a,
@ -394,6 +641,17 @@ func (a *OrganizationsApiService) DeleteOrgsIDExecuteWithHttpInfo(r ApiDeleteOrg
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 { if localVarHTTPResponse.StatusCode == 404 {
var v Error var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 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 * 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 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 userID The ID of the user to remove.
* @param orgID The organization ID. * @param orgID The ID of the organization to remove a user from.
* @return ApiDeleteOrgsIDMembersIDRequest * @return ApiDeleteOrgsIDMembersIDRequest
*/ */
func (a *OrganizationsApiService) DeleteOrgsIDMembersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDMembersIDRequest { func (a *OrganizationsApiService) DeleteOrgsIDMembersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDMembersIDRequest {
return ApiDeleteOrgsIDMembersIDRequest{ return ApiDeleteOrgsIDMembersIDRequest{
ApiService: a, ApiService: a,
@ -559,6 +843,17 @@ func (a *OrganizationsApiService) DeleteOrgsIDMembersIDExecuteWithHttpInfo(r Api
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -615,11 +910,36 @@ func (r ApiDeleteOrgsIDOwnersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Respons
/* /*
* DeleteOrgsIDOwnersID Remove an owner from an organization * 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 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 userID The ID of the user to remove.
* @param orgID The organization ID. * @param orgID The ID of the organization to remove an owner from.
* @return ApiDeleteOrgsIDOwnersIDRequest * @return ApiDeleteOrgsIDOwnersIDRequest
*/ */
func (a *OrganizationsApiService) DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest { func (a *OrganizationsApiService) DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest {
return ApiDeleteOrgsIDOwnersIDRequest{ return ApiDeleteOrgsIDOwnersIDRequest{
ApiService: a, ApiService: a,
@ -713,6 +1033,17 @@ func (a *OrganizationsApiService) DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiD
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetOrgsRequest * @return ApiGetOrgsRequest
*/ */
func (a *OrganizationsApiService) GetOrgs(ctx _context.Context) ApiGetOrgsRequest { func (a *OrganizationsApiService) GetOrgs(ctx _context.Context) ApiGetOrgsRequest {
return ApiGetOrgsRequest{ return ApiGetOrgsRequest{
ApiService: a, ApiService: a,
@ -918,6 +1262,50 @@ func (a *OrganizationsApiService) GetOrgsExecuteWithHttpInfo(r ApiGetOrgsRequest
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -984,10 +1372,18 @@ func (r ApiGetOrgsIDRequest) ExecuteWithHttpInfo() (Organization, *_nethttp.Resp
/* /*
* GetOrgsID Retrieve an organization * 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 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 * @return ApiGetOrgsIDRequest
*/ */
func (a *OrganizationsApiService) GetOrgsID(ctx _context.Context, orgID string) ApiGetOrgsIDRequest { func (a *OrganizationsApiService) GetOrgsID(ctx _context.Context, orgID string) ApiGetOrgsIDRequest {
return ApiGetOrgsIDRequest{ return ApiGetOrgsIDRequest{
ApiService: a, ApiService: a,
@ -1082,6 +1478,28 @@ func (a *OrganizationsApiService) GetOrgsIDExecuteWithHttpInfo(r ApiGetOrgsIDReq
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1148,10 +1566,40 @@ func (r ApiGetOrgsIDMembersRequest) ExecuteWithHttpInfo() (ResourceMembers, *_ne
/* /*
* GetOrgsIDMembers List all members of an organization * 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 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 * @return ApiGetOrgsIDMembersRequest
*/ */
func (a *OrganizationsApiService) GetOrgsIDMembers(ctx _context.Context, orgID string) ApiGetOrgsIDMembersRequest { func (a *OrganizationsApiService) GetOrgsIDMembers(ctx _context.Context, orgID string) ApiGetOrgsIDMembersRequest {
return ApiGetOrgsIDMembersRequest{ return ApiGetOrgsIDMembersRequest{
ApiService: a, ApiService: a,
@ -1246,6 +1694,17 @@ func (a *OrganizationsApiService) GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOr
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 { if localVarHTTPResponse.StatusCode == 404 {
var v Error var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 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 * 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 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 * @return ApiGetOrgsIDOwnersRequest
*/ */
func (a *OrganizationsApiService) GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest { func (a *OrganizationsApiService) GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest {
return ApiGetOrgsIDOwnersRequest{ return ApiGetOrgsIDOwnersRequest{
ApiService: a, ApiService: a,
@ -1507,10 +1980,31 @@ func (r ApiPatchOrgsIDRequest) ExecuteWithHttpInfo() (Organization, *_nethttp.Re
/* /*
* PatchOrgsID Update an organization * 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 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 * @return ApiPatchOrgsIDRequest
*/ */
func (a *OrganizationsApiService) PatchOrgsID(ctx _context.Context, orgID string) ApiPatchOrgsIDRequest { func (a *OrganizationsApiService) PatchOrgsID(ctx _context.Context, orgID string) ApiPatchOrgsIDRequest {
return ApiPatchOrgsIDRequest{ return ApiPatchOrgsIDRequest{
ApiService: a, ApiService: a,
@ -1610,6 +2104,17 @@ func (a *OrganizationsApiService) PatchOrgsIDExecuteWithHttpInfo(r ApiPatchOrgsI
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1676,9 +2181,20 @@ func (r ApiPostOrgsRequest) ExecuteWithHttpInfo() (Organization, *_nethttp.Respo
/* /*
* PostOrgs Create an organization * 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostOrgsRequest * @return ApiPostOrgsRequest
*/ */
func (a *OrganizationsApiService) PostOrgs(ctx _context.Context) ApiPostOrgsRequest { func (a *OrganizationsApiService) PostOrgs(ctx _context.Context) ApiPostOrgsRequest {
return ApiPostOrgsRequest{ return ApiPostOrgsRequest{
ApiService: a, ApiService: a,
@ -1776,6 +2292,17 @@ func (a *OrganizationsApiService) PostOrgsExecuteWithHttpInfo(r ApiPostOrgsReque
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1851,10 +2378,38 @@ func (r ApiPostOrgsIDMembersRequest) ExecuteWithHttpInfo() (ResourceMember, *_ne
/* /*
* PostOrgsIDMembers Add a member to an organization * 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 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 * @return ApiPostOrgsIDMembersRequest
*/ */
func (a *OrganizationsApiService) PostOrgsIDMembers(ctx _context.Context, orgID string) ApiPostOrgsIDMembersRequest { func (a *OrganizationsApiService) PostOrgsIDMembers(ctx _context.Context, orgID string) ApiPostOrgsIDMembersRequest {
return ApiPostOrgsIDMembersRequest{ return ApiPostOrgsIDMembersRequest{
ApiService: a, ApiService: a,
@ -1954,6 +2509,17 @@ func (a *OrganizationsApiService) PostOrgsIDMembersExecuteWithHttpInfo(r ApiPost
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -2029,10 +2595,29 @@ func (r ApiPostOrgsIDOwnersRequest) ExecuteWithHttpInfo() (ResourceOwner, *_neth
/* /*
* PostOrgsIDOwners Add an owner to an organization * 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 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 * @return ApiPostOrgsIDOwnersRequest
*/ */
func (a *OrganizationsApiService) PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest { func (a *OrganizationsApiService) PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest {
return ApiPostOrgsIDOwnersRequest{ return ApiPostOrgsIDOwnersRequest{
ApiService: a, ApiService: a,
@ -2132,6 +2717,17 @@ func (a *OrganizationsApiService) PostOrgsIDOwnersExecuteWithHttpInfo(r ApiPostO
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {

View File

@ -25,11 +25,23 @@ var (
type PingApi interface { type PingApi interface {
/* /*
* GetPing Get the status and version of the instance * GetPing Get the status of the instance
* Returns the status and InfluxDB version of the instance. * Retrieves 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 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 GetPing(ctx _context.Context) ApiGetPingRequest
/* /*
@ -45,11 +57,23 @@ type PingApi interface {
GetPingExecuteWithHttpInfo(r ApiGetPingRequest) (*_nethttp.Response, error) GetPingExecuteWithHttpInfo(r ApiGetPingRequest) (*_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. * 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 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 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 * GetPing Get the status of the instance
* Returns the status and InfluxDB version 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetPingRequest * @return ApiGetPingRequest
*/ */
func (a *PingApiService) GetPing(ctx _context.Context) ApiGetPingRequest { func (a *PingApiService) GetPing(ctx _context.Context) ApiGetPingRequest {
return ApiGetPingRequest{ return ApiGetPingRequest{
ApiService: a, 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. * 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiHeadPingRequest * @return ApiHeadPingRequest
*/ */
func (a *PingApiService) HeadPing(ctx _context.Context) ApiHeadPingRequest { func (a *PingApiService) HeadPing(ctx _context.Context) ApiHeadPingRequest {
return ApiHeadPingRequest{ return ApiHeadPingRequest{
ApiService: a, ApiService: a,

View File

@ -26,11 +26,36 @@ var (
type SigninApi interface { type SigninApi interface {
/* /*
* PostSignin Create a user session. * 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)
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). for a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user),
* @return ApiPostSigninRequest 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 PostSignin(ctx _context.Context) ApiPostSigninRequest
/* /*
@ -73,10 +98,35 @@ func (r ApiPostSigninRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error)
/* /*
* PostSignin Create a user session. * 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostSigninRequest * @return ApiPostSigninRequest
*/ */
func (a *SigninApiService) PostSignin(ctx _context.Context) ApiPostSigninRequest { func (a *SigninApiService) PostSignin(ctx _context.Context) ApiPostSigninRequest {
return ApiPostSigninRequest{ return ApiPostSigninRequest{
ApiService: a, ApiService: a,

View File

@ -29,7 +29,7 @@ type TasksApi interface {
/* /*
* DeleteTasksID Delete a task * 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). 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. 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). 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 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 * @return ApiDeleteTasksIDRequest
*/ */
DeleteTasksID(ctx _context.Context, taskID string) ApiDeleteTasksIDRequest DeleteTasksID(ctx _context.Context, taskID string) ApiDeleteTasksIDRequest
@ -62,10 +62,10 @@ type TasksApi interface {
#### InfluxDB Cloud #### 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 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. * @param runID The ID of the task run to cancel.
* @return ApiDeleteTasksIDRunsIDRequest * @return ApiDeleteTasksIDRunsIDRequest
*/ */
@ -85,7 +85,7 @@ type TasksApi interface {
/* /*
* GetTasks List all tasks * 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. 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`. 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) GetTasksExecuteWithHttpInfo(r ApiGetTasksRequest) (Tasks, *_nethttp.Response, error)
/* /*
* GetTasksID Retrieve a task * GetTasksID Retrieve a task
* Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) * Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).
by ID.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @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 * @return ApiGetTasksIDRequest
*/ */
GetTasksID(ctx _context.Context, taskID string) 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. 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 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 retrieve runs for.
* @param runID The run ID. * @param runID The ID of the run to retrieve.
* @return ApiGetTasksIDRunsIDRequest * @return ApiGetTasksIDRunsIDRequest
*/ */
GetTasksIDRunsID(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDRequest GetTasksIDRunsID(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDRequest
@ -219,12 +218,17 @@ type TasksApi interface {
GetTasksIDRunsIDExecuteWithHttpInfo(r ApiGetTasksIDRunsIDRequest) (Run, *_nethttp.Response, error) GetTasksIDRunsIDExecuteWithHttpInfo(r ApiGetTasksIDRunsIDRequest) (Run, *_nethttp.Response, error)
/* /*
* GetTasksIDRunsIDLogs Retrieve all logs for a run * 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(). * Retrieves all logs for a task run.
* @param taskID The ID of the task to get logs for. A log is a list of run events with `runID`, `time`, and `message` properties.
* @param runID The ID of the run to get logs for.
* @return ApiGetTasksIDRunsIDLogsRequest 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 GetTasksIDRunsIDLogs(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDLogsRequest
/* /*
@ -243,17 +247,63 @@ type TasksApi interface {
/* /*
* PatchTasksID Update a task * 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. 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 update a task, pass an object that contains the updated key-value pairs.
To activate or inactivate a task, set the `status` property. To activate or inactivate a task, set the `status` property.
_`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. _`"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 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 * @return ApiPatchTasksIDRequest
*/ */
PatchTasksID(ctx _context.Context, taskID string) ApiPatchTasksIDRequest PatchTasksID(ctx _context.Context, taskID string) ApiPatchTasksIDRequest
@ -274,17 +324,54 @@ type TasksApi interface {
/* /*
* PostTasks Create a task * 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. 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 #### 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 #### Related guides
@ -317,6 +404,11 @@ type TasksApi interface {
* Schedules a task run to start immediately, ignoring scheduled runs. * Schedules a task run to start immediately, ignoring scheduled runs.
Use this endpoint to manually start a task run. 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 ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param taskID * @param taskID
@ -339,12 +431,22 @@ type TasksApi interface {
PostTasksIDRunsExecuteWithHttpInfo(r ApiPostTasksIDRunsRequest) (Run, *_nethttp.Response, error) PostTasksIDRunsExecuteWithHttpInfo(r ApiPostTasksIDRunsRequest) (Run, *_nethttp.Response, error)
/* /*
* PostTasksIDRunsIDRetry Retry a task run * PostTasksIDRunsIDRetry Retry a task run
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to
* @param taskID The task ID. retry and returns the scheduled run.
* @param runID The run ID.
* @return ApiPostTasksIDRunsIDRetryRequest 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 PostTasksIDRunsIDRetry(ctx _context.Context, taskID string, runID string) ApiPostTasksIDRunsIDRetryRequest
/* /*
@ -398,7 +500,7 @@ func (r ApiDeleteTasksIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, erro
/* /*
* DeleteTasksID Delete a task * 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). 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. 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). 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 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 * @return ApiDeleteTasksIDRequest
*/ */
func (a *TasksApiService) DeleteTasksID(ctx _context.Context, taskID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -562,10 +675,10 @@ Use this endpoint with InfluxDB OSS to cancel a running task.
#### InfluxDB Cloud #### 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 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. * @param runID The ID of the task run to cancel.
* @return ApiDeleteTasksIDRunsIDRequest * @return ApiDeleteTasksIDRunsIDRequest
*/ */
@ -662,6 +775,17 @@ func (a *TasksApiService) DeleteTasksIDRunsIDExecuteWithHttpInfo(r ApiDeleteTask
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 { if localVarHTTPResponse.StatusCode == 405 {
var v Error var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) 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 * 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. 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`. 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status newErr.error = localVarHTTPResponse.Status
if localVarHTTPResponse.StatusCode == 401 { if localVarHTTPResponse.StatusCode == 401 {
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())
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")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) 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 * GetTasksID Retrieve a task
* Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) * Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).
by ID.
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @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 * @return ApiGetTasksIDRequest
*/ */
func (a *TasksApiService) GetTasksID(ctx _context.Context, taskID string) ApiGetTasksIDRequest { func (a *TasksApiService) GetTasksID(ctx _context.Context, taskID string) ApiGetTasksIDRequest {
return ApiGetTasksIDRequest{ return ApiGetTasksIDRequest{
ApiService: a, ApiService: a,
@ -1132,8 +1244,8 @@ func (a *TasksApiService) GetTasksIDExecuteWithHttpInfo(r ApiGetTasksIDRequest)
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status newErr.error = localVarHTTPResponse.Status
if localVarHTTPResponse.StatusCode == 400 { if localVarHTTPResponse.StatusCode == 401 {
var v Error var v UnauthorizedRequestError
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
@ -1315,6 +1427,17 @@ func (a *TasksApiService) GetTasksIDLogsExecuteWithHttpInfo(r ApiGetTasksIDLogsR
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1532,6 +1655,17 @@ func (a *TasksApiService) GetTasksIDRunsExecuteWithHttpInfo(r ApiGetTasksIDRunsR
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { 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. 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 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 retrieve runs for.
* @param runID The run ID. * @param runID The ID of the run to retrieve.
* @return ApiGetTasksIDRunsIDRequest * @return ApiGetTasksIDRunsIDRequest
*/ */
func (a *TasksApiService) GetTasksIDRunsID(ctx _context.Context, taskID string, runID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1787,11 +1932,16 @@ func (r ApiGetTasksIDRunsIDLogsRequest) ExecuteWithHttpInfo() (Logs, *_nethttp.R
/* /*
* GetTasksIDRunsIDLogs Retrieve all logs for a run * 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 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 taskID The ID of the task to get logs for.
* @param runID The ID of the run to get logs for. * @param runID The ID of the run to get logs for.
* @return ApiGetTasksIDRunsIDLogsRequest * @return ApiGetTasksIDRunsIDLogsRequest
*/ */
func (a *TasksApiService) GetTasksIDRunsIDLogs(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDLogsRequest { func (a *TasksApiService) GetTasksIDRunsIDLogs(ctx _context.Context, taskID string, runID string) ApiGetTasksIDRunsIDLogsRequest {
return ApiGetTasksIDRunsIDLogsRequest{ return ApiGetTasksIDRunsIDLogsRequest{
ApiService: a, ApiService: a,
@ -1888,6 +2038,17 @@ func (a *TasksApiService) GetTasksIDRunsIDLogsExecuteWithHttpInfo(r ApiGetTasksI
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1963,17 +2124,63 @@ func (r ApiPatchTasksIDRequest) ExecuteWithHttpInfo() (Task, *_nethttp.Response,
/* /*
* PatchTasksID Update a task * 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. 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 update a task, pass an object that contains the updated key-value pairs.
To activate or inactivate a task, set the `status` property. To activate or inactivate a task, set the `status` property.
_`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. _`"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 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 * @return ApiPatchTasksIDRequest
*/ */
func (a *TasksApiService) PatchTasksID(ctx _context.Context, taskID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -2141,17 +2359,54 @@ func (r ApiPostTasksRequest) ExecuteWithHttpInfo() (Task, *_nethttp.Response, er
/* /*
* PostTasks Create a task * 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. 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 #### 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 #### Related guides
@ -2271,6 +2526,17 @@ func (a *TasksApiService) PostTasksExecuteWithHttpInfo(r ApiPostTasksRequest) (T
newErr.model = &v newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -2349,6 +2615,11 @@ func (r ApiPostTasksIDRunsRequest) ExecuteWithHttpInfo() (Run, *_nethttp.Respons
* Schedules a task run to start immediately, ignoring scheduled runs. * Schedules a task run to start immediately, ignoring scheduled runs.
Use this endpoint to manually start a task run. 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 ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param taskID * @param taskID
@ -2450,6 +2721,17 @@ func (a *TasksApiService) PostTasksIDRunsExecuteWithHttpInfo(r ApiPostTasksIDRun
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -2534,11 +2816,21 @@ func (r ApiPostTasksIDRunsIDRetryRequest) ExecuteWithHttpInfo() (Run, *_nethttp.
/* /*
* PostTasksIDRunsIDRetry Retry a task run * 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 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 retry.
* @param runID The run ID. * @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 * @return ApiPostTasksIDRunsIDRetryRequest
*/ */
func (a *TasksApiService) PostTasksIDRunsIDRetry(ctx _context.Context, taskID string, runID string) ApiPostTasksIDRunsIDRetryRequest { func (a *TasksApiService) PostTasksIDRunsIDRetry(ctx _context.Context, taskID string, runID string) ApiPostTasksIDRunsIDRetryRequest {
return ApiPostTasksIDRunsIDRetryRequest{ return ApiPostTasksIDRunsIDRetryRequest{
ApiService: a, ApiService: a,
@ -2637,6 +2929,28 @@ func (a *TasksApiService) PostTasksIDRunsIDRetryExecuteWithHttpInfo(r ApiPostTas
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {

View File

@ -27,11 +27,25 @@ var (
type UsersApi interface { type UsersApi interface {
/* /*
* DeleteUsersID Delete a user * DeleteUsersID Delete a user
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Deletes a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).
* @param userID The ID of the user to delete.
* @return ApiDeleteUsersIDRequest #### 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 DeleteUsersID(ctx _context.Context, userID string) ApiDeleteUsersIDRequest
/* /*
@ -47,10 +61,24 @@ type UsersApi interface {
DeleteUsersIDExecuteWithHttpInfo(r ApiDeleteUsersIDRequest) (*_nethttp.Response, error) DeleteUsersIDExecuteWithHttpInfo(r ApiDeleteUsersIDRequest) (*_nethttp.Response, error)
/* /*
* GetUsers List all users * GetUsers List users
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves a list of [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).
* @return ApiGetUsersRequest 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 GetUsers(ctx _context.Context) ApiGetUsersRequest
/* /*
@ -68,11 +96,17 @@ type UsersApi interface {
GetUsersExecuteWithHttpInfo(r ApiGetUsersRequest) (Users, *_nethttp.Response, error) GetUsersExecuteWithHttpInfo(r ApiGetUsersRequest) (Users, *_nethttp.Response, error)
/* /*
* GetUsersID Retrieve a user * GetUsersID Retrieve a user
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Retrieves a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).
* @param userID The user ID.
* @return ApiGetUsersIDRequest #### 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 GetUsersID(ctx _context.Context, userID string) ApiGetUsersIDRequest
/* /*
@ -90,11 +124,25 @@ type UsersApi interface {
GetUsersIDExecuteWithHttpInfo(r ApiGetUsersIDRequest) (UserResponse, *_nethttp.Response, error) GetUsersIDExecuteWithHttpInfo(r ApiGetUsersIDRequest) (UserResponse, *_nethttp.Response, error)
/* /*
* PatchUsersID Update a user * PatchUsersID Update a user
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Updates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) and returns the user.
* @param userID The ID of the user to update.
* @return ApiPatchUsersIDRequest #### 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 PatchUsersID(ctx _context.Context, userID string) ApiPatchUsersIDRequest
/* /*
@ -112,10 +160,39 @@ type UsersApi interface {
PatchUsersIDExecuteWithHttpInfo(r ApiPatchUsersIDRequest) (UserResponse, *_nethttp.Response, error) PatchUsersIDExecuteWithHttpInfo(r ApiPatchUsersIDRequest) (UserResponse, *_nethttp.Response, error)
/* /*
* PostUsers Create a user * PostUsers Create a user
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * Creates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that can access InfluxDB.
* @return ApiPostUsersRequest 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 PostUsers(ctx _context.Context) ApiPostUsersRequest
/* /*
@ -134,13 +211,20 @@ type UsersApi interface {
/* /*
* PostUsersIDPassword Update a password * PostUsersIDPassword Update a password
* #### InfluxDB Cloud * Updates a user password.
InfluxDB Cloud does not support changing user passwords through the API. #### InfluxDB Cloud
Use the InfluxDB Cloud user interface to update your password.
- 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 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 * @return ApiPostUsersIDPasswordRequest
*/ */
PostUsersIDPassword(ctx _context.Context, userID string) 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. * content should be achieved through the returned response model if applicable.
*/ */
PostUsersIDPasswordExecuteWithHttpInfo(r ApiPostUsersIDPasswordRequest) (*_nethttp.Response, error) 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 // UsersApiService UsersApi service
@ -194,10 +314,24 @@ func (r ApiDeleteUsersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, erro
/* /*
* DeleteUsersID Delete a user * 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 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 * @return ApiDeleteUsersIDRequest
*/ */
func (a *UsersApiService) DeleteUsersID(ctx _context.Context, userID string) ApiDeleteUsersIDRequest { func (a *UsersApiService) DeleteUsersID(ctx _context.Context, userID string) ApiDeleteUsersIDRequest {
return ApiDeleteUsersIDRequest{ return ApiDeleteUsersIDRequest{
ApiService: a, ApiService: a,
@ -289,6 +423,28 @@ func (a *UsersApiService) DeleteUsersIDExecuteWithHttpInfo(r ApiDeleteUsersIDReq
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetUsersRequest * @return ApiGetUsersRequest
*/ */
func (a *UsersApiService) GetUsers(ctx _context.Context) ApiGetUsersRequest { func (a *UsersApiService) GetUsers(ctx _context.Context) ApiGetUsersRequest {
return ApiGetUsersRequest{ return ApiGetUsersRequest{
ApiService: a, ApiService: a,
@ -482,6 +652,28 @@ func (a *UsersApiService) GetUsersExecuteWithHttpInfo(r ApiGetUsersRequest) (Use
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -548,10 +740,16 @@ func (r ApiGetUsersIDRequest) ExecuteWithHttpInfo() (UserResponse, *_nethttp.Res
/* /*
* GetUsersID Retrieve a user * 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 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 * @return ApiGetUsersIDRequest
*/ */
func (a *UsersApiService) GetUsersID(ctx _context.Context, userID string) ApiGetUsersIDRequest { func (a *UsersApiService) GetUsersID(ctx _context.Context, userID string) ApiGetUsersIDRequest {
return ApiGetUsersIDRequest{ return ApiGetUsersIDRequest{
ApiService: a, ApiService: a,
@ -721,10 +919,24 @@ func (r ApiPatchUsersIDRequest) ExecuteWithHttpInfo() (UserResponse, *_nethttp.R
/* /*
* PatchUsersID Update a user * 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 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 * @return ApiPatchUsersIDRequest
*/ */
func (a *UsersApiService) PatchUsersID(ctx _context.Context, userID string) ApiPatchUsersIDRequest { func (a *UsersApiService) PatchUsersID(ctx _context.Context, userID string) ApiPatchUsersIDRequest {
return ApiPatchUsersIDRequest{ return ApiPatchUsersIDRequest{
ApiService: a, ApiService: a,
@ -824,6 +1036,17 @@ func (a *UsersApiService) PatchUsersIDExecuteWithHttpInfo(r ApiPatchUsersIDReque
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -890,9 +1113,38 @@ func (r ApiPostUsersRequest) ExecuteWithHttpInfo() (UserResponse, *_nethttp.Resp
/* /*
* PostUsers Create a user * 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(). * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiPostUsersRequest * @return ApiPostUsersRequest
*/ */
func (a *UsersApiService) PostUsers(ctx _context.Context) ApiPostUsersRequest { func (a *UsersApiService) PostUsers(ctx _context.Context) ApiPostUsersRequest {
return ApiPostUsersRequest{ return ApiPostUsersRequest{
ApiService: a, ApiService: a,
@ -990,6 +1242,28 @@ func (a *UsersApiService) PostUsersExecuteWithHttpInfo(r ApiPostUsersRequest) (U
} }
newErr.body = localVarBody newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
@ -1065,13 +1339,20 @@ func (r ApiPostUsersIDPasswordRequest) ExecuteWithHttpInfo() (*_nethttp.Response
/* /*
* PostUsersIDPassword Update a password * PostUsersIDPassword Update a password
* #### InfluxDB Cloud * Updates a user password.
InfluxDB Cloud does not support changing user passwords through the API. #### InfluxDB Cloud
Use the InfluxDB Cloud user interface to update your password.
- 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 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 * @return ApiPostUsersIDPasswordRequest
*/ */
func (a *UsersApiService) PostUsersIDPassword(ctx _context.Context, userID string) 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.body = localVarBody
newErr.error = localVarHTTPResponse.Status 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 var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {

View File

@ -33,31 +33,29 @@ type WriteApi interface {
#### InfluxDB Cloud #### 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. 1. Validates the request and queues the write.
2. If the write is queued, responds with an HTTP `204` status code. 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise.
3. Handles the write asynchronously and reaches eventual consistency. 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, 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. when you receive the response.
#### InfluxDB OSS #### InfluxDB OSS
- Validates the request, handles the write synchronously, - Validates the request and handles the write synchronously.
and then responds with success or failure. - If all points were written successfully, responds with HTTP `2xx` status code;
- If all points were written successfully, returns `204`, otherwise, returns the first line that failed.
otherwise returns the first line that failed.
#### Required permissions #### Required permissions
- `write-buckets` or `write-bucket BUCKET_ID`. - `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) #### Rate limits (with InfluxDB Cloud)
@ -66,8 +64,8 @@ type WriteApi interface {
#### Related guides #### Related guides
- [Write data with the InfluxDB API]({{% INFLUXDB_DOCS_URL %}}/write-data/developer-tools/api). - [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/). - [Optimize writes to InfluxDB]({{% INFLUXDB_DOCS_URL %}}/write-data/best-practices/optimize-writes/)
- [Troubleshoot issues writing data]({{% INFLUXDB_DOCS_URL %}}/write-data/troubleshoot/) - [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(). * @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 #### 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. 1. Validates the request and queues the write.
2. If the write is queued, responds with an HTTP `204` status code. 2. If queued, responds with _success_ (HTTP `2xx` status code); _error_ otherwise.
3. Handles the write asynchronously and reaches eventual consistency. 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, 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. when you receive the response.
#### InfluxDB OSS #### InfluxDB OSS
- Validates the request, handles the write synchronously, - Validates the request and handles the write synchronously.
and then responds with success or failure. - If all points were written successfully, responds with HTTP `2xx` status code;
- If all points were written successfully, returns `204`, otherwise, returns the first line that failed.
otherwise returns the first line that failed.
#### Required permissions #### Required permissions
- `write-buckets` or `write-bucket BUCKET_ID`. - `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) #### Rate limits (with InfluxDB Cloud)
@ -235,8 +231,8 @@ For more information, see [limits and adjustable quotas](https://docs.influxdata
#### Related guides #### Related guides
- [Write data with the InfluxDB API]({{% INFLUXDB_DOCS_URL %}}/write-data/developer-tools/api). - [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/). - [Optimize writes to InfluxDB]({{% INFLUXDB_DOCS_URL %}}/write-data/best-practices/optimize-writes/)
- [Troubleshoot issues writing data]({{% INFLUXDB_DOCS_URL %}}/write-data/troubleshoot/) - [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(). * @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 newErr.model = &v
return localVarHTTPResponse, newErr return localVarHTTPResponse, newErr
} }
if localVarHTTPResponse.StatusCode == 404 { if localVarHTTPResponse.StatusCode == 401 {
var v Error var v UnauthorizedRequestError
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil { if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())

View File

@ -7,7 +7,7 @@ paths: {}
components: components:
schemas: schemas:
ResourceEnumOSS: ResourceEnumOSS:
$ref: "./openapi/src/common/schemas/Resource.yml#/properties/type" $ref: "./openapi/src/oss/schemas/Resource.yml#/properties/type"
ResourceEnumCloud: ResourceEnumCloud:
$ref: "./openapi/src/cloud/schemas/Resource.yml#/properties/type" $ref: "./openapi/src/cloud/schemas/Resource.yml#/properties/type"

View File

@ -146,6 +146,8 @@ components:
responses: responses:
ServerError: ServerError:
$ref: "./openapi/src/common/responses/ServerError.yml" $ref: "./openapi/src/common/responses/ServerError.yml"
AuthorizationError:
$ref: "./openapi/src/common/responses/AuthorizationError.yml"
schemas: schemas:
Error: Error:
$ref: "./openapi/src/common/schemas/Error.yml" $ref: "./openapi/src/common/schemas/Error.yml"
@ -487,3 +489,5 @@ components:
$ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptHTTPResponseData.yml" $ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptHTTPResponseData.yml"
ScriptLanguage: ScriptLanguage:
$ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptLanguage.yml" $ref: "./openapi/src/svc/invocable-scripts/schemas/ScriptLanguage.yml"
UnauthorizedRequestError:
$ref: "./openapi/src/common/schemas/UnauthorizedRequestError.yml"

View File

@ -126,3 +126,11 @@ func (o *TemplateSummaryError) Error() string {
func (o *TemplateSummaryError) ErrorCode() ErrorCode { func (o *TemplateSummaryError) ErrorCode() ErrorCode {
return ErrorCode(o.Code) return ErrorCode(o.Code)
} }
func (o *UnauthorizedRequestError) Error() string {
return o.GetMessage()
}
func (o *UnauthorizedRequestError) ErrorCode() ErrorCode {
return ErrorCode(o.GetCode())
}

View File

@ -15,7 +15,7 @@ import (
"fmt" "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 type ResourceEnumCloud string
// List of ResourceEnumCloud // List of ResourceEnumCloud
@ -36,13 +36,14 @@ const (
RESOURCEENUMCLOUD_NOTIFICATION_ENDPOINTS ResourceEnumCloud = "notificationEndpoints" RESOURCEENUMCLOUD_NOTIFICATION_ENDPOINTS ResourceEnumCloud = "notificationEndpoints"
RESOURCEENUMCLOUD_CHECKS ResourceEnumCloud = "checks" RESOURCEENUMCLOUD_CHECKS ResourceEnumCloud = "checks"
RESOURCEENUMCLOUD_DBRP ResourceEnumCloud = "dbrp" RESOURCEENUMCLOUD_DBRP ResourceEnumCloud = "dbrp"
RESOURCEENUMCLOUD_FLOWS ResourceEnumCloud = "flows"
RESOURCEENUMCLOUD_ANNOTATIONS ResourceEnumCloud = "annotations" RESOURCEENUMCLOUD_ANNOTATIONS ResourceEnumCloud = "annotations"
RESOURCEENUMCLOUD_FLOWS ResourceEnumCloud = "flows"
RESOURCEENUMCLOUD_FUNCTIONS ResourceEnumCloud = "functions" RESOURCEENUMCLOUD_FUNCTIONS ResourceEnumCloud = "functions"
RESOURCEENUMCLOUD_SUBSCRIPTIONS ResourceEnumCloud = "subscriptions"
) )
func ResourceEnumCloudValues() []ResourceEnumCloud { 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 { func (v *ResourceEnumCloud) UnmarshalJSON(src []byte) error {
@ -52,7 +53,7 @@ func (v *ResourceEnumCloud) UnmarshalJSON(src []byte) error {
return err return err
} }
enumTypeValue := ResourceEnumCloud(value) 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 { if existing == enumTypeValue {
*v = enumTypeValue *v = enumTypeValue
return nil return nil

View File

@ -15,7 +15,7 @@ import (
"fmt" "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 type ResourceEnumOSS string
// List of ResourceEnumOSS // List of ResourceEnumOSS
@ -24,12 +24,10 @@ const (
RESOURCEENUMOSS_BUCKETS ResourceEnumOSS = "buckets" RESOURCEENUMOSS_BUCKETS ResourceEnumOSS = "buckets"
RESOURCEENUMOSS_DASHBOARDS ResourceEnumOSS = "dashboards" RESOURCEENUMOSS_DASHBOARDS ResourceEnumOSS = "dashboards"
RESOURCEENUMOSS_ORGS ResourceEnumOSS = "orgs" RESOURCEENUMOSS_ORGS ResourceEnumOSS = "orgs"
RESOURCEENUMOSS_SOURCES ResourceEnumOSS = "sources"
RESOURCEENUMOSS_TASKS ResourceEnumOSS = "tasks" RESOURCEENUMOSS_TASKS ResourceEnumOSS = "tasks"
RESOURCEENUMOSS_TELEGRAFS ResourceEnumOSS = "telegrafs" RESOURCEENUMOSS_TELEGRAFS ResourceEnumOSS = "telegrafs"
RESOURCEENUMOSS_USERS ResourceEnumOSS = "users" RESOURCEENUMOSS_USERS ResourceEnumOSS = "users"
RESOURCEENUMOSS_VARIABLES ResourceEnumOSS = "variables" RESOURCEENUMOSS_VARIABLES ResourceEnumOSS = "variables"
RESOURCEENUMOSS_SCRAPERS ResourceEnumOSS = "scrapers"
RESOURCEENUMOSS_SECRETS ResourceEnumOSS = "secrets" RESOURCEENUMOSS_SECRETS ResourceEnumOSS = "secrets"
RESOURCEENUMOSS_LABELS ResourceEnumOSS = "labels" RESOURCEENUMOSS_LABELS ResourceEnumOSS = "labels"
RESOURCEENUMOSS_VIEWS ResourceEnumOSS = "views" RESOURCEENUMOSS_VIEWS ResourceEnumOSS = "views"
@ -38,15 +36,17 @@ const (
RESOURCEENUMOSS_NOTIFICATION_ENDPOINTS ResourceEnumOSS = "notificationEndpoints" RESOURCEENUMOSS_NOTIFICATION_ENDPOINTS ResourceEnumOSS = "notificationEndpoints"
RESOURCEENUMOSS_CHECKS ResourceEnumOSS = "checks" RESOURCEENUMOSS_CHECKS ResourceEnumOSS = "checks"
RESOURCEENUMOSS_DBRP ResourceEnumOSS = "dbrp" RESOURCEENUMOSS_DBRP ResourceEnumOSS = "dbrp"
RESOURCEENUMOSS_NOTEBOOKS ResourceEnumOSS = "notebooks"
RESOURCEENUMOSS_ANNOTATIONS ResourceEnumOSS = "annotations" RESOURCEENUMOSS_ANNOTATIONS ResourceEnumOSS = "annotations"
RESOURCEENUMOSS_SOURCES ResourceEnumOSS = "sources"
RESOURCEENUMOSS_SCRAPERS ResourceEnumOSS = "scrapers"
RESOURCEENUMOSS_NOTEBOOKS ResourceEnumOSS = "notebooks"
RESOURCEENUMOSS_REMOTES ResourceEnumOSS = "remotes" RESOURCEENUMOSS_REMOTES ResourceEnumOSS = "remotes"
RESOURCEENUMOSS_REPLICATIONS ResourceEnumOSS = "replications" RESOURCEENUMOSS_REPLICATIONS ResourceEnumOSS = "replications"
RESOURCEENUMOSS_INSTANCE ResourceEnumOSS = "instance" RESOURCEENUMOSS_INSTANCE ResourceEnumOSS = "instance"
) )
func ResourceEnumOSSValues() []ResourceEnumOSS { 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 { func (v *ResourceEnumOSS) UnmarshalJSON(src []byte) error {
@ -56,7 +56,7 @@ func (v *ResourceEnumOSS) UnmarshalJSON(src []byte) error {
return err return err
} }
enumTypeValue := ResourceEnumOSS(value) 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 { if existing == enumTypeValue {
*v = enumTypeValue *v = enumTypeValue
return nil return nil

View File

@ -23,18 +23,19 @@ type Authorization struct {
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,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"` 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"` Permissions []Permission `json:"permissions" yaml:"permissions"`
Id *string `json:"id,omitempty" yaml:"id,omitempty"` // The authorization ID.
// Token used to authenticate API requests. 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"` 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"` 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"` 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"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"`
} }

View File

@ -19,18 +19,19 @@ import (
type AuthorizationAllOf struct { type AuthorizationAllOf struct {
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,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"` 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"` Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"`
Id *string `json:"id,omitempty" yaml:"id,omitempty"` // The authorization ID.
// Token used to authenticate API requests. 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"` 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"` 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"` 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"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"`
} }

View File

@ -20,11 +20,11 @@ type AuthorizationPostRequest struct {
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
// A description of the token. // A description of the token.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` 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"` 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"` 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"` Permissions []Permission `json:"permissions" yaml:"permissions"`
} }

View File

@ -16,11 +16,11 @@ import (
// AuthorizationPostRequestAllOf struct for AuthorizationPostRequestAllOf // AuthorizationPostRequestAllOf struct for AuthorizationPostRequestAllOf
type AuthorizationPostRequestAllOf struct { 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"` 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"` 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"` Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"`
} }

View File

@ -27,7 +27,7 @@ type Bucket struct {
SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,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"` RetentionRules []RetentionRule `json:"retentionRules" yaml:"retentionRules"`
Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"` Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"`
} }

View File

@ -16,11 +16,11 @@ import (
// DBRP struct for DBRP // DBRP struct for DBRP
type DBRP struct { type DBRP struct {
// ID of the DBRP mapping. // The ID of the DBRP mapping.
Id string `json:"id" yaml:"id"` 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"` 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"` BucketID string `json:"bucketID" yaml:"bucketID"`
// InfluxDB v1 database // InfluxDB v1 database
Database string `json:"database" yaml:"database"` Database string `json:"database" yaml:"database"`

View File

@ -16,11 +16,11 @@ import (
// DBRPCreate struct for DBRPCreate // DBRPCreate struct for DBRPCreate
type DBRPCreate struct { type DBRPCreate struct {
// ID of the organization that owns this mapping. // The ID of the organization.
OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` 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"` 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"` BucketID string `json:"bucketID" yaml:"bucketID"`
// InfluxDB v1 database // InfluxDB v1 database
Database string `json:"database" yaml:"database"` Database string `json:"database" yaml:"database"`

View File

@ -16,7 +16,7 @@ import (
// InlineResponse200 struct for InlineResponse200 // InlineResponse200 struct for InlineResponse200
type InlineResponse200 struct { 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"` Allowed *bool `json:"allowed,omitempty" yaml:"allowed,omitempty"`
} }

View File

@ -20,13 +20,13 @@ type LegacyAuthorizationPostRequest struct {
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
// A description of the token. // A description of the token.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` 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"` 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"` 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"` 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"` Permissions []Permission `json:"permissions" yaml:"permissions"`
} }

View File

@ -16,13 +16,13 @@ import (
// LegacyAuthorizationPostRequestAllOf struct for LegacyAuthorizationPostRequestAllOf // LegacyAuthorizationPostRequestAllOf struct for LegacyAuthorizationPostRequestAllOf
type LegacyAuthorizationPostRequestAllOf struct { 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"` 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"` 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"` 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"` Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"`
} }

View File

@ -18,9 +18,9 @@ import (
// MeasurementSchema Definition of a measurement schema. // MeasurementSchema Definition of a measurement schema.
type MeasurementSchema struct { type MeasurementSchema struct {
Id string `json:"id" yaml:"id"` 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"` 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"` BucketID *string `json:"bucketID,omitempty" yaml:"bucketID,omitempty"`
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// Ordered collection of column definitions. // Ordered collection of column definitions.

View File

@ -16,6 +16,7 @@ import (
// MeasurementSchemaCreateRequest Create a new measurement schema. // MeasurementSchemaCreateRequest Create a new measurement schema.
type MeasurementSchemaCreateRequest struct { type MeasurementSchemaCreateRequest struct {
// The [measurement]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#measurement) name.
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// Ordered collection of column definitions. // Ordered collection of column definitions.
Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"` Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"`

View File

@ -14,9 +14,11 @@ import (
"encoding/json" "encoding/json"
) )
// PatchBucketRequest Updates to an existing bucket resource. // PatchBucketRequest An object that contains updated bucket properties to apply.
type PatchBucketRequest struct { 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"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
// Updates to rules to expire or retain data. No rules means no updates. // Updates to rules to expire or retain data. No rules means no updates.
RetentionRules *[]PatchRetentionRule `json:"retentionRules,omitempty" yaml:"retentionRules,omitempty"` RetentionRules *[]PatchRetentionRule `json:"retentionRules,omitempty" yaml:"retentionRules,omitempty"`

View File

@ -14,11 +14,11 @@ import (
"encoding/json" "encoding/json"
) )
// PatchOrganizationRequest struct for PatchOrganizationRequest // PatchOrganizationRequest An object that contains updated organization properties to apply.
type PatchOrganizationRequest struct { type PatchOrganizationRequest struct {
// New name to set on the organization // The name of the organization.
Name *string `json:"name,omitempty" yaml:"name,omitempty"` 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"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
} }

View File

@ -14,12 +14,12 @@ import (
"encoding/json" "encoding/json"
) )
// PatchRetentionRule Updates to a rule to expire or retain data. // PatchRetentionRule struct for PatchRetentionRule
type PatchRetentionRule struct { type PatchRetentionRule struct {
Type string `json:"type" yaml:"type"` Type *string `json:"type,omitempty" yaml:"type,omitempty"`
// Duration in seconds for how long data will be kept in the database. 0 means infinite. // The number of seconds to keep data. Default duration is `2592000` (30 days). `0` represents infinite retention.
EverySeconds *int64 `json:"everySeconds,omitempty" yaml:"everySeconds,omitempty"` EverySeconds int64 `json:"everySeconds" yaml:"everySeconds"`
// Shard duration measured in seconds. // 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"` 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, // 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 // and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed // will change when the set of required properties is changed
func NewPatchRetentionRule(type_ string) *PatchRetentionRule { func NewPatchRetentionRule(everySeconds int64) *PatchRetentionRule {
this := PatchRetentionRule{} this := PatchRetentionRule{}
this.Type = type_ var type_ string = "expire"
this.Type = &type_
this.EverySeconds = everySeconds
return &this return &this
} }
@ -39,64 +41,66 @@ func NewPatchRetentionRule(type_ string) *PatchRetentionRule {
func NewPatchRetentionRuleWithDefaults() *PatchRetentionRule { func NewPatchRetentionRuleWithDefaults() *PatchRetentionRule {
this := PatchRetentionRule{} this := PatchRetentionRule{}
var type_ string = "expire" var type_ string = "expire"
this.Type = type_ this.Type = &type_
var everySeconds int64 = 2592000
this.EverySeconds = everySeconds
return &this return &this
} }
// GetType returns the Type field value // GetType returns the Type field value if set, zero value otherwise.
func (o *PatchRetentionRule) GetType() string { func (o *PatchRetentionRule) GetType() string {
if o == nil { if o == nil || o.Type == nil {
var ret string var ret string
return ret 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. // and a boolean to check if the value has been set.
func (o *PatchRetentionRule) GetTypeOk() (*string, bool) { func (o *PatchRetentionRule) GetTypeOk() (*string, bool) {
if o == nil { if o == nil || o.Type == nil {
return nil, false 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) SetType(v string) { func (o *PatchRetentionRule) HasType() bool {
o.Type = v if o != nil && o.Type != nil {
}
// GetEverySeconds returns the EverySeconds field value if set, zero value otherwise.
func (o *PatchRetentionRule) GetEverySeconds() int64 {
if o == nil || o.EverySeconds == nil {
var ret int64
return ret
}
return *o.EverySeconds
}
// GetEverySecondsOk returns a tuple with the EverySeconds field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PatchRetentionRule) GetEverySecondsOk() (*int64, bool) {
if o == nil || o.EverySeconds == 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 true
} }
return false return false
} }
// SetEverySeconds gets a reference to the given int64 and assigns it to the EverySeconds field. // SetType gets a reference to the given string and assigns it to the Type field.
func (o *PatchRetentionRule) SetType(v string) {
o.Type = &v
}
// GetEverySeconds returns the EverySeconds field value
func (o *PatchRetentionRule) GetEverySeconds() int64 {
if o == nil {
var ret int64
return ret
}
return o.EverySeconds
}
// 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 {
return nil, false
}
return &o.EverySeconds, true
}
// SetEverySeconds sets field value
func (o *PatchRetentionRule) SetEverySeconds(v int64) { func (o *PatchRetentionRule) SetEverySeconds(v int64) {
o.EverySeconds = &v o.EverySeconds = v
} }
// GetShardGroupDurationSeconds returns the ShardGroupDurationSeconds field value if set, zero value otherwise. // 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) { func (o PatchRetentionRule) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{} toSerialize := map[string]interface{}{}
if true { if o.Type != nil {
toSerialize["type"] = o.Type toSerialize["type"] = o.Type
} }
if o.EverySeconds != nil { if true {
toSerialize["everySeconds"] = o.EverySeconds toSerialize["everySeconds"] = o.EverySeconds
} }
if o.ShardGroupDurationSeconds != nil { if o.ShardGroupDurationSeconds != nil {

View File

@ -16,14 +16,15 @@ import (
// PermissionResource struct for PermissionResource // PermissionResource struct for PermissionResource
type PermissionResource struct { 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"` 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"` 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"` 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"` 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"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
} }

View File

@ -16,15 +16,15 @@ import (
// PostBucketRequest struct for PostBucketRequest // PostBucketRequest struct for PostBucketRequest
type PostBucketRequest struct { 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"` OrgID string `json:"orgID" yaml:"orgID"`
// The name of the bucket. // The bucket name.
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// A description of the bucket. // A description of the bucket.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` 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"` 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"` RetentionRules *[]RetentionRule `json:"retentionRules,omitempty" yaml:"retentionRules,omitempty"`
SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"`
} }

View File

@ -16,7 +16,9 @@ import (
// PostOrganizationRequest struct for PostOrganizationRequest // PostOrganizationRequest struct for PostOrganizationRequest
type PostOrganizationRequest struct { 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"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
} }

View File

@ -21,7 +21,7 @@ type RemoteConnection struct {
OrgID string `json:"orgID" yaml:"orgID"` OrgID string `json:"orgID" yaml:"orgID"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
RemoteURL string `json:"remoteURL" yaml:"remoteURL"` 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"` 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, // 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 // and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed // 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 := RemoteConnection{}
this.Id = id this.Id = id
this.Name = name this.Name = name
this.OrgID = orgID this.OrgID = orgID
this.RemoteURL = remoteURL this.RemoteURL = remoteURL
this.RemoteOrgID = remoteOrgID
this.AllowInsecureTLS = allowInsecureTLS this.AllowInsecureTLS = allowInsecureTLS
return &this return &this
} }
@ -178,28 +177,36 @@ func (o *RemoteConnection) SetRemoteURL(v string) {
o.RemoteURL = v 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 { func (o *RemoteConnection) GetRemoteOrgID() string {
if o == nil { if o == nil || o.RemoteOrgID == nil {
var ret string var ret string
return ret 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. // and a boolean to check if the value has been set.
func (o *RemoteConnection) GetRemoteOrgIDOk() (*string, bool) { func (o *RemoteConnection) GetRemoteOrgIDOk() (*string, bool) {
if o == nil { if o == nil || o.RemoteOrgID == nil {
return nil, false return nil, false
} }
return &o.RemoteOrgID, true return o.RemoteOrgID, true
} }
// SetRemoteOrgID sets field value // 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 gets a reference to the given string and assigns it to the RemoteOrgID field.
func (o *RemoteConnection) SetRemoteOrgID(v string) { func (o *RemoteConnection) SetRemoteOrgID(v string) {
o.RemoteOrgID = v o.RemoteOrgID = &v
} }
// GetAllowInsecureTLS returns the AllowInsecureTLS field value // GetAllowInsecureTLS returns the AllowInsecureTLS field value
@ -243,7 +250,7 @@ func (o RemoteConnection) MarshalJSON() ([]byte, error) {
if true { if true {
toSerialize["remoteURL"] = o.RemoteURL toSerialize["remoteURL"] = o.RemoteURL
} }
if true { if o.RemoteOrgID != nil {
toSerialize["remoteOrgID"] = o.RemoteOrgID toSerialize["remoteOrgID"] = o.RemoteOrgID
} }
if true { if true {

View File

@ -21,7 +21,7 @@ type RemoteConnectionCreationRequest struct {
OrgID string `json:"orgID" yaml:"orgID"` OrgID string `json:"orgID" yaml:"orgID"`
RemoteURL string `json:"remoteURL" yaml:"remoteURL"` RemoteURL string `json:"remoteURL" yaml:"remoteURL"`
RemoteAPIToken string `json:"remoteAPIToken" yaml:"remoteAPIToken"` 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"` 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, // 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 // and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed // 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 := RemoteConnectionCreationRequest{}
this.Name = name this.Name = name
this.OrgID = orgID this.OrgID = orgID
this.RemoteURL = remoteURL this.RemoteURL = remoteURL
this.RemoteAPIToken = remoteAPIToken this.RemoteAPIToken = remoteAPIToken
this.RemoteOrgID = remoteOrgID
this.AllowInsecureTLS = allowInsecureTLS this.AllowInsecureTLS = allowInsecureTLS
return &this return &this
} }
@ -178,28 +177,36 @@ func (o *RemoteConnectionCreationRequest) SetRemoteAPIToken(v string) {
o.RemoteAPIToken = v 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 { func (o *RemoteConnectionCreationRequest) GetRemoteOrgID() string {
if o == nil { if o == nil || o.RemoteOrgID == nil {
var ret string var ret string
return ret 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. // and a boolean to check if the value has been set.
func (o *RemoteConnectionCreationRequest) GetRemoteOrgIDOk() (*string, bool) { func (o *RemoteConnectionCreationRequest) GetRemoteOrgIDOk() (*string, bool) {
if o == nil { if o == nil || o.RemoteOrgID == nil {
return nil, false return nil, false
} }
return &o.RemoteOrgID, true return o.RemoteOrgID, true
} }
// SetRemoteOrgID sets field value // 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 gets a reference to the given string and assigns it to the RemoteOrgID field.
func (o *RemoteConnectionCreationRequest) SetRemoteOrgID(v string) { func (o *RemoteConnectionCreationRequest) SetRemoteOrgID(v string) {
o.RemoteOrgID = v o.RemoteOrgID = &v
} }
// GetAllowInsecureTLS returns the AllowInsecureTLS field value // GetAllowInsecureTLS returns the AllowInsecureTLS field value
@ -243,7 +250,7 @@ func (o RemoteConnectionCreationRequest) MarshalJSON() ([]byte, error) {
if true { if true {
toSerialize["remoteAPIToken"] = o.RemoteAPIToken toSerialize["remoteAPIToken"] = o.RemoteAPIToken
} }
if true { if o.RemoteOrgID != nil {
toSerialize["remoteOrgID"] = o.RemoteOrgID toSerialize["remoteOrgID"] = o.RemoteOrgID
} }
if true { if true {

View File

@ -16,11 +16,11 @@ import (
// ResourceMember struct for ResourceMember // ResourceMember struct for ResourceMember
type ResourceMember struct { type ResourceMember struct {
// The ID of the user. // The user ID.
Id *string `json:"id,omitempty" yaml:"id,omitempty"` Id *string `json:"id,omitempty" yaml:"id,omitempty"`
// The name of the user. // The user name.
Name string `json:"name" yaml:"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"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"`
Role *string `json:"role,omitempty" yaml:"role,omitempty"` Role *string `json:"role,omitempty" yaml:"role,omitempty"`

View File

@ -16,11 +16,11 @@ import (
// ResourceOwner struct for ResourceOwner // ResourceOwner struct for ResourceOwner
type ResourceOwner struct { type ResourceOwner struct {
// The ID of the user. // The user ID.
Id *string `json:"id,omitempty" yaml:"id,omitempty"` Id *string `json:"id,omitempty" yaml:"id,omitempty"`
// The name of the user. // The user name.
Name string `json:"name" yaml:"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"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"`
Role *string `json:"role,omitempty" yaml:"role,omitempty"` Role *string `json:"role,omitempty" yaml:"role,omitempty"`

View File

@ -21,13 +21,15 @@ type Script struct {
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
OrgID string `json:"orgID" yaml:"orgID"` OrgID string `json:"orgID" yaml:"orgID"`
// script to be executed // The script to execute.
Script string `json:"script" yaml:"script"` Script string `json:"script" yaml:"script"`
Language *ScriptLanguage `json:"language,omitempty" yaml:"language,omitempty"` Language *ScriptLanguage `json:"language,omitempty" yaml:"language,omitempty"`
// invocation endpoint address // The invocation endpoint address.
Url *string `json:"url,omitempty" yaml:"url,omitempty"` Url *string `json:"url,omitempty" yaml:"url,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,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 // NewScript instantiates a new Script object
@ -314,6 +316,38 @@ func (o *Script) SetUpdatedAt(v time.Time) {
o.UpdatedAt = &v 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) { func (o Script) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{} toSerialize := map[string]interface{}{}
if o.Id != nil { if o.Id != nil {
@ -343,6 +377,9 @@ func (o Script) MarshalJSON() ([]byte, error) {
if o.UpdatedAt != nil { if o.UpdatedAt != nil {
toSerialize["updatedAt"] = o.UpdatedAt toSerialize["updatedAt"] = o.UpdatedAt
} }
if o.Labels != nil {
toSerialize["labels"] = o.Labels
}
return json.Marshal(toSerialize) return json.Marshal(toSerialize)
} }

View File

@ -21,10 +21,11 @@ type ScriptLanguage string
// List of ScriptLanguage // List of ScriptLanguage
const ( const (
SCRIPTLANGUAGE_FLUX ScriptLanguage = "flux" SCRIPTLANGUAGE_FLUX ScriptLanguage = "flux"
SCRIPTLANGUAGE_SQL ScriptLanguage = "sql"
) )
func ScriptLanguageValues() []ScriptLanguage { func ScriptLanguageValues() []ScriptLanguage {
return []ScriptLanguage{"flux"} return []ScriptLanguage{"flux", "sql"}
} }
func (v *ScriptLanguage) UnmarshalJSON(src []byte) error { func (v *ScriptLanguage) UnmarshalJSON(src []byte) error {
@ -34,7 +35,7 @@ func (v *ScriptLanguage) UnmarshalJSON(src []byte) error {
return err return err
} }
enumTypeValue := ScriptLanguage(value) enumTypeValue := ScriptLanguage(value)
for _, existing := range []ScriptLanguage{"flux"} { for _, existing := range []ScriptLanguage{"flux", "sql"} {
if existing == enumTypeValue { if existing == enumTypeValue {
*v = enumTypeValue *v = enumTypeValue
return nil return nil

View File

@ -16,7 +16,7 @@ import (
// ShardOwner struct for ShardOwner // ShardOwner struct for ShardOwner
type ShardOwner struct { 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"` NodeID int64 `json:"nodeID" yaml:"nodeID"`
} }

View File

@ -18,21 +18,21 @@ import (
// Task struct for Task // Task struct for Task
type Task struct { type Task struct {
Id string `json:"id" yaml:"id"` 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"` 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"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
// The name of the task. // The name of the task.
Name string `json:"name" yaml:"name"` 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"` 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"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"` Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"`
Labels *[]Label `json:"labels,omitempty" yaml:"labels,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"` 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"` 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. // 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"` Every *string `json:"every,omitempty" yaml:"every,omitempty"`
@ -47,9 +47,9 @@ type Task struct {
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
Links *TaskLinks `json:"links,omitempty" yaml:"links,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"` 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"` ScriptParameters *map[string]interface{} `json:"scriptParameters,omitempty" yaml:"scriptParameters,omitempty"`
} }

View File

@ -18,7 +18,7 @@ import (
type TemplateSummaryDiffBucketFields struct { type TemplateSummaryDiffBucketFields struct {
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"` 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"` RetentionRules []RetentionRule `json:"retentionRules" yaml:"retentionRules"`
SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"`
MeasurementSchemas []map[string]interface{} `json:"measurementSchemas" yaml:"measurementSchemas"` MeasurementSchemas []map[string]interface{} `json:"measurementSchemas" yaml:"measurementSchemas"`

View File

@ -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)
}

View File

@ -16,10 +16,13 @@ import (
// User struct for User // User struct for User
type User struct { 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"` OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"`
Name string `json:"name" yaml:"name"` // The user name.
// If inactive the user is inactive. Name string `json:"name" yaml:"name"`
// If `inactive`, the user is inactive. Default is `active`.
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
} }

View File

@ -16,11 +16,11 @@ import (
// UserResponse struct for UserResponse // UserResponse struct for UserResponse
type UserResponse struct { type UserResponse struct {
// The ID of the user. // The user ID.
Id *string `json:"id,omitempty" yaml:"id,omitempty"` Id *string `json:"id,omitempty" yaml:"id,omitempty"`
// The name of the user. // The user name.
Name string `json:"name" yaml:"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"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"`
} }

View File

@ -94,7 +94,7 @@ func TestBucketsUpdate(t *testing.T) {
assert.Nil(t, body.Description) && assert.Nil(t, body.Description) &&
assert.Len(t, body.GetRetentionRules(), 1) && assert.Len(t, body.GetRetentionRules(), 1) &&
assert.Nil(t, body.GetRetentionRules()[0].ShardGroupDurationSeconds) && 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{ })).Return(api.Bucket{
Id: api.PtrString("123"), Id: api.PtrString("123"),
Name: "my-bucket", Name: "my-bucket",
@ -122,7 +122,6 @@ func TestBucketsUpdate(t *testing.T) {
assert.Nil(t, body.Name) && assert.Nil(t, body.Name) &&
assert.Nil(t, body.Description) && assert.Nil(t, body.Description) &&
assert.Len(t, body.GetRetentionRules(), 1) && 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) assert.Equal(t, int64(10*3600+30*60), *body.GetRetentionRules()[0].ShardGroupDurationSeconds)
})).Return(api.Bucket{ })).Return(api.Bucket{
Id: api.PtrString("123"), Id: api.PtrString("123"),

View File

@ -44,13 +44,18 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
OrgID: orgID, OrgID: orgID,
RemoteURL: params.RemoteURL, RemoteURL: params.RemoteURL,
RemoteAPIToken: params.RemoteAPIToken, RemoteAPIToken: params.RemoteAPIToken,
RemoteOrgID: params.RemoteOrgID,
AllowInsecureTLS: params.AllowInsecureTLS, AllowInsecureTLS: params.AllowInsecureTLS,
} }
if params.Description != "" { if params.Description != "" {
body.Description = &params.Description body.Description = &params.Description
} }
if params.RemoteOrgID != "" {
body.RemoteOrgID = &params.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 // send post request
res, err := c.PostRemoteConnection(ctx).RemoteConnectionCreationRequest(body).Execute() res, err := c.PostRemoteConnection(ctx).RemoteConnectionCreationRequest(body).Execute()
@ -215,7 +220,7 @@ func (c Client) printRemote(opts printRemoteOpts) error {
"Name": r.GetName(), "Name": r.GetName(),
"Org ID": r.OrgID, "Org ID": r.OrgID,
"Remote URL": r.RemoteURL, "Remote URL": r.RemoteURL,
"Remote Org ID": r.RemoteOrgID, "Remote Org ID": r.GetRemoteOrgID(),
"Allow Insecure TLS": r.AllowInsecureTLS, "Allow Insecure TLS": r.AllowInsecureTLS,
} }
if opts.deleted { if opts.deleted {

View File

@ -57,7 +57,6 @@ func newRemoteCreateCmd() cli.Command {
&cli.StringFlag{ &cli.StringFlag{
Name: "remote-org-id", Name: "remote-org-id",
Usage: "The ID of the remote organization", Usage: "The ID of the remote organization",
Required: true,
Destination: &params.RemoteOrgID, Destination: &params.RemoteOrgID,
}, },
&cli.BoolFlag{ &cli.BoolFlag{

View File

@ -301,3 +301,46 @@ func (mr *MockUsersApiMockRecorder) PostUsersIDPasswordExecuteWithHttpInfo(arg0
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PostUsersIDPasswordExecuteWithHttpInfo", reflect.TypeOf((*MockUsersApi)(nil).PostUsersIDPasswordExecuteWithHttpInfo), arg0) 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)
}