chore: upgrade to latest OpenAPI (#357)

This commit is contained in:
Dane Strandboge
2022-02-01 14:53:34 -06:00
committed by GitHub
parent 5cd1c9d037
commit 981be7872d
18 changed files with 145 additions and 114 deletions

View File

@ -13,14 +13,14 @@ type ApiError interface {
// Extensions to let our API error types be used as "standard" errors. // Extensions to let our API error types be used as "standard" errors.
func (o *Error) Error() string { func (o *Error) Error() string {
if o.Message != "" && o.Err != nil { if o.Message != nil && o.Err != nil {
var b strings.Builder var b strings.Builder
b.WriteString(o.Message) b.WriteString(*o.Message)
b.WriteString(": ") b.WriteString(": ")
b.WriteString(*o.Err) b.WriteString(*o.Err)
return b.String() return b.String()
} else if o.Message != "" { } else if o.Message != nil {
return o.Message return *o.Message
} else if o.Err != nil { } else if o.Err != nil {
return *o.Err return *o.Err
} }
@ -55,7 +55,10 @@ func (o *HealthCheck) ErrorCode() ErrorCode {
} }
func (o *LineProtocolError) Error() string { func (o *LineProtocolError) Error() string {
return o.Message if o.Message == nil {
return ""
}
return *o.Message
} }
func (o *LineProtocolError) ErrorCode() ErrorCode { func (o *LineProtocolError) ErrorCode() ErrorCode {

View File

@ -17,24 +17,24 @@ import (
// Authorization struct for Authorization // Authorization struct for Authorization
type Authorization struct { type Authorization struct {
// If inactive the token is inactive and requests using the token will be rejected. // Status of the token. If `inactive`, requests using the token will be rejected.
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
// A description of the token. // A description of the token.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
// ID of org that authorization is scoped to. // ID of the organization that the authorization is scoped to.
OrgID string `json:"orgID" yaml:"orgID"` OrgID string `json:"orgID" yaml:"orgID"`
// List of permissions for an auth. An auth must have at least one Permission. // List of permissions for an authorization. An authorization must have at least one permission.
Permissions []Permission `json:"permissions" yaml:"permissions"` Permissions []Permission `json:"permissions" yaml:"permissions"`
Id *string `json:"id,omitempty" yaml:"id,omitempty"` Id *string `json:"id,omitempty" yaml:"id,omitempty"`
// Passed via the Authorization Header and Token Authentication type. // Token used to authenticate API requests.
Token *string `json:"token,omitempty" yaml:"token,omitempty"` Token *string `json:"token,omitempty" yaml:"token,omitempty"`
// ID of user that created and owns the token. // ID of the user that created and owns the token.
UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"`
// Name of user that created and owns the token. // Name of the user that created and owns the token.
User *string `json:"user,omitempty" yaml:"user,omitempty"` User *string `json:"user,omitempty" yaml:"user,omitempty"`
// Name of the org token is scoped to. // Name of the organization that the token is scoped to.
Org *string `json:"org,omitempty" yaml:"org,omitempty"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"`
} }

View File

@ -19,18 +19,18 @@ import (
type AuthorizationAllOf struct { type AuthorizationAllOf struct {
CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty" yaml:"updatedAt,omitempty"`
// ID of org that authorization is scoped to. // ID of the organization that the authorization is scoped to.
OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"`
// List of permissions for an auth. An auth must have at least one Permission. // List of permissions for an authorization. An authorization must have at least one permission.
Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"` Permissions *[]Permission `json:"permissions,omitempty" yaml:"permissions,omitempty"`
Id *string `json:"id,omitempty" yaml:"id,omitempty"` Id *string `json:"id,omitempty" yaml:"id,omitempty"`
// Passed via the Authorization Header and Token Authentication type. // Token used to authenticate API requests.
Token *string `json:"token,omitempty" yaml:"token,omitempty"` Token *string `json:"token,omitempty" yaml:"token,omitempty"`
// ID of user that created and owns the token. // ID of the user that created and owns the token.
UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"` UserID *string `json:"userID,omitempty" yaml:"userID,omitempty"`
// Name of user that created and owns the token. // Name of the user that created and owns the token.
User *string `json:"user,omitempty" yaml:"user,omitempty"` User *string `json:"user,omitempty" yaml:"user,omitempty"`
// Name of the org token is scoped to. // Name of the organization that the token is scoped to.
Org *string `json:"org,omitempty" yaml:"org,omitempty"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"` Links *AuthorizationAllOfLinks `json:"links,omitempty" yaml:"links,omitempty"`
} }

View File

@ -16,7 +16,7 @@ import (
// AuthorizationPostRequest struct for AuthorizationPostRequest // AuthorizationPostRequest struct for AuthorizationPostRequest
type AuthorizationPostRequest struct { type AuthorizationPostRequest struct {
// If inactive the token is inactive and requests using the token will be rejected. // Status of the token. If `inactive`, requests using the token will be rejected.
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
// A description of the token. // A description of the token.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`

View File

@ -16,7 +16,7 @@ import (
// AuthorizationUpdateRequest struct for AuthorizationUpdateRequest // AuthorizationUpdateRequest struct for AuthorizationUpdateRequest
type AuthorizationUpdateRequest struct { type AuthorizationUpdateRequest struct {
// If inactive the token is inactive and requests using the token will be rejected. // Status of the token. If `inactive`, requests using the token will be rejected.
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
// A description of the token. // A description of the token.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`

View File

@ -16,17 +16,17 @@ import (
// DBRP struct for DBRP // DBRP struct for DBRP
type DBRP struct { type DBRP struct {
// the mapping identifier // ID of the DBRP mapping.
Id string `json:"id" yaml:"id"` Id string `json:"id" yaml:"id"`
// the organization ID that owns this mapping. // ID of the organization that owns this mapping.
OrgID string `json:"orgID" yaml:"orgID"` OrgID string `json:"orgID" yaml:"orgID"`
// the bucket ID used as target for the translation. // ID of the bucket used as the target for the translation.
BucketID string `json:"bucketID" yaml:"bucketID"` BucketID string `json:"bucketID" yaml:"bucketID"`
// InfluxDB v1 database // InfluxDB v1 database
Database string `json:"database" yaml:"database"` Database string `json:"database" yaml:"database"`
// InfluxDB v1 retention policy // InfluxDB v1 retention policy
RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"` RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"`
// Specify if this mapping represents the default retention policy for the database specificed. // Mapping represents the default retention policy for the database specified.
Default bool `json:"default" yaml:"default"` Default bool `json:"default" yaml:"default"`
Links *Links `json:"links,omitempty" yaml:"links,omitempty"` Links *Links `json:"links,omitempty" yaml:"links,omitempty"`
} }

View File

@ -16,17 +16,17 @@ import (
// DBRPCreate struct for DBRPCreate // DBRPCreate struct for DBRPCreate
type DBRPCreate struct { type DBRPCreate struct {
// the organization ID that owns this mapping. // ID of the organization that owns this mapping.
OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"`
// the organization that owns this mapping. // Name of the organization that owns this mapping.
Org *string `json:"org,omitempty" yaml:"org,omitempty"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
// the bucket ID used as target for the translation. // ID of the bucket used as the target for the translation.
BucketID string `json:"bucketID" yaml:"bucketID"` BucketID string `json:"bucketID" yaml:"bucketID"`
// InfluxDB v1 database // InfluxDB v1 database
Database string `json:"database" yaml:"database"` Database string `json:"database" yaml:"database"`
// InfluxDB v1 retention policy // InfluxDB v1 retention policy
RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"` RetentionPolicy string `json:"retention_policy" yaml:"retention_policy"`
// Specify if this mapping represents the default retention policy for the database specificed. // Mapping represents the default retention policy for the database specified.
Default *bool `json:"default,omitempty" yaml:"default,omitempty"` Default *bool `json:"default,omitempty" yaml:"default,omitempty"`
} }

View File

@ -17,11 +17,11 @@ import (
// Error struct for Error // Error struct for Error
type Error struct { type Error struct {
Code ErrorCode `json:"code" yaml:"code"` Code ErrorCode `json:"code" yaml:"code"`
// message is a human-readable message. // Human-readable message.
Message string `json:"message" yaml:"message"` Message *string `json:"message,omitempty" yaml:"message,omitempty"`
// op describes the logical code operation during error. Useful for debugging. // Describes the logical code operation when the error occurred. Useful for debugging.
Op *string `json:"op,omitempty" yaml:"op,omitempty"` Op *string `json:"op,omitempty" yaml:"op,omitempty"`
// err is a stack of errors that occurred during processing of the request. Useful for debugging. // Stack of errors that occurred during processing of the request. Useful for debugging.
Err *string `json:"err,omitempty" yaml:"err,omitempty"` Err *string `json:"err,omitempty" yaml:"err,omitempty"`
} }
@ -29,10 +29,9 @@ type Error struct {
// This constructor will assign default values to properties that have it defined, // This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments // and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed // will change when the set of required properties is changed
func NewError(code ErrorCode, message string) *Error { func NewError(code ErrorCode) *Error {
this := Error{} this := Error{}
this.Code = code this.Code = code
this.Message = message
return &this return &this
} }
@ -68,28 +67,36 @@ func (o *Error) SetCode(v ErrorCode) {
o.Code = v o.Code = v
} }
// GetMessage returns the Message field value // GetMessage returns the Message field value if set, zero value otherwise.
func (o *Error) GetMessage() string { func (o *Error) GetMessage() string {
if o == nil { if o == nil || o.Message == nil {
var ret string var ret string
return ret return ret
} }
return *o.Message
return o.Message
} }
// GetMessageOk returns a tuple with the Message field value // GetMessageOk returns a tuple with the Message field value if set, nil otherwise
// and a boolean to check if the value has been set. // and a boolean to check if the value has been set.
func (o *Error) GetMessageOk() (*string, bool) { func (o *Error) GetMessageOk() (*string, bool) {
if o == nil { if o == nil || o.Message == nil {
return nil, false return nil, false
} }
return &o.Message, true return o.Message, true
} }
// SetMessage sets field value // HasMessage returns a boolean if a field has been set.
func (o *Error) HasMessage() bool {
if o != nil && o.Message != nil {
return true
}
return false
}
// SetMessage gets a reference to the given string and assigns it to the Message field.
func (o *Error) SetMessage(v string) { func (o *Error) SetMessage(v string) {
o.Message = v o.Message = &v
} }
// GetOp returns the Op field value if set, zero value otherwise. // GetOp returns the Op field value if set, zero value otherwise.
@ -161,7 +168,7 @@ func (o Error) MarshalJSON() ([]byte, error) {
if true { if true {
toSerialize["code"] = o.Code toSerialize["code"] = o.Code
} }
if true { if o.Message != nil {
toSerialize["message"] = o.Message toSerialize["message"] = o.Message
} }
if o.Op != nil { if o.Op != nil {

View File

@ -16,7 +16,7 @@ import (
// LegacyAuthorizationPostRequest struct for LegacyAuthorizationPostRequest // LegacyAuthorizationPostRequest struct for LegacyAuthorizationPostRequest
type LegacyAuthorizationPostRequest struct { type LegacyAuthorizationPostRequest struct {
// If inactive the token is inactive and requests using the token will be rejected. // Status of the token. If `inactive`, requests using the token will be rejected.
Status *string `json:"status,omitempty" yaml:"status,omitempty"` Status *string `json:"status,omitempty" yaml:"status,omitempty"`
// A description of the token. // A description of the token.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`

View File

@ -17,13 +17,13 @@ import (
// LineProtocolError struct for LineProtocolError // LineProtocolError struct for LineProtocolError
type LineProtocolError struct { type LineProtocolError struct {
Code LineProtocolErrorCode `json:"code" yaml:"code"` Code LineProtocolErrorCode `json:"code" yaml:"code"`
// Message is a human-readable message. // Human-readable message.
Message string `json:"message" yaml:"message"` Message *string `json:"message,omitempty" yaml:"message,omitempty"`
// Op describes the logical code operation during error. Useful for debugging. // Describes the logical code operation when the error occurred. Useful for debugging.
Op string `json:"op" yaml:"op"` Op *string `json:"op,omitempty" yaml:"op,omitempty"`
// Err is a stack of errors that occurred during processing of the request. Useful for debugging. // Stack of errors that occurred during processing of the request. Useful for debugging.
Err string `json:"err" yaml:"err"` Err *string `json:"err,omitempty" yaml:"err,omitempty"`
// First line within sent body containing malformed data // First line in the request body that contains malformed data.
Line *int32 `json:"line,omitempty" yaml:"line,omitempty"` Line *int32 `json:"line,omitempty" yaml:"line,omitempty"`
} }
@ -31,12 +31,9 @@ type LineProtocolError struct {
// This constructor will assign default values to properties that have it defined, // This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments // and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed // will change when the set of required properties is changed
func NewLineProtocolError(code LineProtocolErrorCode, message string, op string, err string) *LineProtocolError { func NewLineProtocolError(code LineProtocolErrorCode) *LineProtocolError {
this := LineProtocolError{} this := LineProtocolError{}
this.Code = code this.Code = code
this.Message = message
this.Op = op
this.Err = err
return &this return &this
} }
@ -72,76 +69,100 @@ func (o *LineProtocolError) SetCode(v LineProtocolErrorCode) {
o.Code = v o.Code = v
} }
// GetMessage returns the Message field value // GetMessage returns the Message field value if set, zero value otherwise.
func (o *LineProtocolError) GetMessage() string { func (o *LineProtocolError) GetMessage() string {
if o == nil { if o == nil || o.Message == nil {
var ret string var ret string
return ret return ret
} }
return *o.Message
return o.Message
} }
// GetMessageOk returns a tuple with the Message field value // GetMessageOk returns a tuple with the Message field value if set, nil otherwise
// and a boolean to check if the value has been set. // and a boolean to check if the value has been set.
func (o *LineProtocolError) GetMessageOk() (*string, bool) { func (o *LineProtocolError) GetMessageOk() (*string, bool) {
if o == nil { if o == nil || o.Message == nil {
return nil, false return nil, false
} }
return &o.Message, true return o.Message, true
} }
// SetMessage sets field value // HasMessage returns a boolean if a field has been set.
func (o *LineProtocolError) HasMessage() bool {
if o != nil && o.Message != nil {
return true
}
return false
}
// SetMessage gets a reference to the given string and assigns it to the Message field.
func (o *LineProtocolError) SetMessage(v string) { func (o *LineProtocolError) SetMessage(v string) {
o.Message = v o.Message = &v
} }
// GetOp returns the Op field value // GetOp returns the Op field value if set, zero value otherwise.
func (o *LineProtocolError) GetOp() string { func (o *LineProtocolError) GetOp() string {
if o == nil { if o == nil || o.Op == nil {
var ret string var ret string
return ret return ret
} }
return *o.Op
return o.Op
} }
// GetOpOk returns a tuple with the Op field value // GetOpOk returns a tuple with the Op field value if set, nil otherwise
// and a boolean to check if the value has been set. // and a boolean to check if the value has been set.
func (o *LineProtocolError) GetOpOk() (*string, bool) { func (o *LineProtocolError) GetOpOk() (*string, bool) {
if o == nil { if o == nil || o.Op == nil {
return nil, false return nil, false
} }
return &o.Op, true return o.Op, true
} }
// SetOp sets field value // HasOp returns a boolean if a field has been set.
func (o *LineProtocolError) HasOp() bool {
if o != nil && o.Op != nil {
return true
}
return false
}
// SetOp gets a reference to the given string and assigns it to the Op field.
func (o *LineProtocolError) SetOp(v string) { func (o *LineProtocolError) SetOp(v string) {
o.Op = v o.Op = &v
} }
// GetErr returns the Err field value // GetErr returns the Err field value if set, zero value otherwise.
func (o *LineProtocolError) GetErr() string { func (o *LineProtocolError) GetErr() string {
if o == nil { if o == nil || o.Err == nil {
var ret string var ret string
return ret return ret
} }
return *o.Err
return o.Err
} }
// GetErrOk returns a tuple with the Err field value // GetErrOk returns a tuple with the Err field value if set, nil otherwise
// and a boolean to check if the value has been set. // and a boolean to check if the value has been set.
func (o *LineProtocolError) GetErrOk() (*string, bool) { func (o *LineProtocolError) GetErrOk() (*string, bool) {
if o == nil { if o == nil || o.Err == nil {
return nil, false return nil, false
} }
return &o.Err, true return o.Err, true
} }
// SetErr sets field value // HasErr returns a boolean if a field has been set.
func (o *LineProtocolError) HasErr() bool {
if o != nil && o.Err != nil {
return true
}
return false
}
// SetErr gets a reference to the given string and assigns it to the Err field.
func (o *LineProtocolError) SetErr(v string) { func (o *LineProtocolError) SetErr(v string) {
o.Err = v o.Err = &v
} }
// GetLine returns the Line field value if set, zero value otherwise. // GetLine returns the Line field value if set, zero value otherwise.
@ -181,13 +202,13 @@ func (o LineProtocolError) MarshalJSON() ([]byte, error) {
if true { if true {
toSerialize["code"] = o.Code toSerialize["code"] = o.Code
} }
if true { if o.Message != nil {
toSerialize["message"] = o.Message toSerialize["message"] = o.Message
} }
if true { if o.Op != nil {
toSerialize["op"] = o.Op toSerialize["op"] = o.Op
} }
if true { if o.Err != nil {
toSerialize["err"] = o.Err toSerialize["err"] = o.Err
} }
if o.Line != nil { if o.Line != nil {

View File

@ -17,7 +17,7 @@ import (
// LineProtocolLengthError struct for LineProtocolLengthError // LineProtocolLengthError struct for LineProtocolLengthError
type LineProtocolLengthError struct { type LineProtocolLengthError struct {
Code LineProtocolLengthErrorCode `json:"code" yaml:"code"` Code LineProtocolLengthErrorCode `json:"code" yaml:"code"`
// Message is a human-readable message. // Human-readable message.
Message string `json:"message" yaml:"message"` Message string `json:"message" yaml:"message"`
} }

View File

@ -15,15 +15,15 @@ import (
"time" "time"
) )
// MeasurementSchema The schema definition for a single measurement // MeasurementSchema Definition of a measurement schema.
type MeasurementSchema struct { type MeasurementSchema struct {
Id string `json:"id" yaml:"id"` Id string `json:"id" yaml:"id"`
// ID of organization that the measurement schema is associated with. // ID of the organization that the measurement schema is associated with.
OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"` OrgID *string `json:"orgID,omitempty" yaml:"orgID,omitempty"`
// ID of the bucket that the measurement schema is associated with. // ID of the bucket that the measurement schema is associated with.
BucketID *string `json:"bucketID,omitempty" yaml:"bucketID,omitempty"` BucketID *string `json:"bucketID,omitempty" yaml:"bucketID,omitempty"`
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// An ordered collection of column definitions // Ordered collection of column definitions.
Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"` Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"`
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"` CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"` UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`

View File

@ -14,7 +14,7 @@ import (
"encoding/json" "encoding/json"
) )
// MeasurementSchemaColumn Definition of a measurement column // MeasurementSchemaColumn Definition of a measurement schema column.
type MeasurementSchemaColumn struct { type MeasurementSchemaColumn struct {
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
Type ColumnSemanticType `json:"type" yaml:"type"` Type ColumnSemanticType `json:"type" yaml:"type"`

View File

@ -14,10 +14,10 @@ import (
"encoding/json" "encoding/json"
) )
// MeasurementSchemaCreateRequest Create a new measurement schema // MeasurementSchemaCreateRequest Create a new measurement schema.
type MeasurementSchemaCreateRequest struct { type MeasurementSchemaCreateRequest struct {
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// An ordered collection of column definitions // Ordered collection of column definitions.
Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"` Columns []MeasurementSchemaColumn `json:"columns" yaml:"columns"`
} }

View File

@ -18,31 +18,31 @@ import (
// Task struct for Task // Task struct for Task
type Task struct { type Task struct {
Id string `json:"id" yaml:"id"` Id string `json:"id" yaml:"id"`
// The type of task, this can be used for filtering tasks on list actions. // Type of the task, useful for filtering a task list.
Type *string `json:"type,omitempty" yaml:"type,omitempty"` Type *string `json:"type,omitempty" yaml:"type,omitempty"`
// The ID of the organization that owns this Task. // ID of the organization that owns the task.
OrgID string `json:"orgID" yaml:"orgID"` OrgID string `json:"orgID" yaml:"orgID"`
// The name of the organization that owns this Task. // Name of the organization that owns the task.
Org *string `json:"org,omitempty" yaml:"org,omitempty"` Org *string `json:"org,omitempty" yaml:"org,omitempty"`
// The name of the task. // Name of the task.
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// The ID of the user who owns this Task. // ID of the user who owns this Task.
OwnerID *string `json:"ownerID,omitempty" yaml:"ownerID,omitempty"` OwnerID *string `json:"ownerID,omitempty" yaml:"ownerID,omitempty"`
// An optional description of the task. // Description of the task.
Description *string `json:"description,omitempty" yaml:"description,omitempty"` Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"` Status *TaskStatusType `json:"status,omitempty" yaml:"status,omitempty"`
Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"` Labels *[]Label `json:"labels,omitempty" yaml:"labels,omitempty"`
// The ID of the authorization used when this task communicates with the query engine. // ID of the authorization used when the task communicates with the query engine.
AuthorizationID *string `json:"authorizationID,omitempty" yaml:"authorizationID,omitempty"` AuthorizationID *string `json:"authorizationID,omitempty" yaml:"authorizationID,omitempty"`
// The Flux script to run for this task. // Flux script to run for this task.
Flux string `json:"flux" yaml:"flux"` Flux string `json:"flux" yaml:"flux"`
// A simple task repetition schedule; parsed from Flux. // Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)).
Every *string `json:"every,omitempty" yaml:"every,omitempty"` Every *string `json:"every,omitempty" yaml:"every,omitempty"`
// A task repetition schedule in the form '* * * * * *'; parsed from Flux. // [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview).
Cron *string `json:"cron,omitempty" yaml:"cron,omitempty"` Cron *string `json:"cron,omitempty" yaml:"cron,omitempty"`
// Duration to delay after the schedule, before executing the task; parsed from flux, if set to zero it will remove this option and use 0 as the default. // [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals).
Offset *string `json:"offset,omitempty" yaml:"offset,omitempty"` Offset *string `json:"offset,omitempty" yaml:"offset,omitempty"`
// Timestamp of latest scheduled, completed run, RFC3339. // Timestamp of the latest scheduled and completed run. Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax).
LatestCompleted *time.Time `json:"latestCompleted,omitempty" yaml:"latestCompleted,omitempty"` LatestCompleted *time.Time `json:"latestCompleted,omitempty" yaml:"latestCompleted,omitempty"`
LastRunStatus *string `json:"lastRunStatus,omitempty" yaml:"lastRunStatus,omitempty"` LastRunStatus *string `json:"lastRunStatus,omitempty" yaml:"lastRunStatus,omitempty"`
LastRunError *string `json:"lastRunError,omitempty" yaml:"lastRunError,omitempty"` LastRunError *string `json:"lastRunError,omitempty" yaml:"lastRunError,omitempty"`

View File

@ -66,7 +66,7 @@ func (cfgs Configs) switchActive(name string) error {
if _, ok := cfgs[name]; !ok { if _, ok := cfgs[name]; !ok {
return &api.Error{ return &api.Error{
Code: api.ERRORCODE_NOT_FOUND, Code: api.ERRORCODE_NOT_FOUND,
Message: fmt.Sprintf("config %q is not found", name), Message: api.PtrString(fmt.Sprintf("config %q is not found", name)),
} }
} }
for k, v := range cfgs { for k, v := range cfgs {

View File

@ -35,7 +35,7 @@ func (svc localConfigsSVC) CreateConfig(cfg Config) (Config, error) {
if cfg.Name == "" { if cfg.Name == "" {
return Config{}, &api.Error{ return Config{}, &api.Error{
Code: api.ERRORCODE_INVALID, Code: api.ERRORCODE_INVALID,
Message: "config name is empty", Message: api.PtrString("config name is empty"),
} }
} }
cfgs, err := svc.ListConfigs() cfgs, err := svc.ListConfigs()
@ -45,7 +45,7 @@ func (svc localConfigsSVC) CreateConfig(cfg Config) (Config, error) {
if _, ok := cfgs[cfg.Name]; ok { if _, ok := cfgs[cfg.Name]; ok {
return Config{}, &api.Error{ return Config{}, &api.Error{
Code: api.ERRORCODE_CONFLICT, Code: api.ERRORCODE_CONFLICT,
Message: fmt.Sprintf("config %q already exists", cfg.Name), Message: api.PtrString(fmt.Sprintf("config %q already exists", cfg.Name)),
} }
} }
cfgs[cfg.Name] = cfg cfgs[cfg.Name] = cfg
@ -69,7 +69,7 @@ func (svc localConfigsSVC) DeleteConfig(name string) (Config, error) {
if !ok { if !ok {
return Config{}, &api.Error{ return Config{}, &api.Error{
Code: api.ERRORCODE_NOT_FOUND, Code: api.ERRORCODE_NOT_FOUND,
Message: fmt.Sprintf("config %q is not found", name), Message: api.PtrString(fmt.Sprintf("config %q is not found", name)),
} }
} }
delete(cfgs, name) delete(cfgs, name)
@ -119,7 +119,7 @@ func (svc localConfigsSVC) UpdateConfig(up Config) (Config, error) {
if !ok { if !ok {
return Config{}, &api.Error{ return Config{}, &api.Error{
Code: api.ERRORCODE_NOT_FOUND, Code: api.ERRORCODE_NOT_FOUND,
Message: fmt.Sprintf("config %q is not found", up.Name), Message: api.PtrString(fmt.Sprintf("config %q is not found", up.Name)),
} }
} }
if up.Token != "" { if up.Token != "" {
@ -209,7 +209,7 @@ func blockBadName(cfgs Configs) error {
if _, ok := badNames[n]; ok { if _, ok := badNames[n]; ok {
return &api.Error{ return &api.Error{
Code: api.ERRORCODE_INVALID, Code: api.ERRORCODE_INVALID,
Message: fmt.Sprintf("%q is not a valid config name", n), Message: api.PtrString(fmt.Sprintf("%q is not a valid config name", n)),
} }
} }
} }
@ -238,7 +238,7 @@ func (s baseRW) parseActiveConfig(currentOrPrevious bool) (Config, error) {
} else if check { } else if check {
return DefaultConfig, &api.Error{ return DefaultConfig, &api.Error{
Code: api.ERRORCODE_CONFLICT, Code: api.ERRORCODE_CONFLICT,
Message: fmt.Sprintf("more than one %s activated configs found", previousText), Message: api.PtrString(fmt.Sprintf("more than one %s activated configs found", previousText)),
} }
} }
} }
@ -247,7 +247,7 @@ func (s baseRW) parseActiveConfig(currentOrPrevious bool) (Config, error) {
} }
return DefaultConfig, &api.Error{ return DefaultConfig, &api.Error{
Code: api.ERRORCODE_NOT_FOUND, Code: api.ERRORCODE_NOT_FOUND,
Message: fmt.Sprintf("%s activated config is not found", previousText), Message: api.PtrString(fmt.Sprintf("%s activated config is not found", previousText)),
} }
} }