identities -> 'environments'

This commit is contained in:
Michael Quigley
2022-08-03 11:54:11 -04:00
parent 1a4bb269e8
commit 46b00ab9f0
25 changed files with 583 additions and 479 deletions

View File

@@ -0,0 +1,126 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewListEnvironmentsParams creates a new ListEnvironmentsParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewListEnvironmentsParams() *ListEnvironmentsParams {
return &ListEnvironmentsParams{
timeout: cr.DefaultTimeout,
}
}
// NewListEnvironmentsParamsWithTimeout creates a new ListEnvironmentsParams object
// with the ability to set a timeout on a request.
func NewListEnvironmentsParamsWithTimeout(timeout time.Duration) *ListEnvironmentsParams {
return &ListEnvironmentsParams{
timeout: timeout,
}
}
// NewListEnvironmentsParamsWithContext creates a new ListEnvironmentsParams object
// with the ability to set a context for a request.
func NewListEnvironmentsParamsWithContext(ctx context.Context) *ListEnvironmentsParams {
return &ListEnvironmentsParams{
Context: ctx,
}
}
// NewListEnvironmentsParamsWithHTTPClient creates a new ListEnvironmentsParams object
// with the ability to set a custom HTTPClient for a request.
func NewListEnvironmentsParamsWithHTTPClient(client *http.Client) *ListEnvironmentsParams {
return &ListEnvironmentsParams{
HTTPClient: client,
}
}
/* ListEnvironmentsParams contains all the parameters to send to the API endpoint
for the list environments operation.
Typically these are written to a http.Request.
*/
type ListEnvironmentsParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list environments params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListEnvironmentsParams) WithDefaults() *ListEnvironmentsParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list environments params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListEnvironmentsParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list environments params
func (o *ListEnvironmentsParams) WithTimeout(timeout time.Duration) *ListEnvironmentsParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list environments params
func (o *ListEnvironmentsParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list environments params
func (o *ListEnvironmentsParams) WithContext(ctx context.Context) *ListEnvironmentsParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list environments params
func (o *ListEnvironmentsParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list environments params
func (o *ListEnvironmentsParams) WithHTTPClient(client *http.Client) *ListEnvironmentsParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list environments params
func (o *ListEnvironmentsParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *ListEnvironmentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,101 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// ListEnvironmentsReader is a Reader for the ListEnvironments structure.
type ListEnvironmentsReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListEnvironmentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListEnvironmentsOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewListEnvironmentsInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewListEnvironmentsOK creates a ListEnvironmentsOK with default headers values
func NewListEnvironmentsOK() *ListEnvironmentsOK {
return &ListEnvironmentsOK{}
}
/* ListEnvironmentsOK describes a response with status code 200, with default header values.
success
*/
type ListEnvironmentsOK struct {
Payload rest_model_zrok.Environments
}
func (o *ListEnvironmentsOK) Error() string {
return fmt.Sprintf("[GET /listEnvironments][%d] listEnvironmentsOK %+v", 200, o.Payload)
}
func (o *ListEnvironmentsOK) GetPayload() rest_model_zrok.Environments {
return o.Payload
}
func (o *ListEnvironmentsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListEnvironmentsInternalServerError creates a ListEnvironmentsInternalServerError with default headers values
func NewListEnvironmentsInternalServerError() *ListEnvironmentsInternalServerError {
return &ListEnvironmentsInternalServerError{}
}
/* ListEnvironmentsInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type ListEnvironmentsInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
func (o *ListEnvironmentsInternalServerError) Error() string {
return fmt.Sprintf("[GET /listEnvironments][%d] listEnvironmentsInternalServerError %+v", 500, o.Payload)
}
func (o *ListEnvironmentsInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *ListEnvironmentsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -1,126 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewListIdentitiesParams creates a new ListIdentitiesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewListIdentitiesParams() *ListIdentitiesParams {
return &ListIdentitiesParams{
timeout: cr.DefaultTimeout,
}
}
// NewListIdentitiesParamsWithTimeout creates a new ListIdentitiesParams object
// with the ability to set a timeout on a request.
func NewListIdentitiesParamsWithTimeout(timeout time.Duration) *ListIdentitiesParams {
return &ListIdentitiesParams{
timeout: timeout,
}
}
// NewListIdentitiesParamsWithContext creates a new ListIdentitiesParams object
// with the ability to set a context for a request.
func NewListIdentitiesParamsWithContext(ctx context.Context) *ListIdentitiesParams {
return &ListIdentitiesParams{
Context: ctx,
}
}
// NewListIdentitiesParamsWithHTTPClient creates a new ListIdentitiesParams object
// with the ability to set a custom HTTPClient for a request.
func NewListIdentitiesParamsWithHTTPClient(client *http.Client) *ListIdentitiesParams {
return &ListIdentitiesParams{
HTTPClient: client,
}
}
/* ListIdentitiesParams contains all the parameters to send to the API endpoint
for the list identities operation.
Typically these are written to a http.Request.
*/
type ListIdentitiesParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list identities params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListIdentitiesParams) WithDefaults() *ListIdentitiesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list identities params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListIdentitiesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list identities params
func (o *ListIdentitiesParams) WithTimeout(timeout time.Duration) *ListIdentitiesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list identities params
func (o *ListIdentitiesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list identities params
func (o *ListIdentitiesParams) WithContext(ctx context.Context) *ListIdentitiesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list identities params
func (o *ListIdentitiesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list identities params
func (o *ListIdentitiesParams) WithHTTPClient(client *http.Client) *ListIdentitiesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list identities params
func (o *ListIdentitiesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *ListIdentitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -1,101 +0,0 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
)
// ListIdentitiesReader is a Reader for the ListIdentities structure.
type ListIdentitiesReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *ListIdentitiesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewListIdentitiesOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewListIdentitiesInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
}
}
// NewListIdentitiesOK creates a ListIdentitiesOK with default headers values
func NewListIdentitiesOK() *ListIdentitiesOK {
return &ListIdentitiesOK{}
}
/* ListIdentitiesOK describes a response with status code 200, with default header values.
success
*/
type ListIdentitiesOK struct {
Payload rest_model_zrok.Identities
}
func (o *ListIdentitiesOK) Error() string {
return fmt.Sprintf("[GET /listIdentities][%d] listIdentitiesOK %+v", 200, o.Payload)
}
func (o *ListIdentitiesOK) GetPayload() rest_model_zrok.Identities {
return o.Payload
}
func (o *ListIdentitiesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewListIdentitiesInternalServerError creates a ListIdentitiesInternalServerError with default headers values
func NewListIdentitiesInternalServerError() *ListIdentitiesInternalServerError {
return &ListIdentitiesInternalServerError{}
}
/* ListIdentitiesInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type ListIdentitiesInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
func (o *ListIdentitiesInternalServerError) Error() string {
return fmt.Sprintf("[GET /listIdentities][%d] listIdentitiesInternalServerError %+v", 500, o.Payload)
}
func (o *ListIdentitiesInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *ListIdentitiesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
// response payload
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}

View File

@@ -30,7 +30,7 @@ type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
ListIdentities(params *ListIdentitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListIdentitiesOK, error)
ListEnvironments(params *ListEnvironmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnvironmentsOK, error)
Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error)
@@ -38,22 +38,22 @@ type ClientService interface {
}
/*
ListIdentities list identities API
ListEnvironments list environments API
*/
func (a *Client) ListIdentities(params *ListIdentitiesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListIdentitiesOK, error) {
func (a *Client) ListEnvironments(params *ListEnvironmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnvironmentsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListIdentitiesParams()
params = NewListEnvironmentsParams()
}
op := &runtime.ClientOperation{
ID: "listIdentities",
ID: "listEnvironments",
Method: "GET",
PathPattern: "/listIdentities",
PathPattern: "/listEnvironments",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &ListIdentitiesReader{formats: a.formats},
Reader: &ListEnvironmentsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
@@ -66,13 +66,13 @@ func (a *Client) ListIdentities(params *ListIdentitiesParams, authInfo runtime.C
if err != nil {
return nil, err
}
success, ok := result.(*ListIdentitiesOK)
success, ok := result.(*ListEnvironmentsOK)
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 listIdentities: API contract not enforced by server. Client expected to get an error, but got: %T", result)
msg := fmt.Sprintf("unexpected success response for listEnvironments: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}