From 5c7c34f16db858e1287cdfe162e6481a36f79145 Mon Sep 17 00:00:00 2001 From: Jeffrey Smith II Date: Thu, 18 Aug 2022 14:21:50 -0400 Subject: [PATCH] feat: replication bucket name (#440) * chore: gofmt * chore: update openapi gen files * feat: add replication-bucket-name flag * fix: fix tests * chore: rename to replication-bucket * feat: show remote bucket name or id * chore: fmt fixup * chore: update openapi to master * chore: fix openapi generation --- api/api_buckets.gen.go | 152 ++++++++++++++++-- api/contract/openapi | 2 +- ...el_add_resource_member_request_body.gen.go | 4 +- api/model_links.gen.go | 2 +- api/model_post_bucket_request.gen.go | 49 ++++-- api/model_replication.gen.go | 69 ++++++-- api/model_replication_creation_request.gen.go | 69 ++++++-- api/model_replication_update_request.gen.go | 36 +++++ api/model_resource_member.gen.go | 44 +---- api/model_resource_owner.gen.go | 44 +---- api/model_retention_rule.gen.go | 43 +++-- api/model_user_response.gen.go | 44 +---- clients/bucket/create.go | 5 +- clients/bucket/create_test.go | 28 ++-- clients/bucket_schema/format.go | 1 - clients/replication/replication.go | 21 ++- clients/restore/restore.go | 3 +- cmd/influx/main.go | 2 +- cmd/influx/replication.go | 6 +- pkg/csv2lp/csv_annotations.go | 10 +- pkg/csv2lp/csv_table_test.go | 2 +- pkg/csv2lp/multi_closer.go | 2 +- 22 files changed, 420 insertions(+), 218 deletions(-) diff --git a/api/api_buckets.gen.go b/api/api_buckets.gen.go index 8cedb99..4632a51 100644 --- a/api/api_buckets.gen.go +++ b/api/api_buckets.gen.go @@ -47,10 +47,40 @@ type BucketsApi interface { DeleteBucketsIDExecuteWithHttpInfo(r ApiDeleteBucketsIDRequest) (*_nethttp.Response, error) /* - * GetBuckets List all buckets - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiGetBucketsRequest - */ + * GetBuckets List buckets + * Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). + + To limit which buckets are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all buckets up to the + default `limit`. + + #### Limitations + + - Paging with an `offset` greater than the number of records will result in + an empty list of buckets--for example: + + The following request is paging to the 50th record, but the user only has + 10 buckets. + + ```sh + $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" + + $ { + "links": { + "prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", + "self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" + }, + "buckets": [] + } + ``` + + #### Related Guides + + - [Manage buckets]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetBucketsRequest + */ GetBuckets(ctx _context.Context) ApiGetBucketsRequest /* @@ -112,10 +142,34 @@ type BucketsApi interface { PatchBucketsIDExecuteWithHttpInfo(r ApiPatchBucketsIDRequest) (Bucket, *_nethttp.Response, error) /* - * PostBuckets Create a bucket - * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiPostBucketsRequest - */ + * PostBuckets Create a bucket + * Creates a [bucket]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket) + and returns the created bucket along with metadata. The default data + [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period) + is 30 days. + + #### InfluxDB OSS + + - A single InfluxDB OSS instance supports active writes or queries for + approximately 20 buckets across all organizations at a given time. Reading + or writing to more than 20 buckets at a time can adversely affect + performance. + + #### Limitations + + - InfluxDB Cloud Free Plan allows users to create up to two buckets. + Exceeding the bucket quota will result in an HTTP `403` status code. + For additional information regarding InfluxDB Cloud offerings, see + [InfluxDB Cloud Pricing](https://www.influxdata.com/influxdb-cloud-pricing/). + + #### Related Guides + + - [Create bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/) + - [Create bucket CLI reference]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/bucket/create) + + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostBucketsRequest + */ PostBuckets(ctx _context.Context) ApiPostBucketsRequest /* @@ -375,10 +429,40 @@ func (r ApiGetBucketsRequest) ExecuteWithHttpInfo() (Buckets, *_nethttp.Response } /* - * GetBuckets List all buckets + * GetBuckets List buckets + * Retrieves a list of [buckets]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket). + +To limit which buckets are returned, pass query parameters in your request. +If no query parameters are passed, InfluxDB returns all buckets up to the +default `limit`. + +#### Limitations + +- Paging with an `offset` greater than the number of records will result in +an empty list of buckets--for example: + + The following request is paging to the 50th record, but the user only has + 10 buckets. + + ```sh + $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" + + $ { + "links": { + "prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", + "self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" + }, + "buckets": [] + } + ``` + +#### Related Guides + +- [Manage buckets]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiGetBucketsRequest - */ +*/ func (a *BucketsApiService) GetBuckets(ctx _context.Context) ApiGetBucketsRequest { return ApiGetBucketsRequest{ ApiService: a, @@ -900,9 +984,33 @@ func (r ApiPostBucketsRequest) ExecuteWithHttpInfo() (Bucket, *_nethttp.Response /* * PostBuckets Create a bucket + * Creates a [bucket]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#bucket) +and returns the created bucket along with metadata. The default data +[retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period) +is 30 days. + +#### InfluxDB OSS + +- A single InfluxDB OSS instance supports active writes or queries for +approximately 20 buckets across all organizations at a given time. Reading +or writing to more than 20 buckets at a time can adversely affect +performance. + +#### Limitations + +- InfluxDB Cloud Free Plan allows users to create up to two buckets. +Exceeding the bucket quota will result in an HTTP `403` status code. +For additional information regarding InfluxDB Cloud offerings, see +[InfluxDB Cloud Pricing](https://www.influxdata.com/influxdb-cloud-pricing/). + +#### Related Guides + +- [Create bucket]({{% INFLUXDB_DOCS_URL %}}/organizations/buckets/create-bucket/) +- [Create bucket CLI reference]({{% INFLUXDB_DOCS_URL %}}/reference/cli/influx/bucket/create) + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPostBucketsRequest - */ +*/ func (a *BucketsApiService) PostBuckets(ctx _context.Context) ApiPostBucketsRequest { return ApiPostBucketsRequest{ ApiService: a, @@ -1000,6 +1108,28 @@ func (a *BucketsApiService) PostBucketsExecuteWithHttpInfo(r ApiPostBucketsReque } 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 == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error()) + return localVarReturnValue, localVarHTTPResponse, newErr + } + v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage())) + newErr.model = &v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 422 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) diff --git a/api/contract/openapi b/api/contract/openapi index 226874d..dbb8700 160000 --- a/api/contract/openapi +++ b/api/contract/openapi @@ -1 +1 @@ -Subproject commit 226874df6889b39e3e0794585b7eafaa70e2f8b1 +Subproject commit dbb87002dfc346133d95af9776b84d6669044e7b diff --git a/api/model_add_resource_member_request_body.gen.go b/api/model_add_resource_member_request_body.gen.go index b59596a..6746ef6 100644 --- a/api/model_add_resource_member_request_body.gen.go +++ b/api/model_add_resource_member_request_body.gen.go @@ -16,7 +16,9 @@ import ( // AddResourceMemberRequestBody struct for AddResourceMemberRequestBody type AddResourceMemberRequestBody struct { - Id string `json:"id" yaml:"id"` + // The ID of the user to add to the resource. + Id string `json:"id" yaml:"id"` + // The name of the user to add to the resource. Name *string `json:"name,omitempty" yaml:"name,omitempty"` } diff --git a/api/model_links.gen.go b/api/model_links.gen.go index 49f00d3..072b8cc 100644 --- a/api/model_links.gen.go +++ b/api/model_links.gen.go @@ -14,7 +14,7 @@ import ( "encoding/json" ) -// Links struct for Links +// Links URI pointers for additional paged results. type Links struct { // URI of resource. Next *string `json:"next,omitempty" yaml:"next,omitempty"` diff --git a/api/model_post_bucket_request.gen.go b/api/model_post_bucket_request.gen.go index 747d9e5..e741e0d 100644 --- a/api/model_post_bucket_request.gen.go +++ b/api/model_post_bucket_request.gen.go @@ -16,24 +16,29 @@ import ( // PostBucketRequest struct for PostBucketRequest type PostBucketRequest struct { - OrgID string `json:"orgID" yaml:"orgID"` - Name string `json:"name" yaml:"name"` + // Organization ID. The ID of the organization. + OrgID string `json:"orgID" yaml:"orgID"` + // The name of the bucket. + Name string `json:"name" yaml:"name"` + // A description of the bucket. Description *string `json:"description,omitempty" yaml:"description,omitempty"` - Rp *string `json:"rp,omitempty" yaml:"rp,omitempty"` + // Retention policy is an InfluxDB 1.x concept that represents the duration of time that each data point in the retention policy persists. Use `rp` for compatibility with InfluxDB 1.x. The InfluxDB 2.x and Cloud equivalent is [retention period]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#retention-period). + Rp *string `json:"rp,omitempty" yaml:"rp,omitempty"` // Rules to expire or retain data. No rules means data never expires. - RetentionRules []RetentionRule `json:"retentionRules" yaml:"retentionRules"` - SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` + RetentionRules *[]RetentionRule `json:"retentionRules,omitempty" yaml:"retentionRules,omitempty"` + SchemaType *SchemaType `json:"schemaType,omitempty" yaml:"schemaType,omitempty"` } // NewPostBucketRequest instantiates a new PostBucketRequest 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 NewPostBucketRequest(orgID string, name string, retentionRules []RetentionRule) *PostBucketRequest { +func NewPostBucketRequest(orgID string, name string) *PostBucketRequest { this := PostBucketRequest{} this.OrgID = orgID this.Name = name - this.RetentionRules = retentionRules + var rp string = "0" + this.Rp = &rp return &this } @@ -42,6 +47,8 @@ func NewPostBucketRequest(orgID string, name string, retentionRules []RetentionR // but it doesn't guarantee that properties required by API are set func NewPostBucketRequestWithDefaults() *PostBucketRequest { this := PostBucketRequest{} + var rp string = "0" + this.Rp = &rp return &this } @@ -157,28 +164,36 @@ func (o *PostBucketRequest) SetRp(v string) { o.Rp = &v } -// GetRetentionRules returns the RetentionRules field value +// GetRetentionRules returns the RetentionRules field value if set, zero value otherwise. func (o *PostBucketRequest) GetRetentionRules() []RetentionRule { - if o == nil { + if o == nil || o.RetentionRules == nil { var ret []RetentionRule return ret } - - return o.RetentionRules + return *o.RetentionRules } -// GetRetentionRulesOk returns a tuple with the RetentionRules field value +// GetRetentionRulesOk returns a tuple with the RetentionRules field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *PostBucketRequest) GetRetentionRulesOk() (*[]RetentionRule, bool) { - if o == nil { + if o == nil || o.RetentionRules == nil { return nil, false } - return &o.RetentionRules, true + return o.RetentionRules, true } -// SetRetentionRules sets field value +// HasRetentionRules returns a boolean if a field has been set. +func (o *PostBucketRequest) HasRetentionRules() bool { + if o != nil && o.RetentionRules != nil { + return true + } + + return false +} + +// SetRetentionRules gets a reference to the given []RetentionRule and assigns it to the RetentionRules field. func (o *PostBucketRequest) SetRetentionRules(v []RetentionRule) { - o.RetentionRules = v + o.RetentionRules = &v } // GetSchemaType returns the SchemaType field value if set, zero value otherwise. @@ -227,7 +242,7 @@ func (o PostBucketRequest) MarshalJSON() ([]byte, error) { if o.Rp != nil { toSerialize["rp"] = o.Rp } - if true { + if o.RetentionRules != nil { toSerialize["retentionRules"] = o.RetentionRules } if o.SchemaType != nil { diff --git a/api/model_replication.gen.go b/api/model_replication.gen.go index c5e5dd6..e8d49e2 100644 --- a/api/model_replication.gen.go +++ b/api/model_replication.gen.go @@ -22,7 +22,8 @@ type Replication struct { OrgID string `json:"orgID" yaml:"orgID"` RemoteID string `json:"remoteID" yaml:"remoteID"` LocalBucketID string `json:"localBucketID" yaml:"localBucketID"` - RemoteBucketID string `json:"remoteBucketID" yaml:"remoteBucketID"` + 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"` @@ -34,14 +35,13 @@ type Replication struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewReplication(id string, name string, orgID string, remoteID string, localBucketID string, remoteBucketID string, maxQueueSizeBytes int64, currentQueueSizeBytes int64) *Replication { +func NewReplication(id string, name string, orgID string, remoteID string, localBucketID string, maxQueueSizeBytes int64, currentQueueSizeBytes int64) *Replication { this := Replication{} this.Id = id this.Name = name this.OrgID = orgID this.RemoteID = remoteID this.LocalBucketID = localBucketID - this.RemoteBucketID = remoteBucketID this.MaxQueueSizeBytes = maxQueueSizeBytes this.CurrentQueueSizeBytes = currentQueueSizeBytes return &this @@ -207,28 +207,68 @@ func (o *Replication) SetLocalBucketID(v string) { o.LocalBucketID = v } -// GetRemoteBucketID returns the RemoteBucketID field value +// GetRemoteBucketID returns the RemoteBucketID field value if set, zero value otherwise. func (o *Replication) GetRemoteBucketID() string { - if o == nil { + if o == nil || o.RemoteBucketID == nil { var ret string return ret } - - return o.RemoteBucketID + return *o.RemoteBucketID } -// GetRemoteBucketIDOk returns a tuple with the RemoteBucketID field value +// GetRemoteBucketIDOk returns a tuple with the RemoteBucketID field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Replication) GetRemoteBucketIDOk() (*string, bool) { - if o == nil { + if o == nil || o.RemoteBucketID == nil { return nil, false } - return &o.RemoteBucketID, true + return o.RemoteBucketID, true } -// SetRemoteBucketID sets field value +// HasRemoteBucketID returns a boolean if a field has been set. +func (o *Replication) HasRemoteBucketID() bool { + if o != nil && o.RemoteBucketID != nil { + return true + } + + return false +} + +// SetRemoteBucketID gets a reference to the given string and assigns it to the RemoteBucketID field. func (o *Replication) SetRemoteBucketID(v string) { - o.RemoteBucketID = v + o.RemoteBucketID = &v +} + +// GetRemoteBucketName returns the RemoteBucketName field value if set, zero value otherwise. +func (o *Replication) GetRemoteBucketName() string { + if o == nil || o.RemoteBucketName == nil { + var ret string + return ret + } + return *o.RemoteBucketName +} + +// GetRemoteBucketNameOk returns a tuple with the RemoteBucketName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Replication) GetRemoteBucketNameOk() (*string, bool) { + if o == nil || o.RemoteBucketName == nil { + return nil, false + } + return o.RemoteBucketName, true +} + +// HasRemoteBucketName returns a boolean if a field has been set. +func (o *Replication) HasRemoteBucketName() bool { + if o != nil && o.RemoteBucketName != nil { + return true + } + + return false +} + +// SetRemoteBucketName gets a reference to the given string and assigns it to the RemoteBucketName field. +func (o *Replication) SetRemoteBucketName(v string) { + o.RemoteBucketName = &v } // GetMaxQueueSizeBytes returns the MaxQueueSizeBytes field value @@ -395,9 +435,12 @@ func (o Replication) MarshalJSON() ([]byte, error) { if true { toSerialize["localBucketID"] = o.LocalBucketID } - if true { + if o.RemoteBucketID != nil { toSerialize["remoteBucketID"] = o.RemoteBucketID } + if o.RemoteBucketName != nil { + toSerialize["remoteBucketName"] = o.RemoteBucketName + } if true { toSerialize["maxQueueSizeBytes"] = o.MaxQueueSizeBytes } diff --git a/api/model_replication_creation_request.gen.go b/api/model_replication_creation_request.gen.go index 0839f35..9c02026 100644 --- a/api/model_replication_creation_request.gen.go +++ b/api/model_replication_creation_request.gen.go @@ -21,7 +21,8 @@ type ReplicationCreationRequest struct { OrgID string `json:"orgID" yaml:"orgID"` RemoteID string `json:"remoteID" yaml:"remoteID"` LocalBucketID string `json:"localBucketID" yaml:"localBucketID"` - RemoteBucketID string `json:"remoteBucketID" yaml:"remoteBucketID"` + RemoteBucketID *string `json:"remoteBucketID,omitempty" yaml:"remoteBucketID,omitempty"` + RemoteBucketName *string `json:"remoteBucketName,omitempty" yaml:"remoteBucketName,omitempty"` MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes" yaml:"maxQueueSizeBytes"` DropNonRetryableData *bool `json:"dropNonRetryableData,omitempty" yaml:"dropNonRetryableData,omitempty"` MaxAgeSeconds int64 `json:"maxAgeSeconds" yaml:"maxAgeSeconds"` @@ -31,13 +32,12 @@ type ReplicationCreationRequest struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewReplicationCreationRequest(name string, orgID string, remoteID string, localBucketID string, remoteBucketID string, maxQueueSizeBytes int64, maxAgeSeconds int64) *ReplicationCreationRequest { +func NewReplicationCreationRequest(name string, orgID string, remoteID string, localBucketID string, maxQueueSizeBytes int64, maxAgeSeconds int64) *ReplicationCreationRequest { this := ReplicationCreationRequest{} this.Name = name this.OrgID = orgID this.RemoteID = remoteID this.LocalBucketID = localBucketID - this.RemoteBucketID = remoteBucketID this.MaxQueueSizeBytes = maxQueueSizeBytes var dropNonRetryableData bool = false this.DropNonRetryableData = &dropNonRetryableData @@ -187,28 +187,68 @@ func (o *ReplicationCreationRequest) SetLocalBucketID(v string) { o.LocalBucketID = v } -// GetRemoteBucketID returns the RemoteBucketID field value +// GetRemoteBucketID returns the RemoteBucketID field value if set, zero value otherwise. func (o *ReplicationCreationRequest) GetRemoteBucketID() string { - if o == nil { + if o == nil || o.RemoteBucketID == nil { var ret string return ret } - - return o.RemoteBucketID + return *o.RemoteBucketID } -// GetRemoteBucketIDOk returns a tuple with the RemoteBucketID field value +// GetRemoteBucketIDOk returns a tuple with the RemoteBucketID field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *ReplicationCreationRequest) GetRemoteBucketIDOk() (*string, bool) { - if o == nil { + if o == nil || o.RemoteBucketID == nil { return nil, false } - return &o.RemoteBucketID, true + return o.RemoteBucketID, true } -// SetRemoteBucketID sets field value +// HasRemoteBucketID returns a boolean if a field has been set. +func (o *ReplicationCreationRequest) HasRemoteBucketID() bool { + if o != nil && o.RemoteBucketID != nil { + return true + } + + return false +} + +// SetRemoteBucketID gets a reference to the given string and assigns it to the RemoteBucketID field. func (o *ReplicationCreationRequest) SetRemoteBucketID(v string) { - o.RemoteBucketID = v + o.RemoteBucketID = &v +} + +// GetRemoteBucketName returns the RemoteBucketName field value if set, zero value otherwise. +func (o *ReplicationCreationRequest) GetRemoteBucketName() string { + if o == nil || o.RemoteBucketName == nil { + var ret string + return ret + } + return *o.RemoteBucketName +} + +// GetRemoteBucketNameOk returns a tuple with the RemoteBucketName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReplicationCreationRequest) GetRemoteBucketNameOk() (*string, bool) { + if o == nil || o.RemoteBucketName == nil { + return nil, false + } + return o.RemoteBucketName, true +} + +// HasRemoteBucketName returns a boolean if a field has been set. +func (o *ReplicationCreationRequest) HasRemoteBucketName() bool { + if o != nil && o.RemoteBucketName != nil { + return true + } + + return false +} + +// SetRemoteBucketName gets a reference to the given string and assigns it to the RemoteBucketName field. +func (o *ReplicationCreationRequest) SetRemoteBucketName(v string) { + o.RemoteBucketName = &v } // GetMaxQueueSizeBytes returns the MaxQueueSizeBytes field value @@ -308,9 +348,12 @@ func (o ReplicationCreationRequest) MarshalJSON() ([]byte, error) { if true { toSerialize["localBucketID"] = o.LocalBucketID } - if true { + if o.RemoteBucketID != nil { toSerialize["remoteBucketID"] = o.RemoteBucketID } + if o.RemoteBucketName != nil { + toSerialize["remoteBucketName"] = o.RemoteBucketName + } if true { toSerialize["maxQueueSizeBytes"] = o.MaxQueueSizeBytes } diff --git a/api/model_replication_update_request.gen.go b/api/model_replication_update_request.gen.go index c189798..d9ac086 100644 --- a/api/model_replication_update_request.gen.go +++ b/api/model_replication_update_request.gen.go @@ -20,6 +20,7 @@ type ReplicationUpdateRequest struct { Description *string `json:"description,omitempty" yaml:"description,omitempty"` RemoteID *string `json:"remoteID,omitempty" yaml:"remoteID,omitempty"` RemoteBucketID *string `json:"remoteBucketID,omitempty" yaml:"remoteBucketID,omitempty"` + RemoteBucketName *string `json:"remoteBucketName,omitempty" yaml:"remoteBucketName,omitempty"` MaxQueueSizeBytes *int64 `json:"maxQueueSizeBytes,omitempty" yaml:"maxQueueSizeBytes,omitempty"` DropNonRetryableData *bool `json:"dropNonRetryableData,omitempty" yaml:"dropNonRetryableData,omitempty"` MaxAgeSeconds *int64 `json:"maxAgeSeconds,omitempty" yaml:"maxAgeSeconds,omitempty"` @@ -170,6 +171,38 @@ func (o *ReplicationUpdateRequest) SetRemoteBucketID(v string) { o.RemoteBucketID = &v } +// GetRemoteBucketName returns the RemoteBucketName field value if set, zero value otherwise. +func (o *ReplicationUpdateRequest) GetRemoteBucketName() string { + if o == nil || o.RemoteBucketName == nil { + var ret string + return ret + } + return *o.RemoteBucketName +} + +// GetRemoteBucketNameOk returns a tuple with the RemoteBucketName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReplicationUpdateRequest) GetRemoteBucketNameOk() (*string, bool) { + if o == nil || o.RemoteBucketName == nil { + return nil, false + } + return o.RemoteBucketName, true +} + +// HasRemoteBucketName returns a boolean if a field has been set. +func (o *ReplicationUpdateRequest) HasRemoteBucketName() bool { + if o != nil && o.RemoteBucketName != nil { + return true + } + + return false +} + +// SetRemoteBucketName gets a reference to the given string and assigns it to the RemoteBucketName field. +func (o *ReplicationUpdateRequest) SetRemoteBucketName(v string) { + o.RemoteBucketName = &v +} + // GetMaxQueueSizeBytes returns the MaxQueueSizeBytes field value if set, zero value otherwise. func (o *ReplicationUpdateRequest) GetMaxQueueSizeBytes() int64 { if o == nil || o.MaxQueueSizeBytes == nil { @@ -280,6 +313,9 @@ func (o ReplicationUpdateRequest) MarshalJSON() ([]byte, error) { if o.RemoteBucketID != nil { toSerialize["remoteBucketID"] = o.RemoteBucketID } + if o.RemoteBucketName != nil { + toSerialize["remoteBucketName"] = o.RemoteBucketName + } if o.MaxQueueSizeBytes != nil { toSerialize["maxQueueSizeBytes"] = o.MaxQueueSizeBytes } diff --git a/api/model_resource_member.gen.go b/api/model_resource_member.gen.go index 0843372..cb03bbb 100644 --- a/api/model_resource_member.gen.go +++ b/api/model_resource_member.gen.go @@ -16,10 +16,11 @@ import ( // ResourceMember struct for ResourceMember type ResourceMember struct { - Id *string `json:"id,omitempty" yaml:"id,omitempty"` - OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"` - Name string `json:"name" yaml:"name"` - // If inactive the user is inactive. + // The ID of the user. + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The name of the user. + Name string `json:"name" yaml:"name"` + // The status of a user. An inactive user won't have access to resources. Status *string `json:"status,omitempty" yaml:"status,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Role *string `json:"role,omitempty" yaml:"role,omitempty"` @@ -83,38 +84,6 @@ func (o *ResourceMember) SetId(v string) { o.Id = &v } -// GetOauthID returns the OauthID field value if set, zero value otherwise. -func (o *ResourceMember) 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 *ResourceMember) 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 *ResourceMember) 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 *ResourceMember) SetOauthID(v string) { - o.OauthID = &v -} - // GetName returns the Name field value func (o *ResourceMember) GetName() string { if o == nil { @@ -240,9 +209,6 @@ func (o ResourceMember) 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/api/model_resource_owner.gen.go b/api/model_resource_owner.gen.go index c3383e7..eca2dd2 100644 --- a/api/model_resource_owner.gen.go +++ b/api/model_resource_owner.gen.go @@ -16,10 +16,11 @@ import ( // ResourceOwner struct for ResourceOwner type ResourceOwner struct { - Id *string `json:"id,omitempty" yaml:"id,omitempty"` - OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"` - Name string `json:"name" yaml:"name"` - // If inactive the user is inactive. + // The ID of the user. + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The name of the user. + Name string `json:"name" yaml:"name"` + // The status of a user. An inactive user won't have access to resources. Status *string `json:"status,omitempty" yaml:"status,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` Role *string `json:"role,omitempty" yaml:"role,omitempty"` @@ -83,38 +84,6 @@ func (o *ResourceOwner) SetId(v string) { o.Id = &v } -// GetOauthID returns the OauthID field value if set, zero value otherwise. -func (o *ResourceOwner) 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 *ResourceOwner) 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 *ResourceOwner) 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 *ResourceOwner) SetOauthID(v string) { - o.OauthID = &v -} - // GetName returns the Name field value func (o *ResourceOwner) GetName() string { if o == nil { @@ -240,9 +209,6 @@ func (o ResourceOwner) 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/api/model_retention_rule.gen.go b/api/model_retention_rule.gen.go index d206759..f0251ba 100644 --- a/api/model_retention_rule.gen.go +++ b/api/model_retention_rule.gen.go @@ -16,10 +16,10 @@ import ( // RetentionRule struct for RetentionRule type RetentionRule struct { - Type string `json:"type" yaml:"type"` - // Duration in seconds for how long data will be kept in the database. 0 means infinite. + 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"` - // Shard duration measured in seconds. + // 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). ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty" yaml:"shardGroupDurationSeconds,omitempty"` } @@ -27,9 +27,10 @@ type RetentionRule struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewRetentionRule(type_ string, everySeconds int64) *RetentionRule { +func NewRetentionRule(everySeconds int64) *RetentionRule { this := RetentionRule{} - this.Type = type_ + var type_ string = "expire" + this.Type = &type_ this.EverySeconds = everySeconds return &this } @@ -40,32 +41,42 @@ func NewRetentionRule(type_ string, everySeconds int64) *RetentionRule { func NewRetentionRuleWithDefaults() *RetentionRule { this := RetentionRule{} var type_ string = "expire" - this.Type = type_ + this.Type = &type_ + var everySeconds int64 = 2592000 + this.EverySeconds = everySeconds return &this } -// GetType returns the Type field value +// GetType returns the Type field value if set, zero value otherwise. func (o *RetentionRule) GetType() string { - if o == nil { + if o == nil || o.Type == nil { var ret string return ret } - - return o.Type + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *RetentionRule) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || o.Type == nil { return nil, false } - return &o.Type, true + return o.Type, true } -// SetType sets field value +// HasType returns a boolean if a field has been set. +func (o *RetentionRule) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. func (o *RetentionRule) SetType(v string) { - o.Type = v + o.Type = &v } // GetEverySeconds returns the EverySeconds field value @@ -126,7 +137,7 @@ func (o *RetentionRule) SetShardGroupDurationSeconds(v int64) { func (o RetentionRule) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { + if o.Type != nil { toSerialize["type"] = o.Type } if true { diff --git a/api/model_user_response.gen.go b/api/model_user_response.gen.go index e4a6a22..6809cb7 100644 --- a/api/model_user_response.gen.go +++ b/api/model_user_response.gen.go @@ -16,10 +16,11 @@ import ( // UserResponse struct for UserResponse type UserResponse struct { - Id *string `json:"id,omitempty" yaml:"id,omitempty"` - OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"` - Name string `json:"name" yaml:"name"` - // If inactive the user is inactive. + // The ID of the user. + Id *string `json:"id,omitempty" yaml:"id,omitempty"` + // The name of the user. + Name string `json:"name" yaml:"name"` + // The status of a user. An inactive user won't have access to resources. Status *string `json:"status,omitempty" yaml:"status,omitempty"` Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"` } @@ -78,38 +79,6 @@ func (o *UserResponse) SetId(v string) { o.Id = &v } -// GetOauthID returns the OauthID field value if set, zero value otherwise. -func (o *UserResponse) 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 *UserResponse) 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 *UserResponse) 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 *UserResponse) SetOauthID(v string) { - o.OauthID = &v -} - // GetName returns the Name field value func (o *UserResponse) GetName() string { if o == nil { @@ -203,9 +172,6 @@ func (o UserResponse) 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/bucket/create.go b/clients/bucket/create.go index c9dc806..c09f8f6 100644 --- a/clients/bucket/create.go +++ b/clients/bucket/create.go @@ -34,10 +34,11 @@ func (c Client) Create(ctx context.Context, params *BucketsCreateParams) error { return err } + var rr []api.RetentionRule reqBody := api.PostBucketRequest{ OrgID: orgId, Name: params.Name, - RetentionRules: []api.RetentionRule{}, + RetentionRules: &rr, SchemaType: ¶ms.SchemaType, } if params.Description != "" { @@ -57,7 +58,7 @@ func (c Client) Create(ctx context.Context, params *BucketsCreateParams) error { if sgd > 0 { rule.SetShardGroupDurationSeconds(int64(sgd.Round(time.Second) / time.Second)) } - reqBody.RetentionRules = append(reqBody.RetentionRules, *rule) + *reqBody.RetentionRules = append(*reqBody.RetentionRules, *rule) } bucket, err := c.PostBuckets(ctx).PostBucketRequest(reqBody).Execute() diff --git a/clients/bucket/create_test.go b/clients/bucket/create_test.go index 11fd3f5..6c51d49 100644 --- a/clients/bucket/create_test.go +++ b/clients/bucket/create_test.go @@ -70,13 +70,14 @@ func TestBucketsCreate(t *testing.T) { bucketsApi.EXPECT(). PostBucketsExecute(tmock.MatchedBy(func(in api.ApiPostBucketsRequest) bool { body := in.GetPostBucketRequest() + retentionRules := *body.RetentionRules return assert.NotNil(t, body) && assert.Equal(t, "123", body.OrgID) && assert.Equal(t, "my-bucket", body.Name) && assert.Equal(t, "my cool bucket", *body.Description) && - assert.Len(t, body.RetentionRules, 1) && - assert.Equal(t, int64(86400), body.RetentionRules[0].EverySeconds) && - assert.Equal(t, int64(3600), *body.RetentionRules[0].ShardGroupDurationSeconds) + assert.Len(t, retentionRules, 1) && + assert.Equal(t, int64(86400), retentionRules[0].EverySeconds) && + assert.Equal(t, int64(3600), *retentionRules[0].ShardGroupDurationSeconds) })). Return(api.Bucket{ Id: api.PtrString("456"), @@ -101,13 +102,14 @@ func TestBucketsCreate(t *testing.T) { bucketsApi.EXPECT(). PostBucketsExecute(tmock.MatchedBy(func(in api.ApiPostBucketsRequest) bool { body := in.GetPostBucketRequest() + retentionRules := *body.RetentionRules return assert.NotNil(t, body) && assert.Equal(t, "123", body.OrgID) && assert.Equal(t, "my-bucket", body.Name) && assert.Nil(t, body.Description) && - assert.Len(t, body.RetentionRules, 1) && - assert.Equal(t, int64(86400), body.RetentionRules[0].EverySeconds) && - assert.Nil(t, body.RetentionRules[0].ShardGroupDurationSeconds) + assert.Len(t, *body.RetentionRules, 1) && + assert.Equal(t, int64(86400), retentionRules[0].EverySeconds) && + assert.Nil(t, retentionRules[0].ShardGroupDurationSeconds) })). Return(api.Bucket{ Id: api.PtrString("456"), @@ -168,13 +170,14 @@ func TestBucketsCreate(t *testing.T) { bucketsApi.EXPECT(). PostBucketsExecute(tmock.MatchedBy(func(in api.ApiPostBucketsRequest) bool { body := in.GetPostBucketRequest() + retentionRules := *body.RetentionRules return assert.NotNil(t, body) && assert.Equal(t, "123", body.OrgID) && assert.Equal(t, "my-bucket", body.Name) && assert.Equal(t, "my cool bucket", *body.Description) && - assert.Len(t, body.RetentionRules, 1) && - assert.Equal(t, int64(86400), body.RetentionRules[0].EverySeconds) && - assert.Equal(t, int64(3600), *body.RetentionRules[0].ShardGroupDurationSeconds) + assert.Len(t, *body.RetentionRules, 1) && + assert.Equal(t, int64(86400), retentionRules[0].EverySeconds) && + assert.Equal(t, int64(3600), *retentionRules[0].ShardGroupDurationSeconds) })). Return(api.Bucket{ Id: api.PtrString("456"), @@ -210,13 +213,14 @@ func TestBucketsCreate(t *testing.T) { bucketsApi.EXPECT(). PostBucketsExecute(tmock.MatchedBy(func(in api.ApiPostBucketsRequest) bool { body := in.GetPostBucketRequest() + retentionRules := *body.RetentionRules return assert.NotNil(t, body) && assert.Equal(t, "123", body.OrgID) && assert.Equal(t, "my-bucket", body.Name) && assert.Equal(t, "my cool bucket", *body.Description) && - assert.Len(t, body.RetentionRules, 1) && - assert.Equal(t, int64(86400), body.RetentionRules[0].EverySeconds) && - assert.Equal(t, int64(3600), *body.RetentionRules[0].ShardGroupDurationSeconds) + assert.Len(t, *body.RetentionRules, 1) && + assert.Equal(t, int64(86400), retentionRules[0].EverySeconds) && + assert.Equal(t, int64(3600), *retentionRules[0].ShardGroupDurationSeconds) })). Return(api.Bucket{ Id: api.PtrString("456"), diff --git a/clients/bucket_schema/format.go b/clients/bucket_schema/format.go index f3c1307..bf9ead1 100644 --- a/clients/bucket_schema/format.go +++ b/clients/bucket_schema/format.go @@ -11,7 +11,6 @@ import ( ) // ColumnsFormat is a type which defines the supported formats -// type ColumnsFormat int const ( diff --git a/clients/replication/replication.go b/clients/replication/replication.go index 2e28060..cc26926 100644 --- a/clients/replication/replication.go +++ b/clients/replication/replication.go @@ -22,6 +22,7 @@ type CreateParams struct { RemoteID string LocalBucketID string RemoteBucketID string + RemoteBucketName string MaxQueueSize int64 DropNonRetryableData bool NoDropNonRetryableData bool @@ -29,6 +30,9 @@ type CreateParams struct { } func (c Client) Create(ctx context.Context, params *CreateParams) error { + if params.RemoteBucketID == "" && params.RemoteBucketName == "" { + return fmt.Errorf("please supply one of: remote-bucket-id, remote-bucket-name") + } orgID, err := params.GetOrgID(ctx, c.ActiveConfig, c.OrganizationsApi) if err != nil { return err @@ -40,11 +44,16 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error { OrgID: orgID, RemoteID: params.RemoteID, LocalBucketID: params.LocalBucketID, - RemoteBucketID: params.RemoteBucketID, MaxQueueSizeBytes: params.MaxQueueSize, MaxAgeSeconds: params.MaxAge, } + if params.RemoteBucketID != "" { + body.RemoteBucketID = ¶ms.RemoteBucketID + } else { + body.RemoteBucketName = ¶ms.RemoteBucketName + } + // set optional params if specified if params.Description != "" { body.Description = ¶ms.Description @@ -231,7 +240,7 @@ func (c Client) printReplication(opts printReplicationOpts) error { return c.PrintJSON(v) } - headers := []string{"ID", "Name", "Org ID", "Remote ID", "Local Bucket ID", "Remote Bucket ID", + 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"} if opts.deleted { headers = append(headers, "Deleted") @@ -243,13 +252,19 @@ func (c Client) printReplication(opts printReplicationOpts) error { var rows []map[string]interface{} for _, r := range opts.replications { + bucketID := r.GetRemoteBucketID() + if r.GetRemoteBucketName() != "" { + // This hides the default id that is required due to platform.ID implementation details + 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": r.GetRemoteBucketID(), + "Remote Bucket ID": bucketID, + "Remote Bucket Name": r.GetRemoteBucketName(), "Current Queue Bytes": r.GetCurrentQueueSizeBytes(), "Max Queue Bytes": r.GetMaxQueueSizeBytes(), "Latest Status Code": r.GetLatestResponseCode(), diff --git a/clients/restore/restore.go b/clients/restore/restore.go index 06c6a60..efe0f26 100644 --- a/clients/restore/restore.go +++ b/clients/restore/restore.go @@ -318,7 +318,8 @@ func (c Client) restoreBucketLegacy(ctx context.Context, bkt br.ManifestBucketEn rps[i].ShardGroupDurationSeconds = &sgd } - bucketReq := *api.NewPostBucketRequest(bkt.OrganizationID, bkt.BucketName, rps) + bucketReq := *api.NewPostBucketRequest(bkt.OrganizationID, bkt.BucketName) + bucketReq.RetentionRules = &rps bucketReq.Description = bkt.Description newBkt, err := c.PostBuckets(ctx).PostBucketRequest(bucketReq).Execute() diff --git a/cmd/influx/main.go b/cmd/influx/main.go index 9865513..c16ef09 100644 --- a/cmd/influx/main.go +++ b/cmd/influx/main.go @@ -96,7 +96,7 @@ func newApp() cli.App { // This creates a new slice and replaces `-t "-FOO-TOKEN"` with `-t=-FOO-TOKEN` // This is necessary to do because the command line arg: -// `-t "-FOO-TOKEN"`` will be parsed as two separate flags instead of a flag and token value. +// `-t "-FOO-TOKEN"“ will be parsed as two separate flags instead of a flag and token value. func ReplaceTokenArg(args []string) []string { if len(args) == 0 { return []string{} diff --git a/cmd/influx/replication.go b/cmd/influx/replication.go index ba4650c..1d5fec4 100644 --- a/cmd/influx/replication.go +++ b/cmd/influx/replication.go @@ -66,9 +66,13 @@ func newReplicationCreateCmd() cli.Command { &cli.StringFlag{ Name: "remote-bucket-id", Usage: "ID of remote bucket data should be replicated to", - Required: true, Destination: ¶ms.RemoteBucketID, }, + &cli.StringFlag{ + Name: "remote-bucket", + Usage: "Name of remote bucket data should be replicated to", + Destination: ¶ms.RemoteBucketName, + }, &cli.Int64Flag{ Name: "max-queue-bytes", Usage: "Max queue size in bytes", diff --git a/pkg/csv2lp/csv_annotations.go b/pkg/csv2lp/csv_annotations.go index 8d662fb..8cd9ec8 100644 --- a/pkg/csv2lp/csv_annotations.go +++ b/pkg/csv2lp/csv_annotations.go @@ -198,11 +198,11 @@ func ignoreLeadingComment(value string) string { // parseTimeZone parses the supplied timezone from a string into a time.Location // -// parseTimeZone("") // time.UTC -// parseTimeZone("local") // time.Local -// parseTimeZone("-0500") // time.FixedZone(-5*3600 + 0*60) -// parseTimeZone("+0200") // time.FixedZone(2*3600 + 0*60) -// parseTimeZone("EST") // time.LoadLocation("EST") +// parseTimeZone("") // time.UTC +// parseTimeZone("local") // time.Local +// parseTimeZone("-0500") // time.FixedZone(-5*3600 + 0*60) +// parseTimeZone("+0200") // time.FixedZone(2*3600 + 0*60) +// parseTimeZone("EST") // time.LoadLocation("EST") func parseTimeZone(val string) (*time.Location, error) { switch { case val == "": diff --git a/pkg/csv2lp/csv_table_test.go b/pkg/csv2lp/csv_table_test.go index 45585fe..ee8282b 100644 --- a/pkg/csv2lp/csv_table_test.go +++ b/pkg/csv2lp/csv_table_test.go @@ -110,7 +110,7 @@ func Test_CsvTable_FluxQueryResult(t *testing.T) { } } -//Test_IgnoreLeadingComment tests ignoreLeadingComment fn +// Test_IgnoreLeadingComment tests ignoreLeadingComment fn func Test_IgnoreLeadingComment(t *testing.T) { var tests = []struct { value string diff --git a/pkg/csv2lp/multi_closer.go b/pkg/csv2lp/multi_closer.go index 0e8847a..e19574f 100644 --- a/pkg/csv2lp/multi_closer.go +++ b/pkg/csv2lp/multi_closer.go @@ -25,7 +25,7 @@ func (mc *multiCloser) Close() error { return err } -//MultiCloser creates an io.Closer that silently closes supplied io.Closer instances +// MultiCloser creates an io.Closer that silently closes supplied io.Closer instances func MultiCloser(closers ...io.Closer) io.Closer { c := make([]io.Closer, len(closers)) copy(c, closers)