feat: reimplement influx dashboards with new APIs (#122)

Fixes #108
This commit is contained in:
Dane Strandboge 2021-06-15 16:22:09 -05:00 committed by GitHub
parent 6757c2bcfa
commit 51b1eadb12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 2325 additions and 0 deletions

279
api/api_dashboards.gen.go Normal file
View File

@ -0,0 +1,279 @@
/*
* 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 (
_context "context"
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
"reflect"
)
// Linger please
var (
_ _context.Context
)
type DashboardsApi interface {
/*
* GetDashboards List all dashboards
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetDashboardsRequest
*/
GetDashboards(ctx _context.Context) ApiGetDashboardsRequest
/*
* GetDashboardsExecute executes the request
* @return Dashboards
*/
GetDashboardsExecute(r ApiGetDashboardsRequest) (Dashboards, error)
}
// DashboardsApiService DashboardsApi service
type DashboardsApiService service
type ApiGetDashboardsRequest struct {
ctx _context.Context
ApiService DashboardsApi
zapTraceSpan *string
offset *int32
limit *int32
descending *bool
owner *string
sortBy *string
id *[]string
orgID *string
org *string
}
func (r ApiGetDashboardsRequest) ZapTraceSpan(zapTraceSpan string) ApiGetDashboardsRequest {
r.zapTraceSpan = &zapTraceSpan
return r
}
func (r ApiGetDashboardsRequest) GetZapTraceSpan() *string {
return r.zapTraceSpan
}
func (r ApiGetDashboardsRequest) Offset(offset int32) ApiGetDashboardsRequest {
r.offset = &offset
return r
}
func (r ApiGetDashboardsRequest) GetOffset() *int32 {
return r.offset
}
func (r ApiGetDashboardsRequest) Limit(limit int32) ApiGetDashboardsRequest {
r.limit = &limit
return r
}
func (r ApiGetDashboardsRequest) GetLimit() *int32 {
return r.limit
}
func (r ApiGetDashboardsRequest) Descending(descending bool) ApiGetDashboardsRequest {
r.descending = &descending
return r
}
func (r ApiGetDashboardsRequest) GetDescending() *bool {
return r.descending
}
func (r ApiGetDashboardsRequest) Owner(owner string) ApiGetDashboardsRequest {
r.owner = &owner
return r
}
func (r ApiGetDashboardsRequest) GetOwner() *string {
return r.owner
}
func (r ApiGetDashboardsRequest) SortBy(sortBy string) ApiGetDashboardsRequest {
r.sortBy = &sortBy
return r
}
func (r ApiGetDashboardsRequest) GetSortBy() *string {
return r.sortBy
}
func (r ApiGetDashboardsRequest) Id(id []string) ApiGetDashboardsRequest {
r.id = &id
return r
}
func (r ApiGetDashboardsRequest) GetId() *[]string {
return r.id
}
func (r ApiGetDashboardsRequest) OrgID(orgID string) ApiGetDashboardsRequest {
r.orgID = &orgID
return r
}
func (r ApiGetDashboardsRequest) GetOrgID() *string {
return r.orgID
}
func (r ApiGetDashboardsRequest) Org(org string) ApiGetDashboardsRequest {
r.org = &org
return r
}
func (r ApiGetDashboardsRequest) GetOrg() *string {
return r.org
}
func (r ApiGetDashboardsRequest) Execute() (Dashboards, error) {
return r.ApiService.GetDashboardsExecute(r)
}
/*
* GetDashboards List all dashboards
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiGetDashboardsRequest
*/
func (a *DashboardsApiService) GetDashboards(ctx _context.Context) ApiGetDashboardsRequest {
return ApiGetDashboardsRequest{
ApiService: a,
ctx: ctx,
}
}
/*
* Execute executes the request
* @return Dashboards
*/
func (a *DashboardsApiService) GetDashboardsExecute(r ApiGetDashboardsRequest) (Dashboards, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Dashboards
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DashboardsApiService.GetDashboards")
if err != nil {
return localVarReturnValue, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/dashboards"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.offset != nil {
localVarQueryParams.Add("offset", parameterToString(*r.offset, ""))
}
if r.limit != nil {
localVarQueryParams.Add("limit", parameterToString(*r.limit, ""))
}
if r.descending != nil {
localVarQueryParams.Add("descending", parameterToString(*r.descending, ""))
}
if r.owner != nil {
localVarQueryParams.Add("owner", parameterToString(*r.owner, ""))
}
if r.sortBy != nil {
localVarQueryParams.Add("sortBy", parameterToString(*r.sortBy, ""))
}
if r.id != nil {
t := *r.id
if reflect.TypeOf(t).Kind() == reflect.Slice {
s := reflect.ValueOf(t)
for i := 0; i < s.Len(); i++ {
localVarQueryParams.Add("id", parameterToString(s.Index(i), "multi"))
}
} else {
localVarQueryParams.Add("id", parameterToString(t, "multi"))
}
}
if r.orgID != nil {
localVarQueryParams.Add("orgID", parameterToString(*r.orgID, ""))
}
if r.org != nil {
localVarQueryParams.Add("org", parameterToString(*r.org, ""))
}
// 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
}
if r.zapTraceSpan != nil {
localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, err
}
if localVarHTTPResponse.StatusCode >= 300 {
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
return localVarReturnValue, err
}
localVarBody, err := _ioutil.ReadAll(body)
body.Close()
if err != nil {
return localVarReturnValue, err
}
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, newErr
}
newErr.model = &v
return localVarReturnValue, newErr
}
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
return localVarReturnValue, err
}
localVarBody, err := _ioutil.ReadAll(body)
body.Close()
if err != nil {
return localVarReturnValue, err
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, newErr
}
return localVarReturnValue, nil
}

View File

