feat: port top-level export command from influxdb (#131)

This commit is contained in:
Daniel Moran
2021-06-21 08:23:18 -04:00
committed by GitHub
parent 0ee555c6a7
commit bd0b90df41
18 changed files with 1869 additions and 2 deletions

173
api/api_templates.gen.go Normal file
View File

@ -0,0 +1,173 @@
/*
* 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"
)
// Linger please
var (
_ _context.Context
)
type TemplatesApi interface {
/*
* ExportTemplate Export a new Influx Template
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiExportTemplateRequest
*/
ExportTemplate(ctx _context.Context) ApiExportTemplateRequest
/*
* ExportTemplateExecute executes the request
* @return []TemplateEntry
*/
ExportTemplateExecute(r ApiExportTemplateRequest) ([]TemplateEntry, error)
}
// TemplatesApiService TemplatesApi service
type TemplatesApiService service
type ApiExportTemplateRequest struct {
ctx _context.Context
ApiService TemplatesApi
templateExport *TemplateExport
}
func (r ApiExportTemplateRequest) TemplateExport(templateExport TemplateExport) ApiExportTemplateRequest {
r.templateExport = &templateExport
return r
}
func (r ApiExportTemplateRequest) GetTemplateExport() *TemplateExport {
return r.templateExport
}
func (r ApiExportTemplateRequest) Execute() ([]TemplateEntry, error) {
return r.ApiService.ExportTemplateExecute(r)
}
/*
* ExportTemplate Export a new Influx Template
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @return ApiExportTemplateRequest
*/
func (a *TemplatesApiService) ExportTemplate(ctx _context.Context) ApiExportTemplateRequest {
return ApiExportTemplateRequest{
ApiService: a,
ctx: ctx,
}
}
/*
* Execute executes the request
* @return []TemplateEntry
*/
func (a *TemplatesApiService) ExportTemplateExecute(r ApiExportTemplateRequest) ([]TemplateEntry, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []TemplateEntry
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.ExportTemplate")
if err != nil {
return localVarReturnValue, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/templates/export"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.templateExport
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

@ -71,6 +71,8 @@ type APIClient struct {
TelegrafsApi TelegrafsApi
TemplatesApi TemplatesApi
UsersApi UsersApi
WriteApi WriteApi
@ -104,6 +106,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
c.SetupApi = (*SetupApiService)(&c.common)
c.TasksApi = (*TasksApiService)(&c.common)
c.TelegrafsApi = (*TelegrafsApiService)(&c.common)
c.TemplatesApi = (*TemplatesApiService)(&c.common)
c.UsersApi = (*UsersApiService)(&c.common)
c.WriteApi = (*WriteApiService)(&c.common)

View File

@ -71,6 +71,8 @@ paths:
$ref: "./overrides/paths/telegrafs_telegrafID.yml"
/dashboards:
$ref: "./overrides/paths/dashboards.yml"
/templates/export:
$ref: "./overrides/paths/templates_export.yml"
components:
parameters:
TraceSpan:
@ -253,3 +255,11 @@ components:
$ref: "./openapi/src/common/schemas/Cells.yml"
Cell:
$ref: "./openapi/src/common/schemas/Cell.yml"
TemplateExport:
$ref: "./overrides/schemas/TemplateExport.yml"
Template:
$ref: "./openapi/src/common/schemas/Template.yml"
TemplateKind:
$ref: "./openapi/src/common/schemas/TemplateKind.yml"
TemplateEntry:
$ref: "./openapi/src/common/schemas/TemplateEntry.yml"

View File

@ -0,0 +1,25 @@
post:
operationId: ExportTemplate
tags:
- Templates
summary: Export a new Influx Template
requestBody:
description: Export resources as an InfluxDB template.
required: false
content:
application/json:
schema:
$ref: "../schemas/TemplateExport.yml"
responses:
"200":
description: InfluxDB template created
content:
application/json:
schema:
$ref: "../../openapi/src/common/schemas/Template.yml"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "../../openapi/src/common/schemas/Error.yml"

View File

@ -0,0 +1,35 @@
type: object
properties:
stackID:
type: string
orgIDs:
type: array
items:
type: object
properties:
orgID:
type: string
resourceFilters:
type: object
properties:
byLabel:
type: array
items:
type: string
byResourceKind:
type: array
items:
$ref: "../../openapi/src/common/schemas/TemplateKind.yml"
resources:
type: array
items:
type: object
properties:
id:
type: string
kind:
$ref: "../../openapi/src/common/schemas/TemplateKind.yml"
name:
type: string
required: [kind]
required: [resources]

View File

@ -0,0 +1,221 @@
/*
* 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"
)
// TemplateEntry struct for TemplateEntry
type TemplateEntry struct {
ApiVersion *string `json:"apiVersion,omitempty"`
Kind *TemplateKind `json:"kind,omitempty"`
Meta *TemplateEntryMeta `json:"meta,omitempty"`
Spec *map[string]interface{} `json:"spec,omitempty"`
}
// NewTemplateEntry instantiates a new TemplateEntry 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 NewTemplateEntry() *TemplateEntry {
this := TemplateEntry{}
return &this
}
// NewTemplateEntryWithDefaults instantiates a new TemplateEntry 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 NewTemplateEntryWithDefaults() *TemplateEntry {
this := TemplateEntry{}
return &this
}
// GetApiVersion returns the ApiVersion field value if set, zero value otherwise.
func (o *TemplateEntry) GetApiVersion() string {
if o == nil || o.ApiVersion == nil {
var ret string
return ret
}
return *o.ApiVersion
}
// GetApiVersionOk returns a tuple with the ApiVersion field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateEntry) GetApiVersionOk() (*string, bool) {
if o == nil || o.ApiVersion == nil {
return nil, false
}
return o.ApiVersion, true
}
// HasApiVersion returns a boolean if a field has been set.
func (o *TemplateEntry) HasApiVersion() bool {
if o != nil && o.ApiVersion != nil {
return true
}
return false
}
// SetApiVersion gets a reference to the given string and assigns it to the ApiVersion field.
func (o *TemplateEntry) SetApiVersion(v string) {
o.ApiVersion = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *TemplateEntry) GetKind() TemplateKind {
if o == nil || o.Kind == nil {
var ret TemplateKind
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateEntry) GetKindOk() (*TemplateKind, bool) {
if o == nil || o.Kind == nil {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *TemplateEntry) HasKind() bool {
if o != nil && o.Kind != nil {
return true
}
return false
}
// SetKind gets a reference to the given TemplateKind and assigns it to the Kind field.
func (o *TemplateEntry) SetKind(v TemplateKind) {
o.Kind = &v
}
// GetMeta returns the Meta field value if set, zero value otherwise.
func (o *TemplateEntry) GetMeta() TemplateEntryMeta {
if o == nil || o.Meta == nil {
var ret TemplateEntryMeta
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 *TemplateEntry) GetMetaOk() (*TemplateEntryMeta, 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 *TemplateEntry) HasMeta() bool {
if o != nil && o.Meta != nil {
return true
}
return false
}
// SetMeta gets a reference to the given TemplateEntryMeta and assigns it to the Meta field.
func (o *TemplateEntry) SetMeta(v TemplateEntryMeta) {
o.Meta = &v
}
// GetSpec returns the Spec field value if set, zero value otherwise.
func (o *TemplateEntry) GetSpec() map[string]interface{} {
if o == nil || o.Spec == nil {
var ret map[string]interface{}
return ret
}
return *o.Spec
}
// GetSpecOk returns a tuple with the Spec field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateEntry) GetSpecOk() (*map[string]interface{}, bool) {
if o == nil || o.Spec == nil {
return nil, false
}
return o.Spec, true
}
// HasSpec returns a boolean if a field has been set.
func (o *TemplateEntry) HasSpec() bool {
if o != nil && o.Spec != nil {
return true
}
return false
}
// SetSpec gets a reference to the given map[string]interface{} and assigns it to the Spec field.
func (o *TemplateEntry) SetSpec(v map[string]interface{}) {
o.Spec = &v
}
func (o TemplateEntry) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.ApiVersion != nil {
toSerialize["apiVersion"] = o.ApiVersion
}
if o.Kind != nil {
toSerialize["kind"] = o.Kind
}
if o.Meta != nil {
toSerialize["meta"] = o.Meta
}
if o.Spec != nil {
toSerialize["spec"] = o.Spec
}
return json.Marshal(toSerialize)
}
type NullableTemplateEntry struct {
value *TemplateEntry
isSet bool
}
func (v NullableTemplateEntry) Get() *TemplateEntry {
return v.value
}
func (v *NullableTemplateEntry) Set(val *TemplateEntry) {
v.value = val
v.isSet = true
}
func (v NullableTemplateEntry) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateEntry) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateEntry(val *TemplateEntry) *NullableTemplateEntry {
return &NullableTemplateEntry{value: val, isSet: true}
}
func (v NullableTemplateEntry) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateEntry) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,113 @@
/*
* 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"
)
// TemplateEntryMeta struct for TemplateEntryMeta
type TemplateEntryMeta struct {
Name *string `json:"name,omitempty"`
}
// NewTemplateEntryMeta instantiates a new TemplateEntryMeta 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 NewTemplateEntryMeta() *TemplateEntryMeta {
this := TemplateEntryMeta{}
return &this
}
// NewTemplateEntryMetaWithDefaults instantiates a new TemplateEntryMeta 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 NewTemplateEntryMetaWithDefaults() *TemplateEntryMeta {
this := TemplateEntryMeta{}
return &this
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *TemplateEntryMeta) GetName() string {
if o == nil || o.Name == nil {
var ret string
return ret
}
return *o.Name
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateEntryMeta) GetNameOk() (*string, bool) {
if o == nil || o.Name == nil {
return nil, false
}
return o.Name, true
}
// HasName returns a boolean if a field has been set.
func (o *TemplateEntryMeta) HasName() bool {
if o != nil && o.Name != nil {
return true
}
return false
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *TemplateEntryMeta) SetName(v string) {
o.Name = &v
}
func (o TemplateEntryMeta) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Name != nil {
toSerialize["name"] = o.Name
}
return json.Marshal(toSerialize)
}
type NullableTemplateEntryMeta struct {
value *TemplateEntryMeta
isSet bool
}
func (v NullableTemplateEntryMeta) Get() *TemplateEntryMeta {
return v.value
}
func (v *NullableTemplateEntryMeta) Set(val *TemplateEntryMeta) {
v.value = val
v.isSet = true
}
func (v NullableTemplateEntryMeta) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateEntryMeta) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateEntryMeta(val *TemplateEntryMeta) *NullableTemplateEntryMeta {
return &NullableTemplateEntryMeta{value: val, isSet: true}
}
func (v NullableTemplateEntryMeta) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateEntryMeta) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,178 @@
/*
* 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"
)
// TemplateExport struct for TemplateExport
type TemplateExport struct {
StackID *string `json:"stackID,omitempty"`
OrgIDs *[]TemplateExportOrgIDs `json:"orgIDs,omitempty"`
Resources []TemplateExportResources `json:"resources"`
}
// NewTemplateExport instantiates a new TemplateExport 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 NewTemplateExport(resources []TemplateExportResources) *TemplateExport {
this := TemplateExport{}
this.Resources = resources
return &this
}
// NewTemplateExportWithDefaults instantiates a new TemplateExport 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 NewTemplateExportWithDefaults() *TemplateExport {
this := TemplateExport{}
return &this
}
// GetStackID returns the StackID field value if set, zero value otherwise.
func (o *TemplateExport) GetStackID() string {
if o == nil || o.StackID == nil {
var ret string
return ret
}
return *o.StackID
}
// GetStackIDOk returns a tuple with the StackID field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExport) GetStackIDOk() (*string, bool) {
if o == nil || o.StackID == nil {
return nil, false
}
return o.StackID, true
}
// HasStackID returns a boolean if a field has been set.
func (o *TemplateExport) HasStackID() bool {
if o != nil && o.StackID != nil {
return true
}
return false
}
// SetStackID gets a reference to the given string and assigns it to the StackID field.
func (o *TemplateExport) SetStackID(v string) {
o.StackID = &v
}
// GetOrgIDs returns the OrgIDs field value if set, zero value otherwise.
func (o *TemplateExport) GetOrgIDs() []TemplateExportOrgIDs {
if o == nil || o.OrgIDs == nil {
var ret []TemplateExportOrgIDs
return ret
}
return *o.OrgIDs
}
// GetOrgIDsOk returns a tuple with the OrgIDs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExport) GetOrgIDsOk() (*[]TemplateExportOrgIDs, bool) {
if o == nil || o.OrgIDs == nil {
return nil, false
}
return o.OrgIDs, true
}
// HasOrgIDs returns a boolean if a field has been set.
func (o *TemplateExport) HasOrgIDs() bool {
if o != nil && o.OrgIDs != nil {
return true
}
return false
}
// SetOrgIDs gets a reference to the given []TemplateExportOrgIDs and assigns it to the OrgIDs field.
func (o *TemplateExport) SetOrgIDs(v []TemplateExportOrgIDs) {
o.OrgIDs = &v
}
// GetResources returns the Resources field value
func (o *TemplateExport) GetResources() []TemplateExportResources {
if o == nil {
var ret []TemplateExportResources
return ret
}
return o.Resources
}
// GetResourcesOk returns a tuple with the Resources field value
// and a boolean to check if the value has been set.
func (o *TemplateExport) GetResourcesOk() (*[]TemplateExportResources, bool) {
if o == nil {
return nil, false
}
return &o.Resources, true
}
// SetResources sets field value
func (o *TemplateExport) SetResources(v []TemplateExportResources) {
o.Resources = v
}
func (o TemplateExport) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.StackID != nil {
toSerialize["stackID"] = o.StackID
}
if o.OrgIDs != nil {
toSerialize["orgIDs"] = o.OrgIDs
}
if true {
toSerialize["resources"] = o.Resources
}
return json.Marshal(toSerialize)
}
type NullableTemplateExport struct {
value *TemplateExport
isSet bool
}
func (v NullableTemplateExport) Get() *TemplateExport {
return v.value
}
func (v *NullableTemplateExport) Set(val *TemplateExport) {
v.value = val
v.isSet = true
}
func (v NullableTemplateExport) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateExport) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateExport(val *TemplateExport) *NullableTemplateExport {
return &NullableTemplateExport{value: val, isSet: true}
}
func (v NullableTemplateExport) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateExport) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

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"
)
// TemplateExportOrgIDs struct for TemplateExportOrgIDs
type TemplateExportOrgIDs struct {
OrgID *string `json:"orgID,omitempty"`
ResourceFilters *TemplateExportResourceFilters `json:"resourceFilters,omitempty"`
}
// NewTemplateExportOrgIDs instantiates a new TemplateExportOrgIDs 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 NewTemplateExportOrgIDs() *TemplateExportOrgIDs {
this := TemplateExportOrgIDs{}
return &this
}
// NewTemplateExportOrgIDsWithDefaults instantiates a new TemplateExportOrgIDs 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 NewTemplateExportOrgIDsWithDefaults() *TemplateExportOrgIDs {
this := TemplateExportOrgIDs{}
return &this
}
// GetOrgID returns the OrgID field value if set, zero value otherwise.
func (o *TemplateExportOrgIDs) GetOrgID() string {
if o == nil || o.OrgID == nil {
var ret string
return ret
}
return *o.OrgID
}
// GetOrgIDOk returns a tuple with the OrgID field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExportOrgIDs) GetOrgIDOk() (*string, bool) {
if o == nil || o.OrgID == nil {
return nil, false
}
return o.OrgID, true
}
// HasOrgID returns a boolean if a field has been set.
func (o *TemplateExportOrgIDs) HasOrgID() bool {
if o != nil && o.OrgID != nil {
return true
}
return false
}
// SetOrgID gets a reference to the given string and assigns it to the OrgID field.
func (o *TemplateExportOrgIDs) SetOrgID(v string) {
o.OrgID = &v
}
// GetResourceFilters returns the ResourceFilters field value if set, zero value otherwise.
func (o *TemplateExportOrgIDs) GetResourceFilters() TemplateExportResourceFilters {
if o == nil || o.ResourceFilters == nil {
var ret TemplateExportResourceFilters
return ret
}
return *o.ResourceFilters
}
// GetResourceFiltersOk returns a tuple with the ResourceFilters field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExportOrgIDs) GetResourceFiltersOk() (*TemplateExportResourceFilters, bool) {
if o == nil || o.ResourceFilters == nil {
return nil, false
}
return o.ResourceFilters, true
}
// HasResourceFilters returns a boolean if a field has been set.
func (o *TemplateExportOrgIDs) HasResourceFilters() bool {
if o != nil && o.ResourceFilters != nil {
return true
}
return false
}
// SetResourceFilters gets a reference to the given TemplateExportResourceFilters and assigns it to the ResourceFilters field.
func (o *TemplateExportOrgIDs) SetResourceFilters(v TemplateExportResourceFilters) {
o.ResourceFilters = &v
}
func (o TemplateExportOrgIDs) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.OrgID != nil {
toSerialize["orgID"] = o.OrgID
}
if o.ResourceFilters != nil {
toSerialize["resourceFilters"] = o.ResourceFilters
}
return json.Marshal(toSerialize)
}
type NullableTemplateExportOrgIDs struct {
value *TemplateExportOrgIDs
isSet bool
}
func (v NullableTemplateExportOrgIDs) Get() *TemplateExportOrgIDs {
return v.value
}
func (v *NullableTemplateExportOrgIDs) Set(val *TemplateExportOrgIDs) {
v.value = val
v.isSet = true
}
func (v NullableTemplateExportOrgIDs) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateExportOrgIDs) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateExportOrgIDs(val *TemplateExportOrgIDs) *NullableTemplateExportOrgIDs {
return &NullableTemplateExportOrgIDs{value: val, isSet: true}
}
func (v NullableTemplateExportOrgIDs) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateExportOrgIDs) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

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"
)
// TemplateExportResourceFilters struct for TemplateExportResourceFilters
type TemplateExportResourceFilters struct {
ByLabel *[]string `json:"byLabel,omitempty"`
ByResourceKind *[]TemplateKind `json:"byResourceKind,omitempty"`
}
// NewTemplateExportResourceFilters instantiates a new TemplateExportResourceFilters 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 NewTemplateExportResourceFilters() *TemplateExportResourceFilters {
this := TemplateExportResourceFilters{}
return &this
}
// NewTemplateExportResourceFiltersWithDefaults instantiates a new TemplateExportResourceFilters 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 NewTemplateExportResourceFiltersWithDefaults() *TemplateExportResourceFilters {
this := TemplateExportResourceFilters{}
return &this
}
// GetByLabel returns the ByLabel field value if set, zero value otherwise.
func (o *TemplateExportResourceFilters) GetByLabel() []string {
if o == nil || o.ByLabel == nil {
var ret []string
return ret
}
return *o.ByLabel
}
// GetByLabelOk returns a tuple with the ByLabel field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExportResourceFilters) GetByLabelOk() (*[]string, bool) {
if o == nil || o.ByLabel == nil {
return nil, false
}
return o.ByLabel, true
}
// HasByLabel returns a boolean if a field has been set.
func (o *TemplateExportResourceFilters) HasByLabel() bool {
if o != nil && o.ByLabel != nil {
return true
}
return false
}
// SetByLabel gets a reference to the given []string and assigns it to the ByLabel field.
func (o *TemplateExportResourceFilters) SetByLabel(v []string) {
o.ByLabel = &v
}
// GetByResourceKind returns the ByResourceKind field value if set, zero value otherwise.
func (o *TemplateExportResourceFilters) GetByResourceKind() []TemplateKind {
if o == nil || o.ByResourceKind == nil {
var ret []TemplateKind
return ret
}
return *o.ByResourceKind
}
// GetByResourceKindOk returns a tuple with the ByResourceKind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExportResourceFilters) GetByResourceKindOk() (*[]TemplateKind, bool) {
if o == nil || o.ByResourceKind == nil {
return nil, false
}
return o.ByResourceKind, true
}
// HasByResourceKind returns a boolean if a field has been set.
func (o *TemplateExportResourceFilters) HasByResourceKind() bool {
if o != nil && o.ByResourceKind != nil {
return true
}
return false
}
// SetByResourceKind gets a reference to the given []TemplateKind and assigns it to the ByResourceKind field.
func (o *TemplateExportResourceFilters) SetByResourceKind(v []TemplateKind) {
o.ByResourceKind = &v
}
func (o TemplateExportResourceFilters) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.ByLabel != nil {
toSerialize["byLabel"] = o.ByLabel
}
if o.ByResourceKind != nil {
toSerialize["byResourceKind"] = o.ByResourceKind
}
return json.Marshal(toSerialize)
}
type NullableTemplateExportResourceFilters struct {
value *TemplateExportResourceFilters
isSet bool
}
func (v NullableTemplateExportResourceFilters) Get() *TemplateExportResourceFilters {
return v.value
}
func (v *NullableTemplateExportResourceFilters) Set(val *TemplateExportResourceFilters) {
v.value = val
v.isSet = true
}
func (v NullableTemplateExportResourceFilters) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateExportResourceFilters) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateExportResourceFilters(val *TemplateExportResourceFilters) *NullableTemplateExportResourceFilters {
return &NullableTemplateExportResourceFilters{value: val, isSet: true}
}
func (v NullableTemplateExportResourceFilters) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateExportResourceFilters) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,178 @@
/*
* 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"
)
// TemplateExportResources struct for TemplateExportResources
type TemplateExportResources struct {
Id *string `json:"id,omitempty"`
Kind TemplateKind `json:"kind"`
Name *string `json:"name,omitempty"`
}
// NewTemplateExportResources instantiates a new TemplateExportResources 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 NewTemplateExportResources(kind TemplateKind) *TemplateExportResources {
this := TemplateExportResources{}
this.Kind = kind
return &this
}
// NewTemplateExportResourcesWithDefaults instantiates a new TemplateExportResources 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 NewTemplateExportResourcesWithDefaults() *TemplateExportResources {
this := TemplateExportResources{}
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *TemplateExportResources) 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 *TemplateExportResources) 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 *TemplateExportResources) 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 *TemplateExportResources) SetId(v string) {
o.Id = &v
}
// GetKind returns the Kind field value
func (o *TemplateExportResources) GetKind() TemplateKind {
if o == nil {
var ret TemplateKind
return ret
}
return o.Kind
}
// GetKindOk returns a tuple with the Kind field value
// and a boolean to check if the value has been set.
func (o *TemplateExportResources) GetKindOk() (*TemplateKind, bool) {
if o == nil {
return nil, false
}
return &o.Kind, true
}
// SetKind sets field value
func (o *TemplateExportResources) SetKind(v TemplateKind) {
o.Kind = v
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *TemplateExportResources) GetName() string {
if o == nil || o.Name == nil {
var ret string
return ret
}
return *o.Name
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TemplateExportResources) GetNameOk() (*string, bool) {
if o == nil || o.Name == nil {
return nil, false
}
return o.Name, true
}
// HasName returns a boolean if a field has been set.
func (o *TemplateExportResources) HasName() bool {
if o != nil && o.Name != nil {
return true
}
return false
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *TemplateExportResources) SetName(v string) {
o.Name = &v
}
func (o TemplateExportResources) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if true {
toSerialize["kind"] = o.Kind
}
if o.Name != nil {
toSerialize["name"] = o.Name
}
return json.Marshal(toSerialize)
}
type NullableTemplateExportResources struct {
value *TemplateExportResources
isSet bool
}
func (v NullableTemplateExportResources) Get() *TemplateExportResources {
return v.value
}
func (v *NullableTemplateExportResources) Set(val *TemplateExportResources) {
v.value = val
v.isSet = true
}
func (v NullableTemplateExportResources) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateExportResources) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateExportResources(val *TemplateExportResources) *NullableTemplateExportResources {
return &NullableTemplateExportResources{value: val, isSet: true}
}
func (v NullableTemplateExportResources) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateExportResources) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,95 @@
/*
* Subset of Influx API covered by Influx CLI
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
"fmt"
)
// TemplateKind the model 'TemplateKind'
type TemplateKind string
// List of TemplateKind
const (
TEMPLATEKIND_BUCKET TemplateKind = "Bucket"
TEMPLATEKIND_CHECK TemplateKind = "Check"
TEMPLATEKIND_CHECK_DEADMAN TemplateKind = "CheckDeadman"
TEMPLATEKIND_CHECK_THRESHOLD TemplateKind = "CheckThreshold"
TEMPLATEKIND_DASHBOARD TemplateKind = "Dashboard"
TEMPLATEKIND_LABEL TemplateKind = "Label"
TEMPLATEKIND_NOTIFICATION_ENDPOINT TemplateKind = "NotificationEndpoint"
TEMPLATEKIND_NOTIFICATION_ENDPOINT_HTTP TemplateKind = "NotificationEndpointHTTP"
TEMPLATEKIND_NOTIFICATION_ENDPOINT_PAGER_DUTY TemplateKind = "NotificationEndpointPagerDuty"
TEMPLATEKIND_NOTIFICATION_ENDPOINT_SLACK TemplateKind = "NotificationEndpointSlack"
TEMPLATEKIND_NOTIFICATION_RULE TemplateKind = "NotificationRule"
TEMPLATEKIND_TASK TemplateKind = "Task"
TEMPLATEKIND_TELEGRAF TemplateKind = "Telegraf"
TEMPLATEKIND_VARIABLE TemplateKind = "Variable"
)
func (v *TemplateKind) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := TemplateKind(value)
for _, existing := range []TemplateKind{"Bucket", "Check", "CheckDeadman", "CheckThreshold", "Dashboard", "Label", "NotificationEndpoint", "NotificationEndpointHTTP", "NotificationEndpointPagerDuty", "NotificationEndpointSlack", "NotificationRule", "Task", "Telegraf", "Variable"} {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid TemplateKind", value)
}
// Ptr returns reference to TemplateKind value
func (v TemplateKind) Ptr() *TemplateKind {
return &v
}
type NullableTemplateKind struct {
value *TemplateKind
isSet bool
}
func (v NullableTemplateKind) Get() *TemplateKind {
return v.value
}
func (v *NullableTemplateKind) Set(val *TemplateKind) {
v.value = val
v.isSet = true
}
func (v NullableTemplateKind) IsSet() bool {
return v.isSet
}
func (v *NullableTemplateKind) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTemplateKind(val *TemplateKind) *NullableTemplateKind {
return &NullableTemplateKind{value: val, isSet: true}
}
func (v NullableTemplateKind) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTemplateKind) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}