Files
ziti/rest_management_api_client/config/config_client.go
T
Andrew Martinez b562fb5c07 splits API specs into composible modules
- splits Open API 2.0 (swagger) into client/management APIs
- uses go-swaggers flatten capabilities
- uses newer version of go-swagger (v0.27.0)
- introduces /edge/client/v1, /edge/management/v1
- non-prefixed URLs default to /edge/client/v1
- splits some shared management/client API handlers
- renames some REST models to "client" instead of "limited"
- passes all apitests, fails dataflow upd test (main fails this as well)
- updates generate rest script for powershell
- todo: test generate rest script for bash
- todo: use xweb (different branch)
2021-05-04 11:30:32 -04:00

623 lines
22 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
//
// Copyright NetFoundry, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// __ __ _
// \ \ / / (_)
// \ \ /\ / /_ _ _ __ _ __ _ _ __ __ _
// \ \/ \/ / _` | '__| '_ \| | '_ \ / _` |
// \ /\ / (_| | | | | | | | | | | (_| | : This file is generated, do not edit it.
// \/ \/ \__,_|_| |_| |_|_|_| |_|\__, |
// __/ |
// |___/
package config
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new config API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for config API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
CreateConfig(params *CreateConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateConfigCreated, error)
CreateConfigType(params *CreateConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateConfigTypeCreated, error)
DeleteConfig(params *DeleteConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteConfigOK, error)
DeleteConfigType(params *DeleteConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteConfigTypeOK, error)
DetailConfig(params *DetailConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailConfigOK, error)
DetailConfigType(params *DetailConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailConfigTypeOK, error)
ListConfigTypes(params *ListConfigTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListConfigTypesOK, error)
ListConfigs(params *ListConfigsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListConfigsOK, error)
ListConfigsForConfigType(params *ListConfigsForConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListConfigsForConfigTypeOK, error)
PatchConfig(params *PatchConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchConfigOK, error)
PatchConfigType(params *PatchConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchConfigTypeOK, error)
UpdateConfig(params *UpdateConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateConfigOK, error)
UpdateConfigType(params *UpdateConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateConfigTypeOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
CreateConfig creates a config resource
Create a config resource. Requires admin access.
*/
func (a *Client) CreateConfig(params *CreateConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateConfigCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateConfigParams()
}
op := &runtime.ClientOperation{
ID: "createConfig",
Method: "POST",
PathPattern: "/configs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CreateConfigReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CreateConfigCreated)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for createConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
CreateConfigType creates a config type requires admin access
*/
func (a *Client) CreateConfigType(params *CreateConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateConfigTypeCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateConfigTypeParams()
}
op := &runtime.ClientOperation{
ID: "createConfigType",
Method: "POST",
PathPattern: "/config-types",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &CreateConfigTypeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*CreateConfigTypeCreated)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for createConfigType: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteConfig deletes a config
Delete a config by id. Requires admin access.
*/
func (a *Client) DeleteConfig(params *DeleteConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteConfigOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteConfigParams()
}
op := &runtime.ClientOperation{
ID: "deleteConfig",
Method: "DELETE",
PathPattern: "/configs/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DeleteConfigReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeleteConfigOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteConfigType deletes a config type
Delete a config-type by id. Removing a configuration type that are in use will result in a 409 conflict HTTP status code and error. All configurations of a type must be removed first.
*/
func (a *Client) DeleteConfigType(params *DeleteConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteConfigTypeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteConfigTypeParams()
}
op := &runtime.ClientOperation{
ID: "deleteConfigType",
Method: "DELETE",
PathPattern: "/config-types/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DeleteConfigTypeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeleteConfigTypeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteConfigType: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DetailConfig retrieves a single config
Retrieves a single config by id. Requires admin access.
*/
func (a *Client) DetailConfig(params *DetailConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailConfigOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDetailConfigParams()
}
op := &runtime.ClientOperation{
ID: "detailConfig",
Method: "GET",
PathPattern: "/configs/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DetailConfigReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DetailConfigOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for detailConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DetailConfigType retrieves a single config type
Retrieves a single config-type by id. Requires admin access.
*/
func (a *Client) DetailConfigType(params *DetailConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailConfigTypeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDetailConfigTypeParams()
}
op := &runtime.ClientOperation{
ID: "detailConfigType",
Method: "GET",
PathPattern: "/config-types/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DetailConfigTypeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DetailConfigTypeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for detailConfigType: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListConfigTypes lists config types
Retrieves a list of config-type resources; supports filtering, sorting, and pagination. Requires admin access.
*/
func (a *Client) ListConfigTypes(params *ListConfigTypesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListConfigTypesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListConfigTypesParams()
}
op := &runtime.ClientOperation{
ID: "listConfigTypes",
Method: "GET",
PathPattern: "/config-types",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListConfigTypesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*ListConfigTypesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for listConfigTypes: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListConfigs lists configs
Retrieves a list of config resources; supports filtering, sorting, and pagination. Requires admin access.
*/
func (a *Client) ListConfigs(params *ListConfigsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListConfigsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListConfigsParams()
}
op := &runtime.ClientOperation{
ID: "listConfigs",
Method: "GET",
PathPattern: "/configs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListConfigsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*ListConfigsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for listConfigs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListConfigsForConfigType lists the configs of a specific config type
Lists the configs associated to a config-type. Requires admin access.
*/
func (a *Client) ListConfigsForConfigType(params *ListConfigsForConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListConfigsForConfigTypeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListConfigsForConfigTypeParams()
}
op := &runtime.ClientOperation{
ID: "listConfigsForConfigType",
Method: "GET",
PathPattern: "/config-types/{id}/configs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListConfigsForConfigTypeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*ListConfigsForConfigTypeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for listConfigsForConfigType: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchConfig updates the supplied fields on a config
Update the supplied fields on a config. Requires admin access.
*/
func (a *Client) PatchConfig(params *PatchConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchConfigOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchConfigParams()
}
op := &runtime.ClientOperation{
ID: "patchConfig",
Method: "PATCH",
PathPattern: "/configs/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &PatchConfigReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchConfigOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for patchConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PatchConfigType updates the supplied fields on a config type
Update the supplied fields on a config-type. Requires admin access.
*/
func (a *Client) PatchConfigType(params *PatchConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchConfigTypeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPatchConfigTypeParams()
}
op := &runtime.ClientOperation{
ID: "patchConfigType",
Method: "PATCH",
PathPattern: "/config-types/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &PatchConfigTypeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PatchConfigTypeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for patchConfigType: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateConfig updates all fields on a config
Update all fields on a config by id. Requires admin access.
*/
func (a *Client) UpdateConfig(params *UpdateConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateConfigOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateConfigParams()
}
op := &runtime.ClientOperation{
ID: "updateConfig",
Method: "PUT",
PathPattern: "/configs/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &UpdateConfigReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*UpdateConfigOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for updateConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateConfigType updates all fields on a config type
Update all fields on a config-type by id. Requires admin access.
*/
func (a *Client) UpdateConfigType(params *UpdateConfigTypeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateConfigTypeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateConfigTypeParams()
}
op := &runtime.ClientOperation{
ID: "updateConfigType",
Method: "PUT",
PathPattern: "/config-types/{id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &UpdateConfigTypeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*UpdateConfigTypeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for updateConfigType: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}