@ -53,6 +53,8 @@ type APIClient struct {
BucketsApi BucketsApi
DashboardsApi DashboardsApi
DeleteApi DeleteApi
HealthApi HealthApi
@ -93,6 +95,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
c.BackupApi = (*BackupApiService)(&c.common)
c.BucketSchemasApi = (*BucketSchemasApiService)(&c.common)
c.BucketsApi = (*BucketsApiService)(&c.common)
c.DashboardsApi = (*DashboardsApiService)(&c.common)
c.DeleteApi = (*DeleteApiService)(&c.common)
c.HealthApi = (*HealthApiService)(&c.common)
c.OrganizationsApi = (*OrganizationsApiService)(&c.common)

View File

@ -69,6 +69,8 @@ paths:
$ref: "./openapi/src/common/paths/telegrafs.yml"
"/telegrafs/{telegrafID}":
$ref: "./overrides/paths/telegrafs_telegrafID.yml"
/dashboards:
$ref: "./overrides/paths/dashboards.yml"
components:
parameters:
TraceSpan:
@ -241,3 +243,13 @@ components:
$ref: "./openapi/src/common/schemas/TelegrafRequest.yml"
Telegraf:
$ref: "./openapi/src/common/schemas/Telegraf.yml"
Dashboards:
$ref: "./openapi/src/common/schemas/Dashboards.yml"
Dashboard:
$ref: "./openapi/src/common/schemas/Dashboard.yml"
CreateDashboardRequest:
$ref: "./openapi/src/common/schemas/CreateDashboardRequest.yml"
Cells:
$ref: "./openapi/src/common/schemas/Cells.yml"
Cell:
$ref: "./openapi/src/common/schemas/Cell.yml"

View File

@ -0,0 +1,57 @@
get:
operationId: GetDashboards
tags:
- Dashboards
summary: List all dashboards
parameters:
- $ref: "../../openapi/src/common/parameters/TraceSpan.yml"
- $ref: "../../openapi/src/common/parameters/Offset.yml"
- $ref: "../../openapi/src/common/parameters/Limit.yml"
- $ref: "../../openapi/src/common/parameters/Descending.yml"
- in: query
name: owner
description: A user identifier. Returns only dashboards where this user has the `owner` role.
schema:
type: string
- in: query
name: sortBy
description: The column to sort by.
schema:
type: string
enum:
- "ID"
- "CreatedAt"
- "UpdatedAt"
- in: query
name: id
description: A list of dashboard identifiers. Returns only the listed dashboards. If both `id` and `owner` are specified, only `id` is used.
schema:
type: array
items:
type: string
- in: query
name: orgID
description: The identifier of the organization.
schema:
type: string
- in: query
name: org
description: The name of the organization.
schema:
type: string
responses:
"200":
description: All dashboards
content:
application/json:
schema:
$ref: "../../openapi/src/common/schemas/Dashboards.yml"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../../openapi/src/common/schemas/Error.yml"
# Cuts out the post section since it is not needed
# for CLI and adds a large amount of extra code-gen.

330
api/model_cell.gen.go Normal file
View File

@ -0,0 +1,330 @@
/*
* 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"
)
// Cell struct for Cell
type Cell struct {
Id *string `json:"id,omitempty"`
Links *CellLinks `json:"links,omitempty"`
X *int32 `json:"x,omitempty"`
Y *int32 `json:"y,omitempty"`
W *int32 `json:"w,omitempty"`
H *int32 `json:"h,omitempty"`
// The reference to a view from the views API.
ViewID *string `json:"viewID,omitempty"`
}
// NewCell instantiates a new Cell 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 NewCell() *Cell {
this := Cell{}
return &this
}
// NewCellWithDefaults instantiates a new Cell 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 NewCellWithDefaults() *Cell {
this := Cell{}
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *Cell) GetId() string {
if o == nil || o.Id == nil {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetIdOk() (*string, bool) {
if o == nil || o.Id == nil {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *Cell) HasId() bool {
if o != nil && o.Id != nil {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *Cell) SetId(v string) {
o.Id = &v
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *Cell) GetLinks() CellLinks {
if o == nil || o.Links == nil {
var ret CellLinks
return ret
}
return *o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetLinksOk() (*CellLinks, bool) {
if o == nil || o.Links == nil {
return nil, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *Cell) HasLinks() bool {
if o != nil && o.Links != nil {
return true
}
return false
}
// SetLinks gets a reference to the given CellLinks and assigns it to the Links field.
func (o *Cell) SetLinks(v CellLinks) {
o.Links = &v
}
// GetX returns the X field value if set, zero value otherwise.
func (o *Cell) GetX() int32 {
if o == nil || o.X == nil {
var ret int32
return ret
}
return *o.X
}
// GetXOk returns a tuple with the X field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetXOk() (*int32, bool) {
if o == nil || o.X == nil {
return nil, false
}
return o.X, true
}
// HasX returns a boolean if a field has been set.
func (o *Cell) HasX() bool {
if o != nil && o.X != nil {
return true
}
return false
}
// SetX gets a reference to the given int32 and assigns it to the X field.
func (o *Cell) SetX(v int32) {
o.X = &v
}
// GetY returns the Y field value if set, zero value otherwise.
func (o *Cell) GetY() int32 {
if o == nil || o.Y == nil {
var ret int32
return ret
}
return *o.Y
}
// GetYOk returns a tuple with the Y field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetYOk() (*int32, bool) {
if o == nil || o.Y == nil {
return nil, false
}
return o.Y, true
}
// HasY returns a boolean if a field has been set.
func (o *Cell) HasY() bool {
if o != nil && o.Y != nil {
return true
}
return false
}
// SetY gets a reference to the given int32 and assigns it to the Y field.
func (o *Cell) SetY(v int32) {
o.Y = &v
}
// GetW returns the W field value if set, zero value otherwise.
func (o *Cell) GetW() int32 {
if o == nil || o.W == nil {
var ret int32
return ret
}
return *o.W
}
// GetWOk returns a tuple with the W field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetWOk() (*int32, bool) {
if o == nil || o.W == nil {
return nil, false
}
return o.W, true
}
// HasW returns a boolean if a field has been set.
func (o *Cell) HasW() bool {
if o != nil && o.W != nil {
return true
}
return false
}
// SetW gets a reference to the given int32 and assigns it to the W field.
func (o *Cell) SetW(v int32) {
o.W = &v
}
// GetH returns the H field value if set, zero value otherwise.
func (o *Cell) GetH() int32 {
if o == nil || o.H == nil {
var ret int32
return ret
}
return *o.H
}
// GetHOk returns a tuple with the H field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetHOk() (*int32, bool) {
if o == nil || o.H == nil {
return nil, false
}
return o.H, true
}
// HasH returns a boolean if a field has been set.
func (o *Cell) HasH() bool {
if o != nil && o.H != nil {
return true
}
return false
}
// SetH gets a reference to the given int32 and assigns it to the H field.
func (o *Cell) SetH(v int32) {
o.H = &v
}
// GetViewID returns the ViewID field value if set, zero value otherwise.
func (o *Cell) GetViewID() string {
if o == nil || o.ViewID == nil {
var ret string
return ret
}
return *o.ViewID
}
// GetViewIDOk returns a tuple with the ViewID field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Cell) GetViewIDOk() (*string, bool) {
if o == nil || o.ViewID == nil {
return nil, false
}
return o.ViewID, true
}
// HasViewID returns a boolean if a field has been set.
func (o *Cell) HasViewID() bool {
if o != nil && o.ViewID != nil {
return true
}
return false
}
// SetViewID gets a reference to the given string and assigns it to the ViewID field.
func (o *Cell) SetViewID(v string) {
o.ViewID = &v
}
func (o Cell) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if o.Links != nil {
toSerialize["links"] = o.Links
}
if o.X != nil {
toSerialize["x"] = o.X
}
if o.Y != nil {
toSerialize["y"] = o.Y
}
if o.W != nil {
toSerialize["w"] = o.W
}
if o.H != nil {
toSerialize["h"] = o.H
}
if o.ViewID != nil {
toSerialize["viewID"] = o.ViewID
}
return json.Marshal(toSerialize)
}
type NullableCell struct {
value *Cell
isSet bool
}
func (v NullableCell) Get() *Cell {
return v.value
}
func (v *NullableCell) Set(val *Cell) {
v.value = val
v.isSet = true
}
func (v NullableCell) IsSet() bool {
return v.isSet
}
func (v *NullableCell) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCell(val *Cell) *NullableCell {
return &NullableCell{value: val, isSet: true}
}
func (v NullableCell) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCell) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

149
api/model_cell_links.gen.go Normal file
View File

@ -0,0 +1,149 @@
/*
* 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"
)
// CellLinks struct for CellLinks
type CellLinks struct {
Self *string `json:"self,omitempty"`
View *string `json:"view,omitempty"`
}
// NewCellLinks instantiates a new CellLinks 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 NewCellLinks() *CellLinks {
this := CellLinks{}
return &this
}
// NewCellLinksWithDefaults instantiates a new CellLinks 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 NewCellLinksWithDefaults() *CellLinks {
this := CellLinks{}
return &this
}
// GetSelf returns the Self field value if set, zero value otherwise.
func (o *CellLinks) GetSelf() string {
if o == nil || o.Self == nil {
var ret string
return ret
}
return *o.Self
}
// GetSelfOk returns a tuple with the Self field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CellLinks) GetSelfOk() (*string, bool) {
if o == nil || o.Self == nil {
return nil, false
}
return o.Self, true
}
// HasSelf returns a boolean if a field has been set.
func (o *CellLinks) HasSelf() bool {
if o != nil && o.Self != nil {
return true
}
return false
}
// SetSelf gets a reference to the given string and assigns it to the Self field.
func (o *CellLinks) SetSelf(v string) {
o.Self = &v
}
// GetView returns the View field value if set, zero value otherwise.
func (o *CellLinks) GetView() string {
if o == nil || o.View == nil {
var ret string
return ret
}
return *o.View
}
// GetViewOk returns a tuple with the View field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CellLinks) GetViewOk() (*string, bool) {
if o == nil || o.View == nil {
return nil, false
}
return o.View, true
}
// HasView returns a boolean if a field has been set.
func (o *CellLinks) HasView() bool {
if o != nil && o.View != nil {
return true
}
return false
}
// SetView gets a reference to the given string and assigns it to the View field.
func (o *CellLinks) SetView(v string) {
o.View = &v
}
func (o CellLinks) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Self != nil {
toSerialize["self"] = o.Self
}
if o.View != nil {
toSerialize["view"] = o.View
}
return json.Marshal(toSerialize)
}
type NullableCellLinks struct {
value *CellLinks
isSet bool
}
func (v NullableCellLinks) Get() *CellLinks {
return v.value
}
func (v *NullableCellLinks) Set(val *CellLinks) {
v.value = val
v.isSet = true
}
func (v NullableCellLinks) IsSet() bool {
return v.isSet
}
func (v *NullableCellLinks) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCellLinks(val *CellLinks) *NullableCellLinks {
return &NullableCellLinks{value: val, isSet: true}
}
func (v NullableCellLinks) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCellLinks) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,174 @@
/*
* 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"
)
// CreateDashboardRequest struct for CreateDashboardRequest
type CreateDashboardRequest struct {
// The ID of the organization that owns the dashboard.
OrgID string `json:"orgID"`
// The user-facing name of the dashboard.
Name string `json:"name"`
// The user-facing description of the dashboard.
Description *string `json:"description,omitempty"`
}
// NewCreateDashboardRequest instantiates a new CreateDashboardRequest 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 NewCreateDashboardRequest(orgID string, name string) *CreateDashboardRequest {
this := CreateDashboardRequest{}
this.OrgID = orgID
this.Name = name
return &this
}
// NewCreateDashboardRequestWithDefaults instantiates a new CreateDashboardRequest 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 NewCreateDashboardRequestWithDefaults() *CreateDashboardRequest {
this := CreateDashboardRequest{}
return &this
}
// GetOrgID returns the OrgID field value
func (o *CreateDashboardRequest) GetOrgID() string {
if o == nil {
var ret string
return ret
}
return o.OrgID
}
// GetOrgIDOk returns a tuple with the OrgID field value
// and a boolean to check if the value has been set.
func (o *CreateDashboardRequest) GetOrgIDOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.OrgID, true
}
// SetOrgID sets field value
func (o *CreateDashboardRequest) SetOrgID(v string) {
o.OrgID = v
}
// GetName returns the Name field value
func (o *CreateDashboardRequest) 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 *CreateDashboardRequest) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *CreateDashboardRequest) SetName(v string) {
o.Name = v
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *CreateDashboardRequest) GetDescription() string {
if o == nil || o.Description == nil {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateDashboardRequest) GetDescriptionOk() (*string, bool) {
if o == nil || o.Description == nil {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *CreateDashboardRequest) HasDescription() bool {
if o != nil && o.Description != nil {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *CreateDashboardRequest) SetDescription(v string) {
o.Description = &v
}
func (o CreateDashboardRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["orgID"] = o.OrgID
}
if true {
toSerialize["name"] = o.Name
}
if o.Description != nil {
toSerialize["description"] = o.Description
}
return json.Marshal(toSerialize)
}
type NullableCreateDashboardRequest struct {
value *CreateDashboardRequest
isSet bool
}
func (v NullableCreateDashboardRequest) Get() *CreateDashboardRequest {
return v.value
}
func (v *NullableCreateDashboardRequest) Set(val *CreateDashboardRequest) {
v.value = val
v.isSet = true
}
func (v NullableCreateDashboardRequest) IsSet() bool {
return v.isSet
}
func (v *NullableCreateDashboardRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateDashboardRequest(val *CreateDashboardRequest) *NullableCreateDashboardRequest {
return &NullableCreateDashboardRequest{value: val, isSet: true}
}
func (v NullableCreateDashboardRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateDashboardRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

354
api/model_dashboard.gen.go Normal file
View File

@ -0,0 +1,354 @@
/*
* 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"
)
// Dashboard struct for Dashboard
type Dashboard struct {
// The ID of the organization that owns the dashboard.
OrgID string `json:"orgID"`
// The user-facing name of the dashboard.
Name string `json:"name"`
// The user-facing description of the dashboard.
Description *string `json:"description,omitempty"`
Links *DashboardAllOfLinks `json:"links,omitempty"`
Id *string `json:"id,omitempty"`
Meta *DashboardAllOfMeta `json:"meta,omitempty"`
Cells *[]Cell `json:"cells,omitempty"`
Labels *[]Label `json:"labels,omitempty"`
}
// NewDashboard instantiates a new Dashboard 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 NewDashboard(orgID string, name string) *Dashboard {
this := Dashboard{}
this.OrgID = orgID
this.Name = name
return &this
}
// NewDashboardWithDefaults instantiates a new Dashboard 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 NewDashboardWithDefaults() *Dashboard {
this := Dashboard{}
return &this
}
// GetOrgID returns the OrgID field value
func (o *Dashboard) GetOrgID() string {
if o == nil {
var ret string
return ret
}
return o.OrgID
}
// GetOrgIDOk returns a tuple with the OrgID field value
// and a boolean to check if the value has been set.
func (o *Dashboard) GetOrgIDOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.OrgID, true
}
// SetOrgID sets field value
func (o *Dashboard) SetOrgID(v string) {
o.OrgID = v
}
// GetName returns the Name field value
func (o *Dashboard) 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 *Dashboard) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *Dashboard) SetName(v string) {
o.Name = v
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *Dashboard) GetDescription() string {
if o == nil || o.Description == nil {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetDescriptionOk() (*string, bool) {
if o == nil || o.Description == nil {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *Dashboard) HasDescription() bool {
if o != nil && o.Description != nil {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *Dashboard) SetDescription(v string) {
o.Description = &v
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *Dashboard) GetLinks() DashboardAllOfLinks {
if o == nil || o.Links == nil {
var ret DashboardAllOfLinks
return ret
}
return *o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetLinksOk() (*DashboardAllOfLinks, bool) {
if o == nil || o.Links == nil {
return nil, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *Dashboard) HasLinks() bool {
if o != nil && o.Links != nil {
return true
}
return false
}
// SetLinks gets a reference to the given DashboardAllOfLinks and assigns it to the Links field.
func (o *Dashboard) SetLinks(v DashboardAllOfLinks) {
o.Links = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *Dashboard) GetId() string {
if o == nil || o.Id == nil {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetIdOk() (*string, bool) {
if o == nil || o.Id == nil {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *Dashboard) HasId() bool {
if o != nil && o.Id != nil {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *Dashboard) SetId(v string) {
o.Id = &v
}
// GetMeta returns the Meta field value if set, zero value otherwise.
func (o *Dashboard) GetMeta() DashboardAllOfMeta {
if o == nil || o.Meta == nil {
var ret DashboardAllOfMeta
return ret
}
return *o.Meta
}
// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetMetaOk() (*DashboardAllOfMeta, bool) {
if o == nil || o.Meta == nil {
return nil, false
}
return o.Meta, true
}
// HasMeta returns a boolean if a field has been set.
func (o *Dashboard) HasMeta() bool {
if o != nil && o.Meta != nil {
return true
}
return false
}
// SetMeta gets a reference to the given DashboardAllOfMeta and assigns it to the Meta field.
func (o *Dashboard) SetMeta(v DashboardAllOfMeta) {
o.Meta = &v
}
// GetCells returns the Cells field value if set, zero value otherwise.
func (o *Dashboard) GetCells() []Cell {
if o == nil || o.Cells == nil {
var ret []Cell
return ret
}
return *o.Cells
}
// GetCellsOk returns a tuple with the Cells field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetCellsOk() (*[]Cell, bool) {
if o == nil || o.Cells == nil {
return nil, false
}
return o.Cells, true
}
// HasCells returns a boolean if a field has been set.
func (o *Dashboard) HasCells() bool {
if o != nil && o.Cells != nil {
return true
}
return false
}
// SetCells gets a reference to the given []Cell and assigns it to the Cells field.
func (o *Dashboard) SetCells(v []Cell) {
o.Cells = &v
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *Dashboard) GetLabels() []Label {
if o == nil || o.Labels == nil {
var ret []Label
return ret
}
return *o.Labels
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboard) GetLabelsOk() (*[]Label, bool) {
if o == nil || o.Labels == nil {
return nil, false
}
return o.Labels, true
}
// HasLabels returns a boolean if a field has been set.
func (o *Dashboard) HasLabels() bool {
if o != nil && o.Labels != nil {
return true
}
return false
}
// SetLabels gets a reference to the given []Label and assigns it to the Labels field.
func (o *Dashboard) SetLabels(v []Label) {
o.Labels = &v
}
func (o Dashboard) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["orgID"] = o.OrgID
}
if true {
toSerialize["name"] = o.Name
}
if o.Description != nil {
toSerialize["description"] = o.Description
}
if o.Links != nil {
toSerialize["links"] = o.Links
}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if o.Meta != nil {
toSerialize["meta"] = o.Meta
}
if o.Cells != nil {
toSerialize["cells"] = o.Cells
}
if o.Labels != nil {
toSerialize["labels"] = o.Labels
}
return json.Marshal(toSerialize)
}
type NullableDashboard struct {
value *Dashboard
isSet bool
}
func (v NullableDashboard) Get() *Dashboard {
return v.value
}
func (v *NullableDashboard) Set(val *Dashboard) {
v.value = val
v.isSet = true
}
func (v NullableDashboard) IsSet() bool {
return v.isSet
}
func (v *NullableDashboard) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDashboard(val *Dashboard) *NullableDashboard {
return &NullableDashboard{value: val, isSet: true}
}
func (v NullableDashboard) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDashboard) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,257 @@
/*
* 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"
)
// DashboardAllOf struct for DashboardAllOf
type DashboardAllOf struct {
Links *DashboardAllOfLinks `json:"links,omitempty"`
Id *string `json:"id,omitempty"`
Meta *DashboardAllOfMeta `json:"meta,omitempty"`
Cells *[]Cell `json:"cells,omitempty"`
Labels *[]Label `json:"labels,omitempty"`
}
// NewDashboardAllOf instantiates a new DashboardAllOf 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 NewDashboardAllOf() *DashboardAllOf {
this := DashboardAllOf{}
return &this
}
// NewDashboardAllOfWithDefaults instantiates a new DashboardAllOf 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 NewDashboardAllOfWithDefaults() *DashboardAllOf {
this := DashboardAllOf{}
return &this
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *DashboardAllOf) GetLinks() DashboardAllOfLinks {
if o == nil || o.Links == nil {
var ret DashboardAllOfLinks
return ret
}
return *o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOf) GetLinksOk() (*DashboardAllOfLinks, bool) {
if o == nil || o.Links == nil {
return nil, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *DashboardAllOf) HasLinks() bool {
if o != nil && o.Links != nil {
return true
}
return false
}
// SetLinks gets a reference to the given DashboardAllOfLinks and assigns it to the Links field.
func (o *DashboardAllOf) SetLinks(v DashboardAllOfLinks) {
o.Links = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *DashboardAllOf) GetId() string {
if o == nil || o.Id == nil {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOf) GetIdOk() (*string, bool) {
if o == nil || o.Id == nil {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *DashboardAllOf) HasId() bool {
if o != nil && o.Id != nil {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *DashboardAllOf) SetId(v string) {
o.Id = &v
}
// GetMeta returns the Meta field value if set, zero value otherwise.
func (o *DashboardAllOf) GetMeta() DashboardAllOfMeta {
if o == nil || o.Meta == nil {
var ret DashboardAllOfMeta
return ret
}
return *o.Meta
}
// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOf) GetMetaOk() (*DashboardAllOfMeta, bool) {
if o == nil || o.Meta == nil {
return nil, false
}
return o.Meta, true
}
// HasMeta returns a boolean if a field has been set.
func (o *DashboardAllOf) HasMeta() bool {
if o != nil && o.Meta != nil {
return true
}
return false
}
// SetMeta gets a reference to the given DashboardAllOfMeta and assigns it to the Meta field.
func (o *DashboardAllOf) SetMeta(v DashboardAllOfMeta) {
o.Meta = &v
}
// GetCells returns the Cells field value if set, zero value otherwise.
func (o *DashboardAllOf) GetCells() []Cell {
if o == nil || o.Cells == nil {
var ret []Cell
return ret
}
return *o.Cells
}
// GetCellsOk returns a tuple with the Cells field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOf) GetCellsOk() (*[]Cell, bool) {
if o == nil || o.Cells == nil {
return nil, false
}
return o.Cells, true
}
// HasCells returns a boolean if a field has been set.
func (o *DashboardAllOf) HasCells() bool {
if o != nil && o.Cells != nil {
return true
}
return false
}
// SetCells gets a reference to the given []Cell and assigns it to the Cells field.
func (o *DashboardAllOf) SetCells(v []Cell) {
o.Cells = &v
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *DashboardAllOf) GetLabels() []Label {
if o == nil || o.Labels == nil {
var ret []Label
return ret
}
return *o.Labels
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOf) GetLabelsOk() (*[]Label, bool) {
if o == nil || o.Labels == nil {
return nil, false
}
return o.Labels, true
}
// HasLabels returns a boolean if a field has been set.
func (o *DashboardAllOf) HasLabels() bool {
if o != nil && o.Labels != nil {
return true
}
return false
}
// SetLabels gets a reference to the given []Label and assigns it to the Labels field.
func (o *DashboardAllOf) SetLabels(v []Label) {
o.Labels = &v
}
func (o DashboardAllOf) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Links != nil {
toSerialize["links"] = o.Links
}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if o.Meta != nil {
toSerialize["meta"] = o.Meta
}
if o.Cells != nil {
toSerialize["cells"] = o.Cells
}
if o.Labels != nil {
toSerialize["labels"] = o.Labels
}
return json.Marshal(toSerialize)
}
type NullableDashboardAllOf struct {
value *DashboardAllOf
isSet bool
}
func (v NullableDashboardAllOf) Get() *DashboardAllOf {
return v.value
}
func (v *NullableDashboardAllOf) Set(val *DashboardAllOf) {
v.value = val
v.isSet = true
}
func (v NullableDashboardAllOf) IsSet() bool {
return v.isSet
}
func (v *NullableDashboardAllOf) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDashboardAllOf(val *DashboardAllOf) *NullableDashboardAllOf {
return &NullableDashboardAllOf{value: val, isSet: true}
}
func (v NullableDashboardAllOf) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDashboardAllOf) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,299 @@
/*
* 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"
)
// DashboardAllOfLinks struct for DashboardAllOfLinks
type DashboardAllOfLinks struct {
// URI of resource.
Self *string `json:"self,omitempty"`
// URI of resource.
Cells *string `json:"cells,omitempty"`
// URI of resource.
Members *string `json:"members,omitempty"`
// URI of resource.
Owners *string `json:"owners,omitempty"`
// URI of resource.
Labels *string `json:"labels,omitempty"`
// URI of resource.
Org *string `json:"org,omitempty"`
}
// NewDashboardAllOfLinks instantiates a new DashboardAllOfLinks 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 NewDashboardAllOfLinks() *DashboardAllOfLinks {
this := DashboardAllOfLinks{}
return &this
}
// NewDashboardAllOfLinksWithDefaults instantiates a new DashboardAllOfLinks 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 NewDashboardAllOfLinksWithDefaults() *DashboardAllOfLinks {
this := DashboardAllOfLinks{}
return &this
}
// GetSelf returns the Self field value if set, zero value otherwise.
func (o *DashboardAllOfLinks) GetSelf() string {
if o == nil || o.Self == nil {
var ret string
return ret
}
return *o.Self
}
// GetSelfOk returns a tuple with the Self field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfLinks) GetSelfOk() (*string, bool) {
if o == nil || o.Self == nil {
return nil, false
}
return o.Self, true
}
// HasSelf returns a boolean if a field has been set.
func (o *DashboardAllOfLinks) HasSelf() bool {
if o != nil && o.Self != nil {
return true
}
return false
}
// SetSelf gets a reference to the given string and assigns it to the Self field.
func (o *DashboardAllOfLinks) SetSelf(v string) {
o.Self = &v
}
// GetCells returns the Cells field value if set, zero value otherwise.
func (o *DashboardAllOfLinks) GetCells() string {
if o == nil || o.Cells == nil {
var ret string
return ret
}
return *o.Cells
}
// GetCellsOk returns a tuple with the Cells field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfLinks) GetCellsOk() (*string, bool) {
if o == nil || o.Cells == nil {
return nil, false
}
return o.Cells, true
}
// HasCells returns a boolean if a field has been set.
func (o *DashboardAllOfLinks) HasCells() bool {
if o != nil && o.Cells != nil {
return true
}
return false
}
// SetCells gets a reference to the given string and assigns it to the Cells field.
func (o *DashboardAllOfLinks) SetCells(v string) {
o.Cells = &v
}
// GetMembers returns the Members field value if set, zero value otherwise.
func (o *DashboardAllOfLinks) GetMembers() string {
if o == nil || o.Members == nil {
var ret string
return ret
}
return *o.Members
}
// GetMembersOk returns a tuple with the Members field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfLinks) GetMembersOk() (*string, bool) {
if o == nil || o.Members == nil {
return nil, false
}
return o.Members, true
}
// HasMembers returns a boolean if a field has been set.
func (o *DashboardAllOfLinks) HasMembers() bool {
if o != nil && o.Members != nil {
return true
}
return false
}
// SetMembers gets a reference to the given string and assigns it to the Members field.
func (o *DashboardAllOfLinks) SetMembers(v string) {
o.Members = &v
}
// GetOwners returns the Owners field value if set, zero value otherwise.
func (o *DashboardAllOfLinks) GetOwners() string {
if o == nil || o.Owners == nil {
var ret string
return ret
}
return *o.Owners
}
// GetOwnersOk returns a tuple with the Owners field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfLinks) GetOwnersOk() (*string, bool) {
if o == nil || o.Owners == nil {
return nil, false
}
return o.Owners, true
}
// HasOwners returns a boolean if a field has been set.
func (o *DashboardAllOfLinks) HasOwners() bool {
if o != nil && o.Owners != nil {
return true
}
return false
}
// SetOwners gets a reference to the given string and assigns it to the Owners field.
func (o *DashboardAllOfLinks) SetOwners(v string) {
o.Owners = &v
}
// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *DashboardAllOfLinks) GetLabels() string {
if o == nil || o.Labels == nil {
var ret string
return ret
}
return *o.Labels
}
// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfLinks) GetLabelsOk() (*string, bool) {
if o == nil || o.Labels == nil {
return nil, false
}
return o.Labels, true
}
// HasLabels returns a boolean if a field has been set.
func (o *DashboardAllOfLinks) HasLabels() bool {
if o != nil && o.Labels != nil {
return true
}
return false
}
// SetLabels gets a reference to the given string and assigns it to the Labels field.
func (o *DashboardAllOfLinks) SetLabels(v string) {
o.Labels = &v
}
// GetOrg returns the Org field value if set, zero value otherwise.
func (o *DashboardAllOfLinks) GetOrg() string {
if o == nil || o.Org == nil {
var ret string
return ret
}
return *o.Org
}
// GetOrgOk returns a tuple with the Org field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfLinks) GetOrgOk() (*string, bool) {
if o == nil || o.Org == nil {
return nil, false
}
return o.Org, true
}
// HasOrg returns a boolean if a field has been set.
func (o *DashboardAllOfLinks) HasOrg() bool {
if o != nil && o.Org != nil {
return true
}
return false
}
// SetOrg gets a reference to the given string and assigns it to the Org field.
func (o *DashboardAllOfLinks) SetOrg(v string) {
o.Org = &v
}
func (o DashboardAllOfLinks) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Self != nil {
toSerialize["self"] = o.Self
}
if o.Cells != nil {
toSerialize["cells"] = o.Cells
}
if o.Members != nil {
toSerialize["members"] = o.Members
}
if o.Owners != nil {
toSerialize["owners"] = o.Owners
}
if o.Labels != nil {
toSerialize["labels"] = o.Labels
}
if o.Org != nil {
toSerialize["org"] = o.Org
}
return json.Marshal(toSerialize)
}
type NullableDashboardAllOfLinks struct {
value *DashboardAllOfLinks
isSet bool
}
func (v NullableDashboardAllOfLinks) Get() *DashboardAllOfLinks {
return v.value
}
func (v *NullableDashboardAllOfLinks) Set(val *DashboardAllOfLinks) {
v.value = val
v.isSet = true
}
func (v NullableDashboardAllOfLinks) IsSet() bool {
return v.isSet
}
func (v *NullableDashboardAllOfLinks) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDashboardAllOfLinks(val *DashboardAllOfLinks) *NullableDashboardAllOfLinks {
return &NullableDashboardAllOfLinks{value: val, isSet: true}
}
func (v NullableDashboardAllOfLinks) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDashboardAllOfLinks) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,150 @@
/*
* 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"
)
// DashboardAllOfMeta struct for DashboardAllOfMeta
type DashboardAllOfMeta struct {
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
}
// NewDashboardAllOfMeta instantiates a new DashboardAllOfMeta 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 NewDashboardAllOfMeta() *DashboardAllOfMeta {
this := DashboardAllOfMeta{}
return &this
}
// NewDashboardAllOfMetaWithDefaults instantiates a new DashboardAllOfMeta 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 NewDashboardAllOfMetaWithDefaults() *DashboardAllOfMeta {
this := DashboardAllOfMeta{}
return &this
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *DashboardAllOfMeta) GetCreatedAt() time.Time {
if o == nil || o.CreatedAt == nil {
var ret time.Time
return ret
}
return *o.CreatedAt
}
// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfMeta) GetCreatedAtOk() (*time.Time, bool) {
if o == nil || o.CreatedAt == nil {
return nil, false
}
return o.CreatedAt, true
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *DashboardAllOfMeta) HasCreatedAt() bool {
if o != nil && o.CreatedAt != nil {
return true
}
return false
}
// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *DashboardAllOfMeta) SetCreatedAt(v time.Time) {
o.CreatedAt = &v
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *DashboardAllOfMeta) GetUpdatedAt() time.Time {
if o == nil || o.UpdatedAt == nil {
var ret time.Time
return ret
}
return *o.UpdatedAt
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DashboardAllOfMeta) GetUpdatedAtOk() (*time.Time, bool) {
if o == nil || o.UpdatedAt == nil {
return nil, false
}
return o.UpdatedAt, true
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *DashboardAllOfMeta) HasUpdatedAt() bool {
if o != nil && o.UpdatedAt != nil {
return true
}
return false
}
// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *DashboardAllOfMeta) SetUpdatedAt(v time.Time) {
o.UpdatedAt = &v
}
func (o DashboardAllOfMeta) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.CreatedAt != nil {
toSerialize["createdAt"] = o.CreatedAt
}
if o.UpdatedAt != nil {
toSerialize["updatedAt"] = o.UpdatedAt
}
return json.Marshal(toSerialize)
}
type NullableDashboardAllOfMeta struct {
value *DashboardAllOfMeta
isSet bool
}
func (v NullableDashboardAllOfMeta) Get() *DashboardAllOfMeta {
return v.value
}
func (v *NullableDashboardAllOfMeta) Set(val *DashboardAllOfMeta) {
v.value = val
v.isSet = true
}
func (v NullableDashboardAllOfMeta) IsSet() bool {
return v.isSet
}
func (v *NullableDashboardAllOfMeta) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDashboardAllOfMeta(val *DashboardAllOfMeta) *NullableDashboardAllOfMeta {
return &NullableDashboardAllOfMeta{value: val, isSet: true}
}
func (v NullableDashboardAllOfMeta) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDashboardAllOfMeta) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

149
api/model_dashboards.gen.go Normal file
View File

@ -0,0 +1,149 @@
/*
* 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"
)
// Dashboards struct for Dashboards
type Dashboards struct {
Links *Links `json:"links,omitempty"`
Dashboards *[]Dashboard `json:"dashboards,omitempty"`
}
// NewDashboards instantiates a new Dashboards 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 NewDashboards() *Dashboards {
this := Dashboards{}
return &this
}
// NewDashboardsWithDefaults instantiates a new Dashboards 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 NewDashboardsWithDefaults() *Dashboards {
this := Dashboards{}
return &this
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *Dashboards) GetLinks() Links {
if o == nil || o.Links == nil {
var ret Links
return ret
}
return *o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboards) GetLinksOk() (*Links, bool) {
if o == nil || o.Links == nil {
return nil, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *Dashboards) HasLinks() bool {
if o != nil && o.Links != nil {
return true
}
return false
}
// SetLinks gets a reference to the given Links and assigns it to the Links field.
func (o *Dashboards) SetLinks(v Links) {
o.Links = &v
}
// GetDashboards returns the Dashboards field value if set, zero value otherwise.
func (o *Dashboards) GetDashboards() []Dashboard {
if o == nil || o.Dashboards == nil {
var ret []Dashboard
return ret
}
return *o.Dashboards
}
// GetDashboardsOk returns a tuple with the Dashboards field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Dashboards) GetDashboardsOk() (*[]Dashboard, bool) {
if o == nil || o.Dashboards == nil {
return nil, false
}
return o.Dashboards, true
}
// HasDashboards returns a boolean if a field has been set.
func (o *Dashboards) HasDashboards() bool {
if o != nil && o.Dashboards != nil {
return true
}
return false
}
// SetDashboards gets a reference to the given []Dashboard and assigns it to the Dashboards field.
func (o *Dashboards) SetDashboards(v []Dashboard) {
o.Dashboards = &v
}
func (o Dashboards) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Links != nil {
toSerialize["links"] = o.Links
}
if o.Dashboards != nil {
toSerialize["dashboards"] = o.Dashboards
}
return json.Marshal(toSerialize)
}
type NullableDashboards struct {
value *Dashboards
isSet bool
}
func (v NullableDashboards) Get() *Dashboards {
return v.value
}
func (v *NullableDashboards) Set(val *Dashboards) {
v.value = val
v.isSet = true
}
func (v NullableDashboards) IsSet() bool {
return v.isSet
}
func (v *NullableDashboards) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDashboards(val *Dashboards) *NullableDashboards {
return &NullableDashboards{value: val, isSet: true}
}
func (v NullableDashboards) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDashboards) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,65 @@
package dashboards
import (
"context"
"fmt"
"github.com/influxdata/influx-cli/v2/api"
"github.com/influxdata/influx-cli/v2/clients"
)
type Client struct {
clients.CLI
api.DashboardsApi
}
type Params struct {
clients.OrgParams
Ids []string
}
func (c Client) List(ctx context.Context, params *Params) error {
if !params.OrgID.Valid() && params.OrgName == "" && c.ActiveConfig.Org == "" && len(params.Ids) == 0 {
return fmt.Errorf("at least one of org, org-id, or id must be provided")
}
const limit = 100
req := c.GetDashboards(ctx)
req = req.Limit(limit)
if params.OrgID.Valid() {
req = req.OrgID(params.OrgID.String())
}
if params.OrgName != "" {
req = req.Org(params.OrgName)
}
if !params.OrgID.Valid() && params.OrgName == "" {
req = req.Org(c.ActiveConfig.Org)
}
dashboards, err := req.Id(params.Ids).Execute()
if err != nil {
return fmt.Errorf("failed to find dashboards: %w", err)
}
return c.printDashboards(dashboards)
}
func (c Client) printDashboards(dashboards api.Dashboards) error {
if c.PrintAsJSON {
return c.PrintJSON(dashboards)
}
headers := []string{"ID", "OrgID", "Name", "Description", "Num Cells"}
var rows []map[string]interface{}
for _, u := range dashboards.GetDashboards() {
row := map[string]interface{}{
"ID": u.GetId(),
"OrgID": u.GetOrgID(),
"Name": u.GetName(),
"Description": u.GetDescription(),
"Num Cells": len(u.GetCells()),
}
rows = append(rows, row)
}
return c.PrintTable(headers, rows...)
}

46
cmd/influx/dashboards.go Normal file
View File

@ -0,0 +1,46 @@
package main
import (
"github.com/influxdata/influx-cli/v2/clients/dashboards"
"github.com/influxdata/influx-cli/v2/pkg/cli/middleware"
"github.com/urfave/cli/v2"
)
func newDashboardsCommand() *cli.Command {
var params dashboards.Params
flags := append(commonFlags(), getOrgFlags(&params.OrgParams)...)
flags = append(flags, &cli.StringSliceFlag{
Name: "id",
Usage: "Dashboard ID to retrieve",
Aliases: []string{"i"},
})
return &cli.Command{
Name: "dashboards",
Usage: "List Dashboard(s).",
Description: `List Dashboard(s).
Examples:
# list all known Dashboards
influx dashboards
# list all known Dashboards matching ids
influx dashboards --id $ID1 --id $ID2
# list all known Dashboards matching ids shorts
influx dashboards -i $ID1 -i $ID2
`,
Flags: flags,
Before: middleware.WithBeforeFns(withCli(), withApi(true)),
Action: func(ctx *cli.Context) error {
rawIds := ctx.StringSlice("id")
params.Ids = rawIds
api := getAPI(ctx)
client := dashboards.Client{
CLI: getCLI(ctx),
DashboardsApi: api.DashboardsApi,
}
return client.List(ctx.Context, &params)
},
}
}

View File

@ -47,6 +47,7 @@ var app = cli.App{
newBackupCmd(),
newRestoreCmd(),
newTelegrafsCommand(),
newDashboardsCommand(),
},
}