From dd4c03a9a8365ca13a3ec492f2afb34067ab10e4 Mon Sep 17 00:00:00 2001 From: Enda Date: Tue, 8 Jun 2021 16:32:30 +0100 Subject: [PATCH] feat: generate srs-mgmt API client (#82) --- .openapi/srs-fleet-manager.json | 361 ++++++++-- examples/srsmgmt/srs_mgmt.go | 6 +- go.mod | 4 +- go.sum | 21 +- srsmgmt/apiv1/README.md | 74 +++ srsmgmt/apiv1/api_client.go | 37 ++ srsmgmt/apiv1/client/.gitignore | 24 + srsmgmt/apiv1/client/.openapi-generator/FILES | 29 + .../apiv1/client/.openapi-generator/VERSION | 1 + srsmgmt/apiv1/client/README.md | 137 ++++ srsmgmt/apiv1/client/api/openapi.yaml | 376 +++++++++++ srsmgmt/apiv1/client/api_registries.go | 616 ++++++++++++++++++ srsmgmt/apiv1/client/client.go | 536 +++++++++++++++ srsmgmt/apiv1/client/configuration.go | 243 +++++++ srsmgmt/apiv1/client/docs/Error.md | 193 ++++++ srsmgmt/apiv1/client/docs/ErrorAllOf.md | 112 ++++ srsmgmt/apiv1/client/docs/ErrorList.md | 141 ++++ srsmgmt/apiv1/client/docs/ErrorListAllOf.md | 58 ++ srsmgmt/apiv1/client/docs/List.md | 119 ++++ srsmgmt/apiv1/client/docs/ObjectReference.md | 112 ++++ srsmgmt/apiv1/client/docs/RegistriesApi.md | 273 ++++++++ srsmgmt/apiv1/client/docs/Registry.md | 151 +++++ srsmgmt/apiv1/client/docs/RegistryCreate.md | 58 ++ srsmgmt/apiv1/client/docs/RegistryStatus.md | 75 +++ .../apiv1/client/docs/RegistryStatusValue.md | 14 + srsmgmt/apiv1/client/model_error.go | 323 +++++++++ srsmgmt/apiv1/client/model_error_all_of.go | 203 ++++++ srsmgmt/apiv1/client/model_error_list.go | 248 +++++++ .../apiv1/client/model_error_list_all_of.go | 123 ++++ srsmgmt/apiv1/client/model_list.go | 215 ++++++ .../apiv1/client/model_object_reference.go | 203 ++++++ srsmgmt/apiv1/client/model_registry.go | 264 ++++++++ srsmgmt/apiv1/client/model_registry_create.go | 124 ++++ srsmgmt/apiv1/client/model_registry_status.go | 151 +++++ .../client/model_registry_status_value.go | 113 ++++ srsmgmt/apiv1/client/registries_api_mock.go | 388 +++++++++++ srsmgmt/apiv1/client/response.go | 48 ++ srsmgmt/apiv1/client/utils.go | 329 ++++++++++ 38 files changed, 6431 insertions(+), 72 deletions(-) create mode 100644 srsmgmt/apiv1/README.md create mode 100644 srsmgmt/apiv1/api_client.go create mode 100644 srsmgmt/apiv1/client/.gitignore create mode 100644 srsmgmt/apiv1/client/.openapi-generator/FILES create mode 100644 srsmgmt/apiv1/client/.openapi-generator/VERSION create mode 100644 srsmgmt/apiv1/client/README.md create mode 100644 srsmgmt/apiv1/client/api/openapi.yaml create mode 100644 srsmgmt/apiv1/client/api_registries.go create mode 100644 srsmgmt/apiv1/client/client.go create mode 100644 srsmgmt/apiv1/client/configuration.go create mode 100644 srsmgmt/apiv1/client/docs/Error.md create mode 100644 srsmgmt/apiv1/client/docs/ErrorAllOf.md create mode 100644 srsmgmt/apiv1/client/docs/ErrorList.md create mode 100644 srsmgmt/apiv1/client/docs/ErrorListAllOf.md create mode 100644 srsmgmt/apiv1/client/docs/List.md create mode 100644 srsmgmt/apiv1/client/docs/ObjectReference.md create mode 100644 srsmgmt/apiv1/client/docs/RegistriesApi.md create mode 100644 srsmgmt/apiv1/client/docs/Registry.md create mode 100644 srsmgmt/apiv1/client/docs/RegistryCreate.md create mode 100644 srsmgmt/apiv1/client/docs/RegistryStatus.md create mode 100644 srsmgmt/apiv1/client/docs/RegistryStatusValue.md create mode 100644 srsmgmt/apiv1/client/model_error.go create mode 100644 srsmgmt/apiv1/client/model_error_all_of.go create mode 100644 srsmgmt/apiv1/client/model_error_list.go create mode 100644 srsmgmt/apiv1/client/model_error_list_all_of.go create mode 100644 srsmgmt/apiv1/client/model_list.go create mode 100644 srsmgmt/apiv1/client/model_object_reference.go create mode 100644 srsmgmt/apiv1/client/model_registry.go create mode 100644 srsmgmt/apiv1/client/model_registry_create.go create mode 100644 srsmgmt/apiv1/client/model_registry_status.go create mode 100644 srsmgmt/apiv1/client/model_registry_status_value.go create mode 100644 srsmgmt/apiv1/client/registries_api_mock.go create mode 100644 srsmgmt/apiv1/client/response.go create mode 100644 srsmgmt/apiv1/client/utils.go diff --git a/.openapi/srs-fleet-manager.json b/.openapi/srs-fleet-manager.json index 9bc1aef1..9b05aba7 100644 --- a/.openapi/srs-fleet-manager.json +++ b/.openapi/srs-fleet-manager.json @@ -1,15 +1,19 @@ { "openapi": "3.0.2", "info": { - "title": "Service Registry Service - Fleet Manager - v1", + "title": "Service Registry Fleet Manager", "version": "0.0.1", - "description": "Main entry point for the system, responsible for all sorts of management operations for the whole service of managed service registry.", + "description": "Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility.", "contact": { + "name": "Cloud Red Hat", + "url": "https://cloud.redhat.com/beta/application-services/streams/", + "email": "rhosak-eval-support@redhat.com" + }, "license": { "name": "Apache 2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0" } }, - "servers": [ + "servers": [ { "url": "https://api.openshift.com", "description": "Main (production) server" @@ -32,6 +36,7 @@ "summary": "Manage the list of all registries.", "description": "", "get": { + "tags": ["Registries"], "responses": { "200": { "content": { @@ -46,8 +51,50 @@ }, "description": "A successful response." }, + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "401Example": { + "$ref": "#/components/examples/401Example" + } + } + } + }, + "description": "Auth token is invalid" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "403Example": { + "$ref": "#/components/examples/403Example" + } + } + } + }, + "description": "User not authorized to access the service." + }, "500": { - "$ref": "#/components/responses/ServerError" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "500Example": { + "$ref": "#/components/examples/500Example" + } + } + } + }, + "description": "Unexpected error occurred" } }, "operationId": "getRegistries", @@ -60,6 +107,7 @@ ] }, "post": { + "tags": ["Registries"], "requestBody": { "description": "A new `Registry` to be created.", "content": { @@ -81,13 +129,54 @@ } }, "description": "A successful response. The full request to create a new `Registry` is processed asynchronously. User should verify the result of the operation by reading the `status` property of the created `Registry` entity." + }, "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "401Example": { + "$ref": "#/components/examples/401Example" + } + } + } + }, + "description": "Auth token is invalid" + }, + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "403Example": { + "$ref": "#/components/examples/403Example" + } + } + } + }, + "description": "User not authorized to access the service." }, "500": { - "$ref": "#/components/responses/ServerError" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "500Example": { + "$ref": "#/components/examples/500Example" + } + } + } + }, + "description": "Unexpected error occurred" } }, "operationId": "createRegistry", - "summary": "Create a Registry.", + "summary": "Create a new Registry instance", "description": "", "security": [ { @@ -96,10 +185,11 @@ ] } }, - "/api/serviceregistry_mgmt/v1/registries/{registryId}": { + "/api/serviceregistry_mgmt/v1/{registryId}": { "summary": "Manage a specific Registry.", "description": "", "get": { + "tags": ["Registries"], "responses": { "200": { "content": { @@ -111,11 +201,50 @@ }, "description": "Successful response - returns a single `Registry`." }, - "404": { - "$ref": "#/components/responses/NotFound" + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "401Example": { + "$ref": "#/components/examples/401Example" + } + } + } + }, + "description": "Auth token is invalid" }, - "500": { - "$ref": "#/components/responses/ServerError" + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "403Example": { + "$ref": "#/components/examples/403Example" + } + } + } + }, + "description": "User not authorized to access the service." + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "404Example": { + "$ref": "#/components/examples/404Example" + } + } + } + }, + "description": "No service registry with specified id exists" } }, "operationId": "getRegistry", @@ -128,15 +257,55 @@ ] }, "delete": { + "tags": ["Registries"], "responses": { "204": { "description": "Successful response." }, - "404": { - "$ref": "#/components/responses/NotFound" + "401": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "401Example": { + "$ref": "#/components/examples/401Example" + } + } + } + }, + "description": "Auth token is invalid" }, - "500": { - "$ref": "#/components/responses/ServerError" + "403": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "403Example": { + "$ref": "#/components/examples/403Example" + } + } + } + }, + "description": "User not authorized to access the service." + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "404Example": { + "$ref": "#/components/examples/404Example" + } + } + } + }, + "description": "No Service Registry with specified id exists" } }, "operationId": "deleteRegistry", @@ -163,6 +332,83 @@ }, "components": { "schemas": { + "ObjectReference": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "href": { + "type": "string" + } + } + }, + "List": { + "required": [ + "kind", + "page", + "size", + "total", + "items" + ], + "type": "object", + "properties": { + "kind": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "Error": { + "allOf": [ + { + "$ref": "#/components/schemas/ObjectReference" + }, + { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "operation_id": { + "type": "string" + } + } + } + ] + }, + "ErrorList": { + "allOf": [ + { + "$ref": "#/components/schemas/List" + }, + { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + } + } + } + } + ] + }, "Registry": { "title": "Root Type for Registry", "description": "Service Registry instance within a multi-tenant deployment.", @@ -237,25 +483,46 @@ "description": "", "enum": ["PROVISIONING", "AVAILABLE", "UNAVAILABLE"], "type": "string" + } + }, + "examples": { + "404Example": { + "value": { + "id": "404", + "kind": "Error", + "href": "/api/managed-services-api/v1/errors/7", + "code": "MGD-SERV-API-7", + "reason": "The requested resource doesn't exist" + } }, - "ErrorInfo1": { - "title": "Root Type for ErrorInfo", - "description": "Details about a specific error returned by the server.", - "required": [ - "error_code" - ], - "type": "object", - "properties": { - "error_code": { - "type": "integer" - }, - "message": { - "type": "string" - } - }, - "example": { - "error_code": 500, - "message": "An error occurred on the server." + "401Example": { + "value": { + "id": "11", + "kind": "Error", + "href": "/api/serviceregistry_mgmt/v1/errors/11", + "code": "CLOUD-SERV-API-11", + "reason": "Unable to verify JWT token: Required authorization token not found", + "operation_id": "1iY3UhEhwmXBpWPfI2lNekpd4ZD" + } + }, + "403Example": { + "value": { + "id": "4", + "kind": "Error", + "href": "/api/serviceregistry_mgmt/v1/errors/4", + "code": "MGD-SERV-API-4", + "reason": "User 'foo-bar' is not authorized to access the service.", + "operation_id": "1lY3UiEhznXBpWPfI2lNejpd4YC" + } + }, + "500Example": { + "value": { + "id": "9", + "kind": "Error", + "href": "/api/serviceregistry_mgmt/v1/errors/9", + "code": "MGD-SERV-API-9", + "reason": "Unspecified error", + "operation_id": "1ieELvF9jMQY6YghfM9gGRsHvEW" } } }, @@ -265,34 +532,6 @@ "bearerFormat": "JWT", "type": "http" } - }, - "responses": { - "NotFound": { - "$ref": "#/components/responses/NotFound1" - }, - "ServerError": { - "$ref": "#/components/responses/ServerError1" - }, - "NotFound1": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorInfo1" - } - } - }, - "description": "The response returned when something is requested but cannot be found." - }, - "ServerError1": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorInfo1" - } - } - }, - "description": "The response sent from the server when an unexpected error occurs (for example \na database connection error)." - } } } } \ No newline at end of file diff --git a/examples/srsmgmt/srs_mgmt.go b/examples/srsmgmt/srs_mgmt.go index 56aa3344..808b14a5 100644 --- a/examples/srsmgmt/srs_mgmt.go +++ b/examples/srsmgmt/srs_mgmt.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - serviceregistrymgmt "github.com/redhat-developer/app-services-sdk-go/serviceregistrymgmt/apiv1" + "github.com/redhat-developer/app-services-sdk-go/srsmgmt/apiv1" "golang.org/x/oauth2" ) @@ -16,11 +16,11 @@ func main() { ) tc := oauth2.NewClient(ctx, ts) - apiClient := serviceregistrymgmt.NewAPIClient(&serviceregistrymgmt.Config{ + apiClient := srsmgmt.NewAPIClient(&srsmgmt.Config{ HTTPClient: tc, }) - registries, _, err := apiClient.DefaultApi.GetRegistries(context.TODO()).Execute() + registries, _, err := apiClient.RegistriesApi.GetRegistries(context.TODO()).Execute() if err != nil { panic(err) } diff --git a/go.mod b/go.mod index 3886e83b..c1ee3405 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,8 @@ module github.com/redhat-developer/app-services-sdk-go go 1.13 require ( - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + github.com/golang/protobuf v1.5.2 // indirect + golang.org/x/net v0.0.0-20210521195947-fe42d452be8f // indirect golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c + google.golang.org/appengine v1.6.7 // indirect ) diff --git a/go.sum b/go.sum index c29cc9a5..1ac24962 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,10 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -80,8 +82,9 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -177,8 +180,8 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210521195947-fe42d452be8f h1:Si4U+UcgJzya9kpiEUJKQvjr512OLli+gL4poHrz93U= +golang.org/x/net v0.0.0-20210521195947-fe42d452be8f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -220,13 +223,14 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -296,8 +300,9 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -348,8 +353,10 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/srsmgmt/apiv1/README.md b/srsmgmt/apiv1/README.md new file mode 100644 index 00000000..2b47ddca --- /dev/null +++ b/srsmgmt/apiv1/README.md @@ -0,0 +1,74 @@ +# Go API client for Service Registry Service + +Managed Service Registry API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. + +## Installation + +To install the package to your project use `go get`: + +```shell +go get github.com/redhat-developer/app-services-sdk-go +``` + +## Usage + +### Importing the package + +Import the `github.com/redhat-developer/app-services-sdk-go/srsmgmt/apiv1` package into your code: + +```go +package main + +import ( + "github.com/redhat-developer/app-services-sdk-go/srsmgmt/apiv1" +) +``` + +### Basic usage + +If you do not need to customise any of the default configuration values you can pass `nil` to the `NewAPIClient` constructor: + +```go +client := srsmgmt.NewAPIClient(nil) + +registries, resp, err := client.RegistriesApi.GetRegistries(context.Background()).Execute() +``` + +### Configuration + +You can override the default configuration options: + +```go +cfg := srsmgmt.Config{ + HTTPClient: yourHTTPClient, + Debug: true, + BaseURL: "http://localhost:8080", +} + +client := srsmgmt.NewAPIClient(&cfg) +``` + +## Authentication + +The SDK does not directly handle authentication. When creating a new client, pass a [`http.Client`](https://golang.org/pkg/net/http/#Client) that can handle authentication for you. The recommended way to do this is using the [`oauth2`](https://pkg.go.dev/golang.org/x/oauth2) library. If you have an OAuth2 access token you can use it with the `oauth2` library using: + +```go +ctx := context.Background() +ts := oauth2.StaticTokenSource( + &oauth2.Token{ + AccessToken: ".. your access token ..", + }, +) + +tc := oauth2.NewClient(ctx, ts) + +client := srsmgmt.NewAPIClient(&srsmgmt.Config{ + HTTPClient: tc, +}) + +registries, _, err := client.RegistriesApi.GetRegistries(ctx).Execute() +``` + +## Endpoints + +For a full list of the available endpoints, see [Documentation for API Endpoints](./client/README.md#documentation-for-api-endpoints). \ No newline at end of file diff --git a/srsmgmt/apiv1/api_client.go b/srsmgmt/apiv1/api_client.go new file mode 100644 index 00000000..8ef41874 --- /dev/null +++ b/srsmgmt/apiv1/api_client.go @@ -0,0 +1,37 @@ +package srsmgmt + +import ( + "github.com/redhat-developer/app-services-sdk-go/internal" + + apiv1 "github.com/redhat-developer/app-services-sdk-go/srsmgmt/apiv1/client" +) + +// APIConfig defines the available configuration options +// to customise the API client settings +type Config = internal.APIConfig + +// NewAPIClient returns a new KafkaManagement v1 API client +// using a custom config +func NewAPIClient(cfg *Config) *apiv1.APIClient { + apiCfg := apiv1.NewConfiguration() + if cfg == nil { + return apiv1.NewAPIClient(apiCfg) + } + + if cfg.HTTPClient != nil { + apiCfg.HTTPClient = cfg.HTTPClient + } + if cfg.BaseURL != "" { + apiCfg.Servers = []apiv1.ServerConfiguration{ + { + URL: cfg.BaseURL, + }, + } + } + + apiCfg.Debug = cfg.Debug + + client := apiv1.NewAPIClient(apiCfg) + + return client +} diff --git a/srsmgmt/apiv1/client/.gitignore b/srsmgmt/apiv1/client/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/srsmgmt/apiv1/client/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/srsmgmt/apiv1/client/.openapi-generator/FILES b/srsmgmt/apiv1/client/.openapi-generator/FILES new file mode 100644 index 00000000..a65ba8cd --- /dev/null +++ b/srsmgmt/apiv1/client/.openapi-generator/FILES @@ -0,0 +1,29 @@ +.gitignore +README.md +api/openapi.yaml +api_registries.go +client.go +configuration.go +docs/Error.md +docs/ErrorAllOf.md +docs/ErrorList.md +docs/ErrorListAllOf.md +docs/List.md +docs/ObjectReference.md +docs/RegistriesApi.md +docs/Registry.md +docs/RegistryCreate.md +docs/RegistryStatus.md +docs/RegistryStatusValue.md +model_error.go +model_error_all_of.go +model_error_list.go +model_error_list_all_of.go +model_list.go +model_object_reference.go +model_registry.go +model_registry_create.go +model_registry_status.go +model_registry_status_value.go +response.go +utils.go diff --git a/srsmgmt/apiv1/client/.openapi-generator/VERSION b/srsmgmt/apiv1/client/.openapi-generator/VERSION new file mode 100644 index 00000000..3bff0591 --- /dev/null +++ b/srsmgmt/apiv1/client/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.1 \ No newline at end of file diff --git a/srsmgmt/apiv1/client/README.md b/srsmgmt/apiv1/client/README.md new file mode 100644 index 00000000..3e317bfb --- /dev/null +++ b/srsmgmt/apiv1/client/README.md @@ -0,0 +1,137 @@ +# Go API client for srsmgmtclient + +Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://cloud.redhat.com/beta/application-services/streams/](https://cloud.redhat.com/beta/application-services/streams/) + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import sw "./srsmgmtclient" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +``` +ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.openshift.com* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*RegistriesApi* | [**CreateRegistry**](docs/RegistriesApi.md#createregistry) | **Post** /api/serviceregistry_mgmt/v1/registries | Create a new Registry instance +*RegistriesApi* | [**DeleteRegistry**](docs/RegistriesApi.md#deleteregistry) | **Delete** /api/serviceregistry_mgmt/v1/{registryId} | Delete a Registry +*RegistriesApi* | [**GetRegistries**](docs/RegistriesApi.md#getregistries) | **Get** /api/serviceregistry_mgmt/v1/registries | Get the list of all registries. +*RegistriesApi* | [**GetRegistry**](docs/RegistriesApi.md#getregistry) | **Get** /api/serviceregistry_mgmt/v1/{registryId} | Get a Registry + + +## Documentation For Models + + - [Error](docs/Error.md) + - [ErrorAllOf](docs/ErrorAllOf.md) + - [ErrorList](docs/ErrorList.md) + - [ErrorListAllOf](docs/ErrorListAllOf.md) + - [List](docs/List.md) + - [ObjectReference](docs/ObjectReference.md) + - [Registry](docs/Registry.md) + - [RegistryCreate](docs/RegistryCreate.md) + - [RegistryStatus](docs/RegistryStatus.md) + - [RegistryStatusValue](docs/RegistryStatusValue.md) + + +## Documentation For Authorization + + + +### Bearer + +- **Type**: HTTP Bearer token authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARERTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + +rhosak-eval-support@redhat.com + diff --git a/srsmgmt/apiv1/client/api/openapi.yaml b/srsmgmt/apiv1/client/api/openapi.yaml new file mode 100644 index 00000000..39ba251e --- /dev/null +++ b/srsmgmt/apiv1/client/api/openapi.yaml @@ -0,0 +1,376 @@ +openapi: 3.0.2 +info: + contact: + email: rhosak-eval-support@redhat.com + name: Cloud Red Hat + url: https://cloud.redhat.com/beta/application-services/streams/ + description: Managed Service Registry cloud.redhat.com API Management API that lets + you create new registry instances. Registry is a datastore for standard event + schemas and API designs. Service Registry enables developers to manage and share + the structure of their data using a REST interface. For example, client applications + can dynamically push or pull the latest updates to or from the registry without + needing to redeploy. Registry is an Managed version of upstream project called + Apicurio Registry. Apicurio Registry also enables developers to create rules that + govern how registry content can evolve over time. For example, this includes rules + for content validation and version compatibility. + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0 + title: Service Registry Fleet Manager + version: 0.0.1 +servers: +- description: Main (production) server + url: https://api.openshift.com +- description: Staging server + url: https://api.stage.openshift.com +- description: localhost + url: http://localhost:8000 +- description: current domain + url: / +paths: + /api/serviceregistry_mgmt/v1/registries: + get: + operationId: getRegistries + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Registry' + type: array + description: A successful response. + "401": + content: + application/json: + examples: + "401Example": + $ref: '#/components/examples/401Example' + schema: + $ref: '#/components/schemas/Error' + description: Auth token is invalid + "403": + content: + application/json: + examples: + "403Example": + $ref: '#/components/examples/403Example' + schema: + $ref: '#/components/schemas/Error' + description: User not authorized to access the service. + "500": + content: + application/json: + examples: + "500Example": + $ref: '#/components/examples/500Example' + schema: + $ref: '#/components/schemas/Error' + description: Unexpected error occurred + security: + - Bearer: [] + summary: Get the list of all registries. + tags: + - Registries + post: + operationId: createRegistry + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RegistryCreate' + description: A new `Registry` to be created. + required: true + responses: + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/Registry' + description: A successful response. The full request to create a new `Registry` + is processed asynchronously. User should verify the result of the operation + by reading the `status` property of the created `Registry` entity. + "401": + content: + application/json: + examples: + "401Example": + $ref: '#/components/examples/401Example' + schema: + $ref: '#/components/schemas/Error' + description: Auth token is invalid + "403": + content: + application/json: + examples: + "403Example": + $ref: '#/components/examples/403Example' + schema: + $ref: '#/components/schemas/Error' + description: User not authorized to access the service. + "500": + content: + application/json: + examples: + "500Example": + $ref: '#/components/examples/500Example' + schema: + $ref: '#/components/schemas/Error' + description: Unexpected error occurred + security: + - Bearer: [] + summary: Create a new Registry instance + tags: + - Registries + summary: Manage the list of all registries. + /api/serviceregistry_mgmt/v1/{registryId}: + delete: + description: Deletes an existing `Registry`. + operationId: deleteRegistry + parameters: + - description: A unique identifier for a `Registry`. + explode: false + in: path + name: registryId + required: true + schema: + type: integer + style: simple + responses: + "204": + description: Successful response. + "401": + content: + application/json: + examples: + "401Example": + $ref: '#/components/examples/401Example' + schema: + $ref: '#/components/schemas/Error' + description: Auth token is invalid + "403": + content: + application/json: + examples: + "403Example": + $ref: '#/components/examples/403Example' + schema: + $ref: '#/components/schemas/Error' + description: User not authorized to access the service. + "404": + content: + application/json: + examples: + "404Example": + $ref: '#/components/examples/404Example' + schema: + $ref: '#/components/schemas/Error' + description: No Service Registry with specified id exists + security: + - Bearer: [] + summary: Delete a Registry + tags: + - Registries + get: + description: Gets the details of a single instance of a `Registry`. + operationId: getRegistry + parameters: + - description: A unique identifier for a `Registry`. + explode: false + in: path + name: registryId + required: true + schema: + type: integer + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Registry' + description: Successful response - returns a single `Registry`. + "401": + content: + application/json: + examples: + "401Example": + $ref: '#/components/examples/401Example' + schema: + $ref: '#/components/schemas/Error' + description: Auth token is invalid + "403": + content: + application/json: + examples: + "403Example": + $ref: '#/components/examples/403Example' + schema: + $ref: '#/components/schemas/Error' + description: User not authorized to access the service. + "404": + content: + application/json: + examples: + "404Example": + $ref: '#/components/examples/404Example' + schema: + $ref: '#/components/schemas/Error' + description: No service registry with specified id exists + security: + - Bearer: [] + summary: Get a Registry + tags: + - Registries + summary: Manage a specific Registry. +components: + examples: + "404Example": + value: + id: "404" + kind: Error + href: /api/managed-services-api/v1/errors/7 + code: MGD-SERV-API-7 + reason: The requested resource doesn't exist + "401Example": + value: + id: "11" + kind: Error + href: /api/serviceregistry_mgmt/v1/errors/11 + code: CLOUD-SERV-API-11 + reason: 'Unable to verify JWT token: Required authorization token not found' + operation_id: 1iY3UhEhwmXBpWPfI2lNekpd4ZD + "403Example": + value: + id: "4" + kind: Error + href: /api/serviceregistry_mgmt/v1/errors/4 + code: MGD-SERV-API-4 + reason: User 'foo-bar' is not authorized to access the service. + operation_id: 1lY3UiEhznXBpWPfI2lNejpd4YC + "500Example": + value: + id: "9" + kind: Error + href: /api/serviceregistry_mgmt/v1/errors/9 + code: MGD-SERV-API-9 + reason: Unspecified error + operation_id: 1ieELvF9jMQY6YghfM9gGRsHvEW + schemas: + ObjectReference: + properties: + id: + type: string + kind: + type: string + href: + type: string + type: object + List: + properties: + kind: + type: string + page: + type: integer + size: + type: integer + total: + type: integer + required: + - items + - kind + - page + - size + - total + type: object + Error: + allOf: + - $ref: '#/components/schemas/ObjectReference' + - $ref: '#/components/schemas/Error_allOf' + ErrorList: + allOf: + - $ref: '#/components/schemas/List' + - $ref: '#/components/schemas/ErrorList_allOf' + Registry: + description: Service Registry instance within a multi-tenant deployment. + example: + id: 42 + name: my-registry + registryUrl: https://registry.apps.example.com/t/5213600b-afc9-487e-8cc3-339f4248d706 + status: + status: PROVISIONING + lastUpdated: 2021-05-04T12:34:56Z + registryDeploymentId: 1 + properties: + id: + type: integer + status: + $ref: '#/components/schemas/RegistryStatus' + registryUrl: + type: string + name: + description: User-defined Registry name. Does not have to be unique. + type: string + registryDeploymentId: + description: Identifier of a multi-tenant deployment, where this Service + Registry instance resides. + type: integer + required: + - id + - registryUrl + - status + title: Root Type for Registry + type: object + RegistryStatus: + example: + value: AVAILABLE + lastUpdated: 2021-05-04T12:34:56Z + properties: + lastUpdated: + description: ISO 8601 UTC timestamp. + format: date-time + type: string + value: + $ref: '#/components/schemas/RegistryStatusValue' + required: + - lastUpdated + - value + type: object + RegistryCreate: + description: Information used to create a new Service Registry instance within + a multi-tenant deployment. + example: + name: my-registry + properties: + name: + description: User-defined Registry name. Does not have to be unique. + type: string + title: Root Type for RegistryCreate + type: object + RegistryStatusValue: + enum: + - PROVISIONING + - AVAILABLE + - UNAVAILABLE + type: string + Error_allOf: + properties: + code: + type: string + reason: + type: string + operation_id: + type: string + type: object + ErrorList_allOf: + properties: + items: + items: + $ref: '#/components/schemas/Error' + type: array + type: object + securitySchemes: + Bearer: + bearerFormat: JWT + scheme: bearer + type: http diff --git a/srsmgmt/apiv1/client/api_registries.go b/srsmgmt/apiv1/client/api_registries.go new file mode 100644 index 00000000..527997bb --- /dev/null +++ b/srsmgmt/apiv1/client/api_registries.go @@ -0,0 +1,616 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "bytes" + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +type RegistriesApi interface { + + /* + * CreateRegistry Create a new Registry instance + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiCreateRegistryRequest + */ + CreateRegistry(ctx _context.Context) ApiCreateRegistryRequest + + /* + * CreateRegistryExecute executes the request + * @return Registry + */ + CreateRegistryExecute(r ApiCreateRegistryRequest) (Registry, *_nethttp.Response, error) + + /* + * DeleteRegistry Delete a Registry + * Deletes an existing `Registry`. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param registryId A unique identifier for a `Registry`. + * @return ApiDeleteRegistryRequest + */ + DeleteRegistry(ctx _context.Context, registryId int32) ApiDeleteRegistryRequest + + /* + * DeleteRegistryExecute executes the request + */ + DeleteRegistryExecute(r ApiDeleteRegistryRequest) (*_nethttp.Response, error) + + /* + * GetRegistries Get the list of all registries. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetRegistriesRequest + */ + GetRegistries(ctx _context.Context) ApiGetRegistriesRequest + + /* + * GetRegistriesExecute executes the request + * @return []Registry + */ + GetRegistriesExecute(r ApiGetRegistriesRequest) ([]Registry, *_nethttp.Response, error) + + /* + * GetRegistry Get a Registry + * Gets the details of a single instance of a `Registry`. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param registryId A unique identifier for a `Registry`. + * @return ApiGetRegistryRequest + */ + GetRegistry(ctx _context.Context, registryId int32) ApiGetRegistryRequest + + /* + * GetRegistryExecute executes the request + * @return Registry + */ + GetRegistryExecute(r ApiGetRegistryRequest) (Registry, *_nethttp.Response, error) +} + +// RegistriesApiService RegistriesApi service +type RegistriesApiService service + +type ApiCreateRegistryRequest struct { + ctx _context.Context + ApiService RegistriesApi + registryCreate *RegistryCreate +} + +func (r ApiCreateRegistryRequest) RegistryCreate(registryCreate RegistryCreate) ApiCreateRegistryRequest { + r.registryCreate = ®istryCreate + return r +} + +func (r ApiCreateRegistryRequest) Execute() (Registry, *_nethttp.Response, error) { + return r.ApiService.CreateRegistryExecute(r) +} + +/* + * CreateRegistry Create a new Registry instance + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiCreateRegistryRequest + */ +func (a *RegistriesApiService) CreateRegistry(ctx _context.Context) ApiCreateRegistryRequest { + return ApiCreateRegistryRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return Registry + */ +func (a *RegistriesApiService) CreateRegistryExecute(r ApiCreateRegistryRequest) (Registry, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Registry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegistriesApiService.CreateRegistry") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/serviceregistry_mgmt/v1/registries" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.registryCreate == nil { + return localVarReturnValue, nil, reportError("registryCreate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.registryCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteRegistryRequest struct { + ctx _context.Context + ApiService RegistriesApi + registryId int32 +} + + +func (r ApiDeleteRegistryRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeleteRegistryExecute(r) +} + +/* + * DeleteRegistry Delete a Registry + * Deletes an existing `Registry`. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param registryId A unique identifier for a `Registry`. + * @return ApiDeleteRegistryRequest + */ +func (a *RegistriesApiService) DeleteRegistry(ctx _context.Context, registryId int32) ApiDeleteRegistryRequest { + return ApiDeleteRegistryRequest{ + ApiService: a, + ctx: ctx, + registryId: registryId, + } +} + +/* + * Execute executes the request + */ +func (a *RegistriesApiService) DeleteRegistryExecute(r ApiDeleteRegistryRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegistriesApiService.DeleteRegistry") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/serviceregistry_mgmt/v1/{registryId}" + localVarPath = strings.Replace(localVarPath, "{"+"registryId"+"}", _neturl.PathEscape(parameterToString(r.registryId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetRegistriesRequest struct { + ctx _context.Context + ApiService RegistriesApi +} + + +func (r ApiGetRegistriesRequest) Execute() ([]Registry, *_nethttp.Response, error) { + return r.ApiService.GetRegistriesExecute(r) +} + +/* + * GetRegistries Get the list of all registries. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiGetRegistriesRequest + */ +func (a *RegistriesApiService) GetRegistries(ctx _context.Context) ApiGetRegistriesRequest { + return ApiGetRegistriesRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return []Registry + */ +func (a *RegistriesApiService) GetRegistriesExecute(r ApiGetRegistriesRequest) ([]Registry, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Registry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegistriesApiService.GetRegistries") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/serviceregistry_mgmt/v1/registries" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRegistryRequest struct { + ctx _context.Context + ApiService RegistriesApi + registryId int32 +} + + +func (r ApiGetRegistryRequest) Execute() (Registry, *_nethttp.Response, error) { + return r.ApiService.GetRegistryExecute(r) +} + +/* + * GetRegistry Get a Registry + * Gets the details of a single instance of a `Registry`. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param registryId A unique identifier for a `Registry`. + * @return ApiGetRegistryRequest + */ +func (a *RegistriesApiService) GetRegistry(ctx _context.Context, registryId int32) ApiGetRegistryRequest { + return ApiGetRegistryRequest{ + ApiService: a, + ctx: ctx, + registryId: registryId, + } +} + +/* + * Execute executes the request + * @return Registry + */ +func (a *RegistriesApiService) GetRegistryExecute(r ApiGetRegistryRequest) (Registry, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Registry + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegistriesApiService.GetRegistry") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/serviceregistry_mgmt/v1/{registryId}" + localVarPath = strings.Replace(localVarPath, "{"+"registryId"+"}", _neturl.PathEscape(parameterToString(r.registryId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/srsmgmt/apiv1/client/client.go b/srsmgmt/apiv1/client/client.go new file mode 100644 index 00000000..41dd632f --- /dev/null +++ b/srsmgmt/apiv1/client/client.go @@ -0,0 +1,536 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the Service Registry Fleet Manager API v0.0.1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + RegistriesApi RegistriesApi +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.RegistriesApi = (*RegistriesApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(**os.File); ok { + _, err = bodyBuf.ReadFrom(*fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/srsmgmt/apiv1/client/configuration.go b/srsmgmt/apiv1/client/configuration.go new file mode 100644 index 00000000..95204e5d --- /dev/null +++ b/srsmgmt/apiv1/client/configuration.go @@ -0,0 +1,243 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://api.openshift.com", + Description: "Main (production) server", + }, + { + URL: "https://api.stage.openshift.com", + Description: "Staging server", + }, + { + URL: "http://localhost:8000", + Description: "localhost", + }, + { + URL: "", + Description: "current domain", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/srsmgmt/apiv1/client/docs/Error.md b/srsmgmt/apiv1/client/docs/Error.md new file mode 100644 index 00000000..e6af6fa9 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/Error.md @@ -0,0 +1,193 @@ +# Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Kind** | Pointer to **string** | | [optional] +**Href** | Pointer to **string** | | [optional] +**Code** | Pointer to **string** | | [optional] +**Reason** | Pointer to **string** | | [optional] +**OperationId** | Pointer to **string** | | [optional] + + +## Methods + +### NewError + +`func NewError() *Error` + +NewError instantiates a new Error object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorWithDefaults + +`func NewErrorWithDefaults() *Error` + +NewErrorWithDefaults instantiates a new Error object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetId + +`func (o *Error) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Error) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Error) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *Error) HasId() bool` + +HasId returns a boolean if a field has been set. + + +### GetKind + +`func (o *Error) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *Error) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *Error) SetKind(v string)` + +SetKind sets Kind field to given value. + +### HasKind + +`func (o *Error) HasKind() bool` + +HasKind returns a boolean if a field has been set. + + +### GetHref + +`func (o *Error) GetHref() string` + +GetHref returns the Href field if non-nil, zero value otherwise. + +### GetHrefOk + +`func (o *Error) GetHrefOk() (*string, bool)` + +GetHrefOk returns a tuple with the Href field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHref + +`func (o *Error) SetHref(v string)` + +SetHref sets Href field to given value. + +### HasHref + +`func (o *Error) HasHref() bool` + +HasHref returns a boolean if a field has been set. + + +### GetCode + +`func (o *Error) GetCode() string` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *Error) GetCodeOk() (*string, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *Error) SetCode(v string)` + +SetCode sets Code field to given value. + +### HasCode + +`func (o *Error) HasCode() bool` + +HasCode returns a boolean if a field has been set. + + +### GetReason + +`func (o *Error) GetReason() string` + +GetReason returns the Reason field if non-nil, zero value otherwise. + +### GetReasonOk + +`func (o *Error) GetReasonOk() (*string, bool)` + +GetReasonOk returns a tuple with the Reason field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReason + +`func (o *Error) SetReason(v string)` + +SetReason sets Reason field to given value. + +### HasReason + +`func (o *Error) HasReason() bool` + +HasReason returns a boolean if a field has been set. + + +### GetOperationId + +`func (o *Error) GetOperationId() string` + +GetOperationId returns the OperationId field if non-nil, zero value otherwise. + +### GetOperationIdOk + +`func (o *Error) GetOperationIdOk() (*string, bool)` + +GetOperationIdOk returns a tuple with the OperationId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOperationId + +`func (o *Error) SetOperationId(v string)` + +SetOperationId sets OperationId field to given value. + +### HasOperationId + +`func (o *Error) HasOperationId() bool` + +HasOperationId returns a boolean if a field has been set. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/ErrorAllOf.md b/srsmgmt/apiv1/client/docs/ErrorAllOf.md new file mode 100644 index 00000000..c0c1a2b5 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/ErrorAllOf.md @@ -0,0 +1,112 @@ +# ErrorAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | Pointer to **string** | | [optional] +**Reason** | Pointer to **string** | | [optional] +**OperationId** | Pointer to **string** | | [optional] + + +## Methods + +### NewErrorAllOf + +`func NewErrorAllOf() *ErrorAllOf` + +NewErrorAllOf instantiates a new ErrorAllOf object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorAllOfWithDefaults + +`func NewErrorAllOfWithDefaults() *ErrorAllOf` + +NewErrorAllOfWithDefaults instantiates a new ErrorAllOf object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetCode + +`func (o *ErrorAllOf) GetCode() string` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *ErrorAllOf) GetCodeOk() (*string, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *ErrorAllOf) SetCode(v string)` + +SetCode sets Code field to given value. + +### HasCode + +`func (o *ErrorAllOf) HasCode() bool` + +HasCode returns a boolean if a field has been set. + + +### GetReason + +`func (o *ErrorAllOf) GetReason() string` + +GetReason returns the Reason field if non-nil, zero value otherwise. + +### GetReasonOk + +`func (o *ErrorAllOf) GetReasonOk() (*string, bool)` + +GetReasonOk returns a tuple with the Reason field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReason + +`func (o *ErrorAllOf) SetReason(v string)` + +SetReason sets Reason field to given value. + +### HasReason + +`func (o *ErrorAllOf) HasReason() bool` + +HasReason returns a boolean if a field has been set. + + +### GetOperationId + +`func (o *ErrorAllOf) GetOperationId() string` + +GetOperationId returns the OperationId field if non-nil, zero value otherwise. + +### GetOperationIdOk + +`func (o *ErrorAllOf) GetOperationIdOk() (*string, bool)` + +GetOperationIdOk returns a tuple with the OperationId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOperationId + +`func (o *ErrorAllOf) SetOperationId(v string)` + +SetOperationId sets OperationId field to given value. + +### HasOperationId + +`func (o *ErrorAllOf) HasOperationId() bool` + +HasOperationId returns a boolean if a field has been set. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/ErrorList.md b/srsmgmt/apiv1/client/docs/ErrorList.md new file mode 100644 index 00000000..09c0bfbb --- /dev/null +++ b/srsmgmt/apiv1/client/docs/ErrorList.md @@ -0,0 +1,141 @@ +# ErrorList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | **string** | | +**Page** | **int32** | | +**Size** | **int32** | | +**Total** | **int32** | | +**Items** | [**[]Error**](Error.md) | | + + +## Methods + +### NewErrorList + +`func NewErrorList(kind string, page int32, size int32, total int32, items []Error, ) *ErrorList` + +NewErrorList instantiates a new ErrorList object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorListWithDefaults + +`func NewErrorListWithDefaults() *ErrorList` + +NewErrorListWithDefaults instantiates a new ErrorList object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetKind + +`func (o *ErrorList) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *ErrorList) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *ErrorList) SetKind(v string)` + +SetKind sets Kind field to given value. + + + +### GetPage + +`func (o *ErrorList) GetPage() int32` + +GetPage returns the Page field if non-nil, zero value otherwise. + +### GetPageOk + +`func (o *ErrorList) GetPageOk() (*int32, bool)` + +GetPageOk returns a tuple with the Page field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPage + +`func (o *ErrorList) SetPage(v int32)` + +SetPage sets Page field to given value. + + + +### GetSize + +`func (o *ErrorList) GetSize() int32` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *ErrorList) GetSizeOk() (*int32, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *ErrorList) SetSize(v int32)` + +SetSize sets Size field to given value. + + + +### GetTotal + +`func (o *ErrorList) GetTotal() int32` + +GetTotal returns the Total field if non-nil, zero value otherwise. + +### GetTotalOk + +`func (o *ErrorList) GetTotalOk() (*int32, bool)` + +GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotal + +`func (o *ErrorList) SetTotal(v int32)` + +SetTotal sets Total field to given value. + + + +### GetItems + +`func (o *ErrorList) GetItems() []Error` + +GetItems returns the Items field if non-nil, zero value otherwise. + +### GetItemsOk + +`func (o *ErrorList) GetItemsOk() (*[]Error, bool)` + +GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetItems + +`func (o *ErrorList) SetItems(v []Error)` + +SetItems sets Items field to given value. + + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/ErrorListAllOf.md b/srsmgmt/apiv1/client/docs/ErrorListAllOf.md new file mode 100644 index 00000000..e16f28d5 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/ErrorListAllOf.md @@ -0,0 +1,58 @@ +# ErrorListAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Items** | Pointer to [**[]Error**](Error.md) | | [optional] + + +## Methods + +### NewErrorListAllOf + +`func NewErrorListAllOf() *ErrorListAllOf` + +NewErrorListAllOf instantiates a new ErrorListAllOf object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorListAllOfWithDefaults + +`func NewErrorListAllOfWithDefaults() *ErrorListAllOf` + +NewErrorListAllOfWithDefaults instantiates a new ErrorListAllOf object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetItems + +`func (o *ErrorListAllOf) GetItems() []Error` + +GetItems returns the Items field if non-nil, zero value otherwise. + +### GetItemsOk + +`func (o *ErrorListAllOf) GetItemsOk() (*[]Error, bool)` + +GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetItems + +`func (o *ErrorListAllOf) SetItems(v []Error)` + +SetItems sets Items field to given value. + +### HasItems + +`func (o *ErrorListAllOf) HasItems() bool` + +HasItems returns a boolean if a field has been set. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/List.md b/srsmgmt/apiv1/client/docs/List.md new file mode 100644 index 00000000..40213442 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/List.md @@ -0,0 +1,119 @@ +# List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | **string** | | +**Page** | **int32** | | +**Size** | **int32** | | +**Total** | **int32** | | + + +## Methods + +### NewList + +`func NewList(kind string, page int32, size int32, total int32, ) *List` + +NewList instantiates a new List object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewListWithDefaults + +`func NewListWithDefaults() *List` + +NewListWithDefaults instantiates a new List object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetKind + +`func (o *List) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *List) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *List) SetKind(v string)` + +SetKind sets Kind field to given value. + + + +### GetPage + +`func (o *List) GetPage() int32` + +GetPage returns the Page field if non-nil, zero value otherwise. + +### GetPageOk + +`func (o *List) GetPageOk() (*int32, bool)` + +GetPageOk returns a tuple with the Page field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPage + +`func (o *List) SetPage(v int32)` + +SetPage sets Page field to given value. + + + +### GetSize + +`func (o *List) GetSize() int32` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *List) GetSizeOk() (*int32, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *List) SetSize(v int32)` + +SetSize sets Size field to given value. + + + +### GetTotal + +`func (o *List) GetTotal() int32` + +GetTotal returns the Total field if non-nil, zero value otherwise. + +### GetTotalOk + +`func (o *List) GetTotalOk() (*int32, bool)` + +GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotal + +`func (o *List) SetTotal(v int32)` + +SetTotal sets Total field to given value. + + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/ObjectReference.md b/srsmgmt/apiv1/client/docs/ObjectReference.md new file mode 100644 index 00000000..f3840e9c --- /dev/null +++ b/srsmgmt/apiv1/client/docs/ObjectReference.md @@ -0,0 +1,112 @@ +# ObjectReference + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | | [optional] +**Kind** | Pointer to **string** | | [optional] +**Href** | Pointer to **string** | | [optional] + + +## Methods + +### NewObjectReference + +`func NewObjectReference() *ObjectReference` + +NewObjectReference instantiates a new ObjectReference object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewObjectReferenceWithDefaults + +`func NewObjectReferenceWithDefaults() *ObjectReference` + +NewObjectReferenceWithDefaults instantiates a new ObjectReference object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetId + +`func (o *ObjectReference) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *ObjectReference) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *ObjectReference) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *ObjectReference) HasId() bool` + +HasId returns a boolean if a field has been set. + + +### GetKind + +`func (o *ObjectReference) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *ObjectReference) GetKindOk() (*string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKind + +`func (o *ObjectReference) SetKind(v string)` + +SetKind sets Kind field to given value. + +### HasKind + +`func (o *ObjectReference) HasKind() bool` + +HasKind returns a boolean if a field has been set. + + +### GetHref + +`func (o *ObjectReference) GetHref() string` + +GetHref returns the Href field if non-nil, zero value otherwise. + +### GetHrefOk + +`func (o *ObjectReference) GetHrefOk() (*string, bool)` + +GetHrefOk returns a tuple with the Href field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHref + +`func (o *ObjectReference) SetHref(v string)` + +SetHref sets Href field to given value. + +### HasHref + +`func (o *ObjectReference) HasHref() bool` + +HasHref returns a boolean if a field has been set. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/RegistriesApi.md b/srsmgmt/apiv1/client/docs/RegistriesApi.md new file mode 100644 index 00000000..73d1b43d --- /dev/null +++ b/srsmgmt/apiv1/client/docs/RegistriesApi.md @@ -0,0 +1,273 @@ +# \RegistriesApi + +All URIs are relative to *https://api.openshift.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateRegistry**](RegistriesApi.md#CreateRegistry) | **Post** /api/serviceregistry_mgmt/v1/registries | Create a new Registry instance +[**DeleteRegistry**](RegistriesApi.md#DeleteRegistry) | **Delete** /api/serviceregistry_mgmt/v1/{registryId} | Delete a Registry +[**GetRegistries**](RegistriesApi.md#GetRegistries) | **Get** /api/serviceregistry_mgmt/v1/registries | Get the list of all registries. +[**GetRegistry**](RegistriesApi.md#GetRegistry) | **Get** /api/serviceregistry_mgmt/v1/{registryId} | Get a Registry + + + +## CreateRegistry + +> Registry CreateRegistry(ctx).RegistryCreate(registryCreate).Execute() + +Create a new Registry instance + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + registryCreate := *openapiclient.NewRegistryCreate() // RegistryCreate | A new `Registry` to be created. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.RegistriesApi.CreateRegistry(context.Background()).RegistryCreate(registryCreate).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RegistriesApi.CreateRegistry``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateRegistry`: Registry + fmt.Fprintf(os.Stdout, "Response from `RegistriesApi.CreateRegistry`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateRegistryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **registryCreate** | [**RegistryCreate**](RegistryCreate.md) | A new `Registry` to be created. | + +### Return type + +[**Registry**](Registry.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteRegistry + +> DeleteRegistry(ctx, registryId).Execute() + +Delete a Registry + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + registryId := int32(56) // int32 | A unique identifier for a `Registry`. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.RegistriesApi.DeleteRegistry(context.Background(), registryId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RegistriesApi.DeleteRegistry``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**registryId** | **int32** | A unique identifier for a `Registry`. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteRegistryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetRegistries + +> []Registry GetRegistries(ctx).Execute() + +Get the list of all registries. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.RegistriesApi.GetRegistries(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RegistriesApi.GetRegistries``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetRegistries`: []Registry + fmt.Fprintf(os.Stdout, "Response from `RegistriesApi.GetRegistries`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetRegistriesRequest struct via the builder pattern + + +### Return type + +[**[]Registry**](Registry.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetRegistry + +> Registry GetRegistry(ctx, registryId).Execute() + +Get a Registry + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + registryId := int32(56) // int32 | A unique identifier for a `Registry`. + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.RegistriesApi.GetRegistry(context.Background(), registryId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RegistriesApi.GetRegistry``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetRegistry`: Registry + fmt.Fprintf(os.Stdout, "Response from `RegistriesApi.GetRegistry`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**registryId** | **int32** | A unique identifier for a `Registry`. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetRegistryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Registry**](Registry.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/Registry.md b/srsmgmt/apiv1/client/docs/Registry.md new file mode 100644 index 00000000..59d9032c --- /dev/null +++ b/srsmgmt/apiv1/client/docs/Registry.md @@ -0,0 +1,151 @@ +# Registry + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int32** | | +**Status** | [**RegistryStatus**](RegistryStatus.md) | | +**RegistryUrl** | **string** | | +**Name** | Pointer to **string** | User-defined Registry name. Does not have to be unique. | [optional] +**RegistryDeploymentId** | Pointer to **int32** | Identifier of a multi-tenant deployment, where this Service Registry instance resides. | [optional] + + +## Methods + +### NewRegistry + +`func NewRegistry(id int32, status RegistryStatus, registryUrl string, ) *Registry` + +NewRegistry instantiates a new Registry object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRegistryWithDefaults + +`func NewRegistryWithDefaults() *Registry` + +NewRegistryWithDefaults instantiates a new Registry object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetId + +`func (o *Registry) GetId() int32` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Registry) GetIdOk() (*int32, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Registry) SetId(v int32)` + +SetId sets Id field to given value. + + + +### GetStatus + +`func (o *Registry) GetStatus() RegistryStatus` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *Registry) GetStatusOk() (*RegistryStatus, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *Registry) SetStatus(v RegistryStatus)` + +SetStatus sets Status field to given value. + + + +### GetRegistryUrl + +`func (o *Registry) GetRegistryUrl() string` + +GetRegistryUrl returns the RegistryUrl field if non-nil, zero value otherwise. + +### GetRegistryUrlOk + +`func (o *Registry) GetRegistryUrlOk() (*string, bool)` + +GetRegistryUrlOk returns a tuple with the RegistryUrl field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegistryUrl + +`func (o *Registry) SetRegistryUrl(v string)` + +SetRegistryUrl sets RegistryUrl field to given value. + + + +### GetName + +`func (o *Registry) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *Registry) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *Registry) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *Registry) HasName() bool` + +HasName returns a boolean if a field has been set. + + +### GetRegistryDeploymentId + +`func (o *Registry) GetRegistryDeploymentId() int32` + +GetRegistryDeploymentId returns the RegistryDeploymentId field if non-nil, zero value otherwise. + +### GetRegistryDeploymentIdOk + +`func (o *Registry) GetRegistryDeploymentIdOk() (*int32, bool)` + +GetRegistryDeploymentIdOk returns a tuple with the RegistryDeploymentId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegistryDeploymentId + +`func (o *Registry) SetRegistryDeploymentId(v int32)` + +SetRegistryDeploymentId sets RegistryDeploymentId field to given value. + +### HasRegistryDeploymentId + +`func (o *Registry) HasRegistryDeploymentId() bool` + +HasRegistryDeploymentId returns a boolean if a field has been set. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/RegistryCreate.md b/srsmgmt/apiv1/client/docs/RegistryCreate.md new file mode 100644 index 00000000..bbeac276 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/RegistryCreate.md @@ -0,0 +1,58 @@ +# RegistryCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | Pointer to **string** | User-defined Registry name. Does not have to be unique. | [optional] + + +## Methods + +### NewRegistryCreate + +`func NewRegistryCreate() *RegistryCreate` + +NewRegistryCreate instantiates a new RegistryCreate object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRegistryCreateWithDefaults + +`func NewRegistryCreateWithDefaults() *RegistryCreate` + +NewRegistryCreateWithDefaults instantiates a new RegistryCreate object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetName + +`func (o *RegistryCreate) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *RegistryCreate) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *RegistryCreate) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *RegistryCreate) HasName() bool` + +HasName returns a boolean if a field has been set. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/RegistryStatus.md b/srsmgmt/apiv1/client/docs/RegistryStatus.md new file mode 100644 index 00000000..c7fde322 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/RegistryStatus.md @@ -0,0 +1,75 @@ +# RegistryStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastUpdated** | **time.Time** | ISO 8601 UTC timestamp. | +**Value** | [**RegistryStatusValue**](RegistryStatusValue.md) | | + + +## Methods + +### NewRegistryStatus + +`func NewRegistryStatus(lastUpdated time.Time, value RegistryStatusValue, ) *RegistryStatus` + +NewRegistryStatus instantiates a new RegistryStatus object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRegistryStatusWithDefaults + +`func NewRegistryStatusWithDefaults() *RegistryStatus` + +NewRegistryStatusWithDefaults instantiates a new RegistryStatus object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +### GetLastUpdated + +`func (o *RegistryStatus) GetLastUpdated() time.Time` + +GetLastUpdated returns the LastUpdated field if non-nil, zero value otherwise. + +### GetLastUpdatedOk + +`func (o *RegistryStatus) GetLastUpdatedOk() (*time.Time, bool)` + +GetLastUpdatedOk returns a tuple with the LastUpdated field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastUpdated + +`func (o *RegistryStatus) SetLastUpdated(v time.Time)` + +SetLastUpdated sets LastUpdated field to given value. + + + +### GetValue + +`func (o *RegistryStatus) GetValue() RegistryStatusValue` + +GetValue returns the Value field if non-nil, zero value otherwise. + +### GetValueOk + +`func (o *RegistryStatus) GetValueOk() (*RegistryStatusValue, bool)` + +GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValue + +`func (o *RegistryStatus) SetValue(v RegistryStatusValue)` + +SetValue sets Value field to given value. + + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/docs/RegistryStatusValue.md b/srsmgmt/apiv1/client/docs/RegistryStatusValue.md new file mode 100644 index 00000000..5ee38483 --- /dev/null +++ b/srsmgmt/apiv1/client/docs/RegistryStatusValue.md @@ -0,0 +1,14 @@ +# RegistryStatusValue + +## Enum + + +* `PROVISIONING` (value: `"PROVISIONING"`) + +* `AVAILABLE` (value: `"AVAILABLE"`) + +* `UNAVAILABLE` (value: `"UNAVAILABLE"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/srsmgmt/apiv1/client/model_error.go b/srsmgmt/apiv1/client/model_error.go new file mode 100644 index 00000000..c0d3feb6 --- /dev/null +++ b/srsmgmt/apiv1/client/model_error.go @@ -0,0 +1,323 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// Error struct for Error +type Error struct { + + Id *string `json:"id,omitempty"` + + Kind *string `json:"kind,omitempty"` + + Href *string `json:"href,omitempty"` + + Code *string `json:"code,omitempty"` + + Reason *string `json:"reason,omitempty"` + + OperationId *string `json:"operation_id,omitempty"` + +} + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError() *Error { + this := Error{} + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + + + + + + + + return &this +} + + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Error) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *Error) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Error) SetId(v string) { + o.Id = &v +} + + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *Error) GetKind() string { + if o == nil || o.Kind == nil { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetKindOk() (*string, bool) { + if o == nil || o.Kind == nil { + return nil, false + } + return o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *Error) HasKind() bool { + if o != nil && o.Kind != nil { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *Error) SetKind(v string) { + o.Kind = &v +} + + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Error) GetHref() string { + if o == nil || o.Href == nil { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetHrefOk() (*string, bool) { + if o == nil || o.Href == nil { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *Error) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Error) SetHref(v string) { + o.Href = &v +} + + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Error) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *Error) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *Error) SetCode(v string) { + o.Code = &v +} + + +// GetReason returns the Reason field value if set, zero value otherwise. +func (o *Error) GetReason() string { + if o == nil || o.Reason == nil { + var ret string + return ret + } + return *o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetReasonOk() (*string, bool) { + if o == nil || o.Reason == nil { + return nil, false + } + return o.Reason, true +} + +// HasReason returns a boolean if a field has been set. +func (o *Error) HasReason() bool { + if o != nil && o.Reason != nil { + return true + } + + return false +} + +// SetReason gets a reference to the given string and assigns it to the Reason field. +func (o *Error) SetReason(v string) { + o.Reason = &v +} + + +// GetOperationId returns the OperationId field value if set, zero value otherwise. +func (o *Error) GetOperationId() string { + if o == nil || o.OperationId == nil { + var ret string + return ret + } + return *o.OperationId +} + +// GetOperationIdOk returns a tuple with the OperationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Error) GetOperationIdOk() (*string, bool) { + if o == nil || o.OperationId == nil { + return nil, false + } + return o.OperationId, true +} + +// HasOperationId returns a boolean if a field has been set. +func (o *Error) HasOperationId() bool { + if o != nil && o.OperationId != nil { + return true + } + + return false +} + +// SetOperationId gets a reference to the given string and assigns it to the OperationId field. +func (o *Error) SetOperationId(v string) { + o.OperationId = &v +} + + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Kind != nil { + toSerialize["kind"] = o.Kind + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Code != nil { + toSerialize["code"] = o.Code + } + + if o.Reason != nil { + toSerialize["reason"] = o.Reason + } + + if o.OperationId != nil { + toSerialize["operation_id"] = o.OperationId + } + + return json.Marshal(toSerialize) +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_error_all_of.go b/srsmgmt/apiv1/client/model_error_all_of.go new file mode 100644 index 00000000..5f0379bf --- /dev/null +++ b/srsmgmt/apiv1/client/model_error_all_of.go @@ -0,0 +1,203 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// ErrorAllOf struct for ErrorAllOf +type ErrorAllOf struct { + + Code *string `json:"code,omitempty"` + + Reason *string `json:"reason,omitempty"` + + OperationId *string `json:"operation_id,omitempty"` + +} + +// NewErrorAllOf instantiates a new ErrorAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorAllOf() *ErrorAllOf { + this := ErrorAllOf{} + return &this +} + +// NewErrorAllOfWithDefaults instantiates a new ErrorAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorAllOfWithDefaults() *ErrorAllOf { + this := ErrorAllOf{} + + + + + return &this +} + + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *ErrorAllOf) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorAllOf) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *ErrorAllOf) HasCode() bool { + if o != nil && o.Code != nil { + return true + } + + return false +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *ErrorAllOf) SetCode(v string) { + o.Code = &v +} + + +// GetReason returns the Reason field value if set, zero value otherwise. +func (o *ErrorAllOf) GetReason() string { + if o == nil || o.Reason == nil { + var ret string + return ret + } + return *o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorAllOf) GetReasonOk() (*string, bool) { + if o == nil || o.Reason == nil { + return nil, false + } + return o.Reason, true +} + +// HasReason returns a boolean if a field has been set. +func (o *ErrorAllOf) HasReason() bool { + if o != nil && o.Reason != nil { + return true + } + + return false +} + +// SetReason gets a reference to the given string and assigns it to the Reason field. +func (o *ErrorAllOf) SetReason(v string) { + o.Reason = &v +} + + +// GetOperationId returns the OperationId field value if set, zero value otherwise. +func (o *ErrorAllOf) GetOperationId() string { + if o == nil || o.OperationId == nil { + var ret string + return ret + } + return *o.OperationId +} + +// GetOperationIdOk returns a tuple with the OperationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorAllOf) GetOperationIdOk() (*string, bool) { + if o == nil || o.OperationId == nil { + return nil, false + } + return o.OperationId, true +} + +// HasOperationId returns a boolean if a field has been set. +func (o *ErrorAllOf) HasOperationId() bool { + if o != nil && o.OperationId != nil { + return true + } + + return false +} + +// SetOperationId gets a reference to the given string and assigns it to the OperationId field. +func (o *ErrorAllOf) SetOperationId(v string) { + o.OperationId = &v +} + + +func (o ErrorAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Code != nil { + toSerialize["code"] = o.Code + } + + if o.Reason != nil { + toSerialize["reason"] = o.Reason + } + + if o.OperationId != nil { + toSerialize["operation_id"] = o.OperationId + } + + return json.Marshal(toSerialize) +} + +type NullableErrorAllOf struct { + value *ErrorAllOf + isSet bool +} + +func (v NullableErrorAllOf) Get() *ErrorAllOf { + return v.value +} + +func (v *NullableErrorAllOf) Set(val *ErrorAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableErrorAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorAllOf(val *ErrorAllOf) *NullableErrorAllOf { + return &NullableErrorAllOf{value: val, isSet: true} +} + +func (v NullableErrorAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_error_list.go b/srsmgmt/apiv1/client/model_error_list.go new file mode 100644 index 00000000..52845af9 --- /dev/null +++ b/srsmgmt/apiv1/client/model_error_list.go @@ -0,0 +1,248 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// ErrorList struct for ErrorList +type ErrorList struct { + + Kind string `json:"kind"` + + Page int32 `json:"page"` + + Size int32 `json:"size"` + + Total int32 `json:"total"` + + Items []Error `json:"items"` + +} + +// NewErrorList instantiates a new ErrorList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorList(kind string, page int32, size int32, total int32, items []Error) *ErrorList { + this := ErrorList{} + this.Kind = kind + this.Page = page + this.Size = size + this.Total = total + this.Items = items + return &this +} + +// NewErrorListWithDefaults instantiates a new ErrorList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorListWithDefaults() *ErrorList { + this := ErrorList{} + + + + + + + return &this +} + + +// GetKind returns the Kind field value +func (o *ErrorList) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *ErrorList) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *ErrorList) SetKind(v string) { + o.Kind = v +} + + +// GetPage returns the Page field value +func (o *ErrorList) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *ErrorList) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value +func (o *ErrorList) SetPage(v int32) { + o.Page = v +} + + +// GetSize returns the Size field value +func (o *ErrorList) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ErrorList) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *ErrorList) SetSize(v int32) { + o.Size = v +} + + +// GetTotal returns the Total field value +func (o *ErrorList) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *ErrorList) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *ErrorList) SetTotal(v int32) { + o.Total = v +} + + +// GetItems returns the Items field value +func (o *ErrorList) GetItems() []Error { + if o == nil { + var ret []Error + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ErrorList) GetItemsOk() (*[]Error, bool) { + if o == nil { + return nil, false + } + return &o.Items, true +} + +// SetItems sets field value +func (o *ErrorList) SetItems(v []Error) { + o.Items = v +} + + +func (o ErrorList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if true { + toSerialize["kind"] = o.Kind + } + + if true { + toSerialize["page"] = o.Page + } + + if true { + toSerialize["size"] = o.Size + } + + if true { + toSerialize["total"] = o.Total + } + + if true { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableErrorList struct { + value *ErrorList + isSet bool +} + +func (v NullableErrorList) Get() *ErrorList { + return v.value +} + +func (v *NullableErrorList) Set(val *ErrorList) { + v.value = val + v.isSet = true +} + +func (v NullableErrorList) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorList(val *ErrorList) *NullableErrorList { + return &NullableErrorList{value: val, isSet: true} +} + +func (v NullableErrorList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_error_list_all_of.go b/srsmgmt/apiv1/client/model_error_list_all_of.go new file mode 100644 index 00000000..0fb17003 --- /dev/null +++ b/srsmgmt/apiv1/client/model_error_list_all_of.go @@ -0,0 +1,123 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// ErrorListAllOf struct for ErrorListAllOf +type ErrorListAllOf struct { + + Items *[]Error `json:"items,omitempty"` + +} + +// NewErrorListAllOf instantiates a new ErrorListAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorListAllOf() *ErrorListAllOf { + this := ErrorListAllOf{} + return &this +} + +// NewErrorListAllOfWithDefaults instantiates a new ErrorListAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorListAllOfWithDefaults() *ErrorListAllOf { + this := ErrorListAllOf{} + + + return &this +} + + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ErrorListAllOf) GetItems() []Error { + if o == nil || o.Items == nil { + var ret []Error + return ret + } + return *o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorListAllOf) GetItemsOk() (*[]Error, bool) { + if o == nil || o.Items == nil { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *ErrorListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +// SetItems gets a reference to the given []Error and assigns it to the Items field. +func (o *ErrorListAllOf) SetItems(v []Error) { + o.Items = &v +} + + +func (o ErrorListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableErrorListAllOf struct { + value *ErrorListAllOf + isSet bool +} + +func (v NullableErrorListAllOf) Get() *ErrorListAllOf { + return v.value +} + +func (v *NullableErrorListAllOf) Set(val *ErrorListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableErrorListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorListAllOf(val *ErrorListAllOf) *NullableErrorListAllOf { + return &NullableErrorListAllOf{value: val, isSet: true} +} + +func (v NullableErrorListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_list.go b/srsmgmt/apiv1/client/model_list.go new file mode 100644 index 00000000..2c7e26a2 --- /dev/null +++ b/srsmgmt/apiv1/client/model_list.go @@ -0,0 +1,215 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// List struct for List +type List struct { + + Kind string `json:"kind"` + + Page int32 `json:"page"` + + Size int32 `json:"size"` + + Total int32 `json:"total"` + +} + +// NewList instantiates a new List object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewList(kind string, page int32, size int32, total int32) *List { + this := List{} + this.Kind = kind + this.Page = page + this.Size = size + this.Total = total + return &this +} + +// NewListWithDefaults instantiates a new List object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewListWithDefaults() *List { + this := List{} + + + + + + return &this +} + + +// GetKind returns the Kind field value +func (o *List) GetKind() string { + if o == nil { + var ret string + return ret + } + + return o.Kind +} + +// GetKindOk returns a tuple with the Kind field value +// and a boolean to check if the value has been set. +func (o *List) GetKindOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kind, true +} + +// SetKind sets field value +func (o *List) SetKind(v string) { + o.Kind = v +} + + +// GetPage returns the Page field value +func (o *List) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *List) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value +func (o *List) SetPage(v int32) { + o.Page = v +} + + +// GetSize returns the Size field value +func (o *List) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *List) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *List) SetSize(v int32) { + o.Size = v +} + + +// GetTotal returns the Total field value +func (o *List) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *List) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *List) SetTotal(v int32) { + o.Total = v +} + + +func (o List) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if true { + toSerialize["kind"] = o.Kind + } + + if true { + toSerialize["page"] = o.Page + } + + if true { + toSerialize["size"] = o.Size + } + + if true { + toSerialize["total"] = o.Total + } + + return json.Marshal(toSerialize) +} + +type NullableList struct { + value *List + isSet bool +} + +func (v NullableList) Get() *List { + return v.value +} + +func (v *NullableList) Set(val *List) { + v.value = val + v.isSet = true +} + +func (v NullableList) IsSet() bool { + return v.isSet +} + +func (v *NullableList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableList(val *List) *NullableList { + return &NullableList{value: val, isSet: true} +} + +func (v NullableList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_object_reference.go b/srsmgmt/apiv1/client/model_object_reference.go new file mode 100644 index 00000000..c4ccbd3e --- /dev/null +++ b/srsmgmt/apiv1/client/model_object_reference.go @@ -0,0 +1,203 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// ObjectReference struct for ObjectReference +type ObjectReference struct { + + Id *string `json:"id,omitempty"` + + Kind *string `json:"kind,omitempty"` + + Href *string `json:"href,omitempty"` + +} + +// NewObjectReference instantiates a new ObjectReference object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewObjectReference() *ObjectReference { + this := ObjectReference{} + return &this +} + +// NewObjectReferenceWithDefaults instantiates a new ObjectReference object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewObjectReferenceWithDefaults() *ObjectReference { + this := ObjectReference{} + + + + + return &this +} + + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ObjectReference) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObjectReference) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ObjectReference) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ObjectReference) SetId(v string) { + o.Id = &v +} + + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *ObjectReference) GetKind() string { + if o == nil || o.Kind == nil { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObjectReference) GetKindOk() (*string, bool) { + if o == nil || o.Kind == nil { + return nil, false + } + return o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *ObjectReference) HasKind() bool { + if o != nil && o.Kind != nil { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *ObjectReference) SetKind(v string) { + o.Kind = &v +} + + +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ObjectReference) GetHref() string { + if o == nil || o.Href == nil { + var ret string + return ret + } + return *o.Href +} + +// GetHrefOk returns a tuple with the Href field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObjectReference) GetHrefOk() (*string, bool) { + if o == nil || o.Href == nil { + return nil, false + } + return o.Href, true +} + +// HasHref returns a boolean if a field has been set. +func (o *ObjectReference) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ObjectReference) SetHref(v string) { + o.Href = &v +} + + +func (o ObjectReference) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Kind != nil { + toSerialize["kind"] = o.Kind + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + return json.Marshal(toSerialize) +} + +type NullableObjectReference struct { + value *ObjectReference + isSet bool +} + +func (v NullableObjectReference) Get() *ObjectReference { + return v.value +} + +func (v *NullableObjectReference) Set(val *ObjectReference) { + v.value = val + v.isSet = true +} + +func (v NullableObjectReference) IsSet() bool { + return v.isSet +} + +func (v *NullableObjectReference) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableObjectReference(val *ObjectReference) *NullableObjectReference { + return &NullableObjectReference{value: val, isSet: true} +} + +func (v NullableObjectReference) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableObjectReference) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_registry.go b/srsmgmt/apiv1/client/model_registry.go new file mode 100644 index 00000000..e6b55d88 --- /dev/null +++ b/srsmgmt/apiv1/client/model_registry.go @@ -0,0 +1,264 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// Registry Service Registry instance within a multi-tenant deployment. +type Registry struct { + + Id int32 `json:"id"` + + Status RegistryStatus `json:"status"` + + RegistryUrl string `json:"registryUrl"` + + // User-defined Registry name. Does not have to be unique. + Name *string `json:"name,omitempty"` + + // Identifier of a multi-tenant deployment, where this Service Registry instance resides. + RegistryDeploymentId *int32 `json:"registryDeploymentId,omitempty"` + +} + +// NewRegistry instantiates a new Registry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegistry(id int32, status RegistryStatus, registryUrl string) *Registry { + this := Registry{} + this.Id = id + this.Status = status + this.RegistryUrl = registryUrl + return &this +} + +// NewRegistryWithDefaults instantiates a new Registry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegistryWithDefaults() *Registry { + this := Registry{} + + + + + + + return &this +} + + +// GetId returns the Id field value +func (o *Registry) GetId() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Registry) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Registry) SetId(v int32) { + o.Id = v +} + + +// GetStatus returns the Status field value +func (o *Registry) GetStatus() RegistryStatus { + if o == nil { + var ret RegistryStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Registry) GetStatusOk() (*RegistryStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *Registry) SetStatus(v RegistryStatus) { + o.Status = v +} + + +// GetRegistryUrl returns the RegistryUrl field value +func (o *Registry) GetRegistryUrl() string { + if o == nil { + var ret string + return ret + } + + return o.RegistryUrl +} + +// GetRegistryUrlOk returns a tuple with the RegistryUrl field value +// and a boolean to check if the value has been set. +func (o *Registry) GetRegistryUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegistryUrl, true +} + +// SetRegistryUrl sets field value +func (o *Registry) SetRegistryUrl(v string) { + o.RegistryUrl = v +} + + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Registry) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Registry) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Registry) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Registry) SetName(v string) { + o.Name = &v +} + + +// GetRegistryDeploymentId returns the RegistryDeploymentId field value if set, zero value otherwise. +func (o *Registry) GetRegistryDeploymentId() int32 { + if o == nil || o.RegistryDeploymentId == nil { + var ret int32 + return ret + } + return *o.RegistryDeploymentId +} + +// GetRegistryDeploymentIdOk returns a tuple with the RegistryDeploymentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Registry) GetRegistryDeploymentIdOk() (*int32, bool) { + if o == nil || o.RegistryDeploymentId == nil { + return nil, false + } + return o.RegistryDeploymentId, true +} + +// HasRegistryDeploymentId returns a boolean if a field has been set. +func (o *Registry) HasRegistryDeploymentId() bool { + if o != nil && o.RegistryDeploymentId != nil { + return true + } + + return false +} + +// SetRegistryDeploymentId gets a reference to the given int32 and assigns it to the RegistryDeploymentId field. +func (o *Registry) SetRegistryDeploymentId(v int32) { + o.RegistryDeploymentId = &v +} + + +func (o Registry) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if true { + toSerialize["id"] = o.Id + } + + if true { + toSerialize["status"] = o.Status + } + + if true { + toSerialize["registryUrl"] = o.RegistryUrl + } + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + if o.RegistryDeploymentId != nil { + toSerialize["registryDeploymentId"] = o.RegistryDeploymentId + } + + return json.Marshal(toSerialize) +} + +type NullableRegistry struct { + value *Registry + isSet bool +} + +func (v NullableRegistry) Get() *Registry { + return v.value +} + +func (v *NullableRegistry) Set(val *Registry) { + v.value = val + v.isSet = true +} + +func (v NullableRegistry) IsSet() bool { + return v.isSet +} + +func (v *NullableRegistry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegistry(val *Registry) *NullableRegistry { + return &NullableRegistry{value: val, isSet: true} +} + +func (v NullableRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegistry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_registry_create.go b/srsmgmt/apiv1/client/model_registry_create.go new file mode 100644 index 00000000..b79fdab8 --- /dev/null +++ b/srsmgmt/apiv1/client/model_registry_create.go @@ -0,0 +1,124 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" +) + +// RegistryCreate Information used to create a new Service Registry instance within a multi-tenant deployment. +type RegistryCreate struct { + + // User-defined Registry name. Does not have to be unique. + Name *string `json:"name,omitempty"` + +} + +// NewRegistryCreate instantiates a new RegistryCreate object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegistryCreate() *RegistryCreate { + this := RegistryCreate{} + return &this +} + +// NewRegistryCreateWithDefaults instantiates a new RegistryCreate object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegistryCreateWithDefaults() *RegistryCreate { + this := RegistryCreate{} + + + return &this +} + + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RegistryCreate) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegistryCreate) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RegistryCreate) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RegistryCreate) SetName(v string) { + o.Name = &v +} + + +func (o RegistryCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Name != nil { + toSerialize["name"] = o.Name + } + + return json.Marshal(toSerialize) +} + +type NullableRegistryCreate struct { + value *RegistryCreate + isSet bool +} + +func (v NullableRegistryCreate) Get() *RegistryCreate { + return v.value +} + +func (v *NullableRegistryCreate) Set(val *RegistryCreate) { + v.value = val + v.isSet = true +} + +func (v NullableRegistryCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableRegistryCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegistryCreate(val *RegistryCreate) *NullableRegistryCreate { + return &NullableRegistryCreate{value: val, isSet: true} +} + +func (v NullableRegistryCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegistryCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_registry_status.go b/srsmgmt/apiv1/client/model_registry_status.go new file mode 100644 index 00000000..b6217fe3 --- /dev/null +++ b/srsmgmt/apiv1/client/model_registry_status.go @@ -0,0 +1,151 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" + "time" +) + +// RegistryStatus struct for RegistryStatus +type RegistryStatus struct { + + // ISO 8601 UTC timestamp. + LastUpdated time.Time `json:"lastUpdated"` + + Value RegistryStatusValue `json:"value"` + +} + +// NewRegistryStatus instantiates a new RegistryStatus object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegistryStatus(lastUpdated time.Time, value RegistryStatusValue) *RegistryStatus { + this := RegistryStatus{} + this.LastUpdated = lastUpdated + this.Value = value + return &this +} + +// NewRegistryStatusWithDefaults instantiates a new RegistryStatus object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegistryStatusWithDefaults() *RegistryStatus { + this := RegistryStatus{} + + + + return &this +} + + +// GetLastUpdated returns the LastUpdated field value +func (o *RegistryStatus) GetLastUpdated() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.LastUpdated +} + +// GetLastUpdatedOk returns a tuple with the LastUpdated field value +// and a boolean to check if the value has been set. +func (o *RegistryStatus) GetLastUpdatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.LastUpdated, true +} + +// SetLastUpdated sets field value +func (o *RegistryStatus) SetLastUpdated(v time.Time) { + o.LastUpdated = v +} + + +// GetValue returns the Value field value +func (o *RegistryStatus) GetValue() RegistryStatusValue { + if o == nil { + var ret RegistryStatusValue + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *RegistryStatus) GetValueOk() (*RegistryStatusValue, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *RegistryStatus) SetValue(v RegistryStatusValue) { + o.Value = v +} + + +func (o RegistryStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if true { + toSerialize["lastUpdated"] = o.LastUpdated + } + + if true { + toSerialize["value"] = o.Value + } + + return json.Marshal(toSerialize) +} + +type NullableRegistryStatus struct { + value *RegistryStatus + isSet bool +} + +func (v NullableRegistryStatus) Get() *RegistryStatus { + return v.value +} + +func (v *NullableRegistryStatus) Set(val *RegistryStatus) { + v.value = val + v.isSet = true +} + +func (v NullableRegistryStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableRegistryStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegistryStatus(val *RegistryStatus) *NullableRegistryStatus { + return &NullableRegistryStatus{value: val, isSet: true} +} + +func (v NullableRegistryStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegistryStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/model_registry_status_value.go b/srsmgmt/apiv1/client/model_registry_status_value.go new file mode 100644 index 00000000..1aff53a8 --- /dev/null +++ b/srsmgmt/apiv1/client/model_registry_status_value.go @@ -0,0 +1,113 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" + "fmt" +) + +// RegistryStatusValue the model 'RegistryStatusValue' +type RegistryStatusValue string + +// List of RegistryStatusValue +const ( + PROVISIONING RegistryStatusValue = "PROVISIONING" + AVAILABLE RegistryStatusValue = "AVAILABLE" + UNAVAILABLE RegistryStatusValue = "UNAVAILABLE" +) + +var allowedRegistryStatusValueEnumValues = []RegistryStatusValue{ + "PROVISIONING", + "AVAILABLE", + "UNAVAILABLE", +} + +func (v *RegistryStatusValue) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := RegistryStatusValue(value) + for _, existing := range allowedRegistryStatusValueEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid RegistryStatusValue", value) +} + +// NewRegistryStatusValueFromValue returns a pointer to a valid RegistryStatusValue +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegistryStatusValueFromValue(v string) (*RegistryStatusValue, error) { + ev := RegistryStatusValue(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for RegistryStatusValue: valid values are %v", v, allowedRegistryStatusValueEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v RegistryStatusValue) IsValid() bool { + for _, existing := range allowedRegistryStatusValueEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RegistryStatusValue value +func (v RegistryStatusValue) Ptr() *RegistryStatusValue { + return &v +} + +type NullableRegistryStatusValue struct { + value *RegistryStatusValue + isSet bool +} + +func (v NullableRegistryStatusValue) Get() *RegistryStatusValue { + return v.value +} + +func (v *NullableRegistryStatusValue) Set(val *RegistryStatusValue) { + v.value = val + v.isSet = true +} + +func (v NullableRegistryStatusValue) IsSet() bool { + return v.isSet +} + +func (v *NullableRegistryStatusValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegistryStatusValue(val *RegistryStatusValue) *NullableRegistryStatusValue { + return &NullableRegistryStatusValue{value: val, isSet: true} +} + +func (v NullableRegistryStatusValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegistryStatusValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/srsmgmt/apiv1/client/registries_api_mock.go b/srsmgmt/apiv1/client/registries_api_mock.go new file mode 100644 index 00000000..91610a5e --- /dev/null +++ b/srsmgmt/apiv1/client/registries_api_mock.go @@ -0,0 +1,388 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package srsmgmtclient + +import ( + _context "context" + _nethttp "net/http" + "sync" +) + +// Ensure, that RegistriesApiMock does implement RegistriesApi. +// If this is not the case, regenerate this file with moq. +var _ RegistriesApi = &RegistriesApiMock{} + +// RegistriesApiMock is a mock implementation of RegistriesApi. +// +// func TestSomethingThatUsesRegistriesApi(t *testing.T) { +// +// // make and configure a mocked RegistriesApi +// mockedRegistriesApi := &RegistriesApiMock{ +// CreateRegistryFunc: func(ctx _context.Context) ApiCreateRegistryRequest { +// panic("mock out the CreateRegistry method") +// }, +// CreateRegistryExecuteFunc: func(r ApiCreateRegistryRequest) (Registry, *_nethttp.Response, error) { +// panic("mock out the CreateRegistryExecute method") +// }, +// DeleteRegistryFunc: func(ctx _context.Context, registryId int32) ApiDeleteRegistryRequest { +// panic("mock out the DeleteRegistry method") +// }, +// DeleteRegistryExecuteFunc: func(r ApiDeleteRegistryRequest) (*_nethttp.Response, error) { +// panic("mock out the DeleteRegistryExecute method") +// }, +// GetRegistriesFunc: func(ctx _context.Context) ApiGetRegistriesRequest { +// panic("mock out the GetRegistries method") +// }, +// GetRegistriesExecuteFunc: func(r ApiGetRegistriesRequest) ([]Registry, *_nethttp.Response, error) { +// panic("mock out the GetRegistriesExecute method") +// }, +// GetRegistryFunc: func(ctx _context.Context, registryId int32) ApiGetRegistryRequest { +// panic("mock out the GetRegistry method") +// }, +// GetRegistryExecuteFunc: func(r ApiGetRegistryRequest) (Registry, *_nethttp.Response, error) { +// panic("mock out the GetRegistryExecute method") +// }, +// } +// +// // use mockedRegistriesApi in code that requires RegistriesApi +// // and then make assertions. +// +// } +type RegistriesApiMock struct { + // CreateRegistryFunc mocks the CreateRegistry method. + CreateRegistryFunc func(ctx _context.Context) ApiCreateRegistryRequest + + // CreateRegistryExecuteFunc mocks the CreateRegistryExecute method. + CreateRegistryExecuteFunc func(r ApiCreateRegistryRequest) (Registry, *_nethttp.Response, error) + + // DeleteRegistryFunc mocks the DeleteRegistry method. + DeleteRegistryFunc func(ctx _context.Context, registryId int32) ApiDeleteRegistryRequest + + // DeleteRegistryExecuteFunc mocks the DeleteRegistryExecute method. + DeleteRegistryExecuteFunc func(r ApiDeleteRegistryRequest) (*_nethttp.Response, error) + + // GetRegistriesFunc mocks the GetRegistries method. + GetRegistriesFunc func(ctx _context.Context) ApiGetRegistriesRequest + + // GetRegistriesExecuteFunc mocks the GetRegistriesExecute method. + GetRegistriesExecuteFunc func(r ApiGetRegistriesRequest) ([]Registry, *_nethttp.Response, error) + + // GetRegistryFunc mocks the GetRegistry method. + GetRegistryFunc func(ctx _context.Context, registryId int32) ApiGetRegistryRequest + + // GetRegistryExecuteFunc mocks the GetRegistryExecute method. + GetRegistryExecuteFunc func(r ApiGetRegistryRequest) (Registry, *_nethttp.Response, error) + + // calls tracks calls to the methods. + calls struct { + // CreateRegistry holds details about calls to the CreateRegistry method. + CreateRegistry []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // CreateRegistryExecute holds details about calls to the CreateRegistryExecute method. + CreateRegistryExecute []struct { + // R is the r argument value. + R ApiCreateRegistryRequest + } + // DeleteRegistry holds details about calls to the DeleteRegistry method. + DeleteRegistry []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // RegistryId is the registryId argument value. + RegistryId int32 + } + // DeleteRegistryExecute holds details about calls to the DeleteRegistryExecute method. + DeleteRegistryExecute []struct { + // R is the r argument value. + R ApiDeleteRegistryRequest + } + // GetRegistries holds details about calls to the GetRegistries method. + GetRegistries []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // GetRegistriesExecute holds details about calls to the GetRegistriesExecute method. + GetRegistriesExecute []struct { + // R is the r argument value. + R ApiGetRegistriesRequest + } + // GetRegistry holds details about calls to the GetRegistry method. + GetRegistry []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // RegistryId is the registryId argument value. + RegistryId int32 + } + // GetRegistryExecute holds details about calls to the GetRegistryExecute method. + GetRegistryExecute []struct { + // R is the r argument value. + R ApiGetRegistryRequest + } + } + lockCreateRegistry sync.RWMutex + lockCreateRegistryExecute sync.RWMutex + lockDeleteRegistry sync.RWMutex + lockDeleteRegistryExecute sync.RWMutex + lockGetRegistries sync.RWMutex + lockGetRegistriesExecute sync.RWMutex + lockGetRegistry sync.RWMutex + lockGetRegistryExecute sync.RWMutex +} + +// CreateRegistry calls CreateRegistryFunc. +func (mock *RegistriesApiMock) CreateRegistry(ctx _context.Context) ApiCreateRegistryRequest { + if mock.CreateRegistryFunc == nil { + panic("RegistriesApiMock.CreateRegistryFunc: method is nil but RegistriesApi.CreateRegistry was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockCreateRegistry.Lock() + mock.calls.CreateRegistry = append(mock.calls.CreateRegistry, callInfo) + mock.lockCreateRegistry.Unlock() + return mock.CreateRegistryFunc(ctx) +} + +// CreateRegistryCalls gets all the calls that were made to CreateRegistry. +// Check the length with: +// len(mockedRegistriesApi.CreateRegistryCalls()) +func (mock *RegistriesApiMock) CreateRegistryCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockCreateRegistry.RLock() + calls = mock.calls.CreateRegistry + mock.lockCreateRegistry.RUnlock() + return calls +} + +// CreateRegistryExecute calls CreateRegistryExecuteFunc. +func (mock *RegistriesApiMock) CreateRegistryExecute(r ApiCreateRegistryRequest) (Registry, *_nethttp.Response, error) { + if mock.CreateRegistryExecuteFunc == nil { + panic("RegistriesApiMock.CreateRegistryExecuteFunc: method is nil but RegistriesApi.CreateRegistryExecute was just called") + } + callInfo := struct { + R ApiCreateRegistryRequest + }{ + R: r, + } + mock.lockCreateRegistryExecute.Lock() + mock.calls.CreateRegistryExecute = append(mock.calls.CreateRegistryExecute, callInfo) + mock.lockCreateRegistryExecute.Unlock() + return mock.CreateRegistryExecuteFunc(r) +} + +// CreateRegistryExecuteCalls gets all the calls that were made to CreateRegistryExecute. +// Check the length with: +// len(mockedRegistriesApi.CreateRegistryExecuteCalls()) +func (mock *RegistriesApiMock) CreateRegistryExecuteCalls() []struct { + R ApiCreateRegistryRequest +} { + var calls []struct { + R ApiCreateRegistryRequest + } + mock.lockCreateRegistryExecute.RLock() + calls = mock.calls.CreateRegistryExecute + mock.lockCreateRegistryExecute.RUnlock() + return calls +} + +// DeleteRegistry calls DeleteRegistryFunc. +func (mock *RegistriesApiMock) DeleteRegistry(ctx _context.Context, registryId int32) ApiDeleteRegistryRequest { + if mock.DeleteRegistryFunc == nil { + panic("RegistriesApiMock.DeleteRegistryFunc: method is nil but RegistriesApi.DeleteRegistry was just called") + } + callInfo := struct { + Ctx _context.Context + RegistryId int32 + }{ + Ctx: ctx, + RegistryId: registryId, + } + mock.lockDeleteRegistry.Lock() + mock.calls.DeleteRegistry = append(mock.calls.DeleteRegistry, callInfo) + mock.lockDeleteRegistry.Unlock() + return mock.DeleteRegistryFunc(ctx, registryId) +} + +// DeleteRegistryCalls gets all the calls that were made to DeleteRegistry. +// Check the length with: +// len(mockedRegistriesApi.DeleteRegistryCalls()) +func (mock *RegistriesApiMock) DeleteRegistryCalls() []struct { + Ctx _context.Context + RegistryId int32 +} { + var calls []struct { + Ctx _context.Context + RegistryId int32 + } + mock.lockDeleteRegistry.RLock() + calls = mock.calls.DeleteRegistry + mock.lockDeleteRegistry.RUnlock() + return calls +} + +// DeleteRegistryExecute calls DeleteRegistryExecuteFunc. +func (mock *RegistriesApiMock) DeleteRegistryExecute(r ApiDeleteRegistryRequest) (*_nethttp.Response, error) { + if mock.DeleteRegistryExecuteFunc == nil { + panic("RegistriesApiMock.DeleteRegistryExecuteFunc: method is nil but RegistriesApi.DeleteRegistryExecute was just called") + } + callInfo := struct { + R ApiDeleteRegistryRequest + }{ + R: r, + } + mock.lockDeleteRegistryExecute.Lock() + mock.calls.DeleteRegistryExecute = append(mock.calls.DeleteRegistryExecute, callInfo) + mock.lockDeleteRegistryExecute.Unlock() + return mock.DeleteRegistryExecuteFunc(r) +} + +// DeleteRegistryExecuteCalls gets all the calls that were made to DeleteRegistryExecute. +// Check the length with: +// len(mockedRegistriesApi.DeleteRegistryExecuteCalls()) +func (mock *RegistriesApiMock) DeleteRegistryExecuteCalls() []struct { + R ApiDeleteRegistryRequest +} { + var calls []struct { + R ApiDeleteRegistryRequest + } + mock.lockDeleteRegistryExecute.RLock() + calls = mock.calls.DeleteRegistryExecute + mock.lockDeleteRegistryExecute.RUnlock() + return calls +} + +// GetRegistries calls GetRegistriesFunc. +func (mock *RegistriesApiMock) GetRegistries(ctx _context.Context) ApiGetRegistriesRequest { + if mock.GetRegistriesFunc == nil { + panic("RegistriesApiMock.GetRegistriesFunc: method is nil but RegistriesApi.GetRegistries was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockGetRegistries.Lock() + mock.calls.GetRegistries = append(mock.calls.GetRegistries, callInfo) + mock.lockGetRegistries.Unlock() + return mock.GetRegistriesFunc(ctx) +} + +// GetRegistriesCalls gets all the calls that were made to GetRegistries. +// Check the length with: +// len(mockedRegistriesApi.GetRegistriesCalls()) +func (mock *RegistriesApiMock) GetRegistriesCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockGetRegistries.RLock() + calls = mock.calls.GetRegistries + mock.lockGetRegistries.RUnlock() + return calls +} + +// GetRegistriesExecute calls GetRegistriesExecuteFunc. +func (mock *RegistriesApiMock) GetRegistriesExecute(r ApiGetRegistriesRequest) ([]Registry, *_nethttp.Response, error) { + if mock.GetRegistriesExecuteFunc == nil { + panic("RegistriesApiMock.GetRegistriesExecuteFunc: method is nil but RegistriesApi.GetRegistriesExecute was just called") + } + callInfo := struct { + R ApiGetRegistriesRequest + }{ + R: r, + } + mock.lockGetRegistriesExecute.Lock() + mock.calls.GetRegistriesExecute = append(mock.calls.GetRegistriesExecute, callInfo) + mock.lockGetRegistriesExecute.Unlock() + return mock.GetRegistriesExecuteFunc(r) +} + +// GetRegistriesExecuteCalls gets all the calls that were made to GetRegistriesExecute. +// Check the length with: +// len(mockedRegistriesApi.GetRegistriesExecuteCalls()) +func (mock *RegistriesApiMock) GetRegistriesExecuteCalls() []struct { + R ApiGetRegistriesRequest +} { + var calls []struct { + R ApiGetRegistriesRequest + } + mock.lockGetRegistriesExecute.RLock() + calls = mock.calls.GetRegistriesExecute + mock.lockGetRegistriesExecute.RUnlock() + return calls +} + +// GetRegistry calls GetRegistryFunc. +func (mock *RegistriesApiMock) GetRegistry(ctx _context.Context, registryId int32) ApiGetRegistryRequest { + if mock.GetRegistryFunc == nil { + panic("RegistriesApiMock.GetRegistryFunc: method is nil but RegistriesApi.GetRegistry was just called") + } + callInfo := struct { + Ctx _context.Context + RegistryId int32 + }{ + Ctx: ctx, + RegistryId: registryId, + } + mock.lockGetRegistry.Lock() + mock.calls.GetRegistry = append(mock.calls.GetRegistry, callInfo) + mock.lockGetRegistry.Unlock() + return mock.GetRegistryFunc(ctx, registryId) +} + +// GetRegistryCalls gets all the calls that were made to GetRegistry. +// Check the length with: +// len(mockedRegistriesApi.GetRegistryCalls()) +func (mock *RegistriesApiMock) GetRegistryCalls() []struct { + Ctx _context.Context + RegistryId int32 +} { + var calls []struct { + Ctx _context.Context + RegistryId int32 + } + mock.lockGetRegistry.RLock() + calls = mock.calls.GetRegistry + mock.lockGetRegistry.RUnlock() + return calls +} + +// GetRegistryExecute calls GetRegistryExecuteFunc. +func (mock *RegistriesApiMock) GetRegistryExecute(r ApiGetRegistryRequest) (Registry, *_nethttp.Response, error) { + if mock.GetRegistryExecuteFunc == nil { + panic("RegistriesApiMock.GetRegistryExecuteFunc: method is nil but RegistriesApi.GetRegistryExecute was just called") + } + callInfo := struct { + R ApiGetRegistryRequest + }{ + R: r, + } + mock.lockGetRegistryExecute.Lock() + mock.calls.GetRegistryExecute = append(mock.calls.GetRegistryExecute, callInfo) + mock.lockGetRegistryExecute.Unlock() + return mock.GetRegistryExecuteFunc(r) +} + +// GetRegistryExecuteCalls gets all the calls that were made to GetRegistryExecute. +// Check the length with: +// len(mockedRegistriesApi.GetRegistryExecuteCalls()) +func (mock *RegistriesApiMock) GetRegistryExecuteCalls() []struct { + R ApiGetRegistryRequest +} { + var calls []struct { + R ApiGetRegistryRequest + } + mock.lockGetRegistryExecute.RLock() + calls = mock.calls.GetRegistryExecute + mock.lockGetRegistryExecute.RUnlock() + return calls +} diff --git a/srsmgmt/apiv1/client/response.go b/srsmgmt/apiv1/client/response.go new file mode 100644 index 00000000..8d0e4862 --- /dev/null +++ b/srsmgmt/apiv1/client/response.go @@ -0,0 +1,48 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/srsmgmt/apiv1/client/utils.go b/srsmgmt/apiv1/client/utils.go new file mode 100644 index 00000000..eecafb5c --- /dev/null +++ b/srsmgmt/apiv1/client/utils.go @@ -0,0 +1,329 @@ +/* + * Service Registry Fleet Manager + * + * Managed Service Registry cloud.redhat.com API Management API that lets you create new registry instances. Registry is a datastore for standard event schemas and API designs. Service Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Registry is an Managed version of upstream project called Apicurio Registry. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility. + * + * API version: 0.0.1 + * Contact: rhosak-eval-support@redhat.com + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package srsmgmtclient + +import ( + "encoding/json" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}