diff --git a/client.yml b/client.yml index 0758883a..a255a6d7 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.0 + version: 0.26.1 host: demo.ziti.dev basePath: /edge/client/v1 paths: @@ -2863,6 +2863,130 @@ paths: name: id in: path required: true + /services/{id}/edge-routers: + get: + security: + - ztSession: [] + - oauth2: + - openid + description: | + Retrieves the list of edge routers permitted to handle traffic for the specified service + tags: + - Service + summary: List of edge routers permitted to handle traffic for the specified + service + operationId: listServiceEdgeRouters + parameters: + - type: integer + name: limit + in: query + - type: integer + name: offset + in: query + - type: string + name: filter + in: query + - type: string + description: an optional JWT token use to authenticate the request. If provided, + the token must be valid else a not authorized response is returned. + name: session-token + in: header + responses: + "200": + description: A list of edge routers suitable for dialing or binding the + specified service by the authenticated identity + schema: + $ref: '#/definitions/listServiceEdgeRoutersEnvelope' + "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 currently 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 + "404": + description: The requested resource does not exist + schema: + $ref: '#/definitions/apiErrorEnvelope' + examples: + application/json: + error: + args: + urlVars: + id: 71a3000f-7dda-491a-9b90-a19f4ee6c406 + cause: null + causeMessage: "" + code: NOT_FOUND + message: The resource requested was not found or is no longer available + requestId: 270908d6-f2ef-4577-b973-67bec18ae376 + 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 + parameters: + - type: string + description: The id of the requested resource + name: id + in: path + required: true /services/{id}/terminators: get: security: @@ -4273,6 +4397,16 @@ definitions: $ref: '#/definitions/listProtocols' meta: $ref: '#/definitions/meta' + listServiceEdgeRoutersEnvelope: + type: object + required: + - meta + - data + properties: + data: + $ref: '#/definitions/serviceEdgeRouters' + meta: + $ref: '#/definitions/meta' listServicesEnvelope: type: object required: @@ -4627,6 +4761,13 @@ definitions: $ref: '#/definitions/attributes' terminatorStrategy: type: string + serviceEdgeRouters: + type: object + properties: + edgeRouters: + type: array + items: + $ref: '#/definitions/commonEdgeRouterProperties' serviceList: type: array items: diff --git a/go.mod b/go.mod index 258e2b48..87df56e3 100644 --- a/go.mod +++ b/go.mod @@ -14,13 +14,13 @@ require ( github.com/jessevdk/go-flags v1.5.0 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 - golang.org/x/net v0.17.0 + golang.org/x/net v0.18.0 ) require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/jsonpointer v0.20.0 // indirect @@ -31,11 +31,11 @@ require ( github.com/oklog/ulid v1.3.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.mongodb.org/mongo-driver v1.12.1 // indirect - go.opentelemetry.io/otel v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + go.mongodb.org/mongo-driver v1.13.0 // indirect + go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a0c412ab..d97845dd 100644 --- a/go.sum +++ b/go.sum @@ -13,8 +13,8 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa h1:RDBNVkRviHZtvDvId8XSGPu3rmpmSe+wKRcEWNgsfWU= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= @@ -83,7 +83,7 @@ github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/V github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -165,15 +165,15 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= -go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= -go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.mongodb.org/mongo-driver v1.13.0 h1:67DgFFjYOCMWdtTEmKFpV3ffWlFnh+CYZ8ZS/tXWUfY= +go.mongodb.org/mongo-driver v1.13.0/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= +go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= +go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= +go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= +go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= +go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -188,8 +188,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -211,8 +211,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/management.yml b/management.yml index 85cec318..a60634c5 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.0 + version: 0.26.1 host: demo.ziti.dev basePath: /edge/management/v1 paths: diff --git a/rest_client_api_client/service/list_service_edge_routers_parameters.go b/rest_client_api_client/service/list_service_edge_routers_parameters.go new file mode 100644 index 00000000..8d8b03ef --- /dev/null +++ b/rest_client_api_client/service/list_service_edge_routers_parameters.go @@ -0,0 +1,292 @@ +// 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 service + +// 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" + "github.com/go-openapi/swag" +) + +// NewListServiceEdgeRoutersParams creates a new ListServiceEdgeRoutersParams 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 NewListServiceEdgeRoutersParams() *ListServiceEdgeRoutersParams { + return &ListServiceEdgeRoutersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListServiceEdgeRoutersParamsWithTimeout creates a new ListServiceEdgeRoutersParams object +// with the ability to set a timeout on a request. +func NewListServiceEdgeRoutersParamsWithTimeout(timeout time.Duration) *ListServiceEdgeRoutersParams { + return &ListServiceEdgeRoutersParams{ + timeout: timeout, + } +} + +// NewListServiceEdgeRoutersParamsWithContext creates a new ListServiceEdgeRoutersParams object +// with the ability to set a context for a request. +func NewListServiceEdgeRoutersParamsWithContext(ctx context.Context) *ListServiceEdgeRoutersParams { + return &ListServiceEdgeRoutersParams{ + Context: ctx, + } +} + +// NewListServiceEdgeRoutersParamsWithHTTPClient creates a new ListServiceEdgeRoutersParams object +// with the ability to set a custom HTTPClient for a request. +func NewListServiceEdgeRoutersParamsWithHTTPClient(client *http.Client) *ListServiceEdgeRoutersParams { + return &ListServiceEdgeRoutersParams{ + HTTPClient: client, + } +} + +/* ListServiceEdgeRoutersParams contains all the parameters to send to the API endpoint + for the list service edge routers operation. + + Typically these are written to a http.Request. +*/ +type ListServiceEdgeRoutersParams struct { + + // Filter. + Filter *string + + /* ID. + + The id of the requested resource + */ + ID string + + // Limit. + Limit *int64 + + // Offset. + Offset *int64 + + /* SessionToken. + + an optional JWT token use to authenticate the request. If provided, the token must be valid else a not authorized response is returned. + */ + SessionToken *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list service edge routers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListServiceEdgeRoutersParams) WithDefaults() *ListServiceEdgeRoutersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list service edge routers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListServiceEdgeRoutersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithTimeout(timeout time.Duration) *ListServiceEdgeRoutersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithContext(ctx context.Context) *ListServiceEdgeRoutersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithHTTPClient(client *http.Client) *ListServiceEdgeRoutersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilter adds the filter to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithFilter(filter *string) *ListServiceEdgeRoutersParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WithID adds the id to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithID(id string) *ListServiceEdgeRoutersParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithLimit(limit *int64) *ListServiceEdgeRoutersParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithOffset(offset *int64) *ListServiceEdgeRoutersParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithSessionToken adds the sessionToken to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) WithSessionToken(sessionToken *string) *ListServiceEdgeRoutersParams { + o.SetSessionToken(sessionToken) + return o +} + +// SetSessionToken adds the sessionToken to the list service edge routers params +func (o *ListServiceEdgeRoutersParams) SetSessionToken(sessionToken *string) { + o.SessionToken = sessionToken +} + +// WriteToRequest writes these params to a swagger request +func (o *ListServiceEdgeRoutersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Limit != nil { + + // query param limit + var qrLimit int64 + + if o.Limit != nil { + qrLimit = *o.Limit + } + qLimit := swag.FormatInt64(qrLimit) + if qLimit != "" { + + if err := r.SetQueryParam("limit", qLimit); err != nil { + return err + } + } + } + + if o.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + if o.SessionToken != nil { + + // header param session-token + if err := r.SetHeaderParam("session-token", *o.SessionToken); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/rest_client_api_client/service/list_service_edge_routers_responses.go b/rest_client_api_client/service/list_service_edge_routers_responses.go new file mode 100644 index 00000000..56ae9325 --- /dev/null +++ b/rest_client_api_client/service/list_service_edge_routers_responses.go @@ -0,0 +1,243 @@ +// 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 service + +// 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" +) + +// ListServiceEdgeRoutersReader is a Reader for the ListServiceEdgeRouters structure. +type ListServiceEdgeRoutersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListServiceEdgeRoutersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListServiceEdgeRoutersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListServiceEdgeRoutersBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListServiceEdgeRoutersUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListServiceEdgeRoutersNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewListServiceEdgeRoutersTooManyRequests() + 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()) + } +} + +// NewListServiceEdgeRoutersOK creates a ListServiceEdgeRoutersOK with default headers values +func NewListServiceEdgeRoutersOK() *ListServiceEdgeRoutersOK { + return &ListServiceEdgeRoutersOK{} +} + +/* ListServiceEdgeRoutersOK describes a response with status code 200, with default header values. + +A list of edge routers suitable for dialing or binding the specified service by the authenticated identity +*/ +type ListServiceEdgeRoutersOK struct { + Payload *rest_model.ListServiceEdgeRoutersEnvelope +} + +func (o *ListServiceEdgeRoutersOK) Error() string { + return fmt.Sprintf("[GET /services/{id}/edge-routers][%d] listServiceEdgeRoutersOK %+v", 200, o.Payload) +} +func (o *ListServiceEdgeRoutersOK) GetPayload() *rest_model.ListServiceEdgeRoutersEnvelope { + return o.Payload +} + +func (o *ListServiceEdgeRoutersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(rest_model.ListServiceEdgeRoutersEnvelope) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListServiceEdgeRoutersBadRequest creates a ListServiceEdgeRoutersBadRequest with default headers values +func NewListServiceEdgeRoutersBadRequest() *ListServiceEdgeRoutersBadRequest { + return &ListServiceEdgeRoutersBadRequest{} +} + +/* ListServiceEdgeRoutersBadRequest 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 ListServiceEdgeRoutersBadRequest struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListServiceEdgeRoutersBadRequest) Error() string { + return fmt.Sprintf("[GET /services/{id}/edge-routers][%d] listServiceEdgeRoutersBadRequest %+v", 400, o.Payload) +} +func (o *ListServiceEdgeRoutersBadRequest) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListServiceEdgeRoutersBadRequest) 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 +} + +// NewListServiceEdgeRoutersUnauthorized creates a ListServiceEdgeRoutersUnauthorized with default headers values +func NewListServiceEdgeRoutersUnauthorized() *ListServiceEdgeRoutersUnauthorized { + return &ListServiceEdgeRoutersUnauthorized{} +} + +/* ListServiceEdgeRoutersUnauthorized describes a response with status code 401, with default header values. + +The currently supplied session does not have the correct access rights to request this resource +*/ +type ListServiceEdgeRoutersUnauthorized struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListServiceEdgeRoutersUnauthorized) Error() string { + return fmt.Sprintf("[GET /services/{id}/edge-routers][%d] listServiceEdgeRoutersUnauthorized %+v", 401, o.Payload) +} +func (o *ListServiceEdgeRoutersUnauthorized) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListServiceEdgeRoutersUnauthorized) 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 +} + +// NewListServiceEdgeRoutersNotFound creates a ListServiceEdgeRoutersNotFound with default headers values +func NewListServiceEdgeRoutersNotFound() *ListServiceEdgeRoutersNotFound { + return &ListServiceEdgeRoutersNotFound{} +} + +/* ListServiceEdgeRoutersNotFound describes a response with status code 404, with default header values. + +The requested resource does not exist +*/ +type ListServiceEdgeRoutersNotFound struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListServiceEdgeRoutersNotFound) Error() string { + return fmt.Sprintf("[GET /services/{id}/edge-routers][%d] listServiceEdgeRoutersNotFound %+v", 404, o.Payload) +} +func (o *ListServiceEdgeRoutersNotFound) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListServiceEdgeRoutersNotFound) 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 +} + +// NewListServiceEdgeRoutersTooManyRequests creates a ListServiceEdgeRoutersTooManyRequests with default headers values +func NewListServiceEdgeRoutersTooManyRequests() *ListServiceEdgeRoutersTooManyRequests { + return &ListServiceEdgeRoutersTooManyRequests{} +} + +/* ListServiceEdgeRoutersTooManyRequests 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 ListServiceEdgeRoutersTooManyRequests struct { + Payload *rest_model.APIErrorEnvelope +} + +func (o *ListServiceEdgeRoutersTooManyRequests) Error() string { + return fmt.Sprintf("[GET /services/{id}/edge-routers][%d] listServiceEdgeRoutersTooManyRequests %+v", 429, o.Payload) +} +func (o *ListServiceEdgeRoutersTooManyRequests) GetPayload() *rest_model.APIErrorEnvelope { + return o.Payload +} + +func (o *ListServiceEdgeRoutersTooManyRequests) 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/service/service_client.go b/rest_client_api_client/service/service_client.go index 2b457137..347d908a 100644 --- a/rest_client_api_client/service/service_client.go +++ b/rest_client_api_client/service/service_client.go @@ -58,6 +58,8 @@ type ClientService interface { DetailService(params *DetailServiceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DetailServiceOK, error) + ListServiceEdgeRouters(params *ListServiceEdgeRoutersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServiceEdgeRoutersOK, error) + ListServiceTerminators(params *ListServiceTerminatorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServiceTerminatorsOK, error) ListServices(params *ListServicesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServicesOK, error) @@ -151,6 +153,48 @@ func (a *Client) DetailService(params *DetailServiceParams, authInfo runtime.Cli panic(msg) } +/* + ListServiceEdgeRouters lists of edge routers permitted to handle traffic for the specified service + + Retrieves the list of edge routers permitted to handle traffic for the specified service + +*/ +func (a *Client) ListServiceEdgeRouters(params *ListServiceEdgeRoutersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListServiceEdgeRoutersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListServiceEdgeRoutersParams() + } + op := &runtime.ClientOperation{ + ID: "listServiceEdgeRouters", + Method: "GET", + PathPattern: "/services/{id}/edge-routers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListServiceEdgeRoutersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListServiceEdgeRoutersOK) + 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 listServiceEdgeRouters: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* ListServiceTerminators lists of terminators assigned to a service diff --git a/rest_client_api_server/configure_ziti_edge_client.go b/rest_client_api_server/configure_ziti_edge_client.go index 909be042..cac5c47f 100644 --- a/rest_client_api_server/configure_ziti_edge_client.go +++ b/rest_client_api_server/configure_ziti_edge_client.go @@ -310,6 +310,11 @@ func configureAPI(api *operations.ZitiEdgeClientAPI) http.Handler { return middleware.NotImplemented("operation informational.ListRoot has not yet been implemented") }) } + if api.ServiceListServiceEdgeRoutersHandler == nil { + api.ServiceListServiceEdgeRoutersHandler = service.ListServiceEdgeRoutersHandlerFunc(func(params service.ListServiceEdgeRoutersParams, principal interface{}) middleware.Responder { + return middleware.NotImplemented("operation service.ListServiceEdgeRouters has not yet been implemented") + }) + } if api.ServiceListServiceTerminatorsHandler == nil { api.ServiceListServiceTerminatorsHandler = service.ListServiceTerminatorsHandlerFunc(func(params service.ListServiceTerminatorsParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation service.ListServiceTerminators has not yet been implemented") diff --git a/rest_client_api_server/doc.go b/rest_client_api_server/doc.go index 8ac04a6a..e0104513 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.0 +// Version: 0.26.1 // 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 7e85bd34..1ee8999b 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.0" + "version": "0.26.1" }, "host": "demo.ziti.dev", "basePath": "/edge/client/v1", @@ -3888,6 +3888,176 @@ func init() { } ] }, + "/services/{id}/edge-routers": { + "get": { + "security": [ + { + "ztSession": [] + }, + { + "oauth2": [ + "openid" + ] + } + ], + "description": "Retrieves the list of edge routers permitted to handle traffic for the specified service\n", + "tags": [ + "Service" + ], + "summary": "List of edge routers permitted to handle traffic for the specified service", + "operationId": "listServiceEdgeRouters", + "parameters": [ + { + "type": "integer", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "name": "offset", + "in": "query" + }, + { + "type": "string", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "an optional JWT token use to authenticate the request. If provided, the token must be valid else a not authorized response is returned.", + "name": "session-token", + "in": "header" + } + ], + "responses": { + "200": { + "description": "A list of edge routers suitable for dialing or binding the specified service by the authenticated identity", + "schema": { + "$ref": "#/definitions/listServiceEdgeRoutersEnvelope" + } + }, + "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 currently 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" + } + } + } + }, + "404": { + "description": "The requested resource does not exist", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": { + "id": "71a3000f-7dda-491a-9b90-a19f4ee6c406" + } + }, + "cause": null, + "causeMessage": "", + "code": "NOT_FOUND", + "message": "The resource requested was not found or is no longer available", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "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" + } + } + } + } + } + }, + "parameters": [ + { + "type": "string", + "description": "The id of the requested resource", + "name": "id", + "in": "path", + "required": true + } + ] + }, "/services/{id}/terminators": { "get": { "security": [ @@ -5953,6 +6123,21 @@ func init() { } } }, + "listServiceEdgeRoutersEnvelope": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/serviceEdgeRouters" + }, + "meta": { + "$ref": "#/definitions/meta" + } + } + }, "listServicesEnvelope": { "type": "object", "required": [ @@ -6491,6 +6676,17 @@ func init() { } ] }, + "serviceEdgeRouters": { + "type": "object", + "properties": { + "edgeRouters": { + "type": "array", + "items": { + "$ref": "#/definitions/commonEdgeRouterProperties" + } + } + } + }, "serviceList": { "type": "array", "items": { @@ -6855,7 +7051,7 @@ func init() { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "0.26.0" + "version": "0.26.1" }, "host": "demo.ziti.dev", "basePath": "/edge/client/v1", @@ -10679,6 +10875,176 @@ func init() { } ] }, + "/services/{id}/edge-routers": { + "get": { + "security": [ + { + "ztSession": [] + }, + { + "oauth2": [ + "openid" + ] + } + ], + "description": "Retrieves the list of edge routers permitted to handle traffic for the specified service\n", + "tags": [ + "Service" + ], + "summary": "List of edge routers permitted to handle traffic for the specified service", + "operationId": "listServiceEdgeRouters", + "parameters": [ + { + "type": "integer", + "name": "limit", + "in": "query" + }, + { + "type": "integer", + "name": "offset", + "in": "query" + }, + { + "type": "string", + "name": "filter", + "in": "query" + }, + { + "type": "string", + "description": "an optional JWT token use to authenticate the request. If provided, the token must be valid else a not authorized response is returned.", + "name": "session-token", + "in": "header" + } + ], + "responses": { + "200": { + "description": "A list of edge routers suitable for dialing or binding the specified service by the authenticated identity", + "schema": { + "$ref": "#/definitions/listServiceEdgeRoutersEnvelope" + } + }, + "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 currently 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" + } + } + } + }, + "404": { + "description": "The requested resource does not exist", + "schema": { + "$ref": "#/definitions/apiErrorEnvelope" + }, + "examples": { + "application/json": { + "error": { + "args": { + "urlVars": { + "id": "71a3000f-7dda-491a-9b90-a19f4ee6c406" + } + }, + "cause": null, + "causeMessage": "", + "code": "NOT_FOUND", + "message": "The resource requested was not found or is no longer available", + "requestId": "270908d6-f2ef-4577-b973-67bec18ae376" + }, + "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" + } + } + } + } + } + }, + "parameters": [ + { + "type": "string", + "description": "The id of the requested resource", + "name": "id", + "in": "path", + "required": true + } + ] + }, "/services/{id}/terminators": { "get": { "security": [ @@ -12827,6 +13193,21 @@ func init() { } } }, + "listServiceEdgeRoutersEnvelope": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/serviceEdgeRouters" + }, + "meta": { + "$ref": "#/definitions/meta" + } + } + }, "listServicesEnvelope": { "type": "object", "required": [ @@ -13365,6 +13746,17 @@ func init() { } ] }, + "serviceEdgeRouters": { + "type": "object", + "properties": { + "edgeRouters": { + "type": "array", + "items": { + "$ref": "#/definitions/commonEdgeRouterProperties" + } + } + } + }, "serviceList": { "type": "array", "items": { diff --git a/rest_client_api_server/operations/service/list_service_edge_routers.go b/rest_client_api_server/operations/service/list_service_edge_routers.go new file mode 100644 index 00000000..4d5a1af2 --- /dev/null +++ b/rest_client_api_server/operations/service/list_service_edge_routers.go @@ -0,0 +1,96 @@ +// 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 service + +// 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" +) + +// ListServiceEdgeRoutersHandlerFunc turns a function with the right signature into a list service edge routers handler +type ListServiceEdgeRoutersHandlerFunc func(ListServiceEdgeRoutersParams, interface{}) middleware.Responder + +// Handle executing the request and returning a response +func (fn ListServiceEdgeRoutersHandlerFunc) Handle(params ListServiceEdgeRoutersParams, principal interface{}) middleware.Responder { + return fn(params, principal) +} + +// ListServiceEdgeRoutersHandler interface for that can handle valid list service edge routers params +type ListServiceEdgeRoutersHandler interface { + Handle(ListServiceEdgeRoutersParams, interface{}) middleware.Responder +} + +// NewListServiceEdgeRouters creates a new http.Handler for the list service edge routers operation +func NewListServiceEdgeRouters(ctx *middleware.Context, handler ListServiceEdgeRoutersHandler) *ListServiceEdgeRouters { + return &ListServiceEdgeRouters{Context: ctx, Handler: handler} +} + +/* ListServiceEdgeRouters swagger:route GET /services/{id}/edge-routers Service listServiceEdgeRouters + +List of edge routers permitted to handle traffic for the specified service + +Retrieves the list of edge routers permitted to handle traffic for the specified service + + +*/ +type ListServiceEdgeRouters struct { + Context *middleware.Context + Handler ListServiceEdgeRoutersHandler +} + +func (o *ListServiceEdgeRouters) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewListServiceEdgeRoutersParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal interface{} + if uprinc != nil { + principal = uprinc.(interface{}) // this is really a interface{}, I promise + } + + 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, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/rest_client_api_server/operations/service/list_service_edge_routers_parameters.go b/rest_client_api_server/operations/service/list_service_edge_routers_parameters.go new file mode 100644 index 00000000..251c29bc --- /dev/null +++ b/rest_client_api_server/operations/service/list_service_edge_routers_parameters.go @@ -0,0 +1,215 @@ +// 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 service + +// 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" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListServiceEdgeRoutersParams creates a new ListServiceEdgeRoutersParams object +// +// There are no default values defined in the spec. +func NewListServiceEdgeRoutersParams() ListServiceEdgeRoutersParams { + + return ListServiceEdgeRoutersParams{} +} + +// ListServiceEdgeRoutersParams contains all the bound params for the list service edge routers operation +// typically these are obtained from a http.Request +// +// swagger:parameters listServiceEdgeRouters +type ListServiceEdgeRoutersParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + In: query + */ + Filter *string + /*The id of the requested resource + Required: true + In: path + */ + ID string + /* + In: query + */ + Limit *int64 + /* + In: query + */ + Offset *int64 + /*an optional JWT token use to authenticate the request. If provided, the token must be valid else a not authorized response is returned. + In: header + */ + SessionToken *string +} + +// 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 NewListServiceEdgeRoutersParams() beforehand. +func (o *ListServiceEdgeRoutersParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qFilter, qhkFilter, _ := qs.GetOK("filter") + if err := o.bindFilter(qFilter, qhkFilter, route.Formats); err != nil { + res = append(res, err) + } + + rID, rhkID, _ := route.Params.GetOK("id") + if err := o.bindID(rID, rhkID, route.Formats); err != nil { + res = append(res, err) + } + + qLimit, qhkLimit, _ := qs.GetOK("limit") + if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil { + res = append(res, err) + } + + qOffset, qhkOffset, _ := qs.GetOK("offset") + if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil { + res = append(res, err) + } + + if err := o.bindSessionToken(r.Header[http.CanonicalHeaderKey("session-token")], true, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindFilter binds and validates parameter Filter from query. +func (o *ListServiceEdgeRoutersParams) bindFilter(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Filter = &raw + + return nil +} + +// bindID binds and validates parameter ID from path. +func (o *ListServiceEdgeRoutersParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.ID = raw + + return nil +} + +// bindLimit binds and validates parameter Limit from query. +func (o *ListServiceEdgeRoutersParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertInt64(raw) + if err != nil { + return errors.InvalidType("limit", "query", "int64", raw) + } + o.Limit = &value + + return nil +} + +// bindOffset binds and validates parameter Offset from query. +func (o *ListServiceEdgeRoutersParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + + value, err := swag.ConvertInt64(raw) + if err != nil { + return errors.InvalidType("offset", "query", "int64", raw) + } + o.Offset = &value + + return nil +} + +// bindSessionToken binds and validates parameter SessionToken from header. +func (o *ListServiceEdgeRoutersParams) bindSessionToken(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.SessionToken = &raw + + return nil +} diff --git a/rest_client_api_server/operations/service/list_service_edge_routers_responses.go b/rest_client_api_server/operations/service/list_service_edge_routers_responses.go new file mode 100644 index 00000000..fda283e5 --- /dev/null +++ b/rest_client_api_server/operations/service/list_service_edge_routers_responses.go @@ -0,0 +1,258 @@ +// 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 service + +// 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" +) + +// ListServiceEdgeRoutersOKCode is the HTTP code returned for type ListServiceEdgeRoutersOK +const ListServiceEdgeRoutersOKCode int = 200 + +/*ListServiceEdgeRoutersOK A list of edge routers suitable for dialing or binding the specified service by the authenticated identity + +swagger:response listServiceEdgeRoutersOK +*/ +type ListServiceEdgeRoutersOK struct { + + /* + In: Body + */ + Payload *rest_model.ListServiceEdgeRoutersEnvelope `json:"body,omitempty"` +} + +// NewListServiceEdgeRoutersOK creates ListServiceEdgeRoutersOK with default headers values +func NewListServiceEdgeRoutersOK() *ListServiceEdgeRoutersOK { + + return &ListServiceEdgeRoutersOK{} +} + +// WithPayload adds the payload to the list service edge routers o k response +func (o *ListServiceEdgeRoutersOK) WithPayload(payload *rest_model.ListServiceEdgeRoutersEnvelope) *ListServiceEdgeRoutersOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list service edge routers o k response +func (o *ListServiceEdgeRoutersOK) SetPayload(payload *rest_model.ListServiceEdgeRoutersEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListServiceEdgeRoutersOK) 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 + } + } +} + +// ListServiceEdgeRoutersBadRequestCode is the HTTP code returned for type ListServiceEdgeRoutersBadRequest +const ListServiceEdgeRoutersBadRequestCode int = 400 + +/*ListServiceEdgeRoutersBadRequest 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 listServiceEdgeRoutersBadRequest +*/ +type ListServiceEdgeRoutersBadRequest struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListServiceEdgeRoutersBadRequest creates ListServiceEdgeRoutersBadRequest with default headers values +func NewListServiceEdgeRoutersBadRequest() *ListServiceEdgeRoutersBadRequest { + + return &ListServiceEdgeRoutersBadRequest{} +} + +// WithPayload adds the payload to the list service edge routers bad request response +func (o *ListServiceEdgeRoutersBadRequest) WithPayload(payload *rest_model.APIErrorEnvelope) *ListServiceEdgeRoutersBadRequest { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list service edge routers bad request response +func (o *ListServiceEdgeRoutersBadRequest) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListServiceEdgeRoutersBadRequest) 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 + } + } +} + +// ListServiceEdgeRoutersUnauthorizedCode is the HTTP code returned for type ListServiceEdgeRoutersUnauthorized +const ListServiceEdgeRoutersUnauthorizedCode int = 401 + +/*ListServiceEdgeRoutersUnauthorized The currently supplied session does not have the correct access rights to request this resource + +swagger:response listServiceEdgeRoutersUnauthorized +*/ +type ListServiceEdgeRoutersUnauthorized struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListServiceEdgeRoutersUnauthorized creates ListServiceEdgeRoutersUnauthorized with default headers values +func NewListServiceEdgeRoutersUnauthorized() *ListServiceEdgeRoutersUnauthorized { + + return &ListServiceEdgeRoutersUnauthorized{} +} + +// WithPayload adds the payload to the list service edge routers unauthorized response +func (o *ListServiceEdgeRoutersUnauthorized) WithPayload(payload *rest_model.APIErrorEnvelope) *ListServiceEdgeRoutersUnauthorized { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list service edge routers unauthorized response +func (o *ListServiceEdgeRoutersUnauthorized) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListServiceEdgeRoutersUnauthorized) 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 + } + } +} + +// ListServiceEdgeRoutersNotFoundCode is the HTTP code returned for type ListServiceEdgeRoutersNotFound +const ListServiceEdgeRoutersNotFoundCode int = 404 + +/*ListServiceEdgeRoutersNotFound The requested resource does not exist + +swagger:response listServiceEdgeRoutersNotFound +*/ +type ListServiceEdgeRoutersNotFound struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListServiceEdgeRoutersNotFound creates ListServiceEdgeRoutersNotFound with default headers values +func NewListServiceEdgeRoutersNotFound() *ListServiceEdgeRoutersNotFound { + + return &ListServiceEdgeRoutersNotFound{} +} + +// WithPayload adds the payload to the list service edge routers not found response +func (o *ListServiceEdgeRoutersNotFound) WithPayload(payload *rest_model.APIErrorEnvelope) *ListServiceEdgeRoutersNotFound { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list service edge routers not found response +func (o *ListServiceEdgeRoutersNotFound) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListServiceEdgeRoutersNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(404) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} + +// ListServiceEdgeRoutersTooManyRequestsCode is the HTTP code returned for type ListServiceEdgeRoutersTooManyRequests +const ListServiceEdgeRoutersTooManyRequestsCode int = 429 + +/*ListServiceEdgeRoutersTooManyRequests The resource requested is rate limited and the rate limit has been exceeded + +swagger:response listServiceEdgeRoutersTooManyRequests +*/ +type ListServiceEdgeRoutersTooManyRequests struct { + + /* + In: Body + */ + Payload *rest_model.APIErrorEnvelope `json:"body,omitempty"` +} + +// NewListServiceEdgeRoutersTooManyRequests creates ListServiceEdgeRoutersTooManyRequests with default headers values +func NewListServiceEdgeRoutersTooManyRequests() *ListServiceEdgeRoutersTooManyRequests { + + return &ListServiceEdgeRoutersTooManyRequests{} +} + +// WithPayload adds the payload to the list service edge routers too many requests response +func (o *ListServiceEdgeRoutersTooManyRequests) WithPayload(payload *rest_model.APIErrorEnvelope) *ListServiceEdgeRoutersTooManyRequests { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the list service edge routers too many requests response +func (o *ListServiceEdgeRoutersTooManyRequests) SetPayload(payload *rest_model.APIErrorEnvelope) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ListServiceEdgeRoutersTooManyRequests) 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/service/list_service_edge_routers_urlbuilder.go b/rest_client_api_server/operations/service/list_service_edge_routers_urlbuilder.go new file mode 100644 index 00000000..8915df47 --- /dev/null +++ b/rest_client_api_server/operations/service/list_service_edge_routers_urlbuilder.go @@ -0,0 +1,157 @@ +// 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 service + +// 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" + "strings" + + "github.com/go-openapi/swag" +) + +// ListServiceEdgeRoutersURL generates an URL for the list service edge routers operation +type ListServiceEdgeRoutersURL struct { + ID string + + Filter *string + Limit *int64 + Offset *int64 + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// 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 *ListServiceEdgeRoutersURL) WithBasePath(bp string) *ListServiceEdgeRoutersURL { + 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 *ListServiceEdgeRoutersURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *ListServiceEdgeRoutersURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/services/{id}/edge-routers" + + id := o.ID + if id != "" { + _path = strings.Replace(_path, "{id}", id, -1) + } else { + return nil, errors.New("id is required on ListServiceEdgeRoutersURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/edge/client/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + var filterQ string + if o.Filter != nil { + filterQ = *o.Filter + } + if filterQ != "" { + qs.Set("filter", filterQ) + } + + var limitQ string + if o.Limit != nil { + limitQ = swag.FormatInt64(*o.Limit) + } + if limitQ != "" { + qs.Set("limit", limitQ) + } + + var offsetQ string + if o.Offset != nil { + offsetQ = swag.FormatInt64(*o.Offset) + } + if offsetQ != "" { + qs.Set("offset", offsetQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *ListServiceEdgeRoutersURL) 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 *ListServiceEdgeRoutersURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *ListServiceEdgeRoutersURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on ListServiceEdgeRoutersURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on ListServiceEdgeRoutersURL") + } + + 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 *ListServiceEdgeRoutersURL) 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 d0b5bcda..6360eca4 100644 --- a/rest_client_api_server/operations/ziti_edge_client_api.go +++ b/rest_client_api_server/operations/ziti_edge_client_api.go @@ -218,6 +218,9 @@ func NewZitiEdgeClientAPI(spec *loads.Document) *ZitiEdgeClientAPI { InformationalListRootHandler: informational.ListRootHandlerFunc(func(params informational.ListRootParams) middleware.Responder { return middleware.NotImplemented("operation informational.ListRoot has not yet been implemented") }), + ServiceListServiceEdgeRoutersHandler: service.ListServiceEdgeRoutersHandlerFunc(func(params service.ListServiceEdgeRoutersParams, principal interface{}) middleware.Responder { + return middleware.NotImplemented("operation service.ListServiceEdgeRouters has not yet been implemented") + }), ServiceListServiceTerminatorsHandler: service.ListServiceTerminatorsHandlerFunc(func(params service.ListServiceTerminatorsParams, principal interface{}) middleware.Responder { return middleware.NotImplemented("operation service.ListServiceTerminators has not yet been implemented") }), @@ -415,6 +418,8 @@ type ZitiEdgeClientAPI struct { InformationalListProtocolsHandler informational.ListProtocolsHandler // InformationalListRootHandler sets the operation handler for the list root operation InformationalListRootHandler informational.ListRootHandler + // ServiceListServiceEdgeRoutersHandler sets the operation handler for the list service edge routers operation + ServiceListServiceEdgeRoutersHandler service.ListServiceEdgeRoutersHandler // ServiceListServiceTerminatorsHandler sets the operation handler for the list service terminators operation ServiceListServiceTerminatorsHandler service.ListServiceTerminatorsHandler // CurrentAPISessionListServiceUpdatesHandler sets the operation handler for the list service updates operation @@ -667,6 +672,9 @@ func (o *ZitiEdgeClientAPI) Validate() error { if o.InformationalListRootHandler == nil { unregistered = append(unregistered, "informational.ListRootHandler") } + if o.ServiceListServiceEdgeRoutersHandler == nil { + unregistered = append(unregistered, "service.ListServiceEdgeRoutersHandler") + } if o.ServiceListServiceTerminatorsHandler == nil { unregistered = append(unregistered, "service.ListServiceTerminatorsHandler") } @@ -982,6 +990,10 @@ func (o *ZitiEdgeClientAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } + o.handlers["GET"]["/services/{id}/edge-routers"] = service.NewListServiceEdgeRouters(o.context, o.ServiceListServiceEdgeRoutersHandler) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } o.handlers["GET"]["/services/{id}/terminators"] = service.NewListServiceTerminators(o.context, o.ServiceListServiceTerminatorsHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) diff --git a/rest_management_api_server/doc.go b/rest_management_api_server/doc.go index ae5ddcfc..c86dd9e7 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.0 +// Version: 0.26.1 // 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 abcdac48..bb7da72e 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.0" + "version": "0.26.1" }, "host": "demo.ziti.dev", "basePath": "/edge/management/v1", @@ -27538,7 +27538,7 @@ func init() { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "version": "0.26.0" + "version": "0.26.1" }, "host": "demo.ziti.dev", "basePath": "/edge/management/v1", diff --git a/rest_model/list_service_edge_routers_envelope.go b/rest_model/list_service_edge_routers_envelope.go new file mode 100644 index 00000000..d9550027 --- /dev/null +++ b/rest_model/list_service_edge_routers_envelope.go @@ -0,0 +1,179 @@ +// 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" +) + +// ListServiceEdgeRoutersEnvelope list service edge routers envelope +// +// swagger:model listServiceEdgeRoutersEnvelope +type ListServiceEdgeRoutersEnvelope struct { + + // data + // Required: true + Data *ServiceEdgeRouters `json:"data"` + + // meta + // Required: true + Meta *Meta `json:"meta"` +} + +// Validate validates this list service edge routers envelope +func (m *ListServiceEdgeRoutersEnvelope) 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 *ListServiceEdgeRoutersEnvelope) validateData(formats strfmt.Registry) error { + + if err := validate.Required("data", "body", m.Data); err != nil { + return err + } + + if m.Data != nil { + 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 *ListServiceEdgeRoutersEnvelope) 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 service edge routers envelope based on the context it is used +func (m *ListServiceEdgeRoutersEnvelope) 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 *ListServiceEdgeRoutersEnvelope) contextValidateData(ctx context.Context, formats strfmt.Registry) error { + + if m.Data != nil { + 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 *ListServiceEdgeRoutersEnvelope) 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 *ListServiceEdgeRoutersEnvelope) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ListServiceEdgeRoutersEnvelope) UnmarshalBinary(b []byte) error { + var res ListServiceEdgeRoutersEnvelope + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/rest_model/service_edge_routers.go b/rest_model/service_edge_routers.go new file mode 100644 index 00000000..ae76e45b --- /dev/null +++ b/rest_model/service_edge_routers.go @@ -0,0 +1,140 @@ +// 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" +) + +// ServiceEdgeRouters service edge routers +// +// swagger:model serviceEdgeRouters +type ServiceEdgeRouters struct { + + // edge routers + EdgeRouters []*CommonEdgeRouterProperties `json:"edgeRouters"` +} + +// Validate validates this service edge routers +func (m *ServiceEdgeRouters) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEdgeRouters(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceEdgeRouters) validateEdgeRouters(formats strfmt.Registry) error { + if swag.IsZero(m.EdgeRouters) { // not required + return nil + } + + for i := 0; i < len(m.EdgeRouters); i++ { + if swag.IsZero(m.EdgeRouters[i]) { // not required + continue + } + + if m.EdgeRouters[i] != nil { + if err := m.EdgeRouters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("edgeRouters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("edgeRouters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this service edge routers based on the context it is used +func (m *ServiceEdgeRouters) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEdgeRouters(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceEdgeRouters) contextValidateEdgeRouters(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.EdgeRouters); i++ { + + if m.EdgeRouters[i] != nil { + if err := m.EdgeRouters[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("edgeRouters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("edgeRouters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceEdgeRouters) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceEdgeRouters) UnmarshalBinary(b []byte) error { + var res ServiceEdgeRouters + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/source/client.yml b/source/client.yml index a8fa5506..54551045 100644 --- a/source/client.yml +++ b/source/client.yml @@ -1,7 +1,7 @@ --- swagger: '2.0' info: - version: 0.26.0 + version: 0.26.1 title: Ziti Edge Client description: OpenZiti Edge Client API contact: @@ -107,6 +107,8 @@ paths: $ref: 'management/services.yml#/paths/services-id' '/services/{id}/terminators': $ref: 'client/services.yml#/paths/services-id-terminators' + '/services/{id}/edge-routers': + $ref: 'client/services.yml#/paths/services-id-edge-routers' '/sessions': $ref: 'client/sessions.yml#/paths/sessions' diff --git a/source/client/services.yml b/source/client/services.yml index 445b028d..003d61f5 100644 --- a/source/client/services.yml +++ b/source/client/services.yml @@ -76,13 +76,62 @@ paths: '429': $ref: '../shared/standard-responses.yml#/responses/rateLimitedResponse' + services-id-edge-routers: + parameters: + - $ref: '../shared/parameters.yml#/id' + get: + summary: List of edge routers permitted to handle traffic for the specified service + description: | + Retrieves the list of edge routers permitted to handle traffic for the specified service + security: + - ztSession: [ ] + - oauth2: [ openid ] + tags: + - Service + operationId: listServiceEdgeRouters + parameters: + - $ref: '../shared/parameters.yml#/limit' + - $ref: '../shared/parameters.yml#/offset' + - $ref: '../shared/parameters.yml#/filter' + - name: session-token + description: an optional JWT token use to authenticate the request. If provided, the token must be valid else a not authorized response is returned. + type: string + in: header + responses: + '200': + $ref: '#/responses/listServiceEdgeRouters' + '401': + $ref: '../shared/standard-responses.yml#/responses/unauthorizedResponse' + '400': + $ref: '../shared/standard-responses.yml#/responses/badRequestResponse' + '429': + $ref: '../shared/standard-responses.yml#/responses/rateLimitedResponse' + '404': + $ref: '../shared/standard-responses.yml#/responses/notFoundResponse' + + responses: listClientTerminators: description: A list of terminators schema: $ref: '#/definitions/listClientTerminatorsEnvelope' + listServiceEdgeRouters: + description: A list of edge routers suitable for dialing or binding the specified service by the authenticated identity + schema: + $ref: '#/definitions/listServiceEdgeRoutersEnvelope' + definitions: + listServiceEdgeRoutersEnvelope: + type: object + required: + - meta + - data + properties: + meta: + $ref: '../shared/standard-responses.yml#/definitions/meta' + data: + $ref: '../shared/edge-routers.yml#/definitions/serviceEdgeRouters' listClientTerminatorsEnvelope: type: object required: diff --git a/source/management.yml b/source/management.yml index 254ecb00..d66e7dd9 100644 --- a/source/management.yml +++ b/source/management.yml @@ -1,7 +1,7 @@ --- swagger: '2.0' info: - version: 0.26.0 + version: 0.26.1 title: Ziti Edge Management description: OpenZiti Edge Management API contact: diff --git a/source/shared/edge-routers.yml b/source/shared/edge-routers.yml index 4064388d..a1783a96 100644 --- a/source/shared/edge-routers.yml +++ b/source/shared/edge-routers.yml @@ -1,5 +1,12 @@ --- definitions: + serviceEdgeRouters: + type: object + properties: + edgeRouters: + type: array + items: + $ref: '#/definitions/commonEdgeRouterProperties' commonEdgeRouterProperties: type: object required: