From c6cb1354f5caf9a6cdd4bd7766eb9f84264f8968 Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Wed, 9 Oct 2024 13:07:07 -0400 Subject: [PATCH 1/2] addresses openziti/ziti#2474 adds a generic network JWT for enrollment --- client.yml | 106 +++++++ management.yml | 106 +++++++ .../enrollment/enrollment_client.go | 105 +++++++ .../list_network_j_w_ts_parameters.go | 150 +++++++++ .../list_network_j_w_ts_responses.go | 205 +++++++++++++ .../ziti_edge_client_client.go | 5 + .../configure_ziti_edge_client.go | 6 + rest_client_api_server/embedded_spec.go | 290 ++++++++++++++++++ .../enrollment/list_network_j_w_ts.go | 82 +++++ .../list_network_j_w_ts_parameters.go | 70 +++++ .../list_network_j_w_ts_responses.go | 214 +++++++++++++ .../list_network_j_w_ts_urlbuilder.go | 111 +++++++ .../operations/ziti_edge_client_api.go | 13 + .../enrollment/enrollment_client.go | 42 +++ .../list_network_j_w_ts_parameters.go | 150 +++++++++ .../list_network_j_w_ts_responses.go | 205 +++++++++++++ .../configure_ziti_edge_management.go | 5 + rest_management_api_server/embedded_spec.go | 290 ++++++++++++++++++ .../enrollment/list_network_j_w_ts.go | 82 +++++ .../list_network_j_w_ts_parameters.go | 70 +++++ .../list_network_j_w_ts_responses.go | 214 +++++++++++++ .../list_network_j_w_ts_urlbuilder.go | 111 +++++++ .../operations/ziti_edge_management_api.go | 12 + rest_model/list_network_j_w_ts_envelope.go | 175 +++++++++++ rest_model/network_jwt.go | 153 +++++++++ rest_model/network_jwt_list.go | 97 ++++++ source/client.yml | 3 + source/management.yml | 3 + source/shared/network-jwt.yml | 55 ++++ 29 files changed, 3130 insertions(+) create mode 100644 rest_client_api_client/enrollment/enrollment_client.go create mode 100644 rest_client_api_client/enrollment/list_network_j_w_ts_parameters.go create mode 100644 rest_client_api_client/enrollment/list_network_j_w_ts_responses.go create mode 100644 rest_client_api_server/operations/enrollment/list_network_j_w_ts.go create mode 100644 rest_client_api_server/operations/enrollment/list_network_j_w_ts_parameters.go create mode 100644 rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go create mode 100644 rest_client_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go create mode 100644 rest_management_api_client/enrollment/list_network_j_w_ts_parameters.go create mode 100644 rest_management_api_client/enrollment/list_network_j_w_ts_responses.go create mode 100644 rest_management_api_server/operations/enrollment/list_network_j_w_ts.go create mode 100644 rest_management_api_server/operations/enrollment/list_network_j_w_ts_parameters.go create mode 100644 rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go create mode 100644 rest_management_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go create mode 100644 rest_model/list_network_j_w_ts_envelope.go create mode 100644 rest_model/network_jwt.go create mode 100644 rest_model/network_jwt_list.go create mode 100644 source/shared/network-jwt.yml diff --git a/client.yml b/client.yml index 434ffbca..662e998c 100644 --- a/client.yml +++ b/client.yml @@ -2358,6 +2358,84 @@ paths: meta: apiEnrollmentVersion: 0.0.1 apiVersion: 0.0.1 + /network-jwts: + get: + description: Returns a list of JWTs for trusting a network + tags: + - Enrollment + summary: Returns a list of JWTs suitable for bootstrapping network trust. + operationId: listNetworkJWTs + responses: + "200": + description: A list of network JWTs + schema: + $ref: '#/definitions/listNetworkJWTsEnvelope' + "400": + description: The supplied request contains invalid fields or could not be + parsed (json and non-json bodies). The error's code, message, and cause + fields can be inspected for further information + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: {} + cause: + details: + context: (root) + field: (root) + property: fooField3 + field: (root) + message: '(root): fooField3 is required' + type: required + value: + fooField: abc + fooField2: def + causeMessage: schema validation failed + code: COULD_NOT_VALIDATE + message: The supplied request contains an invalid document + requestId: ac6766d6-3a09-44b3-8d8a-1b541d97fdd9 + meta: + apiEnrollmentVersion: 0.0.1 + apiVersion: 0.0.1 + "401": + description: The supplied session does not have the correct access rights + to request this resource + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: {} + cause: "" + causeMessage: "" + code: UNAUTHORIZED + message: The request could not be completed. The session is not authorized + or the credentials are invalid + requestId: 0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f + meta: + apiEnrollmentVersion: 0.0.1 + apiVersion: 0.0.1 + "429": + description: The resource requested is rate limited and the rate limit has + been exceeded + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: {} + causeMessage: you have hit a rate limit in the requested operation + code: RATE_LIMITED + message: The resource is rate limited and the rate limit has been + exceeded. Please try again later + requestId: 270908d6-f2ef-4577-b973-67bec18ae376 + meta: + apiEnrollmentVersion: 0.0.1 + apiVersion: 0.0.1 /posture-response: post: security: @@ -4774,6 +4852,16 @@ definitions: $ref: '#/definitions/capabilities' meta: $ref: '#/definitions/meta' + listNetworkJWTsEnvelope: + type: object + required: + - meta + - data + properties: + data: + $ref: '#/definitions/networkJWTList' + meta: + $ref: '#/definitions/meta' listProtocols: type: object additionalProperties: @@ -4870,6 +4958,24 @@ definitions: enum: - ziti - url + networkJWT: + description: A network JWT + type: object + allOf: + - type: object + required: + - name + - token + properties: + name: + type: string + token: + type: string + networkJWTList: + description: An array of network JWTs + type: array + items: + $ref: '#/definitions/networkJWT' nonceChallenge: type: object required: diff --git a/management.yml b/management.yml index 7d5c6d0e..4ebae874 100644 --- a/management.yml +++ b/management.yml @@ -10105,6 +10105,84 @@ paths: name: id in: path required: true + /network-jwts: + get: + description: Returns a list of JWTs for trusting a network + tags: + - Enrollment + summary: Returns a list of JWTs suitable for bootstrapping network trust. + operationId: listNetworkJWTs + responses: + "200": + description: A list of network JWTs + schema: + $ref: '#/definitions/listNetworkJWTsEnvelope' + "400": + description: The supplied request contains invalid fields or could not be + parsed (json and non-json bodies). The error's code, message, and cause + fields can be inspected for further information + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: {} + cause: + details: + context: (root) + field: (root) + property: fooField3 + field: (root) + message: '(root): fooField3 is required' + type: required + value: + fooField: abc + fooField2: def + causeMessage: schema validation failed + code: COULD_NOT_VALIDATE + message: The supplied request contains an invalid document + requestId: ac6766d6-3a09-44b3-8d8a-1b541d97fdd9 + meta: + apiEnrollmentVersion: 0.0.1 + apiVersion: 0.0.1 + "401": + description: The supplied session does not have the correct access rights + to request this resource + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: {} + cause: "" + causeMessage: "" + code: UNAUTHORIZED + message: The request could not be completed. The session is not authorized + or the credentials are invalid + requestId: 0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f + meta: + apiEnrollmentVersion: 0.0.1 + apiVersion: 0.0.1 + "429": + description: The resource requested is rate limited and the rate limit has + been exceeded + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: {} + causeMessage: you have hit a rate limit in the requested operation + code: RATE_LIMITED + message: The resource is rate limited and the rate limit has been + exceeded. Please try again later + requestId: 270908d6-f2ef-4577-b973-67bec18ae376 + meta: + apiEnrollmentVersion: 0.0.1 + apiVersion: 0.0.1 /posture-check-role-attributes: get: security: @@ -18454,6 +18532,16 @@ definitions: $ref: '#/definitions/identityTypeList' meta: $ref: '#/definitions/meta' + listNetworkJWTsEnvelope: + type: object + required: + - meta + - data + properties: + data: + $ref: '#/definitions/networkJWTList' + meta: + $ref: '#/definitions/meta' listPostureCheckEnvelope: type: object required: @@ -18634,6 +18722,24 @@ definitions: items: $ref: '#/definitions/namedRole' x-omitempty: false + networkJWT: + description: A network JWT + type: object + allOf: + - type: object + required: + - name + - token + properties: + name: + type: string + token: + type: string + networkJWTList: + description: An array of network JWTs + type: array + items: + $ref: '#/definitions/networkJWT' operatingSystem: type: object required: diff --git a/rest_client_api_client/enrollment/enrollment_client.go b/rest_client_api_client/enrollment/enrollment_client.go new file mode 100644 index 00000000..db53eb84 --- /dev/null +++ b/rest_client_api_client/enrollment/enrollment_client.go @@ -0,0 +1,105 @@ +// 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 enrollment + +// 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 enrollment API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for enrollment 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 { + ListNetworkJWTs(params *ListNetworkJWTsParams, opts ...ClientOption) (*ListNetworkJWTsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ListNetworkJWTs returns a list of j w ts suitable for bootstrapping network trust + + Returns a list of JWTs for trusting a network +*/ +func (a *Client) ListNetworkJWTs(params *ListNetworkJWTsParams, opts ...ClientOption) (*ListNetworkJWTsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListNetworkJWTsParams() + } + op := &runtime.ClientOperation{ + ID: "listNetworkJWTs", + Method: "GET", + PathPattern: "/network-jwts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListNetworkJWTsReader{formats: a.formats}, + 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.(*ListNetworkJWTsOK) + 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 listNetworkJWTs: 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 +} diff --git a/rest_client_api_client/enrollment/list_network_j_w_ts_parameters.go b/rest_client_api_client/enrollment/list_network_j_w_ts_parameters.go new file mode 100644 index 00000000..a81a81c6 --- /dev/null +++ b/rest_client_api_client/enrollment/list_network_j_w_ts_parameters.go @@ -0,0 +1,150 @@ +// 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 enrollment + +// 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" +) + +// NewListNetworkJWTsParams creates a new ListNetworkJWTsParams 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 NewListNetworkJWTsParams() *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListNetworkJWTsParamsWithTimeout creates a new ListNetworkJWTsParams object +// with the ability to set a timeout on a request. +func NewListNetworkJWTsParamsWithTimeout(timeout time.Duration) *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + timeout: timeout, + } +} + +// NewListNetworkJWTsParamsWithContext creates a new ListNetworkJWTsParams object +// with the ability to set a context for a request. +func NewListNetworkJWTsParamsWithContext(ctx context.Context) *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + Context: ctx, + } +} + +// NewListNetworkJWTsParamsWithHTTPClient creates a new ListNetworkJWTsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListNetworkJWTsParamsWithHTTPClient(client *http.Client) *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + HTTPClient: client, + } +} + +/* ListNetworkJWTsParams contains all the parameters to send to the API endpoint + for the list network j w ts operation. + + Typically these are written to a http.Request. +*/ +type ListNetworkJWTsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list network j w ts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListNetworkJWTsParams) WithDefaults() *ListNetworkJWTsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list network j w ts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListNetworkJWTsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list network j w ts params +func (o *ListNetworkJWTsParams) WithTimeout(timeout time.Duration) *ListNetworkJWTsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list network j w ts params +func (o *ListNetworkJWTsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list network j w ts params +func (o *ListNetworkJWTsParams) WithContext(ctx context.Context) *ListNetworkJWTsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list network j w ts params +func (o *ListNetworkJWTsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list network j w ts params +func (o *ListNetworkJWTsParams) WithHTTPClient(client *http.Client) *ListNetworkJWTsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list network j w ts params +func (o *ListNetworkJWTsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListNetworkJWTsParams) 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 +} diff --git a/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go b/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go new file mode 100644 index 00000000..efb85237 --- /dev/null +++ b/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go @@ -0,0 +1,205 @@ +// 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 enrollment + +// 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/edge-api/rest_model" +) + +// ListNetworkJWTsReader is a Reader for the ListNetworkJWTs structure. +type ListNetworkJWTsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListNetworkJWTsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListNetworkJWTsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListNetworkJWTsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListNetworkJWTsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewListNetworkJWTsTooManyRequests() + 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()) + } +} + +// NewListNetworkJWTsOK creates a ListNetworkJWTsOK with default headers values +func NewListNetworkJWTsOK() *ListNetworkJWTsOK { + return &ListNetworkJWTsOK{} +} + +/* ListNetworkJWTsOK describes a response with status code 200, with default header values. + +A list of network JWTs +*/ +type ListNetworkJWTsOK struct { + Payload *rest_model.ListNetworkJWTsEnvelope +} + +func (o *ListNetworkJWTsOK) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsOK %+v", 200, o.Payload) +} +func (o *ListNetworkJWTsOK) GetPayload() *rest_model.ListNetworkJWTsEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.ListNetworkJWTsEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListNetworkJWTsBadRequest creates a ListNetworkJWTsBadRequest with default headers values +func NewListNetworkJWTsBadRequest() *ListNetworkJWTsBadRequest { + return &ListNetworkJWTsBadRequest{} +} + +/* ListNetworkJWTsBadRequest describes a response with status code 400, with default header values. + +The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information +*/ +type ListNetworkJWTsBadRequest struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListNetworkJWTsBadRequest) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsBadRequest %+v", 400, o.Payload) +} +func (o *ListNetworkJWTsBadRequest) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListNetworkJWTsUnauthorized creates a ListNetworkJWTsUnauthorized with default headers values +func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { + return &ListNetworkJWTsUnauthorized{} +} + +/* ListNetworkJWTsUnauthorized describes a response with status code 401, with default header values. + +The supplied session does not have the correct access rights to request this resource +*/ +type ListNetworkJWTsUnauthorized struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListNetworkJWTsUnauthorized) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsUnauthorized %+v", 401, o.Payload) +} +func (o *ListNetworkJWTsUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListNetworkJWTsTooManyRequests creates a ListNetworkJWTsTooManyRequests with default headers values +func NewListNetworkJWTsTooManyRequests() *ListNetworkJWTsTooManyRequests { + return &ListNetworkJWTsTooManyRequests{} +} + +/* ListNetworkJWTsTooManyRequests describes a response with status code 429, with default header values. + +The resource requested is rate limited and the rate limit has been exceeded +*/ +type ListNetworkJWTsTooManyRequests struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListNetworkJWTsTooManyRequests) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsTooManyRequests %+v", 429, o.Payload) +} +func (o *ListNetworkJWTsTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/rest_client_api_client/ziti_edge_client_client.go b/rest_client_api_client/ziti_edge_client_client.go index 5770c64e..a85e7b0d 100644 --- a/rest_client_api_client/ziti_edge_client_client.go +++ b/rest_client_api_client/ziti_edge_client_client.go @@ -39,6 +39,7 @@ import ( "github.com/openziti/edge-api/rest_client_api_client/current_api_session" "github.com/openziti/edge-api/rest_client_api_client/current_identity" "github.com/openziti/edge-api/rest_client_api_client/enroll" + "github.com/openziti/edge-api/rest_client_api_client/enrollment" "github.com/openziti/edge-api/rest_client_api_client/external_jwt_signer" "github.com/openziti/edge-api/rest_client_api_client/informational" "github.com/openziti/edge-api/rest_client_api_client/posture_checks" @@ -94,6 +95,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *ZitiEdgeCl cli.CurrentAPISession = current_api_session.New(transport, formats) cli.CurrentIdentity = current_identity.New(transport, formats) cli.Enroll = enroll.New(transport, formats) + cli.Enrollment = enrollment.New(transport, formats) cli.ExternalJWTSigner = external_jwt_signer.New(transport, formats) cli.Informational = informational.New(transport, formats) cli.PostureChecks = posture_checks.New(transport, formats) @@ -154,6 +156,8 @@ type ZitiEdgeClient struct { Enroll enroll.ClientService + Enrollment enrollment.ClientService + ExternalJWTSigner external_jwt_signer.ClientService Informational informational.ClientService @@ -177,6 +181,7 @@ func (c *ZitiEdgeClient) SetTransport(transport runtime.ClientTransport) { c.CurrentAPISession.SetTransport(transport) c.CurrentIdentity.SetTransport(transport) c.Enroll.SetTransport(transport) + c.Enrollment.SetTransport(transport) c.ExternalJWTSigner.SetTransport(transport) c.Informational.SetTransport(transport) c.PostureChecks.SetTransport(transport) diff --git a/rest_client_api_server/configure_ziti_edge_client.go b/rest_client_api_server/configure_ziti_edge_client.go index e1220ad0..cae28137 100644 --- a/rest_client_api_server/configure_ziti_edge_client.go +++ b/rest_client_api_server/configure_ziti_edge_client.go @@ -41,6 +41,7 @@ import ( "github.com/openziti/edge-api/rest_client_api_server/operations/current_api_session" "github.com/openziti/edge-api/rest_client_api_server/operations/current_identity" "github.com/openziti/edge-api/rest_client_api_server/operations/enroll" + "github.com/openziti/edge-api/rest_client_api_server/operations/enrollment" "github.com/openziti/edge-api/rest_client_api_server/operations/external_jwt_signer" "github.com/openziti/edge-api/rest_client_api_server/operations/informational" "github.com/openziti/edge-api/rest_client_api_server/operations/posture_checks" @@ -313,6 +314,11 @@ func configureAPI(api *operations.ZitiEdgeClientAPI) http.Handler { return middleware.NotImplemented("operation external_jwt_signer.ListExternalJWTSigners has not yet been implemented") }) } + if api.EnrollmentListNetworkJWTsHandler == nil { + api.EnrollmentListNetworkJWTsHandler = enrollment.ListNetworkJWTsHandlerFunc(func(params enrollment.ListNetworkJWTsParams) middleware.Responder { + return middleware.NotImplemented("operation enrollment.ListNetworkJWTs has not yet been implemented") + }) + } if api.InformationalListProtocolsHandler == nil { api.InformationalListProtocolsHandler = informational.ListProtocolsHandlerFunc(func(params informational.ListProtocolsParams) middleware.Responder { return middleware.NotImplemented("operation informational.ListProtocols has not yet been implemented") diff --git a/rest_client_api_server/embedded_spec.go b/rest_client_api_server/embedded_spec.go index 817ba839..0362ef89 100644 --- a/rest_client_api_server/embedded_spec.go +++ b/rest_client_api_server/embedded_spec.go @@ -3200,6 +3200,108 @@ func init() { } } }, + "/network-jwts": { + "get": { + "description": "Returns a list of JWTs for trusting a network", + "tags": [ + "Enrollment" + ], + "summary": "Returns a list of JWTs suitable for bootstrapping network trust.", + "operationId": "listNetworkJWTs", + "responses": { + "200": { + "description": "A list of network JWTs", + "schema": { + "$ref": "#/definitions/listNetworkJWTsEnvelope" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "401": { + "description": "The supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, "/posture-response": { "post": { "security": [ @@ -6660,6 +6762,21 @@ func init() { } } }, + "listNetworkJWTsEnvelope": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/networkJWTList" + }, + "meta": { + "$ref": "#/definitions/meta" + } + } + }, "listProtocols": { "type": "object", "additionalProperties": { @@ -6803,6 +6920,34 @@ func init() { "url" ] }, + "networkJWT": { + "description": "A network JWT", + "type": "object", + "allOf": [ + { + "type": "object", + "required": [ + "name", + "token" + ], + "properties": { + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + } + } + ] + }, + "networkJWTList": { + "description": "An array of network JWTs", + "type": "array", + "items": { + "$ref": "#/definitions/networkJWT" + } + }, "nonceChallenge": { "type": "object", "required": [ @@ -10828,6 +10973,108 @@ func init() { } } }, + "/network-jwts": { + "get": { + "description": "Returns a list of JWTs for trusting a network", + "tags": [ + "Enrollment" + ], + "summary": "Returns a list of JWTs suitable for bootstrapping network trust.", + "operationId": "listNetworkJWTs", + "responses": { + "200": { + "description": "A list of network JWTs", + "schema": { + "$ref": "#/definitions/listNetworkJWTsEnvelope" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "401": { + "description": "The supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, "/posture-response": { "post": { "security": [ @@ -14371,6 +14618,21 @@ func init() { } } }, + "listNetworkJWTsEnvelope": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/networkJWTList" + }, + "meta": { + "$ref": "#/definitions/meta" + } + } + }, "listProtocols": { "type": "object", "additionalProperties": { @@ -14514,6 +14776,34 @@ func init() { "url" ] }, + "networkJWT": { + "description": "A network JWT", + "type": "object", + "allOf": [ + { + "type": "object", + "required": [ + "name", + "token" + ], + "properties": { + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + } + } + ] + }, + "networkJWTList": { + "description": "An array of network JWTs", + "type": "array", + "items": { + "$ref": "#/definitions/networkJWT" + } + }, "nonceChallenge": { "type": "object", "required": [ diff --git a/rest_client_api_server/operations/enrollment/list_network_j_w_ts.go b/rest_client_api_server/operations/enrollment/list_network_j_w_ts.go new file mode 100644 index 00000000..5b1c2a70 --- /dev/null +++ b/rest_client_api_server/operations/enrollment/list_network_j_w_ts.go @@ -0,0 +1,82 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// ListNetworkJWTsHandlerFunc turns a function with the right signature into a list network j w ts handler +type ListNetworkJWTsHandlerFunc func(ListNetworkJWTsParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn ListNetworkJWTsHandlerFunc) Handle(params ListNetworkJWTsParams) middleware.Responder { + return fn(params) +} + +// ListNetworkJWTsHandler interface for that can handle valid list network j w ts params +type ListNetworkJWTsHandler interface { + Handle(ListNetworkJWTsParams) middleware.Responder +} + +// NewListNetworkJWTs creates a new http.Handler for the list network j w ts operation +func NewListNetworkJWTs(ctx *middleware.Context, handler ListNetworkJWTsHandler) *ListNetworkJWTs { + return &ListNetworkJWTs{Context: ctx, Handler: handler} +} + +/* ListNetworkJWTs swagger:route GET /network-jwts Enrollment listNetworkJWTs + +Returns a list of JWTs suitable for bootstrapping network trust. + +Returns a list of JWTs for trusting a network + +*/ +type ListNetworkJWTs struct { + Context *middleware.Context + Handler ListNetworkJWTsHandler +} + +func (o *ListNetworkJWTs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewListNetworkJWTsParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/rest_client_api_server/operations/enrollment/list_network_j_w_ts_parameters.go b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_parameters.go new file mode 100644 index 00000000..929c35f8 --- /dev/null +++ b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_parameters.go @@ -0,0 +1,70 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" +) + +// NewListNetworkJWTsParams creates a new ListNetworkJWTsParams object +// +// There are no default values defined in the spec. +func NewListNetworkJWTsParams() ListNetworkJWTsParams { + + return ListNetworkJWTsParams{} +} + +// ListNetworkJWTsParams contains all the bound params for the list network j w ts operation +// typically these are obtained from a http.Request +// +// swagger:parameters listNetworkJWTs +type ListNetworkJWTsParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewListNetworkJWTsParams() beforehand. +func (o *ListNetworkJWTsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go new file mode 100644 index 00000000..e61e8500 --- /dev/null +++ b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go @@ -0,0 +1,214 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/openziti/edge-api/rest_model" +) + +// ListNetworkJWTsOKCode is the HTTP code returned for type ListNetworkJWTsOK +const ListNetworkJWTsOKCode int = 200 + +/*ListNetworkJWTsOK A list of network JWTs + +swagger:response listNetworkJWTsOK +*/ +type ListNetworkJWTsOK struct { + + /* + In: Body + */ + Payload *rest_model.ListNetworkJWTsEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsOK creates ListNetworkJWTsOK with default headers values +func NewListNetworkJWTsOK() *ListNetworkJWTsOK { + + return &ListNetworkJWTsOK{} +} + +// WithPayload adds the payload to the list network j w ts o k response +func (o *ListNetworkJWTsOK) WithPayload(payload *rest_model.ListNetworkJWTsEnvelope) *ListNetworkJWTsOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts o k response +func (o *ListNetworkJWTsOK) SetPayload(payload *rest_model.ListNetworkJWTsEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(200) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListNetworkJWTsBadRequestCode is the HTTP code returned for type ListNetworkJWTsBadRequest +const ListNetworkJWTsBadRequestCode int = 400 + +/*ListNetworkJWTsBadRequest The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information + +swagger:response listNetworkJWTsBadRequest +*/ +type ListNetworkJWTsBadRequest struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsBadRequest creates ListNetworkJWTsBadRequest with default headers values +func NewListNetworkJWTsBadRequest() *ListNetworkJWTsBadRequest { + + return &ListNetworkJWTsBadRequest{} +} + +// WithPayload adds the payload to the list network j w ts bad request response +func (o *ListNetworkJWTsBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts bad request response +func (o *ListNetworkJWTsBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListNetworkJWTsUnauthorizedCode is the HTTP code returned for type ListNetworkJWTsUnauthorized +const ListNetworkJWTsUnauthorizedCode int = 401 + +/*ListNetworkJWTsUnauthorized The supplied session does not have the correct access rights to request this resource + +swagger:response listNetworkJWTsUnauthorized +*/ +type ListNetworkJWTsUnauthorized struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsUnauthorized creates ListNetworkJWTsUnauthorized with default headers values +func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { + + return &ListNetworkJWTsUnauthorized{} +} + +// WithPayload adds the payload to the list network j w ts unauthorized response +func (o *ListNetworkJWTsUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts unauthorized response +func (o *ListNetworkJWTsUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListNetworkJWTsTooManyRequestsCode is the HTTP code returned for type ListNetworkJWTsTooManyRequests +const ListNetworkJWTsTooManyRequestsCode int = 429 + +/*ListNetworkJWTsTooManyRequests The resource requested is rate limited and the rate limit has been exceeded + +swagger:response listNetworkJWTsTooManyRequests +*/ +type ListNetworkJWTsTooManyRequests struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsTooManyRequests creates ListNetworkJWTsTooManyRequests with default headers values +func NewListNetworkJWTsTooManyRequests() *ListNetworkJWTsTooManyRequests { + + return &ListNetworkJWTsTooManyRequests{} +} + +// WithPayload adds the payload to the list network j w ts too many requests response +func (o *ListNetworkJWTsTooManyRequests) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsTooManyRequests { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts too many requests response +func (o *ListNetworkJWTsTooManyRequests) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(429) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/rest_client_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go new file mode 100644 index 00000000..730ff41d --- /dev/null +++ b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go @@ -0,0 +1,111 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// ListNetworkJWTsURL generates an URL for the list network j w ts operation +type ListNetworkJWTsURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *ListNetworkJWTsURL) WithBasePath(bp string) *ListNetworkJWTsURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *ListNetworkJWTsURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *ListNetworkJWTsURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/network-jwts" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/edge/client/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *ListNetworkJWTsURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *ListNetworkJWTsURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *ListNetworkJWTsURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on ListNetworkJWTsURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on ListNetworkJWTsURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *ListNetworkJWTsURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/rest_client_api_server/operations/ziti_edge_client_api.go b/rest_client_api_server/operations/ziti_edge_client_api.go index 974c4dc3..e6c6569c 100644 --- a/rest_client_api_server/operations/ziti_edge_client_api.go +++ b/rest_client_api_server/operations/ziti_edge_client_api.go @@ -49,6 +49,7 @@ import ( "github.com/openziti/edge-api/rest_client_api_server/operations/current_api_session" "github.com/openziti/edge-api/rest_client_api_server/operations/current_identity" "github.com/openziti/edge-api/rest_client_api_server/operations/enroll" + "github.com/openziti/edge-api/rest_client_api_server/operations/enrollment" "github.com/openziti/edge-api/rest_client_api_server/operations/external_jwt_signer" "github.com/openziti/edge-api/rest_client_api_server/operations/informational" "github.com/openziti/edge-api/rest_client_api_server/operations/posture_checks" @@ -219,6 +220,9 @@ func NewZitiEdgeClientAPI(spec *loads.Document) *ZitiEdgeClientAPI { ExternalJWTSignerListExternalJWTSignersHandler: external_jwt_signer.ListExternalJWTSignersHandlerFunc(func(params external_jwt_signer.ListExternalJWTSignersParams) middleware.Responder { return middleware.NotImplemented("operation external_jwt_signer.ListExternalJWTSigners has not yet been implemented") }), + EnrollmentListNetworkJWTsHandler: enrollment.ListNetworkJWTsHandlerFunc(func(params enrollment.ListNetworkJWTsParams) middleware.Responder { + return middleware.NotImplemented("operation enrollment.ListNetworkJWTs has not yet been implemented") + }), InformationalListProtocolsHandler: informational.ListProtocolsHandlerFunc(func(params informational.ListProtocolsParams) middleware.Responder { return middleware.NotImplemented("operation informational.ListProtocols has not yet been implemented") }), @@ -424,6 +428,8 @@ type ZitiEdgeClientAPI struct { InformationalListEnumeratedCapabilitiesHandler informational.ListEnumeratedCapabilitiesHandler // ExternalJWTSignerListExternalJWTSignersHandler sets the operation handler for the list external Jwt signers operation ExternalJWTSignerListExternalJWTSignersHandler external_jwt_signer.ListExternalJWTSignersHandler + // EnrollmentListNetworkJWTsHandler sets the operation handler for the list network j w ts operation + EnrollmentListNetworkJWTsHandler enrollment.ListNetworkJWTsHandler // InformationalListProtocolsHandler sets the operation handler for the list protocols operation InformationalListProtocolsHandler informational.ListProtocolsHandler // InformationalListRootHandler sets the operation handler for the list root operation @@ -682,6 +688,9 @@ func (o *ZitiEdgeClientAPI) Validate() error { if o.ExternalJWTSignerListExternalJWTSignersHandler == nil { unregistered = append(unregistered, "external_jwt_signer.ListExternalJWTSignersHandler") } + if o.EnrollmentListNetworkJWTsHandler == nil { + unregistered = append(unregistered, "enrollment.ListNetworkJWTsHandler") + } if o.InformationalListProtocolsHandler == nil { unregistered = append(unregistered, "informational.ListProtocolsHandler") } @@ -1008,6 +1017,10 @@ func (o *ZitiEdgeClientAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } + o.handlers["GET"]["/network-jwts"] = enrollment.NewListNetworkJWTs(o.context, o.EnrollmentListNetworkJWTsHandler) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } o.handlers["GET"]["/protocols"] = informational.NewListProtocols(o.context, o.InformationalListProtocolsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) diff --git a/rest_management_api_client/enrollment/enrollment_client.go b/rest_management_api_client/enrollment/enrollment_client.go index f9c057b1..3b377ce8 100644 --- a/rest_management_api_client/enrollment/enrollment_client.go +++ b/rest_management_api_client/enrollment/enrollment_client.go @@ -62,6 +62,8 @@ type ClientService interface { ListEnrollments(params *ListEnrollmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnrollmentsOK, error) + ListNetworkJWTs(params *ListNetworkJWTsParams, opts ...ClientOption) (*ListNetworkJWTsOK, error) + RefreshEnrollment(params *RefreshEnrollmentParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RefreshEnrollmentOK, error) SetTransport(transport runtime.ClientTransport) @@ -232,6 +234,46 @@ func (a *Client) ListEnrollments(params *ListEnrollmentsParams, authInfo runtime panic(msg) } +/* + ListNetworkJWTs returns a list of j w ts suitable for bootstrapping network trust + + Returns a list of JWTs for trusting a network +*/ +func (a *Client) ListNetworkJWTs(params *ListNetworkJWTsParams, opts ...ClientOption) (*ListNetworkJWTsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListNetworkJWTsParams() + } + op := &runtime.ClientOperation{ + ID: "listNetworkJWTs", + Method: "GET", + PathPattern: "/network-jwts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListNetworkJWTsReader{formats: a.formats}, + 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.(*ListNetworkJWTsOK) + 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 listNetworkJWTs: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* RefreshEnrollment refreshes an enrollment record s expiration window diff --git a/rest_management_api_client/enrollment/list_network_j_w_ts_parameters.go b/rest_management_api_client/enrollment/list_network_j_w_ts_parameters.go new file mode 100644 index 00000000..a81a81c6 --- /dev/null +++ b/rest_management_api_client/enrollment/list_network_j_w_ts_parameters.go @@ -0,0 +1,150 @@ +// 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 enrollment + +// 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" +) + +// NewListNetworkJWTsParams creates a new ListNetworkJWTsParams 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 NewListNetworkJWTsParams() *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListNetworkJWTsParamsWithTimeout creates a new ListNetworkJWTsParams object +// with the ability to set a timeout on a request. +func NewListNetworkJWTsParamsWithTimeout(timeout time.Duration) *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + timeout: timeout, + } +} + +// NewListNetworkJWTsParamsWithContext creates a new ListNetworkJWTsParams object +// with the ability to set a context for a request. +func NewListNetworkJWTsParamsWithContext(ctx context.Context) *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + Context: ctx, + } +} + +// NewListNetworkJWTsParamsWithHTTPClient creates a new ListNetworkJWTsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListNetworkJWTsParamsWithHTTPClient(client *http.Client) *ListNetworkJWTsParams { + return &ListNetworkJWTsParams{ + HTTPClient: client, + } +} + +/* ListNetworkJWTsParams contains all the parameters to send to the API endpoint + for the list network j w ts operation. + + Typically these are written to a http.Request. +*/ +type ListNetworkJWTsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list network j w ts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListNetworkJWTsParams) WithDefaults() *ListNetworkJWTsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list network j w ts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListNetworkJWTsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list network j w ts params +func (o *ListNetworkJWTsParams) WithTimeout(timeout time.Duration) *ListNetworkJWTsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list network j w ts params +func (o *ListNetworkJWTsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list network j w ts params +func (o *ListNetworkJWTsParams) WithContext(ctx context.Context) *ListNetworkJWTsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list network j w ts params +func (o *ListNetworkJWTsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list network j w ts params +func (o *ListNetworkJWTsParams) WithHTTPClient(client *http.Client) *ListNetworkJWTsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list network j w ts params +func (o *ListNetworkJWTsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListNetworkJWTsParams) 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 +} diff --git a/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go b/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go new file mode 100644 index 00000000..efb85237 --- /dev/null +++ b/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go @@ -0,0 +1,205 @@ +// 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 enrollment + +// 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/edge-api/rest_model" +) + +// ListNetworkJWTsReader is a Reader for the ListNetworkJWTs structure. +type ListNetworkJWTsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListNetworkJWTsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListNetworkJWTsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListNetworkJWTsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListNetworkJWTsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewListNetworkJWTsTooManyRequests() + 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()) + } +} + +// NewListNetworkJWTsOK creates a ListNetworkJWTsOK with default headers values +func NewListNetworkJWTsOK() *ListNetworkJWTsOK { + return &ListNetworkJWTsOK{} +} + +/* ListNetworkJWTsOK describes a response with status code 200, with default header values. + +A list of network JWTs +*/ +type ListNetworkJWTsOK struct { + Payload *rest_model.ListNetworkJWTsEnvelope +} + +func (o *ListNetworkJWTsOK) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsOK %+v", 200, o.Payload) +} +func (o *ListNetworkJWTsOK) GetPayload() *rest_model.ListNetworkJWTsEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.ListNetworkJWTsEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListNetworkJWTsBadRequest creates a ListNetworkJWTsBadRequest with default headers values +func NewListNetworkJWTsBadRequest() *ListNetworkJWTsBadRequest { + return &ListNetworkJWTsBadRequest{} +} + +/* ListNetworkJWTsBadRequest describes a response with status code 400, with default header values. + +The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information +*/ +type ListNetworkJWTsBadRequest struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListNetworkJWTsBadRequest) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsBadRequest %+v", 400, o.Payload) +} +func (o *ListNetworkJWTsBadRequest) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListNetworkJWTsUnauthorized creates a ListNetworkJWTsUnauthorized with default headers values +func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { + return &ListNetworkJWTsUnauthorized{} +} + +/* ListNetworkJWTsUnauthorized describes a response with status code 401, with default header values. + +The supplied session does not have the correct access rights to request this resource +*/ +type ListNetworkJWTsUnauthorized struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListNetworkJWTsUnauthorized) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsUnauthorized %+v", 401, o.Payload) +} +func (o *ListNetworkJWTsUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListNetworkJWTsTooManyRequests creates a ListNetworkJWTsTooManyRequests with default headers values +func NewListNetworkJWTsTooManyRequests() *ListNetworkJWTsTooManyRequests { + return &ListNetworkJWTsTooManyRequests{} +} + +/* ListNetworkJWTsTooManyRequests describes a response with status code 429, with default header values. + +The resource requested is rate limited and the rate limit has been exceeded +*/ +type ListNetworkJWTsTooManyRequests struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListNetworkJWTsTooManyRequests) Error() string { + return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsTooManyRequests %+v", 429, o.Payload) +} +func (o *ListNetworkJWTsTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListNetworkJWTsTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.APIErrorEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/rest_management_api_server/configure_ziti_edge_management.go b/rest_management_api_server/configure_ziti_edge_management.go index 060e8b0e..0d0ecc5f 100644 --- a/rest_management_api_server/configure_ziti_edge_management.go +++ b/rest_management_api_server/configure_ziti_edge_management.go @@ -706,6 +706,11 @@ func configureAPI(api *operations.ZitiEdgeManagementAPI) http.Handler { return middleware.NotImplemented("operation identity.ListIdentitysServiceConfigs has not yet been implemented") }) } + if api.EnrollmentListNetworkJWTsHandler == nil { + api.EnrollmentListNetworkJWTsHandler = enrollment.ListNetworkJWTsHandlerFunc(func(params enrollment.ListNetworkJWTsParams) middleware.Responder { + return middleware.NotImplemented("operation enrollment.ListNetworkJWTs has not yet been implemented") + }) + } if api.RoleAttributesListPostureCheckRoleAttributesHandler == nil { api.RoleAttributesListPostureCheckRoleAttributesHandler = role_attributes.ListPostureCheckRoleAttributesHandlerFunc(func(params role_attributes.ListPostureCheckRoleAttributesParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation role_attributes.ListPostureCheckRoleAttributes has not yet been implemented") diff --git a/rest_management_api_server/embedded_spec.go b/rest_management_api_server/embedded_spec.go index 2bd9c2dc..eca0f72e 100644 --- a/rest_management_api_server/embedded_spec.go +++ b/rest_management_api_server/embedded_spec.go @@ -13935,6 +13935,108 @@ func init() { } ] }, + "/network-jwts": { + "get": { + "description": "Returns a list of JWTs for trusting a network", + "tags": [ + "Enrollment" + ], + "summary": "Returns a list of JWTs suitable for bootstrapping network trust.", + "operationId": "listNetworkJWTs", + "responses": { + "200": { + "description": "A list of network JWTs", + "schema": { + "$ref": "#/definitions/listNetworkJWTsEnvelope" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "401": { + "description": "The supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, "/posture-check-role-attributes": { "get": { "security": [ @@ -25613,6 +25715,21 @@ func init() { } } }, + "listNetworkJWTsEnvelope": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/networkJWTList" + }, + "meta": { + "$ref": "#/definitions/meta" + } + } + }, "listPostureCheckEnvelope": { "type": "object", "required": [ @@ -25882,6 +25999,34 @@ func init() { }, "x-omitempty": false }, + "networkJWT": { + "description": "A network JWT", + "type": "object", + "allOf": [ + { + "type": "object", + "required": [ + "name", + "token" + ], + "properties": { + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + } + } + ] + }, + "networkJWTList": { + "description": "An array of network JWTs", + "type": "array", + "items": { + "$ref": "#/definitions/networkJWT" + } + }, "operatingSystem": { "type": "object", "required": [ @@ -42408,6 +42553,108 @@ func init() { } ] }, + "/network-jwts": { + "get": { + "description": "Returns a list of JWTs for trusting a network", + "tags": [ + "Enrollment" + ], + "summary": "Returns a list of JWTs suitable for bootstrapping network trust.", + "operationId": "listNetworkJWTs", + "responses": { + "200": { + "description": "A list of network JWTs", + "schema": { + "$ref": "#/definitions/listNetworkJWTsEnvelope" + } + }, + "400": { + "description": "The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": { + "details": { + "context": "(root)", + "field": "(root)", + "property": "fooField3" + }, + "field": "(root)", + "message": "(root): fooField3 is required", + "type": "required", + "value": { + "fooField": "abc", + "fooField2": "def" + } + }, + "causeMessage": "schema validation failed", + "code": "COULD_NOT_VALIDATE", + "message": "The supplied request contains an invalid document", + "requestId": "ac6766d6-3a09-44b3-8d8a-1b541d97fdd9" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "401": { + "description": "The supplied session does not have the correct access rights to request this resource", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "cause": "", + "causeMessage": "", + "code": "UNAUTHORIZED", + "message": "The request could not be completed. The session is not authorized or the credentials are invalid", + "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + }, + "429": { + "description": "The resource requested is rate limited and the rate limit has been exceeded", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": {} + }, + "causeMessage": "you have hit a rate limit in the requested operation", + "code": "RATE_LIMITED", + "message": "The resource is rate limited and the rate limit has been exceeded. Please try again later", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "meta": { + "apiEnrollmentVersion": "0.0.1", + "apiVersion": "0.0.1" + } + } + } + } + } + } + }, "/posture-check-role-attributes": { "get": { "security": [ @@ -54186,6 +54433,21 @@ func init() { } } }, + "listNetworkJWTsEnvelope": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/networkJWTList" + }, + "meta": { + "$ref": "#/definitions/meta" + } + } + }, "listPostureCheckEnvelope": { "type": "object", "required": [ @@ -54455,6 +54717,34 @@ func init() { }, "x-omitempty": false }, + "networkJWT": { + "description": "A network JWT", + "type": "object", + "allOf": [ + { + "type": "object", + "required": [ + "name", + "token" + ], + "properties": { + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + } + } + ] + }, + "networkJWTList": { + "description": "An array of network JWTs", + "type": "array", + "items": { + "$ref": "#/definitions/networkJWT" + } + }, "operatingSystem": { "type": "object", "required": [ diff --git a/rest_management_api_server/operations/enrollment/list_network_j_w_ts.go b/rest_management_api_server/operations/enrollment/list_network_j_w_ts.go new file mode 100644 index 00000000..5b1c2a70 --- /dev/null +++ b/rest_management_api_server/operations/enrollment/list_network_j_w_ts.go @@ -0,0 +1,82 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" +) + +// ListNetworkJWTsHandlerFunc turns a function with the right signature into a list network j w ts handler +type ListNetworkJWTsHandlerFunc func(ListNetworkJWTsParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn ListNetworkJWTsHandlerFunc) Handle(params ListNetworkJWTsParams) middleware.Responder { + return fn(params) +} + +// ListNetworkJWTsHandler interface for that can handle valid list network j w ts params +type ListNetworkJWTsHandler interface { + Handle(ListNetworkJWTsParams) middleware.Responder +} + +// NewListNetworkJWTs creates a new http.Handler for the list network j w ts operation +func NewListNetworkJWTs(ctx *middleware.Context, handler ListNetworkJWTsHandler) *ListNetworkJWTs { + return &ListNetworkJWTs{Context: ctx, Handler: handler} +} + +/* ListNetworkJWTs swagger:route GET /network-jwts Enrollment listNetworkJWTs + +Returns a list of JWTs suitable for bootstrapping network trust. + +Returns a list of JWTs for trusting a network + +*/ +type ListNetworkJWTs struct { + Context *middleware.Context + Handler ListNetworkJWTsHandler +} + +func (o *ListNetworkJWTs) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewListNetworkJWTsParams() + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/rest_management_api_server/operations/enrollment/list_network_j_w_ts_parameters.go b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_parameters.go new file mode 100644 index 00000000..929c35f8 --- /dev/null +++ b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_parameters.go @@ -0,0 +1,70 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" +) + +// NewListNetworkJWTsParams creates a new ListNetworkJWTsParams object +// +// There are no default values defined in the spec. +func NewListNetworkJWTsParams() ListNetworkJWTsParams { + + return ListNetworkJWTsParams{} +} + +// ListNetworkJWTsParams contains all the bound params for the list network j w ts operation +// typically these are obtained from a http.Request +// +// swagger:parameters listNetworkJWTs +type ListNetworkJWTsParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewListNetworkJWTsParams() beforehand. +func (o *ListNetworkJWTsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go new file mode 100644 index 00000000..e61e8500 --- /dev/null +++ b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go @@ -0,0 +1,214 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/openziti/edge-api/rest_model" +) + +// ListNetworkJWTsOKCode is the HTTP code returned for type ListNetworkJWTsOK +const ListNetworkJWTsOKCode int = 200 + +/*ListNetworkJWTsOK A list of network JWTs + +swagger:response listNetworkJWTsOK +*/ +type ListNetworkJWTsOK struct { + + /* + In: Body + */ + Payload *rest_model.ListNetworkJWTsEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsOK creates ListNetworkJWTsOK with default headers values +func NewListNetworkJWTsOK() *ListNetworkJWTsOK { + + return &ListNetworkJWTsOK{} +} + +// WithPayload adds the payload to the list network j w ts o k response +func (o *ListNetworkJWTsOK) WithPayload(payload *rest_model.ListNetworkJWTsEnvelope) *ListNetworkJWTsOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts o k response +func (o *ListNetworkJWTsOK) SetPayload(payload *rest_model.ListNetworkJWTsEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(200) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListNetworkJWTsBadRequestCode is the HTTP code returned for type ListNetworkJWTsBadRequest +const ListNetworkJWTsBadRequestCode int = 400 + +/*ListNetworkJWTsBadRequest The supplied request contains invalid fields or could not be parsed (json and non-json bodies). The error's code, message, and cause fields can be inspected for further information + +swagger:response listNetworkJWTsBadRequest +*/ +type ListNetworkJWTsBadRequest struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsBadRequest creates ListNetworkJWTsBadRequest with default headers values +func NewListNetworkJWTsBadRequest() *ListNetworkJWTsBadRequest { + + return &ListNetworkJWTsBadRequest{} +} + +// WithPayload adds the payload to the list network j w ts bad request response +func (o *ListNetworkJWTsBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts bad request response +func (o *ListNetworkJWTsBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(400) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListNetworkJWTsUnauthorizedCode is the HTTP code returned for type ListNetworkJWTsUnauthorized +const ListNetworkJWTsUnauthorizedCode int = 401 + +/*ListNetworkJWTsUnauthorized The supplied session does not have the correct access rights to request this resource + +swagger:response listNetworkJWTsUnauthorized +*/ +type ListNetworkJWTsUnauthorized struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsUnauthorized creates ListNetworkJWTsUnauthorized with default headers values +func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { + + return &ListNetworkJWTsUnauthorized{} +} + +// WithPayload adds the payload to the list network j w ts unauthorized response +func (o *ListNetworkJWTsUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts unauthorized response +func (o *ListNetworkJWTsUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(401) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListNetworkJWTsTooManyRequestsCode is the HTTP code returned for type ListNetworkJWTsTooManyRequests +const ListNetworkJWTsTooManyRequestsCode int = 429 + +/*ListNetworkJWTsTooManyRequests The resource requested is rate limited and the rate limit has been exceeded + +swagger:response listNetworkJWTsTooManyRequests +*/ +type ListNetworkJWTsTooManyRequests struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListNetworkJWTsTooManyRequests creates ListNetworkJWTsTooManyRequests with default headers values +func NewListNetworkJWTsTooManyRequests() *ListNetworkJWTsTooManyRequests { + + return &ListNetworkJWTsTooManyRequests{} +} + +// WithPayload adds the payload to the list network j w ts too many requests response +func (o *ListNetworkJWTsTooManyRequests) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsTooManyRequests { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list network j w ts too many requests response +func (o *ListNetworkJWTsTooManyRequests) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListNetworkJWTsTooManyRequests) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(429) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/rest_management_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go new file mode 100644 index 00000000..e4b111b0 --- /dev/null +++ b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_urlbuilder.go @@ -0,0 +1,111 @@ +// 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 enrollment + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// ListNetworkJWTsURL generates an URL for the list network j w ts operation +type ListNetworkJWTsURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *ListNetworkJWTsURL) WithBasePath(bp string) *ListNetworkJWTsURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *ListNetworkJWTsURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *ListNetworkJWTsURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/network-jwts" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/edge/management/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *ListNetworkJWTsURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *ListNetworkJWTsURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *ListNetworkJWTsURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on ListNetworkJWTsURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on ListNetworkJWTsURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *ListNetworkJWTsURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/rest_management_api_server/operations/ziti_edge_management_api.go b/rest_management_api_server/operations/ziti_edge_management_api.go index 78fdb039..10a694bc 100644 --- a/rest_management_api_server/operations/ziti_edge_management_api.go +++ b/rest_management_api_server/operations/ziti_edge_management_api.go @@ -458,6 +458,9 @@ func NewZitiEdgeManagementAPI(spec *loads.Document) *ZitiEdgeManagementAPI { IdentityListIdentitysServiceConfigsHandler: identity.ListIdentitysServiceConfigsHandlerFunc(func(params identity.ListIdentitysServiceConfigsParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation identity.ListIdentitysServiceConfigs has not yet been implemented") }), + EnrollmentListNetworkJWTsHandler: enrollment.ListNetworkJWTsHandlerFunc(func(params enrollment.ListNetworkJWTsParams) middleware.Responder { + return middleware.NotImplemented("operation enrollment.ListNetworkJWTs has not yet been implemented") + }), RoleAttributesListPostureCheckRoleAttributesHandler: role_attributes.ListPostureCheckRoleAttributesHandlerFunc(func(params role_attributes.ListPostureCheckRoleAttributesParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation role_attributes.ListPostureCheckRoleAttributes has not yet been implemented") }), @@ -970,6 +973,8 @@ type ZitiEdgeManagementAPI struct { IdentityListIdentitysEdgeRouterPoliciesHandler identity.ListIdentitysEdgeRouterPoliciesHandler // IdentityListIdentitysServiceConfigsHandler sets the operation handler for the list identitys service configs operation IdentityListIdentitysServiceConfigsHandler identity.ListIdentitysServiceConfigsHandler + // EnrollmentListNetworkJWTsHandler sets the operation handler for the list network j w ts operation + EnrollmentListNetworkJWTsHandler enrollment.ListNetworkJWTsHandler // RoleAttributesListPostureCheckRoleAttributesHandler sets the operation handler for the list posture check role attributes operation RoleAttributesListPostureCheckRoleAttributesHandler role_attributes.ListPostureCheckRoleAttributesHandler // PostureChecksListPostureCheckTypesHandler sets the operation handler for the list posture check types operation @@ -1559,6 +1564,9 @@ func (o *ZitiEdgeManagementAPI) Validate() error { if o.IdentityListIdentitysServiceConfigsHandler == nil { unregistered = append(unregistered, "identity.ListIdentitysServiceConfigsHandler") } + if o.EnrollmentListNetworkJWTsHandler == nil { + unregistered = append(unregistered, "enrollment.ListNetworkJWTsHandler") + } if o.RoleAttributesListPostureCheckRoleAttributesHandler == nil { unregistered = append(unregistered, "role_attributes.ListPostureCheckRoleAttributesHandler") } @@ -2348,6 +2356,10 @@ func (o *ZitiEdgeManagementAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } + o.handlers["GET"]["/network-jwts"] = enrollment.NewListNetworkJWTs(o.context, o.EnrollmentListNetworkJWTsHandler) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } o.handlers["GET"]["/posture-check-role-attributes"] = role_attributes.NewListPostureCheckRoleAttributes(o.context, o.RoleAttributesListPostureCheckRoleAttributesHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) diff --git a/rest_model/list_network_j_w_ts_envelope.go b/rest_model/list_network_j_w_ts_envelope.go new file mode 100644 index 00000000..c4fc7c5f --- /dev/null +++ b/rest_model/list_network_j_w_ts_envelope.go @@ -0,0 +1,175 @@ +// 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 rest_model + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ListNetworkJWTsEnvelope list network j w ts envelope +// +// swagger:model listNetworkJWTsEnvelope +type ListNetworkJWTsEnvelope struct { + + // data + // Required: true + Data NetworkJWTList `json:"data"` + + // meta + // Required: true + Meta *Meta `json:"meta"` +} + +// Validate validates this list network j w ts envelope +func (m *ListNetworkJWTsEnvelope) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateData(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMeta(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListNetworkJWTsEnvelope) validateData(formats strfmt.Registry) error { + + if err := validate.Required("data", "body", m.Data); err != nil { + return err + } + + if err := m.Data.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("data") + } + return err + } + + return nil +} + +func (m *ListNetworkJWTsEnvelope) validateMeta(formats strfmt.Registry) error { + + if err := validate.Required("meta", "body", m.Meta); err != nil { + return err + } + + if m.Meta != nil { + if err := m.Meta.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("meta") + } + return err + } + } + + return nil +} + +// ContextValidate validate this list network j w ts envelope based on the context it is used +func (m *ListNetworkJWTsEnvelope) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateData(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ListNetworkJWTsEnvelope) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Data.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("data") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("data") + } + return err + } + + return nil +} + +func (m *ListNetworkJWTsEnvelope) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("meta") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ListNetworkJWTsEnvelope) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListNetworkJWTsEnvelope) UnmarshalBinary(b []byte) error { + var res ListNetworkJWTsEnvelope + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rest_model/network_jwt.go b/rest_model/network_jwt.go new file mode 100644 index 00000000..dbb9ecde --- /dev/null +++ b/rest_model/network_jwt.go @@ -0,0 +1,153 @@ +// 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 rest_model + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkJWT A network JWT +// +// swagger:model networkJWT +type NetworkJWT struct { + + // name + // Required: true + Name *string `json:"name"` + + // token + // Required: true + Token *string `json:"token"` +} + +// UnmarshalJSON unmarshals this object from a JSON structure +func (m *NetworkJWT) UnmarshalJSON(raw []byte) error { + // AO0 + var dataAO0 struct { + Name *string `json:"name"` + + Token *string `json:"token"` + } + if err := swag.ReadJSON(raw, &dataAO0); err != nil { + return err + } + + m.Name = dataAO0.Name + + m.Token = dataAO0.Token + + return nil +} + +// MarshalJSON marshals this object to a JSON structure +func (m NetworkJWT) MarshalJSON() ([]byte, error) { + _parts := make([][]byte, 0, 1) + + var dataAO0 struct { + Name *string `json:"name"` + + Token *string `json:"token"` + } + + dataAO0.Name = m.Name + + dataAO0.Token = m.Token + + jsonDataAO0, errAO0 := swag.WriteJSON(dataAO0) + if errAO0 != nil { + return nil, errAO0 + } + _parts = append(_parts, jsonDataAO0) + return swag.ConcatJSON(_parts...), nil +} + +// Validate validates this network JWT +func (m *NetworkJWT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkJWT) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkJWT) validateToken(formats strfmt.Registry) error { + + if err := validate.Required("token", "body", m.Token); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network JWT based on context it is used +func (m *NetworkJWT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkJWT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkJWT) UnmarshalBinary(b []byte) error { + var res NetworkJWT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rest_model/network_jwt_list.go b/rest_model/network_jwt_list.go new file mode 100644 index 00000000..1903bdc8 --- /dev/null +++ b/rest_model/network_jwt_list.go @@ -0,0 +1,97 @@ +// 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 rest_model + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkJWTList An array of network JWTs +// +// swagger:model networkJWTList +type NetworkJWTList []*NetworkJWT + +// Validate validates this network JWT list +func (m NetworkJWTList) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this network JWT list based on the context it is used +func (m NetworkJWTList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/source/client.yml b/source/client.yml index e6a63df0..a6c953e4 100644 --- a/source/client.yml +++ b/source/client.yml @@ -108,6 +108,9 @@ paths: '/protocols': $ref: 'client/protocols.yml#/paths/protocols' + '/network-jwts': + $ref: 'shared/network-jwt.yml#/paths/network-jwts' + '/services': $ref: 'client/services.yml#/paths/services' '/services/{id}': diff --git a/source/management.yml b/source/management.yml index 21162e10..d27d6272 100644 --- a/source/management.yml +++ b/source/management.yml @@ -198,6 +198,9 @@ paths: '/identity-types/{id}': $ref: 'management/identity-types.yml#/paths/identity-types-id' + '/network-jwts': + $ref: 'shared/network-jwt.yml#/paths/network-jwts' + '/posture-checks': $ref: 'management/posture-checks.yml#/paths/posture-checks' '/posture-checks/{id}': diff --git a/source/shared/network-jwt.yml b/source/shared/network-jwt.yml new file mode 100644 index 00000000..13950bcb --- /dev/null +++ b/source/shared/network-jwt.yml @@ -0,0 +1,55 @@ +--- +paths: + network-jwts: + get: + summary: Returns a list of JWTs suitable for bootstrapping network trust. + description: Returns a list of JWTs for trusting a network + tags: + - Enrollment + operationId: listNetworkJWTs + responses: + '200': + $ref: '#/responses/listNetworkJWTs' + '401': + $ref: '../shared/standard-responses.yml#/responses/unauthorizedResponse' + '400': + $ref: '../shared/standard-responses.yml#/responses/badRequestResponse' + '429': + $ref: '../shared/standard-responses.yml#/responses/rateLimitedResponse' + +responses: + listNetworkJWTs: + description: A list of network JWTs + schema: + $ref: '#/definitions/listNetworkJWTsEnvelope' + +definitions: + listNetworkJWTsEnvelope: + type: object + required: + - meta + - data + properties: + meta: + $ref: '../shared/standard-responses.yml#/definitions/meta' + data: + $ref: '#/definitions/networkJWTList' + networkJWTList: + description: An array of network JWTs + type: array + items: + $ref: '#/definitions/networkJWT' + + networkJWT: + description: A network JWT + type: object + allOf: + - type: object + required: + - name + - token + properties: + name: + type: string + token: + type: string \ No newline at end of file From 62c6be716fcabd8b902085b93d111106eed98e2a Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Fri, 11 Oct 2024 09:56:38 -0400 Subject: [PATCH 2/2] update version, remove 401 --- client.yml | 21 +------- management.yml | 21 +------- .../list_network_j_w_ts_responses.go | 38 -------------- rest_client_api_server/doc.go | 2 +- rest_client_api_server/embedded_spec.go | 52 +------------------ .../list_network_j_w_ts_responses.go | 44 ---------------- .../list_network_j_w_ts_responses.go | 38 -------------- rest_management_api_server/doc.go | 2 +- rest_management_api_server/embedded_spec.go | 52 +------------------ .../list_network_j_w_ts_responses.go | 44 ---------------- source/client.yml | 2 +- source/management.yml | 2 +- source/shared/network-jwt.yml | 2 - 13 files changed, 10 insertions(+), 310 deletions(-) diff --git a/client.yml b/client.yml index 662e998c..f0c991a6 100644 --- a/client.yml +++ b/client.yml @@ -15,7 +15,7 @@ info: license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html - version: 0.26.33 + version: 0.26.34 host: demo.ziti.dev basePath: /edge/client/v1 paths: @@ -2399,25 +2399,6 @@ paths: meta: apiEnrollmentVersion: 0.0.1 apiVersion: 0.0.1 - "401": - description: The supplied session does not have the correct access rights - to request this resource - schema: - $ref: '#/definitions/apiErrorEnvelope' - examples: - application/json: - error: - args: - urlVars: {} - cause: "" - causeMessage: "" - code: UNAUTHORIZED - message: The request could not be completed. The session is not authorized - or the credentials are invalid - requestId: 0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f - meta: - apiEnrollmentVersion: 0.0.1 - apiVersion: 0.0.1 "429": description: The resource requested is rate limited and the rate limit has been exceeded diff --git a/management.yml b/management.yml index 4ebae874..1b226f31 100644 --- a/management.yml +++ b/management.yml @@ -15,7 +15,7 @@ info: license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html - version: 0.26.33 + version: 0.26.34 host: demo.ziti.dev basePath: /edge/management/v1 paths: @@ -10146,25 +10146,6 @@ paths: meta: apiEnrollmentVersion: 0.0.1 apiVersion: 0.0.1 - "401": - description: The supplied session does not have the correct access rights - to request this resource - schema: - $ref: '#/definitions/apiErrorEnvelope' - examples: - application/json: - error: - args: - urlVars: {} - cause: "" - causeMessage: "" - code: UNAUTHORIZED - message: The request could not be completed. The session is not authorized - or the credentials are invalid - requestId: 0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f - meta: - apiEnrollmentVersion: 0.0.1 - apiVersion: 0.0.1 "429": description: The resource requested is rate limited and the rate limit has been exceeded diff --git a/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go b/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go index efb85237..1beee10e 100644 --- a/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go +++ b/rest_client_api_client/enrollment/list_network_j_w_ts_responses.go @@ -59,12 +59,6 @@ func (o *ListNetworkJWTsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - case 401: - result := NewListNetworkJWTsUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result case 429: result := NewListNetworkJWTsTooManyRequests() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -140,38 +134,6 @@ func (o *ListNetworkJWTsBadRequest) readResponse(response runtime.ClientResponse return nil } -// NewListNetworkJWTsUnauthorized creates a ListNetworkJWTsUnauthorized with default headers values -func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { - return &ListNetworkJWTsUnauthorized{} -} - -/* ListNetworkJWTsUnauthorized describes a response with status code 401, with default header values. - -The supplied session does not have the correct access rights to request this resource -*/ -type ListNetworkJWTsUnauthorized struct { - Payload *rest_model.APIErrorEnvelope -} - -func (o *ListNetworkJWTsUnauthorized) Error() string { - return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsUnauthorized %+v", 401, o.Payload) -} -func (o *ListNetworkJWTsUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { - return o.Payload -} - -func (o *ListNetworkJWTsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(rest_model.APIErrorEnvelope) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - // NewListNetworkJWTsTooManyRequests creates a ListNetworkJWTsTooManyRequests with default headers values func NewListNetworkJWTsTooManyRequests() *ListNetworkJWTsTooManyRequests { return &ListNetworkJWTsTooManyRequests{} diff --git a/rest_client_api_server/doc.go b/rest_client_api_server/doc.go index 239385a0..238fcc56 100644 --- a/rest_client_api_server/doc.go +++ b/rest_client_api_server/doc.go @@ -30,7 +30,7 @@ // https // Host: demo.ziti.dev // BasePath: /edge/client/v1 -// Version: 0.26.33 +// Version: 0.26.34 // License: Apache 2.0 https://www.apache.org/licenses/LICENSE-2.0.html // Contact: OpenZiti https://openziti.discourse.group // diff --git a/rest_client_api_server/embedded_spec.go b/rest_client_api_server/embedded_spec.go index 0362ef89..a5060287 100644 --- a/rest_client_api_server/embedded_spec.go +++ b/rest_client_api_server/embedded_spec.go @@ -64,7 +64,7 @@ func init() { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "0.26.33" + "version": "0.26.34" }, "host": "demo.ziti.dev", "basePath": "/edge/client/v1", @@ -3252,30 +3252,6 @@ func init() { } } }, - "401": { - "description": "The supplied session does not have the correct access rights to request this resource", - "schema": { - "$ref": "#/definitions/apiErrorEnvelope" - }, - "examples": { - "application/json": { - "error": { - "args": { - "urlVars": {} - }, - "cause": "", - "causeMessage": "", - "code": "UNAUTHORIZED", - "message": "The request could not be completed. The session is not authorized or the credentials are invalid", - "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" - }, - "meta": { - "apiEnrollmentVersion": "0.0.1", - "apiVersion": "0.0.1" - } - } - } - }, "429": { "description": "The resource requested is rate limited and the rate limit has been exceeded", "schema": { @@ -7837,7 +7813,7 @@ func init() { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "0.26.33" + "version": "0.26.34" }, "host": "demo.ziti.dev", "basePath": "/edge/client/v1", @@ -11025,30 +11001,6 @@ func init() { } } }, - "401": { - "description": "The supplied session does not have the correct access rights to request this resource", - "schema": { - "$ref": "#/definitions/apiErrorEnvelope" - }, - "examples": { - "application/json": { - "error": { - "args": { - "urlVars": {} - }, - "cause": "", - "causeMessage": "", - "code": "UNAUTHORIZED", - "message": "The request could not be completed. The session is not authorized or the credentials are invalid", - "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" - }, - "meta": { - "apiEnrollmentVersion": "0.0.1", - "apiVersion": "0.0.1" - } - } - } - }, "429": { "description": "The resource requested is rate limited and the rate limit has been exceeded", "schema": { diff --git a/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go index e61e8500..e57bb78f 100644 --- a/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go +++ b/rest_client_api_server/operations/enrollment/list_network_j_w_ts_responses.go @@ -125,50 +125,6 @@ func (o *ListNetworkJWTsBadRequest) WriteResponse(rw http.ResponseWriter, produc } } -// ListNetworkJWTsUnauthorizedCode is the HTTP code returned for type ListNetworkJWTsUnauthorized -const ListNetworkJWTsUnauthorizedCode int = 401 - -/*ListNetworkJWTsUnauthorized The supplied session does not have the correct access rights to request this resource - -swagger:response listNetworkJWTsUnauthorized -*/ -type ListNetworkJWTsUnauthorized struct { - - /* - In: Body - */ - Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` -} - -// NewListNetworkJWTsUnauthorized creates ListNetworkJWTsUnauthorized with default headers values -func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { - - return &ListNetworkJWTsUnauthorized{} -} - -// WithPayload adds the payload to the list network j w ts unauthorized response -func (o *ListNetworkJWTsUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsUnauthorized { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list network j w ts unauthorized response -func (o *ListNetworkJWTsUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListNetworkJWTsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(401) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - // ListNetworkJWTsTooManyRequestsCode is the HTTP code returned for type ListNetworkJWTsTooManyRequests const ListNetworkJWTsTooManyRequestsCode int = 429 diff --git a/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go b/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go index efb85237..1beee10e 100644 --- a/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go +++ b/rest_management_api_client/enrollment/list_network_j_w_ts_responses.go @@ -59,12 +59,6 @@ func (o *ListNetworkJWTsReader) ReadResponse(response runtime.ClientResponse, co return nil, err } return nil, result - case 401: - result := NewListNetworkJWTsUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result case 429: result := NewListNetworkJWTsTooManyRequests() if err := result.readResponse(response, consumer, o.formats); err != nil { @@ -140,38 +134,6 @@ func (o *ListNetworkJWTsBadRequest) readResponse(response runtime.ClientResponse return nil } -// NewListNetworkJWTsUnauthorized creates a ListNetworkJWTsUnauthorized with default headers values -func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { - return &ListNetworkJWTsUnauthorized{} -} - -/* ListNetworkJWTsUnauthorized describes a response with status code 401, with default header values. - -The supplied session does not have the correct access rights to request this resource -*/ -type ListNetworkJWTsUnauthorized struct { - Payload *rest_model.APIErrorEnvelope -} - -func (o *ListNetworkJWTsUnauthorized) Error() string { - return fmt.Sprintf("[GET /network-jwts][%d] listNetworkJWTsUnauthorized %+v", 401, o.Payload) -} -func (o *ListNetworkJWTsUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { - return o.Payload -} - -func (o *ListNetworkJWTsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(rest_model.APIErrorEnvelope) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - // NewListNetworkJWTsTooManyRequests creates a ListNetworkJWTsTooManyRequests with default headers values func NewListNetworkJWTsTooManyRequests() *ListNetworkJWTsTooManyRequests { return &ListNetworkJWTsTooManyRequests{} diff --git a/rest_management_api_server/doc.go b/rest_management_api_server/doc.go index 89b07cd1..354fb720 100644 --- a/rest_management_api_server/doc.go +++ b/rest_management_api_server/doc.go @@ -30,7 +30,7 @@ // https // Host: demo.ziti.dev // BasePath: /edge/management/v1 -// Version: 0.26.33 +// Version: 0.26.34 // License: Apache 2.0 https://www.apache.org/licenses/LICENSE-2.0.html // Contact: OpenZiti https://openziti.discourse.group // diff --git a/rest_management_api_server/embedded_spec.go b/rest_management_api_server/embedded_spec.go index eca0f72e..d3180ddd 100644 --- a/rest_management_api_server/embedded_spec.go +++ b/rest_management_api_server/embedded_spec.go @@ -64,7 +64,7 @@ func init() { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "0.26.33" + "version": "0.26.34" }, "host": "demo.ziti.dev", "basePath": "/edge/management/v1", @@ -13987,30 +13987,6 @@ func init() { } } }, - "401": { - "description": "The supplied session does not have the correct access rights to request this resource", - "schema": { - "$ref": "#/definitions/apiErrorEnvelope" - }, - "examples": { - "application/json": { - "error": { - "args": { - "urlVars": {} - }, - "cause": "", - "causeMessage": "", - "code": "UNAUTHORIZED", - "message": "The request could not be completed. The session is not authorized or the credentials are invalid", - "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" - }, - "meta": { - "apiEnrollmentVersion": "0.0.1", - "apiVersion": "0.0.1" - } - } - } - }, "429": { "description": "The resource requested is rate limited and the rate limit has been exceeded", "schema": { @@ -28682,7 +28658,7 @@ func init() { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "0.26.33" + "version": "0.26.34" }, "host": "demo.ziti.dev", "basePath": "/edge/management/v1", @@ -42605,30 +42581,6 @@ func init() { } } }, - "401": { - "description": "The supplied session does not have the correct access rights to request this resource", - "schema": { - "$ref": "#/definitions/apiErrorEnvelope" - }, - "examples": { - "application/json": { - "error": { - "args": { - "urlVars": {} - }, - "cause": "", - "causeMessage": "", - "code": "UNAUTHORIZED", - "message": "The request could not be completed. The session is not authorized or the credentials are invalid", - "requestId": "0bfe7a04-9229-4b7a-812c-9eb3cc0eac0f" - }, - "meta": { - "apiEnrollmentVersion": "0.0.1", - "apiVersion": "0.0.1" - } - } - } - }, "429": { "description": "The resource requested is rate limited and the rate limit has been exceeded", "schema": { diff --git a/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go index e61e8500..e57bb78f 100644 --- a/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go +++ b/rest_management_api_server/operations/enrollment/list_network_j_w_ts_responses.go @@ -125,50 +125,6 @@ func (o *ListNetworkJWTsBadRequest) WriteResponse(rw http.ResponseWriter, produc } } -// ListNetworkJWTsUnauthorizedCode is the HTTP code returned for type ListNetworkJWTsUnauthorized -const ListNetworkJWTsUnauthorizedCode int = 401 - -/*ListNetworkJWTsUnauthorized The supplied session does not have the correct access rights to request this resource - -swagger:response listNetworkJWTsUnauthorized -*/ -type ListNetworkJWTsUnauthorized struct { - - /* - In: Body - */ - Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` -} - -// NewListNetworkJWTsUnauthorized creates ListNetworkJWTsUnauthorized with default headers values -func NewListNetworkJWTsUnauthorized() *ListNetworkJWTsUnauthorized { - - return &ListNetworkJWTsUnauthorized{} -} - -// WithPayload adds the payload to the list network j w ts unauthorized response -func (o *ListNetworkJWTsUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *ListNetworkJWTsUnauthorized { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the list network j w ts unauthorized response -func (o *ListNetworkJWTsUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *ListNetworkJWTsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(401) - if o.Payload != nil { - payload := o.Payload - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } - } -} - // ListNetworkJWTsTooManyRequestsCode is the HTTP code returned for type ListNetworkJWTsTooManyRequests const ListNetworkJWTsTooManyRequestsCode int = 429 diff --git a/source/client.yml b/source/client.yml index a6c953e4..695c52f5 100644 --- a/source/client.yml +++ b/source/client.yml @@ -1,7 +1,7 @@ --- swagger: '2.0' info: - version: 0.26.33 + version: 0.26.34 title: Ziti Edge Client description: OpenZiti Edge Client API contact: diff --git a/source/management.yml b/source/management.yml index d27d6272..8e42fbf9 100644 --- a/source/management.yml +++ b/source/management.yml @@ -1,7 +1,7 @@ --- swagger: '2.0' info: - version: 0.26.33 + version: 0.26.34 title: Ziti Edge Management description: OpenZiti Edge Management API contact: diff --git a/source/shared/network-jwt.yml b/source/shared/network-jwt.yml index 13950bcb..42fd9568 100644 --- a/source/shared/network-jwt.yml +++ b/source/shared/network-jwt.yml @@ -10,8 +10,6 @@ paths: responses: '200': $ref: '#/responses/listNetworkJWTs' - '401': - $ref: '../shared/standard-responses.yml#/responses/unauthorizedResponse' '400': $ref: '../shared/standard-responses.yml#/responses/badRequestResponse' '429':