feat: Add bucket schema management commands (#52)
* feat: update generated client to include schema-management APIs * feat: implement interfaces to decode flags and CSV * feat: implement decoders for different measurement schema column formats * feat: extend bucket CLI commands to support schema type property * feat: add CLI commands to manage measurement schema * test: add unit tests for bucket schema create, update and list commands
This commit is contained in:
718
internal/api/api_bucket_schemas.gen.go
Normal file
718
internal/api/api_bucket_schemas.gen.go
Normal file
@ -0,0 +1,718 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_context "context"
|
||||
_ioutil "io/ioutil"
|
||||
_nethttp "net/http"
|
||||
_neturl "net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Linger please
|
||||
var (
|
||||
_ _context.Context
|
||||
)
|
||||
|
||||
type BucketSchemasApi interface {
|
||||
|
||||
/*
|
||||
* CreateMeasurementSchema Create a new measurement schema for this bucket
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @return ApiCreateMeasurementSchemaRequest
|
||||
*/
|
||||
CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest
|
||||
|
||||
/*
|
||||
* CreateMeasurementSchemaExecute executes the request
|
||||
* @return MeasurementSchema
|
||||
*/
|
||||
CreateMeasurementSchemaExecute(r ApiCreateMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error)
|
||||
|
||||
/*
|
||||
* GetMeasurementSchema Fetch schema information for a measurement
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @param measurementID The ID of the measurement
|
||||
* @return ApiGetMeasurementSchemaRequest
|
||||
*/
|
||||
GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiGetMeasurementSchemaRequest
|
||||
|
||||
/*
|
||||
* GetMeasurementSchemaExecute executes the request
|
||||
* @return MeasurementSchema
|
||||
*/
|
||||
GetMeasurementSchemaExecute(r ApiGetMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error)
|
||||
|
||||
/*
|
||||
* GetMeasurementSchemas Retrieve a list of measurement schemas defined for this bucket
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @return ApiGetMeasurementSchemasRequest
|
||||
*/
|
||||
GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest
|
||||
|
||||
/*
|
||||
* GetMeasurementSchemasExecute executes the request
|
||||
* @return MeasurementSchemaList
|
||||
*/
|
||||
GetMeasurementSchemasExecute(r ApiGetMeasurementSchemasRequest) (MeasurementSchemaList, *_nethttp.Response, error)
|
||||
|
||||
/*
|
||||
* UpdateMeasurementSchema Update existing measurement schema
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @param measurementID The ID of the measurement
|
||||
* @return ApiUpdateMeasurementSchemaRequest
|
||||
*/
|
||||
UpdateMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiUpdateMeasurementSchemaRequest
|
||||
|
||||
/*
|
||||
* UpdateMeasurementSchemaExecute executes the request
|
||||
* @return MeasurementSchema
|
||||
*/
|
||||
UpdateMeasurementSchemaExecute(r ApiUpdateMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error)
|
||||
}
|
||||
|
||||
// BucketSchemasApiService BucketSchemasApi service
|
||||
type BucketSchemasApiService service
|
||||
|
||||
type ApiCreateMeasurementSchemaRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService BucketSchemasApi
|
||||
bucketID string
|
||||
org *string
|
||||
orgID *string
|
||||
measurementSchemaCreateRequest *MeasurementSchemaCreateRequest
|
||||
}
|
||||
|
||||
func (r ApiCreateMeasurementSchemaRequest) BucketID(bucketID string) ApiCreateMeasurementSchemaRequest {
|
||||
r.bucketID = bucketID
|
||||
return r
|
||||
}
|
||||
func (r ApiCreateMeasurementSchemaRequest) GetBucketID() string {
|
||||
return r.bucketID
|
||||
}
|
||||
|
||||
func (r ApiCreateMeasurementSchemaRequest) Org(org string) ApiCreateMeasurementSchemaRequest {
|
||||
r.org = &org
|
||||
return r
|
||||
}
|
||||
func (r ApiCreateMeasurementSchemaRequest) GetOrg() *string {
|
||||
return r.org
|
||||
}
|
||||
|
||||
func (r ApiCreateMeasurementSchemaRequest) OrgID(orgID string) ApiCreateMeasurementSchemaRequest {
|
||||
r.orgID = &orgID
|
||||
return r
|
||||
}
|
||||
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, *_nethttp.Response, error) {
|
||||
return r.ApiService.CreateMeasurementSchemaExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* CreateMeasurementSchema Create a new measurement schema for this bucket
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @return ApiCreateMeasurementSchemaRequest
|
||||
*/
|
||||
func (a *BucketSchemasApiService) CreateMeasurementSchema(ctx _context.Context, bucketID string) ApiCreateMeasurementSchemaRequest {
|
||||
return ApiCreateMeasurementSchemaRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
bucketID: bucketID,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return MeasurementSchema
|
||||
*/
|
||||
func (a *BucketSchemasApiService) CreateMeasurementSchemaExecute(r ApiCreateMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodPost
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue MeasurementSchema
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BucketSchemasApiService.CreateMeasurementSchema")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
|
||||
if r.org != nil {
|
||||
localVarQueryParams.Add("org", parameterToString(*r.org, ""))
|
||||
}
|
||||
if r.orgID != nil {
|
||||
localVarQueryParams.Add("orgID", parameterToString(*r.orgID, ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.measurementSchemaCreateRequest
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
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 = err.Error()
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
newErr.model = &v
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHTTPResponse, nil
|
||||
}
|
||||
|
||||
type ApiGetMeasurementSchemaRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService BucketSchemasApi
|
||||
bucketID string
|
||||
measurementID string
|
||||
org *string
|
||||
orgID *string
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemaRequest) BucketID(bucketID string) ApiGetMeasurementSchemaRequest {
|
||||
r.bucketID = bucketID
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemaRequest) GetBucketID() string {
|
||||
return r.bucketID
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemaRequest) MeasurementID(measurementID string) ApiGetMeasurementSchemaRequest {
|
||||
r.measurementID = measurementID
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemaRequest) GetMeasurementID() string {
|
||||
return r.measurementID
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemaRequest) Org(org string) ApiGetMeasurementSchemaRequest {
|
||||
r.org = &org
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemaRequest) GetOrg() *string {
|
||||
return r.org
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemaRequest) OrgID(orgID string) ApiGetMeasurementSchemaRequest {
|
||||
r.orgID = &orgID
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemaRequest) GetOrgID() *string {
|
||||
return r.orgID
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemaRequest) Execute() (MeasurementSchema, *_nethttp.Response, error) {
|
||||
return r.ApiService.GetMeasurementSchemaExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* GetMeasurementSchema Fetch schema information for a measurement
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @param measurementID The ID of the measurement
|
||||
* @return ApiGetMeasurementSchemaRequest
|
||||
*/
|
||||
func (a *BucketSchemasApiService) GetMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiGetMeasurementSchemaRequest {
|
||||
return ApiGetMeasurementSchemaRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
bucketID: bucketID,
|
||||
measurementID: measurementID,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return MeasurementSchema
|
||||
*/
|
||||
func (a *BucketSchemasApiService) GetMeasurementSchemaExecute(r ApiGetMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodGet
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue MeasurementSchema
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BucketSchemasApiService.GetMeasurementSchema")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements/{measurementID}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"measurementID"+"}", _neturl.PathEscape(parameterToString(r.measurementID, "")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
|
||||
if r.org != nil {
|
||||
localVarQueryParams.Add("org", parameterToString(*r.org, ""))
|
||||
}
|
||||
if r.orgID != nil {
|
||||
localVarQueryParams.Add("orgID", parameterToString(*r.orgID, ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: localVarHTTPResponse.Status,
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHTTPResponse, nil
|
||||
}
|
||||
|
||||
type ApiGetMeasurementSchemasRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService BucketSchemasApi
|
||||
bucketID string
|
||||
org *string
|
||||
orgID *string
|
||||
name *string
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemasRequest) BucketID(bucketID string) ApiGetMeasurementSchemasRequest {
|
||||
r.bucketID = bucketID
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemasRequest) GetBucketID() string {
|
||||
return r.bucketID
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemasRequest) Org(org string) ApiGetMeasurementSchemasRequest {
|
||||
r.org = &org
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemasRequest) GetOrg() *string {
|
||||
return r.org
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemasRequest) OrgID(orgID string) ApiGetMeasurementSchemasRequest {
|
||||
r.orgID = &orgID
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemasRequest) GetOrgID() *string {
|
||||
return r.orgID
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemasRequest) Name(name string) ApiGetMeasurementSchemasRequest {
|
||||
r.name = &name
|
||||
return r
|
||||
}
|
||||
func (r ApiGetMeasurementSchemasRequest) GetName() *string {
|
||||
return r.name
|
||||
}
|
||||
|
||||
func (r ApiGetMeasurementSchemasRequest) Execute() (MeasurementSchemaList, *_nethttp.Response, error) {
|
||||
return r.ApiService.GetMeasurementSchemasExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* GetMeasurementSchemas Retrieve a list of measurement schemas defined for this bucket
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @return ApiGetMeasurementSchemasRequest
|
||||
*/
|
||||
func (a *BucketSchemasApiService) GetMeasurementSchemas(ctx _context.Context, bucketID string) ApiGetMeasurementSchemasRequest {
|
||||
return ApiGetMeasurementSchemasRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
bucketID: bucketID,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return MeasurementSchemaList
|
||||
*/
|
||||
func (a *BucketSchemasApiService) GetMeasurementSchemasExecute(r ApiGetMeasurementSchemasRequest) (MeasurementSchemaList, *_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodGet
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue MeasurementSchemaList
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BucketSchemasApiService.GetMeasurementSchemas")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
|
||||
if r.org != nil {
|
||||
localVarQueryParams.Add("org", parameterToString(*r.org, ""))
|
||||
}
|
||||
if r.orgID != nil {
|
||||
localVarQueryParams.Add("orgID", parameterToString(*r.orgID, ""))
|
||||
}
|
||||
if r.name != nil {
|
||||
localVarQueryParams.Add("name", parameterToString(*r.name, ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: localVarHTTPResponse.Status,
|
||||
}
|
||||
if localVarHTTPResponse.StatusCode == 404 {
|
||||
var v Error
|
||||
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
newErr.model = &v
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHTTPResponse, nil
|
||||
}
|
||||
|
||||
type ApiUpdateMeasurementSchemaRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService BucketSchemasApi
|
||||
bucketID string
|
||||
measurementID string
|
||||
org *string
|
||||
orgID *string
|
||||
measurementSchemaUpdateRequest *MeasurementSchemaUpdateRequest
|
||||
}
|
||||
|
||||
func (r ApiUpdateMeasurementSchemaRequest) BucketID(bucketID string) ApiUpdateMeasurementSchemaRequest {
|
||||
r.bucketID = bucketID
|
||||
return r
|
||||
}
|
||||
func (r ApiUpdateMeasurementSchemaRequest) GetBucketID() string {
|
||||
return r.bucketID
|
||||
}
|
||||
|
||||
func (r ApiUpdateMeasurementSchemaRequest) MeasurementID(measurementID string) ApiUpdateMeasurementSchemaRequest {
|
||||
r.measurementID = measurementID
|
||||
return r
|
||||
}
|
||||
func (r ApiUpdateMeasurementSchemaRequest) GetMeasurementID() string {
|
||||
return r.measurementID
|
||||
}
|
||||
|
||||
func (r ApiUpdateMeasurementSchemaRequest) Org(org string) ApiUpdateMeasurementSchemaRequest {
|
||||
r.org = &org
|
||||
return r
|
||||
}
|
||||
func (r ApiUpdateMeasurementSchemaRequest) GetOrg() *string {
|
||||
return r.org
|
||||
}
|
||||
|
||||
func (r ApiUpdateMeasurementSchemaRequest) OrgID(orgID string) ApiUpdateMeasurementSchemaRequest {
|
||||
r.orgID = &orgID
|
||||
return r
|
||||
}
|
||||
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, *_nethttp.Response, error) {
|
||||
return r.ApiService.UpdateMeasurementSchemaExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* UpdateMeasurementSchema Update existing measurement schema
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param bucketID The ID of the bucket
|
||||
* @param measurementID The ID of the measurement
|
||||
* @return ApiUpdateMeasurementSchemaRequest
|
||||
*/
|
||||
func (a *BucketSchemasApiService) UpdateMeasurementSchema(ctx _context.Context, bucketID string, measurementID string) ApiUpdateMeasurementSchemaRequest {
|
||||
return ApiUpdateMeasurementSchemaRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
bucketID: bucketID,
|
||||
measurementID: measurementID,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return MeasurementSchema
|
||||
*/
|
||||
func (a *BucketSchemasApiService) UpdateMeasurementSchemaExecute(r ApiUpdateMeasurementSchemaRequest) (MeasurementSchema, *_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodPatch
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue MeasurementSchema
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BucketSchemasApiService.UpdateMeasurementSchema")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/buckets/{bucketID}/schema/measurements/{measurementID}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"bucketID"+"}", _neturl.PathEscape(parameterToString(r.bucketID, "")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"measurementID"+"}", _neturl.PathEscape(parameterToString(r.measurementID, "")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
|
||||
if r.org != nil {
|
||||
localVarQueryParams.Add("org", parameterToString(*r.org, ""))
|
||||
}
|
||||
if r.orgID != nil {
|
||||
localVarQueryParams.Add("orgID", parameterToString(*r.orgID, ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.measurementSchemaUpdateRequest
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
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 = err.Error()
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
newErr.model = &v
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHTTPResponse, nil
|
||||
}
|
@ -47,6 +47,8 @@ type APIClient struct {
|
||||
|
||||
// API Services
|
||||
|
||||
BucketSchemasApi BucketSchemasApi
|
||||
|
||||
BucketsApi BucketsApi
|
||||
|
||||
HealthApi HealthApi
|
||||
@ -74,6 +76,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
|
||||
c.common.client = c
|
||||
|
||||
// API Services
|
||||
c.BucketSchemasApi = (*BucketSchemasApiService)(&c.common)
|
||||
c.BucketsApi = (*BucketsApiService)(&c.common)
|
||||
c.HealthApi = (*HealthApiService)(&c.common)
|
||||
c.OrganizationsApi = (*OrganizationsApiService)(&c.common)
|
||||
|
@ -24,6 +24,7 @@ type Bucket struct {
|
||||
Description *string `json:"description,omitempty"`
|
||||
OrgID *string `json:"orgID,omitempty"`
|
||||
Rp *string `json:"rp,omitempty"`
|
||||
SchemaType *SchemaType `json:"schemaType,omitempty"`
|
||||
CreatedAt *time.Time `json:"createdAt,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
|
||||
// Rules to expire or retain data. No rules means data never expires.
|
||||
@ -270,6 +271,38 @@ func (o *Bucket) SetRp(v string) {
|
||||
o.Rp = &v
|
||||
}
|
||||
|
||||
// GetSchemaType returns the SchemaType field value if set, zero value otherwise.
|
||||
func (o *Bucket) GetSchemaType() SchemaType {
|
||||
if o == nil || o.SchemaType == nil {
|
||||
var ret SchemaType
|
||||
return ret
|
||||
}
|
||||
return *o.SchemaType
|
||||
}
|
||||
|
||||
// GetSchemaTypeOk returns a tuple with the SchemaType field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Bucket) GetSchemaTypeOk() (*SchemaType, bool) {
|
||||
if o == nil || o.SchemaType == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.SchemaType, true
|
||||
}
|
||||
|
||||
// HasSchemaType returns a boolean if a field has been set.
|
||||
func (o *Bucket) HasSchemaType() bool {
|
||||
if o != nil && o.SchemaType != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetSchemaType gets a reference to the given SchemaType and assigns it to the SchemaType field.
|
||||
func (o *Bucket) SetSchemaType(v SchemaType) {
|
||||
o.SchemaType = &v
|
||||
}
|
||||
|
||||
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
|
||||
func (o *Bucket) GetCreatedAt() time.Time {
|
||||
if o == nil || o.CreatedAt == nil {
|
||||
@ -413,6 +446,9 @@ func (o Bucket) MarshalJSON() ([]byte, error) {
|
||||
if o.Rp != nil {
|
||||
toSerialize["rp"] = o.Rp
|
||||
}
|
||||
if o.SchemaType != nil {
|
||||
toSerialize["schemaType"] = o.SchemaType
|
||||
}
|
||||
if o.CreatedAt != nil {
|
||||
toSerialize["createdAt"] = o.CreatedAt
|
||||
}
|
||||
|
86
internal/api/model_column_data_type.gen.go
Normal file
86
internal/api/model_column_data_type.gen.go
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ColumnDataType the model 'ColumnDataType'
|
||||
type ColumnDataType string
|
||||
|
||||
// List of ColumnDataType
|
||||
const (
|
||||
COLUMNDATATYPE_INTEGER ColumnDataType = "integer"
|
||||
COLUMNDATATYPE_FLOAT ColumnDataType = "float"
|
||||
COLUMNDATATYPE_BOOLEAN ColumnDataType = "boolean"
|
||||
COLUMNDATATYPE_STRING ColumnDataType = "string"
|
||||
COLUMNDATATYPE_UNSIGNED ColumnDataType = "unsigned"
|
||||
)
|
||||
|
||||
func (v *ColumnDataType) UnmarshalJSON(src []byte) error {
|
||||
var value string
|
||||
err := json.Unmarshal(src, &value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
enumTypeValue := ColumnDataType(value)
|
||||
for _, existing := range []ColumnDataType{"integer", "float", "boolean", "string", "unsigned"} {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid ColumnDataType", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to ColumnDataType value
|
||||
func (v ColumnDataType) Ptr() *ColumnDataType {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableColumnDataType struct {
|
||||
value *ColumnDataType
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableColumnDataType) Get() *ColumnDataType {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableColumnDataType) Set(val *ColumnDataType) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableColumnDataType) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableColumnDataType) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableColumnDataType(val *ColumnDataType) *NullableColumnDataType {
|
||||
return &NullableColumnDataType{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableColumnDataType) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableColumnDataType) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
84
internal/api/model_column_semantic_type.gen.go
Normal file
84
internal/api/model_column_semantic_type.gen.go
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ColumnSemanticType the model 'ColumnSemanticType'
|
||||
type ColumnSemanticType string
|
||||
|
||||
// List of ColumnSemanticType
|
||||
const (
|
||||
COLUMNSEMANTICTYPE_TIMESTAMP ColumnSemanticType = "timestamp"
|
||||
COLUMNSEMANTICTYPE_TAG ColumnSemanticType = "tag"
|
||||
COLUMNSEMANTICTYPE_FIELD ColumnSemanticType = "field"
|
||||
)
|
||||
|
||||
func (v *ColumnSemanticType) UnmarshalJSON(src []byte) error {
|
||||
var value string
|
||||
err := json.Unmarshal(src, &value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
enumTypeValue := ColumnSemanticType(value)
|
||||
for _, existing := range []ColumnSemanticType{"timestamp", "tag", "field"} {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid ColumnSemanticType", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to ColumnSemanticType value
|
||||
func (v ColumnSemanticType) Ptr() *ColumnSemanticType {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableColumnSemanticType struct {
|
||||
value *ColumnSemanticType
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableColumnSemanticType) Get() *ColumnSemanticType {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableColumnSemanticType) Set(val *ColumnSemanticType) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableColumnSemanticType) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableColumnSemanticType) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableColumnSemanticType(val *ColumnSemanticType) *NullableColumnSemanticType {
|
||||
return &NullableColumnSemanticType{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableColumnSemanticType) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableColumnSemanticType) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
224
internal/api/model_measurement_schema.gen.go
Normal file
224
internal/api/model_measurement_schema.gen.go
Normal file
@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// MeasurementSchema The schema definition for a single measurement
|
||||
type MeasurementSchema struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
// An ordered collection of column definitions
|
||||
Columns []MeasurementSchemaColumn `json:"columns"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// NewMeasurementSchema instantiates a new MeasurementSchema 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 NewMeasurementSchema(id string, name string, columns []MeasurementSchemaColumn, createdAt time.Time, updatedAt time.Time) *MeasurementSchema {
|
||||
this := MeasurementSchema{}
|
||||
this.Id = id
|
||||
this.Name = name
|
||||
this.Columns = columns
|
||||
this.CreatedAt = createdAt
|
||||
this.UpdatedAt = updatedAt
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaWithDefaults instantiates a new MeasurementSchema object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewMeasurementSchemaWithDefaults() *MeasurementSchema {
|
||||
this := MeasurementSchema{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetId returns the Id field value
|
||||
func (o *MeasurementSchema) GetId() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Id
|
||||
}
|
||||
|
||||
// GetIdOk returns a tuple with the Id field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchema) GetIdOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Id, true
|
||||
}
|
||||
|
||||
// SetId sets field value
|
||||
func (o *MeasurementSchema) SetId(v string) {
|
||||
o.Id = v
|
||||
}
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *MeasurementSchema) GetName() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Name
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchema) GetNameOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Name, true
|
||||
}
|
||||
|
||||
// SetName sets field value
|
||||
func (o *MeasurementSchema) SetName(v string) {
|
||||
o.Name = v
|
||||
}
|
||||
|
||||
// GetColumns returns the Columns field value
|
||||
func (o *MeasurementSchema) GetColumns() []MeasurementSchemaColumn {
|
||||
if o == nil {
|
||||
var ret []MeasurementSchemaColumn
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Columns
|
||||
}
|
||||
|
||||
// GetColumnsOk returns a tuple with the Columns field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchema) GetColumnsOk() (*[]MeasurementSchemaColumn, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Columns, true
|
||||
}
|
||||
|
||||
// SetColumns sets field value
|
||||
func (o *MeasurementSchema) SetColumns(v []MeasurementSchemaColumn) {
|
||||
o.Columns = v
|
||||
}
|
||||
|
||||
// GetCreatedAt returns the CreatedAt field value
|
||||
func (o *MeasurementSchema) GetCreatedAt() time.Time {
|
||||
if o == nil {
|
||||
var ret time.Time
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.CreatedAt
|
||||
}
|
||||
|
||||
// GetCreatedAtOk returns a tuple with the CreatedAt field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchema) GetCreatedAtOk() (*time.Time, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.CreatedAt, true
|
||||
}
|
||||
|
||||
// SetCreatedAt sets field value
|
||||
func (o *MeasurementSchema) SetCreatedAt(v time.Time) {
|
||||
o.CreatedAt = v
|
||||
}
|
||||
|
||||
// GetUpdatedAt returns the UpdatedAt field value
|
||||
func (o *MeasurementSchema) GetUpdatedAt() time.Time {
|
||||
if o == nil {
|
||||
var ret time.Time
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.UpdatedAt
|
||||
}
|
||||
|
||||
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchema) GetUpdatedAtOk() (*time.Time, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.UpdatedAt, true
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets field value
|
||||
func (o *MeasurementSchema) SetUpdatedAt(v time.Time) {
|
||||
o.UpdatedAt = v
|
||||
}
|
||||
|
||||
func (o MeasurementSchema) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if true {
|
||||
toSerialize["id"] = o.Id
|
||||
}
|
||||
if true {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
if true {
|
||||
toSerialize["columns"] = o.Columns
|
||||
}
|
||||
if true {
|
||||
toSerialize["createdAt"] = o.CreatedAt
|
||||
}
|
||||
if true {
|
||||
toSerialize["updatedAt"] = o.UpdatedAt
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
type NullableMeasurementSchema struct {
|
||||
value *MeasurementSchema
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchema) Get() *MeasurementSchema {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchema) Set(val *MeasurementSchema) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchema) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchema) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableMeasurementSchema(val *MeasurementSchema) *NullableMeasurementSchema {
|
||||
return &NullableMeasurementSchema{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchema) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchema) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
171
internal/api/model_measurement_schema_column.gen.go
Normal file
171
internal/api/model_measurement_schema_column.gen.go
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// MeasurementSchemaColumn Definition of a measurement column
|
||||
type MeasurementSchemaColumn struct {
|
||||
Name string `json:"name"`
|
||||
Type ColumnSemanticType `json:"type"`
|
||||
DataType *ColumnDataType `json:"dataType,omitempty"`
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaColumn instantiates a new MeasurementSchemaColumn 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 NewMeasurementSchemaColumn(name string, type_ ColumnSemanticType) *MeasurementSchemaColumn {
|
||||
this := MeasurementSchemaColumn{}
|
||||
this.Name = name
|
||||
this.Type = type_
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaColumnWithDefaults instantiates a new MeasurementSchemaColumn object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewMeasurementSchemaColumnWithDefaults() *MeasurementSchemaColumn {
|
||||
this := MeasurementSchemaColumn{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *MeasurementSchemaColumn) GetName() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Name
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaColumn) GetNameOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Name, true
|
||||
}
|
||||
|
||||
// SetName sets field value
|
||||
func (o *MeasurementSchemaColumn) SetName(v string) {
|
||||
o.Name = v
|
||||
}
|
||||
|
||||
// GetType returns the Type field value
|
||||
func (o *MeasurementSchemaColumn) GetType() ColumnSemanticType {
|
||||
if o == nil {
|
||||
var ret ColumnSemanticType
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Type
|
||||
}
|
||||
|
||||
// GetTypeOk returns a tuple with the Type field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaColumn) GetTypeOk() (*ColumnSemanticType, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Type, true
|
||||
}
|
||||
|
||||
// SetType sets field value
|
||||
func (o *MeasurementSchemaColumn) SetType(v ColumnSemanticType) {
|
||||
o.Type = v
|
||||
}
|
||||
|
||||
// GetDataType returns the DataType field value if set, zero value otherwise.
|
||||
func (o *MeasurementSchemaColumn) GetDataType() ColumnDataType {
|
||||
if o == nil || o.DataType == nil {
|
||||
var ret ColumnDataType
|
||||
return ret
|
||||
}
|
||||
return *o.DataType
|
||||
}
|
||||
|
||||
// GetDataTypeOk returns a tuple with the DataType field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaColumn) GetDataTypeOk() (*ColumnDataType, bool) {
|
||||
if o == nil || o.DataType == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.DataType, true
|
||||
}
|
||||
|
||||
// HasDataType returns a boolean if a field has been set.
|
||||
func (o *MeasurementSchemaColumn) HasDataType() bool {
|
||||
if o != nil && o.DataType != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetDataType gets a reference to the given ColumnDataType and assigns it to the DataType field.
|
||||
func (o *MeasurementSchemaColumn) SetDataType(v ColumnDataType) {
|
||||
o.DataType = &v
|
||||
}
|
||||
|
||||
func (o MeasurementSchemaColumn) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if true {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
if true {
|
||||
toSerialize["type"] = o.Type
|
||||
}
|
||||
if o.DataType != nil {
|
||||
toSerialize["dataType"] = o.DataType
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
type NullableMeasurementSchemaColumn struct {
|
||||
value *MeasurementSchemaColumn
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaColumn) Get() *MeasurementSchemaColumn {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaColumn) Set(val *MeasurementSchemaColumn) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaColumn) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaColumn) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableMeasurementSchemaColumn(val *MeasurementSchemaColumn) *NullableMeasurementSchemaColumn {
|
||||
return &NullableMeasurementSchemaColumn{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaColumn) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaColumn) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
136
internal/api/model_measurement_schema_create_request.gen.go
Normal file
136
internal/api/model_measurement_schema_create_request.gen.go
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// MeasurementSchemaCreateRequest Create a new measurement schema
|
||||
type MeasurementSchemaCreateRequest struct {
|
||||
Name string `json:"name"`
|
||||
// An ordered collection of column definitions
|
||||
Columns []MeasurementSchemaColumn `json:"columns"`
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaCreateRequest instantiates a new MeasurementSchemaCreateRequest 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 NewMeasurementSchemaCreateRequest(name string, columns []MeasurementSchemaColumn) *MeasurementSchemaCreateRequest {
|
||||
this := MeasurementSchemaCreateRequest{}
|
||||
this.Name = name
|
||||
this.Columns = columns
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaCreateRequestWithDefaults instantiates a new MeasurementSchemaCreateRequest object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewMeasurementSchemaCreateRequestWithDefaults() *MeasurementSchemaCreateRequest {
|
||||
this := MeasurementSchemaCreateRequest{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *MeasurementSchemaCreateRequest) GetName() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Name
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaCreateRequest) GetNameOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Name, true
|
||||
}
|
||||
|
||||
// SetName sets field value
|
||||
func (o *MeasurementSchemaCreateRequest) SetName(v string) {
|
||||
o.Name = v
|
||||
}
|
||||
|
||||
// GetColumns returns the Columns field value
|
||||
func (o *MeasurementSchemaCreateRequest) GetColumns() []MeasurementSchemaColumn {
|
||||
if o == nil {
|
||||
var ret []MeasurementSchemaColumn
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Columns
|
||||
}
|
||||
|
||||
// GetColumnsOk returns a tuple with the Columns field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaCreateRequest) GetColumnsOk() (*[]MeasurementSchemaColumn, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Columns, true
|
||||
}
|
||||
|
||||
// SetColumns sets field value
|
||||
func (o *MeasurementSchemaCreateRequest) SetColumns(v []MeasurementSchemaColumn) {
|
||||
o.Columns = v
|
||||
}
|
||||
|
||||
func (o MeasurementSchemaCreateRequest) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if true {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
if true {
|
||||
toSerialize["columns"] = o.Columns
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
type NullableMeasurementSchemaCreateRequest struct {
|
||||
value *MeasurementSchemaCreateRequest
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaCreateRequest) Get() *MeasurementSchemaCreateRequest {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaCreateRequest) Set(val *MeasurementSchemaCreateRequest) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaCreateRequest) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaCreateRequest) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableMeasurementSchemaCreateRequest(val *MeasurementSchemaCreateRequest) *NullableMeasurementSchemaCreateRequest {
|
||||
return &NullableMeasurementSchemaCreateRequest{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaCreateRequest) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaCreateRequest) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
106
internal/api/model_measurement_schema_list.gen.go
Normal file
106
internal/api/model_measurement_schema_list.gen.go
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// MeasurementSchemaList A list of measurement schemas returning summary information
|
||||
type MeasurementSchemaList struct {
|
||||
MeasurementSchemas []MeasurementSchema `json:"measurementSchemas"`
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaList instantiates a new MeasurementSchemaList 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 NewMeasurementSchemaList(measurementSchemas []MeasurementSchema) *MeasurementSchemaList {
|
||||
this := MeasurementSchemaList{}
|
||||
this.MeasurementSchemas = measurementSchemas
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaListWithDefaults instantiates a new MeasurementSchemaList object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewMeasurementSchemaListWithDefaults() *MeasurementSchemaList {
|
||||
this := MeasurementSchemaList{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetMeasurementSchemas returns the MeasurementSchemas field value
|
||||
func (o *MeasurementSchemaList) GetMeasurementSchemas() []MeasurementSchema {
|
||||
if o == nil {
|
||||
var ret []MeasurementSchema
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.MeasurementSchemas
|
||||
}
|
||||
|
||||
// GetMeasurementSchemasOk returns a tuple with the MeasurementSchemas field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaList) GetMeasurementSchemasOk() (*[]MeasurementSchema, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.MeasurementSchemas, true
|
||||
}
|
||||
|
||||
// SetMeasurementSchemas sets field value
|
||||
func (o *MeasurementSchemaList) SetMeasurementSchemas(v []MeasurementSchema) {
|
||||
o.MeasurementSchemas = v
|
||||
}
|
||||
|
||||
func (o MeasurementSchemaList) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if true {
|
||||
toSerialize["measurementSchemas"] = o.MeasurementSchemas
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
type NullableMeasurementSchemaList struct {
|
||||
value *MeasurementSchemaList
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaList) Get() *MeasurementSchemaList {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaList) Set(val *MeasurementSchemaList) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaList) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaList) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableMeasurementSchemaList(val *MeasurementSchemaList) *NullableMeasurementSchemaList {
|
||||
return &NullableMeasurementSchemaList{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaList) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaList) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
107
internal/api/model_measurement_schema_update_request.gen.go
Normal file
107
internal/api/model_measurement_schema_update_request.gen.go
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// MeasurementSchemaUpdateRequest Update an existing measurement schema
|
||||
type MeasurementSchemaUpdateRequest struct {
|
||||
// An ordered collection of column definitions
|
||||
Columns []MeasurementSchemaColumn `json:"columns"`
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaUpdateRequest instantiates a new MeasurementSchemaUpdateRequest 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 NewMeasurementSchemaUpdateRequest(columns []MeasurementSchemaColumn) *MeasurementSchemaUpdateRequest {
|
||||
this := MeasurementSchemaUpdateRequest{}
|
||||
this.Columns = columns
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewMeasurementSchemaUpdateRequestWithDefaults instantiates a new MeasurementSchemaUpdateRequest object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewMeasurementSchemaUpdateRequestWithDefaults() *MeasurementSchemaUpdateRequest {
|
||||
this := MeasurementSchemaUpdateRequest{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetColumns returns the Columns field value
|
||||
func (o *MeasurementSchemaUpdateRequest) GetColumns() []MeasurementSchemaColumn {
|
||||
if o == nil {
|
||||
var ret []MeasurementSchemaColumn
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Columns
|
||||
}
|
||||
|
||||
// GetColumnsOk returns a tuple with the Columns field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *MeasurementSchemaUpdateRequest) GetColumnsOk() (*[]MeasurementSchemaColumn, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Columns, true
|
||||
}
|
||||
|
||||
// SetColumns sets field value
|
||||
func (o *MeasurementSchemaUpdateRequest) SetColumns(v []MeasurementSchemaColumn) {
|
||||
o.Columns = v
|
||||
}
|
||||
|
||||
func (o MeasurementSchemaUpdateRequest) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if true {
|
||||
toSerialize["columns"] = o.Columns
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
type NullableMeasurementSchemaUpdateRequest struct {
|
||||
value *MeasurementSchemaUpdateRequest
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaUpdateRequest) Get() *MeasurementSchemaUpdateRequest {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaUpdateRequest) Set(val *MeasurementSchemaUpdateRequest) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaUpdateRequest) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaUpdateRequest) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableMeasurementSchemaUpdateRequest(val *MeasurementSchemaUpdateRequest) *NullableMeasurementSchemaUpdateRequest {
|
||||
return &NullableMeasurementSchemaUpdateRequest{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableMeasurementSchemaUpdateRequest) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableMeasurementSchemaUpdateRequest) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
@ -22,6 +22,7 @@ type PostBucketRequest struct {
|
||||
Rp *string `json:"rp,omitempty"`
|
||||
// Rules to expire or retain data. No rules means data never expires.
|
||||
RetentionRules []RetentionRule `json:"retentionRules"`
|
||||
SchemaType *SchemaType `json:"schemaType,omitempty"`
|
||||
}
|
||||
|
||||
// NewPostBucketRequest instantiates a new PostBucketRequest object
|
||||
@ -180,6 +181,38 @@ func (o *PostBucketRequest) SetRetentionRules(v []RetentionRule) {
|
||||
o.RetentionRules = v
|
||||
}
|
||||
|
||||
// GetSchemaType returns the SchemaType field value if set, zero value otherwise.
|
||||
func (o *PostBucketRequest) GetSchemaType() SchemaType {
|
||||
if o == nil || o.SchemaType == nil {
|
||||
var ret SchemaType
|
||||
return ret
|
||||
}
|
||||
return *o.SchemaType
|
||||
}
|
||||
|
||||
// GetSchemaTypeOk returns a tuple with the SchemaType field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *PostBucketRequest) GetSchemaTypeOk() (*SchemaType, bool) {
|
||||
if o == nil || o.SchemaType == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.SchemaType, true
|
||||
}
|
||||
|
||||
// HasSchemaType returns a boolean if a field has been set.
|
||||
func (o *PostBucketRequest) HasSchemaType() bool {
|
||||
if o != nil && o.SchemaType != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetSchemaType gets a reference to the given SchemaType and assigns it to the SchemaType field.
|
||||
func (o *PostBucketRequest) SetSchemaType(v SchemaType) {
|
||||
o.SchemaType = &v
|
||||
}
|
||||
|
||||
func (o PostBucketRequest) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if true {
|
||||
@ -197,6 +230,9 @@ func (o PostBucketRequest) MarshalJSON() ([]byte, error) {
|
||||
if true {
|
||||
toSerialize["retentionRules"] = o.RetentionRules
|
||||
}
|
||||
if o.SchemaType != nil {
|
||||
toSerialize["schemaType"] = o.SchemaType
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
|
83
internal/api/model_schema_type.gen.go
Normal file
83
internal/api/model_schema_type.gen.go
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Subset of Influx API covered by Influx CLI
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 2.0.0
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// SchemaType the model 'SchemaType'
|
||||
type SchemaType string
|
||||
|
||||
// List of SchemaType
|
||||
const (
|
||||
SCHEMATYPE_IMPLICIT SchemaType = "implicit"
|
||||
SCHEMATYPE_EXPLICIT SchemaType = "explicit"
|
||||
)
|
||||
|
||||
func (v *SchemaType) UnmarshalJSON(src []byte) error {
|
||||
var value string
|
||||
err := json.Unmarshal(src, &value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
enumTypeValue := SchemaType(value)
|
||||
for _, existing := range []SchemaType{"implicit", "explicit"} {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid SchemaType", value)
|
||||
}
|
||||
|
||||
// Ptr returns reference to SchemaType value
|
||||
func (v SchemaType) Ptr() *SchemaType {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableSchemaType struct {
|
||||
value *SchemaType
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableSchemaType) Get() *SchemaType {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableSchemaType) Set(val *SchemaType) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableSchemaType) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableSchemaType) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableSchemaType(val *SchemaType) *NullableSchemaType {
|
||||
return &NullableSchemaType{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableSchemaType) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableSchemaType) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
23
internal/api/schema_type.go
Normal file
23
internal/api/schema_type.go
Normal file
@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (v SchemaType) String() string {
|
||||
return string(v)
|
||||
}
|
||||
|
||||
// Set implements the cli.Generic interface for parsing
|
||||
// flags.
|
||||
func (v *SchemaType) Set(s string) error {
|
||||
switch s {
|
||||
case string(SCHEMATYPE_IMPLICIT):
|
||||
*v = SCHEMATYPE_IMPLICIT
|
||||
case string(SCHEMATYPE_EXPLICIT):
|
||||
*v = SCHEMATYPE_EXPLICIT
|
||||
default:
|
||||
return fmt.Errorf("unsupported schema type: %q", s)
|
||||
}
|
||||
return nil
|
||||
}
|
39
internal/api/unmarshal_csv.go
Normal file
39
internal/api/unmarshal_csv.go
Normal file
@ -0,0 +1,39 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UnmarshalCSV implements the gocsv.TypeUnmarshaller interface
|
||||
// for decoding CSV.
|
||||
func (v *ColumnSemanticType) UnmarshalCSV(s string) error {
|
||||
types := []string{string(COLUMNSEMANTICTYPE_TIMESTAMP), string(COLUMNSEMANTICTYPE_TAG), string(COLUMNSEMANTICTYPE_FIELD)}
|
||||
for _, t := range types {
|
||||
if s == t {
|
||||
*v = ColumnSemanticType(t)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%q is not a valid column type. Valid values are [%s]", s, strings.Join(types, ", "))
|
||||
}
|
||||
|
||||
// UnmarshalCSV implements the gocsv.TypeUnmarshaller interface
|
||||
// for decoding CSV.
|
||||
func (v *ColumnDataType) UnmarshalCSV(s string) error {
|
||||
types := []string{
|
||||
string(COLUMNDATATYPE_INTEGER),
|
||||
string(COLUMNDATATYPE_FLOAT),
|
||||
string(COLUMNDATATYPE_BOOLEAN),
|
||||
string(COLUMNDATATYPE_STRING),
|
||||
string(COLUMNDATATYPE_UNSIGNED),
|
||||
}
|
||||
|
||||
for _, t := range types {
|
||||
if s == t {
|
||||
*v = ColumnDataType(t)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%q is not a valid column data type. Valid values are [%s]", s, strings.Join(types, ", "))
|
||||
}
|
Reference in New Issue
Block a user