From 625273adf9643b15ef314b1035711c7c3ee5afc5 Mon Sep 17 00:00:00 2001 From: Jeffrey Smith II Date: Fri, 10 Mar 2023 09:13:35 -0500 Subject: [PATCH] feat: Add new replication field to better show queue sync progress (#480) * chore: update openapi * feat: update replication field names to match influx changes * feat: add new field to show replication queue sync progress * chore: update to master openapi --- ...o => api_authorizations_api_tokens.gen.go} | 343 +++++++++++++----- api/api_bucket_schemas.gen.go | 46 ++- api/api_buckets.gen.go | 12 +- api/api_dbrps.gen.go | 182 ++++++++-- api/api_invokable_scripts.gen.go | 179 +++++---- api/api_organizations.gen.go | 54 +-- api/api_signin.gen.go | 4 +- api/api_users.gen.go | 20 +- api/client.gen.go | 4 +- api/contract/openapi | 2 +- api/model_authorization.gen.go | 2 +- api/model_authorization_post_request.gen.go | 8 +- ...l_authorization_post_request_all_of.gen.go | 6 +- api/model_authorization_update_request.gen.go | 2 +- api/model_dbrp.gen.go | 12 +- api/model_dbrp_create.gen.go | 84 ++--- api/model_dbrp_update.gen.go | 5 +- ...l_legacy_authorization_post_request.gen.go | 10 +- ...y_authorization_post_request_all_of.gen.go | 8 +- api/model_organization.gen.go | 51 ++- api/model_permission_resource.gen.go | 10 +- api/model_replication.gen.go | 93 +++-- api/model_retention_rule.gen.go | 2 +- api/model_script.gen.go | 37 -- api/model_script_update_request.gen.go | 39 +- api/model_user.gen.go | 37 -- clients/auth/auth.go | 2 +- clients/replication/replication.go | 25 +- clients/script/script.go | 1 - cmd/influx/auth.go | 42 +-- 30 files changed, 796 insertions(+), 526 deletions(-) rename api/{api_authorizations.gen.go => api_authorizations_api_tokens.gen.go} (74%) diff --git a/api/api_authorizations.gen.go b/api/api_authorizations_api_tokens.gen.go similarity index 74% rename from api/api_authorizations.gen.go rename to api/api_authorizations_api_tokens.gen.go index 4d92f68..514c51a 100644 --- a/api/api_authorizations.gen.go +++ b/api/api_authorizations_api_tokens.gen.go @@ -24,14 +24,21 @@ var ( _ _context.Context ) -type AuthorizationsApi interface { +type AuthorizationsAPITokensApi interface { /* - * DeleteAuthorizationsID Delete an authorization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param authID The ID of the authorization to delete. - * @return ApiDeleteAuthorizationsIDRequest - */ + * DeleteAuthorizationsID Delete an authorization + * Deletes an authorization. + + Use the endpoint to delete an API token. + + If you want to disable an API token instead of delete it, + [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param authID An authorization ID. Specifies the authorization to delete. + * @return ApiDeleteAuthorizationsIDRequest + */ DeleteAuthorizationsID(ctx _context.Context, authID string) ApiDeleteAuthorizationsIDRequest /* @@ -48,21 +55,24 @@ type AuthorizationsApi interface { /* * GetAuthorizations List authorizations - * Retrieves a list of authorizations. + * Lists 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 + #### InfluxDB Cloud - - 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. + - InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) + values in `GET /api/v2/authorizations` responses; + returns `token: redacted` for all authorizations. #### Required permissions - - InfluxDB OSS requires an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + To retrieve an authorization, the request must use an API token that has the + following permissions: + + - `read-authorizations` + - `read-user` for the user that the authorization is scoped to #### Related guides @@ -88,11 +98,27 @@ type AuthorizationsApi interface { GetAuthorizationsExecuteWithHttpInfo(r ApiGetAuthorizationsRequest) (Authorizations, *_nethttp.Response, error) /* - * GetAuthorizationsID Retrieve an authorization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param authID The ID of the authorization to get. - * @return ApiGetAuthorizationsIDRequest - */ + * GetAuthorizationsID Retrieve an authorization + * Retrieves an authorization. + + Use this endpoint to retrieve information about an API token, including + the token's permissions and the user that the token is scoped to. + + #### InfluxDB OSS + + - 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. + + #### 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 authID An authorization ID. Specifies the authorization to retrieve. + * @return ApiGetAuthorizationsIDRequest + */ GetAuthorizationsID(ctx _context.Context, authID string) ApiGetAuthorizationsIDRequest /* @@ -110,11 +136,16 @@ type AuthorizationsApi interface { GetAuthorizationsIDExecuteWithHttpInfo(r ApiGetAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) /* - * PatchAuthorizationsID Update an authorization to be active or inactive - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param authID The ID of the authorization to update. - * @return ApiPatchAuthorizationsIDRequest - */ + * PatchAuthorizationsID Update an API token to be active or inactive + * Updates an authorization. + + Use this endpoint to set an API token's status to be _active_ or _inactive_. + InfluxDB rejects requests that use inactive API tokens. + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param authID An authorization ID. Specifies the authorization to update. + * @return ApiPatchAuthorizationsIDRequest + */ PatchAuthorizationsID(ctx _context.Context, authID string) ApiPatchAuthorizationsIDRequest /* @@ -133,27 +164,29 @@ type AuthorizationsApi interface { /* * PostAuthorizations Create an authorization - * Creates an authorization. + * Creates an authorization and returns the authorization with the + generated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token). 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. + The API token is the authorization's `token` property value. - Keep the following in mind when creating and updating authorizations: + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. - - 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. + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. - #### Limitations + We recommend the following for managing your tokens: - - 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. + - Create a generic user to create and manage tokens for writing data. + - Store your tokens in a secure password vault for future access. - We recommend creating a generic user to create and manage tokens for writing data. + #### Required permissions + + - `write-authorizations` + - `write-user` for the user that the authorization is scoped to #### Related guides @@ -179,12 +212,12 @@ type AuthorizationsApi interface { PostAuthorizationsExecuteWithHttpInfo(r ApiPostAuthorizationsRequest) (Authorization, *_nethttp.Response, error) } -// AuthorizationsApiService AuthorizationsApi service -type AuthorizationsApiService service +// AuthorizationsAPITokensApiService AuthorizationsAPITokensApi service +type AuthorizationsAPITokensApiService service type ApiDeleteAuthorizationsIDRequest struct { ctx _context.Context - ApiService AuthorizationsApi + ApiService AuthorizationsAPITokensApi authID string zapTraceSpan *string } @@ -214,12 +247,19 @@ func (r ApiDeleteAuthorizationsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Respo } /* - * DeleteAuthorizationsID Delete an authorization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param authID The ID of the authorization to delete. - * @return ApiDeleteAuthorizationsIDRequest - */ -func (a *AuthorizationsApiService) DeleteAuthorizationsID(ctx _context.Context, authID string) ApiDeleteAuthorizationsIDRequest { + - DeleteAuthorizationsID Delete an authorization + - Deletes an authorization. + +Use the endpoint to delete an API token. + +If you want to disable an API token instead of delete it, +[update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param authID An authorization ID. Specifies the authorization to delete. + - @return ApiDeleteAuthorizationsIDRequest +*/ +func (a *AuthorizationsAPITokensApiService) DeleteAuthorizationsID(ctx _context.Context, authID string) ApiDeleteAuthorizationsIDRequest { return ApiDeleteAuthorizationsIDRequest{ ApiService: a, ctx: ctx, @@ -230,7 +270,7 @@ func (a *AuthorizationsApiService) DeleteAuthorizationsID(ctx _context.Context, /* * Execute executes the request */ -func (a *AuthorizationsApiService) DeleteAuthorizationsIDExecute(r ApiDeleteAuthorizationsIDRequest) error { +func (a *AuthorizationsAPITokensApiService) DeleteAuthorizationsIDExecute(r ApiDeleteAuthorizationsIDRequest) error { _, err := a.DeleteAuthorizationsIDExecuteWithHttpInfo(r) return err } @@ -240,7 +280,7 @@ func (a *AuthorizationsApiService) DeleteAuthorizationsIDExecute(r ApiDeleteAuth * 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 *AuthorizationsApiService) DeleteAuthorizationsIDExecuteWithHttpInfo(r ApiDeleteAuthorizationsIDRequest) (*_nethttp.Response, error) { +func (a *AuthorizationsAPITokensApiService) DeleteAuthorizationsIDExecuteWithHttpInfo(r ApiDeleteAuthorizationsIDRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -249,7 +289,7 @@ func (a *AuthorizationsApiService) DeleteAuthorizationsIDExecuteWithHttpInfo(r A localVarFileBytes []byte ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsApiService.DeleteAuthorizationsID") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsAPITokensApiService.DeleteAuthorizationsID") if err != nil { return nil, GenericOpenAPIError{error: err.Error()} } @@ -310,6 +350,39 @@ func (a *AuthorizationsApiService) DeleteAuthorizationsIDExecuteWithHttpInfo(r A } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + 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 { @@ -326,12 +399,13 @@ func (a *AuthorizationsApiService) DeleteAuthorizationsIDExecuteWithHttpInfo(r A type ApiGetAuthorizationsRequest struct { ctx _context.Context - ApiService AuthorizationsApi + ApiService AuthorizationsAPITokensApi zapTraceSpan *string userID *string user *string orgID *string org *string + token *string } func (r ApiGetAuthorizationsRequest) ZapTraceSpan(zapTraceSpan string) ApiGetAuthorizationsRequest { @@ -374,6 +448,14 @@ func (r ApiGetAuthorizationsRequest) GetOrg() *string { return r.org } +func (r ApiGetAuthorizationsRequest) Token(token string) ApiGetAuthorizationsRequest { + r.token = &token + return r +} +func (r ApiGetAuthorizationsRequest) GetToken() *string { + return r.token +} + func (r ApiGetAuthorizationsRequest) Execute() (Authorizations, error) { return r.ApiService.GetAuthorizationsExecute(r) } @@ -384,21 +466,24 @@ func (r ApiGetAuthorizationsRequest) ExecuteWithHttpInfo() (Authorizations, *_ne /* - GetAuthorizations List authorizations - - Retrieves a list of authorizations. + - Lists 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 +#### InfluxDB Cloud - - 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. + - InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) + values in `GET /api/v2/authorizations` responses; + returns `token: redacted` for all authorizations. #### Required permissions -- InfluxDB OSS requires an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. +To retrieve an authorization, the request must use an API token that has the +following permissions: + +- `read-authorizations` +- `read-user` for the user that the authorization is scoped to #### Related guides @@ -407,7 +492,7 @@ If no query parameters are passed, InfluxDB returns all authorizations. - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetAuthorizationsRequest */ -func (a *AuthorizationsApiService) GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest { +func (a *AuthorizationsAPITokensApiService) GetAuthorizations(ctx _context.Context) ApiGetAuthorizationsRequest { return ApiGetAuthorizationsRequest{ ApiService: a, ctx: ctx, @@ -418,7 +503,7 @@ func (a *AuthorizationsApiService) GetAuthorizations(ctx _context.Context) ApiGe * Execute executes the request * @return Authorizations */ -func (a *AuthorizationsApiService) GetAuthorizationsExecute(r ApiGetAuthorizationsRequest) (Authorizations, error) { +func (a *AuthorizationsAPITokensApiService) GetAuthorizationsExecute(r ApiGetAuthorizationsRequest) (Authorizations, error) { returnVal, _, err := a.GetAuthorizationsExecuteWithHttpInfo(r) return returnVal, err } @@ -429,7 +514,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecute(r ApiGetAuthorizatio * achieved through the returned response model if applicable. * @return Authorizations */ -func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGetAuthorizationsRequest) (Authorizations, *_nethttp.Response, error) { +func (a *AuthorizationsAPITokensApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGetAuthorizationsRequest) (Authorizations, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -439,7 +524,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGet localVarReturnValue Authorizations ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsApiService.GetAuthorizations") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsAPITokensApiService.GetAuthorizations") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -462,6 +547,9 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGet if r.org != nil { localVarQueryParams.Add("org", parameterToString(*r.org, "")) } + if r.token != nil { + localVarQueryParams.Add("token", parameterToString(*r.token, "")) + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -568,7 +656,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsExecuteWithHttpInfo(r ApiGet type ApiGetAuthorizationsIDRequest struct { ctx _context.Context - ApiService AuthorizationsApi + ApiService AuthorizationsAPITokensApi authID string zapTraceSpan *string } @@ -598,12 +686,28 @@ func (r ApiGetAuthorizationsIDRequest) ExecuteWithHttpInfo() (Authorization, *_n } /* - * GetAuthorizationsID Retrieve an authorization - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param authID The ID of the authorization to get. - * @return ApiGetAuthorizationsIDRequest - */ -func (a *AuthorizationsApiService) GetAuthorizationsID(ctx _context.Context, authID string) ApiGetAuthorizationsIDRequest { + - GetAuthorizationsID Retrieve an authorization + - Retrieves an authorization. + +Use this endpoint to retrieve information about an API token, including +the token's permissions and the user that the token is scoped to. + +#### InfluxDB OSS + + - 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. + +#### 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 authID An authorization ID. Specifies the authorization to retrieve. + - @return ApiGetAuthorizationsIDRequest +*/ +func (a *AuthorizationsAPITokensApiService) GetAuthorizationsID(ctx _context.Context, authID string) ApiGetAuthorizationsIDRequest { return ApiGetAuthorizationsIDRequest{ ApiService: a, ctx: ctx, @@ -615,7 +719,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsID(ctx _context.Context, aut * Execute executes the request * @return Authorization */ -func (a *AuthorizationsApiService) GetAuthorizationsIDExecute(r ApiGetAuthorizationsIDRequest) (Authorization, error) { +func (a *AuthorizationsAPITokensApiService) GetAuthorizationsIDExecute(r ApiGetAuthorizationsIDRequest) (Authorization, error) { returnVal, _, err := a.GetAuthorizationsIDExecuteWithHttpInfo(r) return returnVal, err } @@ -626,7 +730,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsIDExecute(r ApiGetAuthorizat * achieved through the returned response model if applicable. * @return Authorization */ -func (a *AuthorizationsApiService) GetAuthorizationsIDExecuteWithHttpInfo(r ApiGetAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) { +func (a *AuthorizationsAPITokensApiService) GetAuthorizationsIDExecuteWithHttpInfo(r ApiGetAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -636,7 +740,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsIDExecuteWithHttpInfo(r ApiG localVarReturnValue Authorization ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsApiService.GetAuthorizationsID") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsAPITokensApiService.GetAuthorizationsID") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -697,6 +801,39 @@ func (a *AuthorizationsApiService) GetAuthorizationsIDExecuteWithHttpInfo(r ApiG } newErr.body = localVarBody newErr.error = localVarHTTPResponse.Status + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -732,7 +869,7 @@ func (a *AuthorizationsApiService) GetAuthorizationsIDExecuteWithHttpInfo(r ApiG type ApiPatchAuthorizationsIDRequest struct { ctx _context.Context - ApiService AuthorizationsApi + ApiService AuthorizationsAPITokensApi authID string authorizationUpdateRequest *AuthorizationUpdateRequest zapTraceSpan *string @@ -771,12 +908,17 @@ func (r ApiPatchAuthorizationsIDRequest) ExecuteWithHttpInfo() (Authorization, * } /* - * PatchAuthorizationsID Update an authorization to be active or inactive - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param authID The ID of the authorization to update. - * @return ApiPatchAuthorizationsIDRequest - */ -func (a *AuthorizationsApiService) PatchAuthorizationsID(ctx _context.Context, authID string) ApiPatchAuthorizationsIDRequest { + - PatchAuthorizationsID Update an API token to be active or inactive + - Updates an authorization. + +Use this endpoint to set an API token's status to be _active_ or _inactive_. +InfluxDB rejects requests that use inactive API tokens. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param authID An authorization ID. Specifies the authorization to update. + - @return ApiPatchAuthorizationsIDRequest +*/ +func (a *AuthorizationsAPITokensApiService) PatchAuthorizationsID(ctx _context.Context, authID string) ApiPatchAuthorizationsIDRequest { return ApiPatchAuthorizationsIDRequest{ ApiService: a, ctx: ctx, @@ -788,7 +930,7 @@ func (a *AuthorizationsApiService) PatchAuthorizationsID(ctx _context.Context, a * Execute executes the request * @return Authorization */ -func (a *AuthorizationsApiService) PatchAuthorizationsIDExecute(r ApiPatchAuthorizationsIDRequest) (Authorization, error) { +func (a *AuthorizationsAPITokensApiService) PatchAuthorizationsIDExecute(r ApiPatchAuthorizationsIDRequest) (Authorization, error) { returnVal, _, err := a.PatchAuthorizationsIDExecuteWithHttpInfo(r) return returnVal, err } @@ -799,7 +941,7 @@ func (a *AuthorizationsApiService) PatchAuthorizationsIDExecute(r ApiPatchAuthor * achieved through the returned response model if applicable. * @return Authorization */ -func (a *AuthorizationsApiService) PatchAuthorizationsIDExecuteWithHttpInfo(r ApiPatchAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) { +func (a *AuthorizationsAPITokensApiService) PatchAuthorizationsIDExecuteWithHttpInfo(r ApiPatchAuthorizationsIDRequest) (Authorization, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -809,7 +951,7 @@ func (a *AuthorizationsApiService) PatchAuthorizationsIDExecuteWithHttpInfo(r Ap localVarReturnValue Authorization ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsApiService.PatchAuthorizationsID") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsAPITokensApiService.PatchAuthorizationsID") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } @@ -910,7 +1052,7 @@ func (a *AuthorizationsApiService) PatchAuthorizationsIDExecuteWithHttpInfo(r Ap type ApiPostAuthorizationsRequest struct { ctx _context.Context - ApiService AuthorizationsApi + ApiService AuthorizationsAPITokensApi authorizationPostRequest *AuthorizationPostRequest zapTraceSpan *string } @@ -941,27 +1083,30 @@ func (r ApiPostAuthorizationsRequest) ExecuteWithHttpInfo() (Authorization, *_ne /* - PostAuthorizations Create an authorization - - Creates an authorization. + - Creates an authorization and returns the authorization with the + +generated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token). 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. +The API token is the authorization's `token` property value. -Keep the following in mind when creating and updating authorizations: +To follow best practices for secure API token generation and retrieval, +InfluxDB enforces access restrictions on API tokens. -- 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. + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. - 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. +We recommend the following for managing your tokens: + + - Create a generic user to create and manage tokens for writing data. + - Store your tokens in a secure password vault for future access. + +#### Required permissions + +- `write-authorizations` +- `write-user` for the user that the authorization is scoped to #### Related guides @@ -970,7 +1115,7 @@ We recommend creating a generic user to create and manage tokens for writing dat - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiPostAuthorizationsRequest */ -func (a *AuthorizationsApiService) PostAuthorizations(ctx _context.Context) ApiPostAuthorizationsRequest { +func (a *AuthorizationsAPITokensApiService) PostAuthorizations(ctx _context.Context) ApiPostAuthorizationsRequest { return ApiPostAuthorizationsRequest{ ApiService: a, ctx: ctx, @@ -981,7 +1126,7 @@ func (a *AuthorizationsApiService) PostAuthorizations(ctx _context.Context) ApiP * Execute executes the request * @return Authorization */ -func (a *AuthorizationsApiService) PostAuthorizationsExecute(r ApiPostAuthorizationsRequest) (Authorization, error) { +func (a *AuthorizationsAPITokensApiService) PostAuthorizationsExecute(r ApiPostAuthorizationsRequest) (Authorization, error) { returnVal, _, err := a.PostAuthorizationsExecuteWithHttpInfo(r) return returnVal, err } @@ -992,7 +1137,7 @@ func (a *AuthorizationsApiService) PostAuthorizationsExecute(r ApiPostAuthorizat * achieved through the returned response model if applicable. * @return Authorization */ -func (a *AuthorizationsApiService) PostAuthorizationsExecuteWithHttpInfo(r ApiPostAuthorizationsRequest) (Authorization, *_nethttp.Response, error) { +func (a *AuthorizationsAPITokensApiService) PostAuthorizationsExecuteWithHttpInfo(r ApiPostAuthorizationsRequest) (Authorization, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1002,7 +1147,7 @@ func (a *AuthorizationsApiService) PostAuthorizationsExecuteWithHttpInfo(r ApiPo localVarReturnValue Authorization ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsApiService.PostAuthorizations") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthorizationsAPITokensApiService.PostAuthorizations") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } diff --git a/api/api_bucket_schemas.gen.go b/api/api_bucket_schemas.gen.go index f1ab957..df77d68 100644 --- a/api/api_bucket_schemas.gen.go +++ b/api/api_bucket_schemas.gen.go @@ -96,7 +96,7 @@ type BucketSchemasApi interface { /* * GetMeasurementSchemas List measurement schemas of a bucket - * Retrieves a list of _explicit_ + * Lists _explicit_ [schemas]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema) (`"schemaType": "explicit"`) for a bucket. @@ -175,9 +175,9 @@ type ApiCreateMeasurementSchemaRequest struct { ctx _context.Context ApiService BucketSchemasApi bucketID string + measurementSchemaCreateRequest *MeasurementSchemaCreateRequest org *string orgID *string - measurementSchemaCreateRequest *MeasurementSchemaCreateRequest } func (r ApiCreateMeasurementSchemaRequest) BucketID(bucketID string) ApiCreateMeasurementSchemaRequest { @@ -188,6 +188,14 @@ func (r ApiCreateMeasurementSchemaRequest) GetBucketID() string { return r.bucketID } +func (r ApiCreateMeasurementSchemaRequest) MeasurementSchemaCreateRequest(measurementSchemaCreateRequest MeasurementSchemaCreateRequest) ApiCreateMeasurementSchemaRequest { + r.measurementSchemaCreateRequest = &measurementSchemaCreateRequest + return r +} +func (r ApiCreateMeasurementSchemaRequest) GetMeasurementSchemaCreateRequest() *MeasurementSchemaCreateRequest { + return r.measurementSchemaCreateRequest +} + func (r ApiCreateMeasurementSchemaRequest) Org(org string) ApiCreateMeasurementSchemaRequest { r.org = &org return r @@ -204,14 +212,6 @@ func (r ApiCreateMeasurementSchemaRequest) GetOrgID() *string { return r.orgID } -func (r ApiCreateMeasurementSchemaRequest) MeasurementSchemaCreateRequest(measurementSchemaCreateRequest MeasurementSchemaCreateRequest) ApiCreateMeasurementSchemaRequest { - r.measurementSchemaCreateRequest = &measurementSchemaCreateRequest - return r -} -func (r ApiCreateMeasurementSchemaRequest) GetMeasurementSchemaCreateRequest() *MeasurementSchemaCreateRequest { - return r.measurementSchemaCreateRequest -} - func (r ApiCreateMeasurementSchemaRequest) Execute() (MeasurementSchema, error) { return r.ApiService.CreateMeasurementSchemaExecute(r) } @@ -292,6 +292,9 @@ func (a *BucketSchemasApiService) CreateMeasurementSchemaExecuteWithHttpInfo(r A localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.measurementSchemaCreateRequest == nil { + return localVarReturnValue, nil, reportError("measurementSchemaCreateRequest is required and must be specified") + } if r.org != nil { localVarQueryParams.Add("org", parameterToString(*r.org, "")) @@ -638,7 +641,7 @@ func (r ApiGetMeasurementSchemasRequest) ExecuteWithHttpInfo() (MeasurementSchem /* - GetMeasurementSchemas List measurement schemas of a bucket - - Retrieves a list of _explicit_ + - Lists _explicit_ [schemas]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#schema) (`"schemaType": "explicit"`) for a bucket. @@ -809,9 +812,9 @@ type ApiUpdateMeasurementSchemaRequest struct { ApiService BucketSchemasApi bucketID string measurementID string + measurementSchemaUpdateRequest *MeasurementSchemaUpdateRequest org *string orgID *string - measurementSchemaUpdateRequest *MeasurementSchemaUpdateRequest } func (r ApiUpdateMeasurementSchemaRequest) BucketID(bucketID string) ApiUpdateMeasurementSchemaRequest { @@ -830,6 +833,14 @@ func (r ApiUpdateMeasurementSchemaRequest) GetMeasurementID() string { return r.measurementID } +func (r ApiUpdateMeasurementSchemaRequest) MeasurementSchemaUpdateRequest(measurementSchemaUpdateRequest MeasurementSchemaUpdateRequest) ApiUpdateMeasurementSchemaRequest { + r.measurementSchemaUpdateRequest = &measurementSchemaUpdateRequest + return r +} +func (r ApiUpdateMeasurementSchemaRequest) GetMeasurementSchemaUpdateRequest() *MeasurementSchemaUpdateRequest { + return r.measurementSchemaUpdateRequest +} + func (r ApiUpdateMeasurementSchemaRequest) Org(org string) ApiUpdateMeasurementSchemaRequest { r.org = &org return r @@ -846,14 +857,6 @@ func (r ApiUpdateMeasurementSchemaRequest) GetOrgID() *string { return r.orgID } -func (r ApiUpdateMeasurementSchemaRequest) MeasurementSchemaUpdateRequest(measurementSchemaUpdateRequest MeasurementSchemaUpdateRequest) ApiUpdateMeasurementSchemaRequest { - r.measurementSchemaUpdateRequest = &measurementSchemaUpdateRequest - return r -} -func (r ApiUpdateMeasurementSchemaRequest) GetMeasurementSchemaUpdateRequest() *MeasurementSchemaUpdateRequest { - return r.measurementSchemaUpdateRequest -} - func (r ApiUpdateMeasurementSchemaRequest) Execute() (MeasurementSchema, error) { return r.ApiService.UpdateMeasurementSchemaExecute(r) } @@ -929,6 +932,9 @@ func (a *BucketSchemasApiService) UpdateMeasurementSchemaExecuteWithHttpInfo(r A localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.measurementSchemaUpdateRequest == nil { + return localVarReturnValue, nil, reportError("measurementSchemaUpdateRequest is required and must be specified") + } if r.org != nil { localVarQueryParams.Add("org", parameterToString(*r.org, "")) diff --git a/api/api_buckets.gen.go b/api/api_buckets.gen.go index d1dada1..2258a96 100644 --- a/api/api_buckets.gen.go +++ b/api/api_buckets.gen.go @@ -71,7 +71,7 @@ type BucketsApi interface { /* * GetBuckets List buckets - * Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). + * Lists [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). InfluxDB retrieves buckets owned by the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) @@ -81,10 +81,6 @@ type BucketsApi interface { If no query parameters are passed, InfluxDB returns all buckets up to the default `limit`. - #### InfluxDB Cloud - - - Doesn't use `org` or `orgID` parameters. - #### InfluxDB OSS - If you use an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_ @@ -524,7 +520,7 @@ func (r ApiGetBucketsRequest) ExecuteWithHttpInfo() (Buckets, *_nethttp.Response /* - GetBuckets List buckets - - Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). + - Lists [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). InfluxDB retrieves buckets owned by the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) @@ -534,10 +530,6 @@ To limit which buckets are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all buckets up to the default `limit`. -#### InfluxDB Cloud - -- Doesn't use `org` or `orgID` parameters. - #### InfluxDB OSS - If you use an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_ diff --git a/api/api_dbrps.gen.go b/api/api_dbrps.gen.go index 0eb77ef..6dbb331 100644 --- a/api/api_dbrps.gen.go +++ b/api/api_dbrps.gen.go @@ -27,11 +27,17 @@ var ( type DBRPsApi interface { /* - * DeleteDBRPID Delete a database retention policy - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param dbrpID The database retention policy mapping - * @return ApiDeleteDBRPIDRequest - */ + * DeleteDBRPID Delete a database retention policy + * Deletes the specified database retention policy (DBRP) mapping. + + #### Related guide + + - [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param dbrpID A DBRP mapping ID. Only returns the specified DBRP mapping. + * @return ApiDeleteDBRPIDRequest + */ DeleteDBRPID(ctx _context.Context, dbrpID string) ApiDeleteDBRPIDRequest /* @@ -47,10 +53,16 @@ type DBRPsApi interface { DeleteDBRPIDExecuteWithHttpInfo(r ApiDeleteDBRPIDRequest) (*_nethttp.Response, error) /* - * GetDBRPs List database retention policy mappings - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetDBRPsRequest - */ + * GetDBRPs List database retention policy mappings + * Lists database retention policy (DBRP) mappings. + + #### Related guide + + - [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetDBRPsRequest + */ GetDBRPs(ctx _context.Context) ApiGetDBRPsRequest /* @@ -68,11 +80,17 @@ type DBRPsApi interface { GetDBRPsExecuteWithHttpInfo(r ApiGetDBRPsRequest) (DBRPs, *_nethttp.Response, error) /* - * GetDBRPsID Retrieve a database retention policy mapping - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param dbrpID The database retention policy mapping ID - * @return ApiGetDBRPsIDRequest - */ + * GetDBRPsID Retrieve a database retention policy mapping + * Retrieves the specified retention policy (DBRP) mapping. + + #### Related guide + + - [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param dbrpID A DBRP mapping ID. Specifies the DBRP mapping. + * @return ApiGetDBRPsIDRequest + */ GetDBRPsID(ctx _context.Context, dbrpID string) ApiGetDBRPsIDRequest /* @@ -92,7 +110,7 @@ type DBRPsApi interface { /* * PatchDBRPID Update a database retention policy mapping * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param dbrpID The database retention policy mapping. + * @param dbrpID A DBRP mapping ID. Specifies the DBRP mapping. * @return ApiPatchDBRPIDRequest */ PatchDBRPID(ctx _context.Context, dbrpID string) ApiPatchDBRPIDRequest @@ -112,10 +130,21 @@ type DBRPsApi interface { PatchDBRPIDExecuteWithHttpInfo(r ApiPatchDBRPIDRequest) (DBRPGet, *_nethttp.Response, error) /* - * PostDBRP Add a database retention policy mapping - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostDBRPRequest - */ + * PostDBRP Add a database retention policy mapping + * Creates a database retention policy (DBRP) mapping and returns the mapping. + + Use this endpoint to add InfluxDB 1.x API compatibility to your + InfluxDB Cloud or InfluxDB OSS 2.x buckets. Your buckets must contain a + DBRP mapping in order to query and write using the InfluxDB 1.x API. + object. + + #### Related guide + + - [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostDBRPRequest + */ PostDBRP(ctx _context.Context) ApiPostDBRPRequest /* @@ -186,11 +215,17 @@ func (r ApiDeleteDBRPIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error } /* - * DeleteDBRPID Delete a database retention policy - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param dbrpID The database retention policy mapping - * @return ApiDeleteDBRPIDRequest - */ + - DeleteDBRPID Delete a database retention policy + - Deletes the specified database retention policy (DBRP) mapping. + +#### Related guide + +- [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param dbrpID A DBRP mapping ID. Only returns the specified DBRP mapping. + - @return ApiDeleteDBRPIDRequest +*/ func (a *DBRPsApiService) DeleteDBRPID(ctx _context.Context, dbrpID string) ApiDeleteDBRPIDRequest { return ApiDeleteDBRPIDRequest{ ApiService: a, @@ -299,6 +334,17 @@ func (a *DBRPsApiService) DeleteDBRPIDExecuteWithHttpInfo(r ApiDeleteDBRPIDReque newErr.model = &v return localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -399,10 +445,16 @@ func (r ApiGetDBRPsRequest) ExecuteWithHttpInfo() (DBRPs, *_nethttp.Response, er } /* - * GetDBRPs List database retention policy mappings - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetDBRPsRequest - */ + - GetDBRPs List database retention policy mappings + - Lists database retention policy (DBRP) mappings. + +#### Related guide + +- [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiGetDBRPsRequest +*/ func (a *DBRPsApiService) GetDBRPs(ctx _context.Context) ApiGetDBRPsRequest { return ApiGetDBRPsRequest{ ApiService: a, @@ -527,6 +579,17 @@ func (a *DBRPsApiService) GetDBRPsExecuteWithHttpInfo(r ApiGetDBRPsRequest) (DBR newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -610,11 +673,17 @@ func (r ApiGetDBRPsIDRequest) ExecuteWithHttpInfo() (DBRPGet, *_nethttp.Response } /* - * GetDBRPsID Retrieve a database retention policy mapping - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param dbrpID The database retention policy mapping ID - * @return ApiGetDBRPsIDRequest - */ + - GetDBRPsID Retrieve a database retention policy mapping + - Retrieves the specified retention policy (DBRP) mapping. + +#### Related guide + +- [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param dbrpID A DBRP mapping ID. Specifies the DBRP mapping. + - @return ApiGetDBRPsIDRequest +*/ func (a *DBRPsApiService) GetDBRPsID(ctx _context.Context, dbrpID string) ApiGetDBRPsIDRequest { return ApiGetDBRPsIDRequest{ ApiService: a, @@ -726,6 +795,17 @@ func (a *DBRPsApiService) GetDBRPsIDExecuteWithHttpInfo(r ApiGetDBRPsIDRequest) newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -820,7 +900,7 @@ func (r ApiPatchDBRPIDRequest) ExecuteWithHttpInfo() (DBRPGet, *_nethttp.Respons /* * PatchDBRPID Update a database retention policy mapping * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param dbrpID The database retention policy mapping. + * @param dbrpID A DBRP mapping ID. Specifies the DBRP mapping. * @return ApiPatchDBRPIDRequest */ func (a *DBRPsApiService) PatchDBRPID(ctx _context.Context, dbrpID string) ApiPatchDBRPIDRequest { @@ -939,8 +1019,8 @@ func (a *DBRPsApiService) PatchDBRPIDExecuteWithHttpInfo(r ApiPatchDBRPIDRequest newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v Error + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) @@ -1015,10 +1095,21 @@ func (r ApiPostDBRPRequest) ExecuteWithHttpInfo() (DBRP, *_nethttp.Response, err } /* - * PostDBRP Add a database retention policy mapping - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostDBRPRequest - */ + - PostDBRP Add a database retention policy mapping + - Creates a database retention policy (DBRP) mapping and returns the mapping. + +Use this endpoint to add InfluxDB 1.x API compatibility to your +InfluxDB Cloud or InfluxDB OSS 2.x buckets. Your buckets must contain a +DBRP mapping in order to query and write using the InfluxDB 1.x API. +object. + +#### Related guide + +- [Database and retention policy mapping]({{% INFLUXDB_DOCS_URL %}}/reference/api/influxdb-1x/dbrp/) + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiPostDBRPRequest +*/ func (a *DBRPsApiService) PostDBRP(ctx _context.Context) ApiPostDBRPRequest { return ApiPostDBRPRequest{ ApiService: a, @@ -1127,6 +1218,17 @@ func (a *DBRPsApiService) PostDBRPExecuteWithHttpInfo(r ApiPostDBRPRequest) (DBR newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequestError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_invokable_scripts.gen.go b/api/api_invokable_scripts.gen.go index 33bd7db..5145281 100644 --- a/api/api_invokable_scripts.gen.go +++ b/api/api_invokable_scripts.gen.go @@ -16,7 +16,6 @@ import ( _io "io" _nethttp "net/http" _neturl "net/url" - "reflect" "strings" ) @@ -28,12 +27,23 @@ var ( type InvokableScriptsApi interface { /* - * DeleteScriptsID Delete a script - * Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records. - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID A script ID. Deletes the specified script. - * @return ApiDeleteScriptsIDRequest - */ + * DeleteScriptsID Delete a script + * Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records. + + #### Limitations + + - You can delete only one script per request. + - If the script ID you provide doesn't exist for the organization, InfluxDB + responds with an HTTP `204` status code. + + #### Related Guides + + - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptID A script ID. Deletes the specified script. + * @return ApiDeleteScriptsIDRequest + */ DeleteScriptsID(ctx _context.Context, scriptID string) ApiDeleteScriptsIDRequest /* @@ -50,7 +60,7 @@ type InvokableScriptsApi interface { /* * GetScripts List scripts - * Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). + * Lists [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). #### Related guides @@ -76,13 +86,17 @@ type InvokableScriptsApi interface { GetScriptsExecuteWithHttpInfo(r ApiGetScriptsRequest) (Scripts, *_nethttp.Response, error) /* - * GetScriptsID Retrieve a script - * Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). + * GetScriptsID Retrieve a script + * Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID A script ID. Retrieves the specified script. - * @return ApiGetScriptsIDRequest - */ + #### Related Guides + + - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptID A script ID. Retrieves the specified script. + * @return ApiGetScriptsIDRequest + */ GetScriptsID(ctx _context.Context, scriptID string) ApiGetScriptsIDRequest /* @@ -101,9 +115,21 @@ type InvokableScriptsApi interface { /* * PatchScriptsID Update a script - * Updates a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and returns the script. + * Updates an invokable script. - Use this endpoint to update the properties (`name`, `description`, and `script`) of an invokable script. + Use this endpoint to modify values for script properties (`description` and `script`). + + To update a script, pass an object that contains the updated key-value pairs. + + #### Limitations + + - If you send an empty request body, the script will neither update nor + store an empty script, but InfluxDB will respond with an HTTP `200` status + code. + + #### Related Guides + + - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param scriptID A script ID. Updates the specified script. @@ -204,12 +230,23 @@ func (r ApiDeleteScriptsIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, er } /* - * DeleteScriptsID Delete a script - * Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records. - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param scriptID A script ID. Deletes the specified script. - * @return ApiDeleteScriptsIDRequest - */ + - DeleteScriptsID Delete a script + - Deletes a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and all associated records. + +#### Limitations + +- You can delete only one script per request. +- If the script ID you provide doesn't exist for the organization, InfluxDB +responds with an HTTP `204` status code. + +#### Related Guides + +- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param scriptID A script ID. Deletes the specified script. + - @return ApiDeleteScriptsIDRequest +*/ func (a *InvokableScriptsApiService) DeleteScriptsID(ctx _context.Context, scriptID string) ApiDeleteScriptsIDRequest { return ApiDeleteScriptsIDRequest{ ApiService: a, @@ -324,13 +361,11 @@ func (a *InvokableScriptsApiService) DeleteScriptsIDExecuteWithHttpInfo(r ApiDel } type ApiGetScriptsRequest struct { - ctx _context.Context - ApiService InvokableScriptsApi - offset *int32 - limit *int32 - name *string - labelNames *[]string - labelContains *string + ctx _context.Context + ApiService InvokableScriptsApi + offset *int32 + limit *int32 + name *string } func (r ApiGetScriptsRequest) Offset(offset int32) ApiGetScriptsRequest { @@ -357,22 +392,6 @@ func (r ApiGetScriptsRequest) GetName() *string { return r.name } -func (r ApiGetScriptsRequest) LabelNames(labelNames []string) ApiGetScriptsRequest { - r.labelNames = &labelNames - return r -} -func (r ApiGetScriptsRequest) GetLabelNames() *[]string { - return r.labelNames -} - -func (r ApiGetScriptsRequest) LabelContains(labelContains string) ApiGetScriptsRequest { - r.labelContains = &labelContains - return r -} -func (r ApiGetScriptsRequest) GetLabelContains() *string { - return r.labelContains -} - func (r ApiGetScriptsRequest) Execute() (Scripts, error) { return r.ApiService.GetScriptsExecute(r) } @@ -383,7 +402,7 @@ func (r ApiGetScriptsRequest) ExecuteWithHttpInfo() (Scripts, *_nethttp.Response /* - GetScripts List scripts - - Retrieves a list of [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). + - Lists [scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). #### Related guides @@ -444,20 +463,6 @@ func (a *InvokableScriptsApiService) GetScriptsExecuteWithHttpInfo(r ApiGetScrip if r.name != nil { localVarQueryParams.Add("name", parameterToString(*r.name, "")) } - if r.labelNames != nil { - t := *r.labelNames - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("labelNames", parameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("labelNames", parameterToString(t, "multi")) - } - } - if r.labelContains != nil { - localVarQueryParams.Add("labelContains", parameterToString(*r.labelContains, "")) - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -582,13 +587,17 @@ func (r ApiGetScriptsIDRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Respons } /* -* GetScriptsID Retrieve a script -* Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). + - GetScriptsID Retrieve a script + - Retrieves a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/). -* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -* @param scriptID A script ID. Retrieves the specified script. -* @return ApiGetScriptsIDRequest - */ +#### Related Guides + +- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param scriptID A script ID. Retrieves the specified script. + - @return ApiGetScriptsIDRequest +*/ func (a *InvokableScriptsApiService) GetScriptsID(ctx _context.Context, scriptID string) ApiGetScriptsIDRequest { return ApiGetScriptsIDRequest{ ApiService: a, @@ -691,6 +700,17 @@ func (a *InvokableScriptsApiService) GetScriptsIDExecuteWithHttpInfo(r ApiGetScr newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -757,9 +777,21 @@ func (r ApiPatchScriptsIDRequest) ExecuteWithHttpInfo() (Script, *_nethttp.Respo /* - PatchScriptsID Update a script - - Updates a [script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) and returns the script. + - Updates an invokable script. -Use this endpoint to update the properties (`name`, `description`, and `script`) of an invokable script. +Use this endpoint to modify values for script properties (`description` and `script`). + +To update a script, pass an object that contains the updated key-value pairs. + +#### Limitations + +- If you send an empty request body, the script will neither update nor +store an empty script, but InfluxDB will respond with an HTTP `200` status +code. + +#### Related Guides + +- [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param scriptID A script ID. Updates the specified script. @@ -872,6 +904,17 @@ func (a *InvokableScriptsApiService) PatchScriptsIDExecuteWithHttpInfo(r ApiPatc newErr.model = &v return localVarReturnValue, localVarHTTPResponse, newErr } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/api_organizations.gen.go b/api/api_organizations.gen.go index 51c9dca..c95ab4a 100644 --- a/api/api_organizations.gen.go +++ b/api/api_organizations.gen.go @@ -76,13 +76,14 @@ type OrganizationsApi interface { * 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. + Use this endpoint to remove a user's member privileges for an organization. + Removing member privileges 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. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -129,7 +130,7 @@ type OrganizationsApi interface { #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -144,7 +145,7 @@ type OrganizationsApi interface { remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations) + - [Authorizations](#tag/Authorizations-(API-tokens)) * @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. @@ -167,7 +168,7 @@ type OrganizationsApi interface { /* * GetOrgs List organizations - * Retrieves a list of [organizations]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization/). + * Lists [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`. @@ -231,7 +232,7 @@ type OrganizationsApi interface { /* * GetOrgsIDMembers List all members of an organization - * Retrieves a list of all users that belong to an organization. + * Lists all users that belong to an organization. InfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have permission to access InfluxDB. @@ -242,7 +243,7 @@ type OrganizationsApi interface { #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -283,12 +284,12 @@ type OrganizationsApi interface { /* * GetOrgsIDOwners List all owners of an organization - * Retrieves a list of all owners of an organization. + * Lists all owners of an organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Required permissions @@ -404,7 +405,7 @@ type OrganizationsApi interface { #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -451,7 +452,7 @@ type OrganizationsApi interface { #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Required permissions @@ -461,7 +462,7 @@ type OrganizationsApi interface { #### Related endpoints - - [Authorizations](#tag/Authorizations) + - [Authorizations](#tag/Authorizations-(API-tokens)) * @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. @@ -721,13 +722,14 @@ func (r ApiDeleteOrgsIDMembersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Respon - DeleteOrgsIDMembersID Remove a member from an organization - Removes a member from an organization. -Use this endpoint to remove a user's member privileges from a bucket. This -removes the user's `read` and `write` permissions from the organization. +Use this endpoint to remove a user's member privileges for an organization. +Removing member privileges 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. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -919,7 +921,7 @@ permissions from the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -934,7 +936,7 @@ permissions from the organization. remove an owner from. #### Related endpoints -- [Authorizations](#tag/Authorizations) +- [Authorizations](#tag/Authorizations-(API-tokens)) - @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. @@ -1137,7 +1139,7 @@ func (r ApiGetOrgsRequest) ExecuteWithHttpInfo() (Organizations, *_nethttp.Respo /* - GetOrgs List organizations - - Retrieves a list of [organizations]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization/). + - Lists [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`. @@ -1567,7 +1569,7 @@ func (r ApiGetOrgsIDMembersRequest) ExecuteWithHttpInfo() (ResourceMembers, *_ne /* - GetOrgsIDMembers List all members of an organization - - Retrieves a list of all users that belong to an organization. + - Lists all users that belong to an organization. InfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have permission to access InfluxDB. @@ -1578,7 +1580,7 @@ within the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -1783,12 +1785,12 @@ func (r ApiGetOrgsIDOwnersRequest) ExecuteWithHttpInfo() (ResourceOwners, *_neth /* - GetOrgsIDOwners List all owners of an organization - - Retrieves a list of all owners of an organization. + - Lists all owners of an organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Required permissions @@ -2390,7 +2392,7 @@ within the organization. #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Limitations @@ -2604,7 +2606,7 @@ 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. + Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. #### Required permissions @@ -2614,7 +2616,7 @@ Use this endpoint to assign the organization `owner` role to a user. #### Related endpoints -- [Authorizations](#tag/Authorizations) +- [Authorizations](#tag/Authorizations-(API-tokens)) - @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. diff --git a/api/api_signin.gen.go b/api/api_signin.gen.go index 72be52b..3cdc9a0 100644 --- a/api/api_signin.gen.go +++ b/api/api_signin.gen.go @@ -39,7 +39,7 @@ type SigninApi interface { 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. + InfluxDB stores user sessions in memory only. They expire within ten minutes and during restarts of the InfluxDB instance. #### User sessions with authorizations @@ -111,7 +111,7 @@ 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. +InfluxDB stores user sessions in memory only. They expire within ten minutes and during restarts of the InfluxDB instance. #### User sessions with authorizations diff --git a/api/api_users.gen.go b/api/api_users.gen.go index 307457f..db7baea 100644 --- a/api/api_users.gen.go +++ b/api/api_users.gen.go @@ -62,7 +62,7 @@ type UsersApi interface { /* * GetUsers List users - * Retrieves a list of [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + * Lists [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). Default limit is `20`. To limit which users are returned, pass query parameters in your request. @@ -76,6 +76,10 @@ type UsersApi interface { *`USER_ID`* is the ID of the user that you want to retrieve. + #### Related guides + + - [View users](https://docs.influxdata.com/influxdb/latest/users/view-users/). + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetUsersRequest */ @@ -174,8 +178,8 @@ type UsersApi interface { 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_. + 1. Create a user: send a `POST` request to `POST /api/v2/users`. The `name` property is required. + 2. Extract the user ID (`id` property) 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_. @@ -528,7 +532,7 @@ func (r ApiGetUsersRequest) ExecuteWithHttpInfo() (Users, *_nethttp.Response, er /* - GetUsers List users - - Retrieves a list of [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - Lists [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). Default limit is `20`. @@ -543,6 +547,10 @@ To limit which users are returned, pass query parameters in your request. *`USER_ID`* is the ID of the user that you want to retrieve. +#### Related guides + +- [View users](https://docs.influxdata.com/influxdb/latest/users/view-users/). + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetUsersRequest */ @@ -1128,8 +1136,8 @@ through one of the following interfaces: 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_. + 1. Create a user: send a `POST` request to `POST /api/v2/users`. The `name` property is required. + 2. Extract the user ID (`id` property) 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_. diff --git a/api/client.gen.go b/api/client.gen.go index 3663439..df9ec02 100644 --- a/api/client.gen.go +++ b/api/client.gen.go @@ -46,7 +46,7 @@ type APIClient struct { // API Services - AuthorizationsApi AuthorizationsApi + AuthorizationsAPITokensApi AuthorizationsAPITokensApi BackupApi BackupApi @@ -123,7 +123,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services - c.AuthorizationsApi = (*AuthorizationsApiService)(&c.common) + c.AuthorizationsAPITokensApi = (*AuthorizationsAPITokensApiService)(&c.common) c.BackupApi = (*BackupApiService)(&c.common) c.BucketSchemasApi = (*BucketSchemasApiService)(&c.common) c.BucketsApi = (*BucketsApiService)(&c.common) diff --git a/api/contract/openapi b/api/contract/openapi index aa6a5a4..76ede4f 160000 --- a/api/contract/openapi +++ b/api/contract/openapi @@ -1 +1 @@ -Subproject commit aa6a5a48509ffeb49d61593b5a6e70bf6e888b4f +Subproject commit 76ede4fadc8ab793585252b59149f9e46bf67feb diff --git a/api/model_authorization.gen.go b/api/model_authorization.gen.go index c499aa6..086e53e 100644 --- a/api/model_authorization.gen.go +++ b/api/model_authorization.gen.go @@ -17,7 +17,7 @@ import ( // Authorization struct for Authorization type Authorization struct { - // Status of the token. If `inactive`, requests using the token will be rejected. + // Status of the token. If `inactive`, InfluxDB rejects requests that use the token. Status *string `json:"status,omitempty" yaml:"status,omitempty"` // A description of the token. Description *string `json:"description,omitempty" yaml:"description,omitempty"` diff --git a/api/model_authorization_post_request.gen.go b/api/model_authorization_post_request.gen.go index 96a4375..110b15c 100644 --- a/api/model_authorization_post_request.gen.go +++ b/api/model_authorization_post_request.gen.go @@ -16,15 +16,15 @@ import ( // AuthorizationPostRequest struct for AuthorizationPostRequest type AuthorizationPostRequest struct { - // Status of the token. If `inactive`, requests using the token will be rejected. + // Status of the token. If `inactive`, InfluxDB rejects requests that use the token. Status *string `json:"status,omitempty" yaml:"status,omitempty"` // A description of the token. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // The ID of the organization that owns the authorization. + // An organization ID. Specifies the organization that owns the authorization. OrgID string `json:"orgID" yaml:"orgID"` - // The ID of the user that the authorization is scoped to. + // A user ID. Specifies the user that the authorization is scoped to. When a user authenticates with username and password, InfluxDB generates a _user session_ with all the permissions specified by all the user's authorizations. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // A list of permissions for an authorization. An authorization must have at least one permission. + // A list of permissions for an authorization. In the list, provide at least one `permission` object. In a `permission`, the `resource.type` property grants access to all resources of the specified type. To grant access to only a specific resource, specify the `resource.id` property. Permissions []Permission `json:"permissions" yaml:"permissions"` } diff --git a/api/model_authorization_post_request_all_of.gen.go b/api/model_authorization_post_request_all_of.gen.go index 6e10812..32a378d 100644 --- a/api/model_authorization_post_request_all_of.gen.go +++ b/api/model_authorization_post_request_all_of.gen.go @@ -16,11 +16,11 @@ import ( // AuthorizationPostRequestAllOf struct for AuthorizationPostRequestAllOf type AuthorizationPostRequestAllOf struct { - // The ID of the organization that owns the authorization. + // An organization ID. Specifies the organization that owns the authorization. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // The ID of the user that the authorization is scoped to. + // A user ID. Specifies the user that the authorization is scoped to. When a user authenticates with username and password, InfluxDB generates a _user session_ with all the permissions specified by all the user's authorizations. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // A list of permissions for an authorization. An authorization must have at least one permission. + // A list of permissions for an authorization. In the list, provide at least one `permission` object. In a `permission`, the `resource.type` property grants access to all resources of the specified type. To grant access to only a specific resource, specify the `resource.id` property. Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` } diff --git a/api/model_authorization_update_request.gen.go b/api/model_authorization_update_request.gen.go index 8797aaa..a74ea61 100644 --- a/api/model_authorization_update_request.gen.go +++ b/api/model_authorization_update_request.gen.go @@ -16,7 +16,7 @@ import ( // AuthorizationUpdateRequest struct for AuthorizationUpdateRequest type AuthorizationUpdateRequest struct { - // Status of the token. If `inactive`, requests using the token will be rejected. + // Status of the token. If `inactive`, InfluxDB rejects requests that use the token. Status *string `json:"status,omitempty" yaml:"status,omitempty"` // A description of the token. Description *string `json:"description,omitempty" yaml:"description,omitempty"` diff --git a/api/model_dbrp.gen.go b/api/model_dbrp.gen.go index 47fcf3c..f981f12 100644 --- a/api/model_dbrp.gen.go +++ b/api/model_dbrp.gen.go @@ -16,17 +16,17 @@ import ( // DBRP struct for DBRP type DBRP struct { - // The ID of the DBRP mapping. + // The resource ID that InfluxDB uses to uniquely identify the database retention policy (DBRP) mapping. Id string `json:"id" yaml:"id"` - // The ID of the organization. + // An organization ID. Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the mapping. OrgID string `json:"orgID" yaml:"orgID"` - // The ID of the bucket used as the target for the translation. + // A bucket ID. Identifies the bucket used as the target for the translation. BucketID string `json:"bucketID" yaml:"bucketID"` - // InfluxDB v1 database + // A database name. Identifies the InfluxDB v1 database. Database string `json:"database" yaml:"database"` - // InfluxDB v1 retention policy + // A [retention policy](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#retention-policy-rp) name. Identifies the InfluxDB v1 retention policy mapping. RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"` - // Mapping represents the default retention policy for the database specified. + // If set to `true`, this DBRP mapping is the default retention policy for the database (specified by the `database` property's value). Default bool `json:"default" yaml:"default"` // Indicates an autogenerated, virtual mapping based on the bucket name. Currently only available in OSS. Virtual *bool `json:"virtual,omitempty" yaml:"virtual,omitempty"` diff --git a/api/model_dbrp_create.gen.go b/api/model_dbrp_create.gen.go index d776a4a..7eead84 100644 --- a/api/model_dbrp_create.gen.go +++ b/api/model_dbrp_create.gen.go @@ -16,17 +16,17 @@ import ( // DBRPCreate struct for DBRPCreate type DBRPCreate struct { - // The ID of the organization. - OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // The name of the organization that owns this mapping. + // An organization name. Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the mapping. Org *string `json:"org,omitempty" yaml:"org,omitempty"` - // The ID of the bucket used as the target for the translation. + // An organization ID. Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the mapping. + OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` + // A bucket ID. Identifies the bucket used as the target for the translation. BucketID string `json:"bucketID" yaml:"bucketID"` - // InfluxDB v1 database + // A database name. Identifies the InfluxDB v1 database. Database string `json:"database" yaml:"database"` - // InfluxDB v1 retention policy + // A [retention policy](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#retention-policy-rp) name. Identifies the InfluxDB v1 retention policy mapping. RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"` - // Mapping represents the default retention policy for the database specified. + // Set to `true` to use this DBRP mapping as the default retention policy for the database (specified by the `database` property's value). Default *bool `json:"default,omitempty" yaml:"default,omitempty"` } @@ -50,38 +50,6 @@ func NewDBRPCreateWithDefaults() *DBRPCreate { return &this } -// GetOrgID returns the OrgID field value if set, zero value otherwise. -func (o *DBRPCreate) GetOrgID() string { - if o == nil || o.OrgID == nil { - var ret string - return ret - } - return *o.OrgID -} - -// GetOrgIDOk returns a tuple with the OrgID field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DBRPCreate) GetOrgIDOk() (*string, bool) { - if o == nil || o.OrgID == nil { - return nil, false - } - return o.OrgID, true -} - -// HasOrgID returns a boolean if a field has been set. -func (o *DBRPCreate) HasOrgID() bool { - if o != nil && o.OrgID != nil { - return true - } - - return false -} - -// SetOrgID gets a reference to the given string and assigns it to the OrgID field. -func (o *DBRPCreate) SetOrgID(v string) { - o.OrgID = &v -} - // GetOrg returns the Org field value if set, zero value otherwise. func (o *DBRPCreate) GetOrg() string { if o == nil || o.Org == nil { @@ -114,6 +82,38 @@ func (o *DBRPCreate) SetOrg(v string) { o.Org = &v } +// GetOrgID returns the OrgID field value if set, zero value otherwise. +func (o *DBRPCreate) GetOrgID() string { + if o == nil || o.OrgID == nil { + var ret string + return ret + } + return *o.OrgID +} + +// GetOrgIDOk returns a tuple with the OrgID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DBRPCreate) GetOrgIDOk() (*string, bool) { + if o == nil || o.OrgID == nil { + return nil, false + } + return o.OrgID, true +} + +// HasOrgID returns a boolean if a field has been set. +func (o *DBRPCreate) HasOrgID() bool { + if o != nil && o.OrgID != nil { + return true + } + + return false +} + +// SetOrgID gets a reference to the given string and assigns it to the OrgID field. +func (o *DBRPCreate) SetOrgID(v string) { + o.OrgID = &v +} + // GetBucketID returns the BucketID field value func (o *DBRPCreate) GetBucketID() string { if o == nil { @@ -220,12 +220,12 @@ func (o *DBRPCreate) SetDefault(v bool) { func (o DBRPCreate) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.OrgID != nil { - toSerialize["orgID"] = o.OrgID - } if o.Org != nil { toSerialize["org"] = o.Org } + if o.OrgID != nil { + toSerialize["orgID"] = o.OrgID + } if true { toSerialize["bucketID"] = o.BucketID } diff --git a/api/model_dbrp_update.gen.go b/api/model_dbrp_update.gen.go index ce1aa51..d8c951d 100644 --- a/api/model_dbrp_update.gen.go +++ b/api/model_dbrp_update.gen.go @@ -16,9 +16,10 @@ import ( // DBRPUpdate struct for DBRPUpdate type DBRPUpdate struct { - // InfluxDB v1 retention policy + // A [retention policy](https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#retention-policy-rp) name. Identifies the InfluxDB v1 retention policy mapping. RetentionPolicy *string `json:"retention_policy,omitempty" yaml:"retention_policy,omitempty"` - Default *bool `json:"default,omitempty" yaml:"default,omitempty"` + // Set to `true` to use this DBRP mapping as the default retention policy for the database (specified by the `database` property's value). To remove the default mapping, set to `false`. + Default *bool `json:"default,omitempty" yaml:"default,omitempty"` } // NewDBRPUpdate instantiates a new DBRPUpdate object diff --git a/api/model_legacy_authorization_post_request.gen.go b/api/model_legacy_authorization_post_request.gen.go index b0110d1..f3bdbd3 100644 --- a/api/model_legacy_authorization_post_request.gen.go +++ b/api/model_legacy_authorization_post_request.gen.go @@ -16,17 +16,17 @@ import ( // LegacyAuthorizationPostRequest struct for LegacyAuthorizationPostRequest type LegacyAuthorizationPostRequest struct { - // Status of the token. If `inactive`, requests using the token will be rejected. + // Status of the token. If `inactive`, InfluxDB rejects requests that use the token. Status *string `json:"status,omitempty" yaml:"status,omitempty"` // A description of the token. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // The ID of the organization that the authorization is scoped to. + // The organization ID. Identifies the organization that the authorization is scoped to. OrgID string `json:"orgID" yaml:"orgID"` - // The ID of the user that the authorization is scoped to. + // The user ID. Identifies the user that the authorization is scoped to. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // A name that you provide for the authorization. + // The name that you provide for the authorization. Token *string `json:"token,omitempty" yaml:"token,omitempty"` - // A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. + // The list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. Permissions []Permission `json:"permissions" yaml:"permissions"` } diff --git a/api/model_legacy_authorization_post_request_all_of.gen.go b/api/model_legacy_authorization_post_request_all_of.gen.go index 25d7a56..e91ce0d 100644 --- a/api/model_legacy_authorization_post_request_all_of.gen.go +++ b/api/model_legacy_authorization_post_request_all_of.gen.go @@ -16,13 +16,13 @@ import ( // LegacyAuthorizationPostRequestAllOf struct for LegacyAuthorizationPostRequestAllOf type LegacyAuthorizationPostRequestAllOf struct { - // The ID of the organization that the authorization is scoped to. + // The organization ID. Identifies the organization that the authorization is scoped to. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // The ID of the user that the authorization is scoped to. + // The user ID. Identifies the user that the authorization is scoped to. UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` - // A name that you provide for the authorization. + // The name that you provide for the authorization. Token *string `json:"token,omitempty" yaml:"token,omitempty"` - // A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. + // The list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` } diff --git a/api/model_organization.gen.go b/api/model_organization.gen.go index f07714c..a4e57c4 100644 --- a/api/model_organization.gen.go +++ b/api/model_organization.gen.go @@ -17,13 +17,15 @@ import ( // Organization struct for Organization type Organization struct { - Links *OrganizationLinks `json:"links,omitempty" yaml:"links,omitempty"` - Id *string `json:"id,omitempty" yaml:"id,omitempty"` - Name string `json:"name" yaml:"name"` - Description *string `json:"description,omitempty" yaml:"description,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` - // If inactive the organization is inactive. + Links *OrganizationLinks `json:"links,omitempty" yaml:"links,omitempty"` + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + Name string `json:"name" yaml:"name"` + // Discloses whether the organization uses TSM or IOx. + DefaultStorageType *string `json:"defaultStorageType,omitempty" yaml:"defaultStorageType,omitempty"` + Description *string `json:"description,omitempty" yaml:"description,omitempty"` + CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` + // If inactive, the organization is inactive. Status *string `json:"status,omitempty" yaml:"status,omitempty"` } @@ -137,6 +139,38 @@ func (o *Organization) SetName(v string) { o.Name = v } +// GetDefaultStorageType returns the DefaultStorageType field value if set, zero value otherwise. +func (o *Organization) GetDefaultStorageType() string { + if o == nil || o.DefaultStorageType == nil { + var ret string + return ret + } + return *o.DefaultStorageType +} + +// GetDefaultStorageTypeOk returns a tuple with the DefaultStorageType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Organization) GetDefaultStorageTypeOk() (*string, bool) { + if o == nil || o.DefaultStorageType == nil { + return nil, false + } + return o.DefaultStorageType, true +} + +// HasDefaultStorageType returns a boolean if a field has been set. +func (o *Organization) HasDefaultStorageType() bool { + if o != nil && o.DefaultStorageType != nil { + return true + } + + return false +} + +// SetDefaultStorageType gets a reference to the given string and assigns it to the DefaultStorageType field. +func (o *Organization) SetDefaultStorageType(v string) { + o.DefaultStorageType = &v +} + // GetDescription returns the Description field value if set, zero value otherwise. func (o *Organization) GetDescription() string { if o == nil || o.Description == nil { @@ -276,6 +310,9 @@ func (o Organization) MarshalJSON() ([]byte, error) { if true { toSerialize["name"] = o.Name } + if o.DefaultStorageType != nil { + toSerialize["defaultStorageType"] = o.DefaultStorageType + } if o.Description != nil { toSerialize["description"] = o.Description } diff --git a/api/model_permission_resource.gen.go b/api/model_permission_resource.gen.go index 617a7ad..efa359a 100644 --- a/api/model_permission_resource.gen.go +++ b/api/model_permission_resource.gen.go @@ -16,15 +16,15 @@ import ( // PermissionResource struct for PermissionResource type PermissionResource struct { - // The type of resource. In a `permission`, applies the permission to all resources of this type. + // A resource type. Identifies the API resource's type (or _kind_). Type string `json:"type" yaml:"type"` - // The ID of a specific resource. In a `permission`, applies the permission to only the resource with this ID. + // A resource ID. Identifies a specific resource. Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // Optional: A name for the resource. Not all resource types have a name field. + // The name of the resource. _Note: not all resource types have a `name` property_. Name *string `json:"name,omitempty" yaml:"name,omitempty"` - // The ID of the organization that owns the resource. In a `permission`, applies the permission to all resources of `type` owned by this organization. + // An organization ID. Identifies the organization that owns the resource. OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` - // Optional: The name of the organization with `orgID`. + // An organization name. The organization that owns the resource. Org *string `json:"org,omitempty" yaml:"org,omitempty"` } diff --git a/api/model_replication.gen.go b/api/model_replication.gen.go index e8d49e2..59d7cc5 100644 --- a/api/model_replication.gen.go +++ b/api/model_replication.gen.go @@ -16,26 +16,27 @@ import ( // Replication struct for Replication type Replication struct { - Id string `json:"id" yaml:"id"` - Name string `json:"name" yaml:"name"` - Description *string `json:"description,omitempty" yaml:"description,omitempty"` - OrgID string `json:"orgID" yaml:"orgID"` - RemoteID string `json:"remoteID" yaml:"remoteID"` - LocalBucketID string `json:"localBucketID" yaml:"localBucketID"` - RemoteBucketID *string `json:"remoteBucketID,omitempty" yaml:"remoteBucketID,omitempty"` - RemoteBucketName *string `json:"remoteBucketName,omitempty" yaml:"remoteBucketName,omitempty"` - MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" yaml:"maxQueueSizeBytes"` - CurrentQueueSizeBytes int64 `json:"currentQueueSizeBytes" yaml:"currentQueueSizeBytes"` - LatestResponseCode *int32 `json:"latestResponseCode,omitempty" yaml:"latestResponseCode,omitempty"` - LatestErrorMessage *string `json:"latestErrorMessage,omitempty" yaml:"latestErrorMessage,omitempty"` - DropNonRetryableData *bool `json:"dropNonRetryableData,omitempty" yaml:"dropNonRetryableData,omitempty"` + Id string `json:"id" yaml:"id"` + Name string `json:"name" yaml:"name"` + Description *string `json:"description,omitempty" yaml:"description,omitempty"` + OrgID string `json:"orgID" yaml:"orgID"` + RemoteID string `json:"remoteID" yaml:"remoteID"` + LocalBucketID string `json:"localBucketID" yaml:"localBucketID"` + RemoteBucketID *string `json:"remoteBucketID,omitempty" yaml:"remoteBucketID,omitempty"` + RemoteBucketName *string `json:"remoteBucketName,omitempty" yaml:"remoteBucketName,omitempty"` + MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" yaml:"maxQueueSizeBytes"` + CurrentQueueSizeBytes *int64 `json:"currentQueueSizeBytes,omitempty" yaml:"currentQueueSizeBytes,omitempty"` + RemainingBytesToBeSynced *int64 `json:"remainingBytesToBeSynced,omitempty" yaml:"remainingBytesToBeSynced,omitempty"` + LatestResponseCode *int32 `json:"latestResponseCode,omitempty" yaml:"latestResponseCode,omitempty"` + LatestErrorMessage *string `json:"latestErrorMessage,omitempty" yaml:"latestErrorMessage,omitempty"` + DropNonRetryableData *bool `json:"dropNonRetryableData,omitempty" yaml:"dropNonRetryableData,omitempty"` } // NewReplication instantiates a new Replication 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 NewReplication(id string, name string, orgID string, remoteID string, localBucketID string, maxQueueSizeBytes int64, currentQueueSizeBytes int64) *Replication { +func NewReplication(id string, name string, orgID string, remoteID string, localBucketID string, maxQueueSizeBytes int64) *Replication { this := Replication{} this.Id = id this.Name = name @@ -43,7 +44,6 @@ func NewReplication(id string, name string, orgID string, remoteID string, local this.RemoteID = remoteID this.LocalBucketID = localBucketID this.MaxQueueSizeBytes = maxQueueSizeBytes - this.CurrentQueueSizeBytes = currentQueueSizeBytes return &this } @@ -295,28 +295,68 @@ func (o *Replication) SetMaxQueueSizeBytes(v int64) { o.MaxQueueSizeBytes = v } -// GetCurrentQueueSizeBytes returns the CurrentQueueSizeBytes field value +// GetCurrentQueueSizeBytes returns the CurrentQueueSizeBytes field value if set, zero value otherwise. func (o *Replication) GetCurrentQueueSizeBytes() int64 { - if o == nil { + if o == nil || o.CurrentQueueSizeBytes == nil { var ret int64 return ret } - - return o.CurrentQueueSizeBytes + return *o.CurrentQueueSizeBytes } -// GetCurrentQueueSizeBytesOk returns a tuple with the CurrentQueueSizeBytes field value +// GetCurrentQueueSizeBytesOk returns a tuple with the CurrentQueueSizeBytes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Replication) GetCurrentQueueSizeBytesOk() (*int64, bool) { - if o == nil { + if o == nil || o.CurrentQueueSizeBytes == nil { return nil, false } - return &o.CurrentQueueSizeBytes, true + return o.CurrentQueueSizeBytes, true } -// SetCurrentQueueSizeBytes sets field value +// HasCurrentQueueSizeBytes returns a boolean if a field has been set. +func (o *Replication) HasCurrentQueueSizeBytes() bool { + if o != nil && o.CurrentQueueSizeBytes != nil { + return true + } + + return false +} + +// SetCurrentQueueSizeBytes gets a reference to the given int64 and assigns it to the CurrentQueueSizeBytes field. func (o *Replication) SetCurrentQueueSizeBytes(v int64) { - o.CurrentQueueSizeBytes = v + o.CurrentQueueSizeBytes = &v +} + +// GetRemainingBytesToBeSynced returns the RemainingBytesToBeSynced field value if set, zero value otherwise. +func (o *Replication) GetRemainingBytesToBeSynced() int64 { + if o == nil || o.RemainingBytesToBeSynced == nil { + var ret int64 + return ret + } + return *o.RemainingBytesToBeSynced +} + +// GetRemainingBytesToBeSyncedOk returns a tuple with the RemainingBytesToBeSynced field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Replication) GetRemainingBytesToBeSyncedOk() (*int64, bool) { + if o == nil || o.RemainingBytesToBeSynced == nil { + return nil, false + } + return o.RemainingBytesToBeSynced, true +} + +// HasRemainingBytesToBeSynced returns a boolean if a field has been set. +func (o *Replication) HasRemainingBytesToBeSynced() bool { + if o != nil && o.RemainingBytesToBeSynced != nil { + return true + } + + return false +} + +// SetRemainingBytesToBeSynced gets a reference to the given int64 and assigns it to the RemainingBytesToBeSynced field. +func (o *Replication) SetRemainingBytesToBeSynced(v int64) { + o.RemainingBytesToBeSynced = &v } // GetLatestResponseCode returns the LatestResponseCode field value if set, zero value otherwise. @@ -444,9 +484,12 @@ func (o Replication) MarshalJSON() ([]byte, error) { if true { toSerialize["maxQueueSizeBytes"] = o.MaxQueueSizeBytes } - if true { + if o.CurrentQueueSizeBytes != nil { toSerialize["currentQueueSizeBytes"] = o.CurrentQueueSizeBytes } + if o.RemainingBytesToBeSynced != nil { + toSerialize["remainingBytesToBeSynced"] = o.RemainingBytesToBeSynced + } if o.LatestResponseCode != nil { toSerialize["latestResponseCode"] = o.LatestResponseCode } diff --git a/api/model_retention_rule.gen.go b/api/model_retention_rule.gen.go index f0251ba..42be118 100644 --- a/api/model_retention_rule.gen.go +++ b/api/model_retention_rule.gen.go @@ -19,7 +19,7 @@ type RetentionRule struct { Type *string `json:"type,omitempty" yaml:"type,omitempty"` // The duration in seconds for how long data will be kept in the database. The default duration is 2592000 (30 days). 0 represents infinite retention. EverySeconds int64 `json:"everySeconds" yaml:"everySeconds"` - // The shard group duration. The duration or interval (in seconds) that each shard group covers. #### InfluxDB Cloud - Does not use `shardGroupDurationsSeconds`. #### InfluxDB OSS - Default value depends on the [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration). + // The shard group duration. The duration or interval (in seconds) that each shard group covers. #### InfluxDB Cloud - Does not use `shardGroupDurationsSeconds`. #### InfluxDB OSS - Default value depends on the [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration). ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty" yaml:"shardGroupDurationSeconds,omitempty"` } diff --git a/api/model_script.gen.go b/api/model_script.gen.go index ac71c06..39baa19 100644 --- a/api/model_script.gen.go +++ b/api/model_script.gen.go @@ -28,8 +28,6 @@ type Script struct { Url *string `json:"url,omitempty" yaml:"url,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` - // The list of label names associated with the script. - Labels *[]string `json:"labels,omitempty" yaml:"labels,omitempty"` } // NewScript instantiates a new Script object @@ -316,38 +314,6 @@ func (o *Script) SetUpdatedAt(v time.Time) { o.UpdatedAt = &v } -// GetLabels returns the Labels field value if set, zero value otherwise. -func (o *Script) GetLabels() []string { - if o == nil || o.Labels == nil { - var ret []string - return ret - } - return *o.Labels -} - -// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Script) GetLabelsOk() (*[]string, bool) { - if o == nil || o.Labels == nil { - return nil, false - } - return o.Labels, true -} - -// HasLabels returns a boolean if a field has been set. -func (o *Script) HasLabels() bool { - if o != nil && o.Labels != nil { - return true - } - - return false -} - -// SetLabels gets a reference to the given []string and assigns it to the Labels field. -func (o *Script) SetLabels(v []string) { - o.Labels = &v -} - func (o Script) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { @@ -377,9 +343,6 @@ func (o Script) MarshalJSON() ([]byte, error) { if o.UpdatedAt != nil { toSerialize["updatedAt"] = o.UpdatedAt } - if o.Labels != nil { - toSerialize["labels"] = o.Labels - } return json.Marshal(toSerialize) } diff --git a/api/model_script_update_request.gen.go b/api/model_script_update_request.gen.go index 1d9b556..304922e 100644 --- a/api/model_script_update_request.gen.go +++ b/api/model_script_update_request.gen.go @@ -16,9 +16,9 @@ import ( // ScriptUpdateRequest struct for ScriptUpdateRequest type ScriptUpdateRequest struct { - Name *string `json:"name,omitempty" yaml:"name,omitempty"` + // A description of the script. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - // script is script to be executed + // The script to execute. Script *string `json:"script,omitempty" yaml:"script,omitempty"` } @@ -39,38 +39,6 @@ func NewScriptUpdateRequestWithDefaults() *ScriptUpdateRequest { return &this } -// GetName returns the Name field value if set, zero value otherwise. -func (o *ScriptUpdateRequest) GetName() string { - if o == nil || o.Name == nil { - var ret string - return ret - } - return *o.Name -} - -// GetNameOk returns a tuple with the Name field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ScriptUpdateRequest) GetNameOk() (*string, bool) { - if o == nil || o.Name == nil { - return nil, false - } - return o.Name, true -} - -// HasName returns a boolean if a field has been set. -func (o *ScriptUpdateRequest) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. -func (o *ScriptUpdateRequest) SetName(v string) { - o.Name = &v -} - // GetDescription returns the Description field value if set, zero value otherwise. func (o *ScriptUpdateRequest) GetDescription() string { if o == nil || o.Description == nil { @@ -137,9 +105,6 @@ func (o *ScriptUpdateRequest) SetScript(v string) { func (o ScriptUpdateRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } if o.Description != nil { toSerialize["description"] = o.Description } diff --git a/api/model_user.gen.go b/api/model_user.gen.go index 926b6fc..c501ac8 100644 --- a/api/model_user.gen.go +++ b/api/model_user.gen.go @@ -18,8 +18,6 @@ import ( type User struct { // The user ID. Id *string `json:"id,omitempty" yaml:"id,omitempty"` - // The OAuth ID. - OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"` // The user name. Name string `json:"name" yaml:"name"` // If `inactive`, the user is inactive. Default is `active`. @@ -80,38 +78,6 @@ func (o *User) SetId(v string) { o.Id = &v } -// GetOauthID returns the OauthID field value if set, zero value otherwise. -func (o *User) GetOauthID() string { - if o == nil || o.OauthID == nil { - var ret string - return ret - } - return *o.OauthID -} - -// GetOauthIDOk returns a tuple with the OauthID field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *User) GetOauthIDOk() (*string, bool) { - if o == nil || o.OauthID == nil { - return nil, false - } - return o.OauthID, true -} - -// HasOauthID returns a boolean if a field has been set. -func (o *User) HasOauthID() bool { - if o != nil && o.OauthID != nil { - return true - } - - return false -} - -// SetOauthID gets a reference to the given string and assigns it to the OauthID field. -func (o *User) SetOauthID(v string) { - o.OauthID = &v -} - // GetName returns the Name field value func (o *User) GetName() string { if o == nil { @@ -173,9 +139,6 @@ func (o User) MarshalJSON() ([]byte, error) { if o.Id != nil { toSerialize["id"] = o.Id } - if o.OauthID != nil { - toSerialize["oauthID"] = o.OauthID - } if true { toSerialize["name"] = o.Name } diff --git a/clients/auth/auth.go b/clients/auth/auth.go index e47a3b8..8b37aa6 100644 --- a/clients/auth/auth.go +++ b/clients/auth/auth.go @@ -12,7 +12,7 @@ import ( type Client struct { clients.CLI - api.AuthorizationsApi + api.AuthorizationsAPITokensApi api.UsersApi api.OrganizationsApi api.ResourcesApi diff --git a/clients/replication/replication.go b/clients/replication/replication.go index cc26926..96d720d 100644 --- a/clients/replication/replication.go +++ b/clients/replication/replication.go @@ -241,7 +241,7 @@ func (c Client) printReplication(opts printReplicationOpts) error { } headers := []string{"ID", "Name", "Org ID", "Remote ID", "Local Bucket ID", "Remote Bucket ID", "Remote Bucket Name", - "Current Queue Bytes", "Max Queue Bytes", "Latest Status Code", "Drop Non-Retryable Data"} + "Remaining Bytes to be Synced", "Current Queue Bytes on Disk", "Max Queue Bytes", "Latest Status Code", "Drop Non-Retryable Data"} if opts.deleted { headers = append(headers, "Deleted") } @@ -258,17 +258,18 @@ func (c Client) printReplication(opts printReplicationOpts) error { bucketID = "" } row := map[string]interface{}{ - "ID": r.GetId(), - "Name": r.GetName(), - "Org ID": r.GetOrgID(), - "Remote ID": r.GetRemoteID(), - "Local Bucket ID": r.GetLocalBucketID(), - "Remote Bucket ID": bucketID, - "Remote Bucket Name": r.GetRemoteBucketName(), - "Current Queue Bytes": r.GetCurrentQueueSizeBytes(), - "Max Queue Bytes": r.GetMaxQueueSizeBytes(), - "Latest Status Code": r.GetLatestResponseCode(), - "Drop Non-Retryable Data": r.GetDropNonRetryableData(), + "ID": r.GetId(), + "Name": r.GetName(), + "Org ID": r.GetOrgID(), + "Remote ID": r.GetRemoteID(), + "Local Bucket ID": r.GetLocalBucketID(), + "Remote Bucket ID": bucketID, + "Remote Bucket Name": r.GetRemoteBucketName(), + "Remaining Bytes to be Synced": r.GetRemainingBytesToBeSynced(), + "Current Queue Bytes on Disk": r.GetCurrentQueueSizeBytes(), + "Max Queue Bytes": r.GetMaxQueueSizeBytes(), + "Latest Status Code": r.GetLatestResponseCode(), + "Drop Non-Retryable Data": r.GetDropNonRetryableData(), } if opts.deleted { row["Deleted"] = true diff --git a/clients/script/script.go b/clients/script/script.go index e962038..7146419 100644 --- a/clients/script/script.go +++ b/clients/script/script.go @@ -139,7 +139,6 @@ func (c Client) Update(ctx context.Context, params *UpdateParams) error { } req := api.ScriptUpdateRequest{ - Name: ¶ms.Name, Description: ¶ms.Description, Script: ¶ms.Script, } diff --git a/cmd/influx/auth.go b/cmd/influx/auth.go index f3f7dc0..eb4e1f3 100644 --- a/cmd/influx/auth.go +++ b/cmd/influx/auth.go @@ -133,11 +133,11 @@ func newCreateCommand() cli.Command { api := getAPI(ctx) client := auth.Client{ - CLI: getCLI(ctx), - AuthorizationsApi: api.AuthorizationsApi, - UsersApi: api.UsersApi, - OrganizationsApi: api.OrganizationsApi, - ResourcesApi: api.ResourcesApi, + CLI: getCLI(ctx), + AuthorizationsAPITokensApi: api.AuthorizationsAPITokensApi, + UsersApi: api.UsersApi, + OrganizationsApi: api.OrganizationsApi, + ResourcesApi: api.ResourcesApi, } return client.Create(getContext(ctx), ¶ms) }, @@ -160,10 +160,10 @@ func newDeleteCommand() cli.Command { Action: func(ctx *cli.Context) error { api := getAPI(ctx) client := auth.Client{ - CLI: getCLI(ctx), - AuthorizationsApi: api.AuthorizationsApi, - UsersApi: api.UsersApi, - OrganizationsApi: api.OrganizationsApi, + CLI: getCLI(ctx), + AuthorizationsAPITokensApi: api.AuthorizationsAPITokensApi, + UsersApi: api.UsersApi, + OrganizationsApi: api.OrganizationsApi, } return client.Remove(getContext(ctx), ctx.String("id")) }, @@ -202,10 +202,10 @@ func newListCommand() cli.Command { } api := getAPI(ctx) client := auth.Client{ - CLI: getCLI(ctx), - AuthorizationsApi: api.AuthorizationsApi, - UsersApi: api.UsersApi, - OrganizationsApi: api.OrganizationsApi, + CLI: getCLI(ctx), + AuthorizationsAPITokensApi: api.AuthorizationsAPITokensApi, + UsersApi: api.UsersApi, + OrganizationsApi: api.OrganizationsApi, } return client.List(getContext(ctx), ¶ms) }, @@ -227,10 +227,10 @@ func newSetActiveCommand() cli.Command { Action: func(ctx *cli.Context) error { api := getAPI(ctx) client := auth.Client{ - CLI: getCLI(ctx), - AuthorizationsApi: api.AuthorizationsApi, - UsersApi: api.UsersApi, - OrganizationsApi: api.OrganizationsApi, + CLI: getCLI(ctx), + AuthorizationsAPITokensApi: api.AuthorizationsAPITokensApi, + UsersApi: api.UsersApi, + OrganizationsApi: api.OrganizationsApi, } return client.SetActive(getContext(ctx), ctx.String("id"), true) }, @@ -252,10 +252,10 @@ func newSetInactiveCommand() cli.Command { Action: func(ctx *cli.Context) error { api := getAPI(ctx) client := auth.Client{ - CLI: getCLI(ctx), - AuthorizationsApi: api.AuthorizationsApi, - UsersApi: api.UsersApi, - OrganizationsApi: api.OrganizationsApi, + CLI: getCLI(ctx), + AuthorizationsAPITokensApi: api.AuthorizationsAPITokensApi, + UsersApi: api.UsersApi, + OrganizationsApi: api.OrganizationsApi, } return client.SetActive(getContext(ctx), ctx.String("id"), false) },