diff --git a/internal/config/iaas/v1/config.yaml b/internal/config/iaas/v1/config.yaml new file mode 100644 index 0000000..e0f7deb --- /dev/null +++ b/internal/config/iaas/v1/config.yaml @@ -0,0 +1,33 @@ +package: iaas +output: ../../../../pkg/services/iaas-api/v1/iaas.go +generate: + models: true + client: true +output-options: + custom-doer: + enabled: true + import: contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" + name: "contracts.BaseClientInterface" + split-by-tags: + verbose: false + enabled: true +tidy: + verbose: false + functions: + - replace: Id + with: ID + all: true + params: + - replace: Id + with: ID + all: true + - replace: v1OrganizationID + with: OrganizationID + all: true + - replace: v1ProjectID + with: ProjectID + all: true + schemas: + - replace: Id + with: ID + all: true diff --git a/internal/config/iaas/v1/generate.go b/internal/config/iaas/v1/generate.go new file mode 100644 index 0000000..6b2514b --- /dev/null +++ b/internal/config/iaas/v1/generate.go @@ -0,0 +1,3 @@ +package gen + +//go:generate go run github.com/do87/stackit-client-generator/cmd/oapi-codegen@v0.0.2 -config config.yaml iaas-api-v1.json diff --git a/internal/config/iaas/v1/iaas-api-v1.json b/internal/config/iaas/v1/iaas-api-v1.json new file mode 100644 index 0000000..f732a0e --- /dev/null +++ b/internal/config/iaas/v1/iaas-api-v1.json @@ -0,0 +1,2476 @@ +{ + "components": { + "responses": { + "BadRequest": { + "content": { + "application/json": { + "examples": { + "InvalidAffinityPolicy": { + "value": { + "code": 400, + "msg": "The server group policy is not supported" + } + }, + "InvalidBootDeviceSize": { + "value": { + "code": 400, + "msg": "boot device size is not valid or missing" + } + }, + "InvalidMachineType": { + "value": { + "code": 400, + "msg": "machine type is not valid" + } + }, + "InvalidParameter": { + "value": { + "code": 400, + "msg": "request body has an error: doesn't match schema: Error at \"/name\": value must be a string" + } + }, + "InvalidPublicKey": { + "value": { + "code": 400, + "msg": "invalid pubkey" + } + }, + "InvalidUUID": { + "value": { + "code": 400, + "msg": "invalid uuid" + } + } + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "A bad request." + }, + "Forbidden": { + "content": { + "application/json": { + "example": { + "code": 403, + "msg": "Forbidden" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "A request which was forbidden." + }, + "InternalServerError": { + "content": { + "application/json": { + "example": { + "code": 500, + "msg": "internal server error" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Internal Server Error, returns a 500 if something is broken on IaaS API Side." + }, + "NotFound": { + "content": { + "application/json": { + "examples": { + "AreaNotFound": { + "value": { + "code": 404, + "msg": "area not found" + } + }, + "KeyPairNotFound": { + "value": { + "code": 404, + "msg": "keypair not found" + } + }, + "KeypairNotFound": { + "value": { + "code": 404, + "msg": "keypair not found" + } + }, + "NetworkNotFound": { + "value": { + "code": 404, + "msg": "network not found" + } + }, + "NetworkRangeNotFound": { + "value": { + "code": 404, + "msg": "network range not found" + } + }, + "OrganizationNotFound": { + "value": { + "code": 404, + "msg": "organization not found" + } + }, + "ProjectNotFound": { + "value": { + "code": 404, + "msg": "project not found" + } + }, + "RequestNotFound": { + "value": { + "code": 404, + "msg": "request not found" + } + }, + "RouteNotFound": { + "value": { + "code": 404, + "msg": "route not found" + } + } + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "The object was not found." + }, + "Unauthorized": { + "content": { + "application/json": { + "example": { + "code": 401, + "msg": "Unauthorized" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "A request which was not authorized." + }, + "UpdateAccepted": { + "description": "An update was accepted." + } + }, + "schemas": { + "v1Area": { + "description": "The basic properties of a network area.", + "properties": { + "defaultNameservers": { + "$ref": "#/components/schemas/v1Nameserver" + }, + "networkRanges": { + "$ref": "#/components/schemas/v1NetworkRangeList" + }, + "routes": { + "$ref": "#/components/schemas/v1RouteList" + }, + "transferNetwork": { + "$ref": "#/components/schemas/v1CIDR" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "Area" + } + }, + "v1AreaConfig": { + "description": "The basic network area object.", + "properties": { + "defaultNameservers": { + "items": { + "$ref": "#/components/schemas/v1IP" + }, + "maxItems": 3, + "type": "array" + }, + "networkRanges": { + "$ref": "#/components/schemas/v1NetworkRangeList" + }, + "routes": { + "$ref": "#/components/schemas/v1RouteList" + }, + "transferNetwork": { + "$ref": "#/components/schemas/v1CIDR" + } + }, + "required": [ + "transferNetwork", + "networkRanges" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "AreaConfig" + } + }, + "v1AreaDefaultPrefixLengthIPv4": { + "description": "The default prefix length for networks in the network area.", + "example": 24, + "maximum": 29, + "minimum": 24, + "type": "integer", + "x-stackit-sdk": { + "schema-name": "AreaDefaultPrefixLengthIPv4" + } + }, + "v1AreaMaxPrefixLengthIPv4": { + "description": "The maximal prefix length for networks in the network area.", + "example": 29, + "maximum": 29, + "minimum": 24, + "type": "integer", + "x-stackit-sdk": { + "schema-name": "AreaMaxPrefixLengthIPv4" + } + }, + "v1AreaMinPrefixLengthIPv4": { + "description": "The minimal prefix length for networks in the network area.", + "example": 24, + "maximum": 29, + "minimum": 22, + "type": "integer", + "x-stackit-sdk": { + "schema-name": "AreaMinPrefixLengthIPv4" + } + }, + "v1AreaPrefixConfigIPv4": { + "description": "The IPv4 prefix config for a network area.", + "properties": { + "defaultPrefixLen": { + "allOf": [ + { + "$ref": "#/components/schemas/v1AreaDefaultPrefixLengthIPv4" + } + ], + "default": 25 + }, + "maxPrefixLen": { + "allOf": [ + { + "$ref": "#/components/schemas/v1AreaMaxPrefixLengthIPv4" + } + ], + "default": 29 + }, + "minPrefixLen": { + "allOf": [ + { + "$ref": "#/components/schemas/v1AreaMinPrefixLengthIPv4" + } + ], + "default": 24 + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "AreaPrefixConfigIPv4" + } + }, + "v1CIDR": { + "description": "Classless Inter-Domain Routing (CIDR).", + "example": "192.168.0.0/24", + "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\/(3[0-2]|2[0-9]|1[0-9]|[0-9]))$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\\/((1(1[0-9]|2[0-8]))|([0-9][0-9])|([0-9])))?$", + "type": "string", + "x-stackit-sdk": { + "schema-name": "CIDR" + } + }, + "v1CreateAreaAddressFamily": { + "description": "The addressFamily object for a area create request.", + "minProperties": 1, + "properties": { + "ipv4": { + "$ref": "#/components/schemas/v1CreateAreaIPv4" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "CreateAreaAddressFamily" + } + }, + "v1CreateAreaIPv4": { + "allOf": [ + { + "$ref": "#/components/schemas/v1AreaConfig" + }, + { + "$ref": "#/components/schemas/v1AreaPrefixConfigIPv4" + } + ], + "description": "The config object for a IPv4 network area.", + "x-stackit-sdk": { + "schema-name": "CreateAreaIPv4" + } + }, + "v1CreateNetworkAddressFamily": { + "description": "The addressFamily object for a network create request.", + "minProperties": 1, + "properties": { + "ipv4": { + "$ref": "#/components/schemas/v1CreateNetworkIPv4" + }, + "ipv6": { + "$ref": "#/components/schemas/v1CreateNetworkIPv6" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "CreateNetworkAddressFamily" + } + }, + "v1CreateNetworkIPv4": { + "description": "The config object for a IPv4 network.", + "properties": { + "nameservers": { + "$ref": "#/components/schemas/v1Nameserver" + }, + "prefixLength": { + "default": 25, + "example": 24, + "maximum": 29, + "minimum": 22, + "type": "integer" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "CreateNetworkIPv4" + } + }, + "v1CreateNetworkIPv6": { + "description": "The config object for a IPv6 network.", + "properties": { + "nameservers": { + "$ref": "#/components/schemas/v1Nameserverv6" + }, + "prefixLength": { + "default": 64, + "example": 64, + "maximum": 128, + "minimum": 56, + "type": "integer" + } + }, + "type": "object" + }, + "v1Error": { + "description": "Error with HTTP error code and an error message.", + "properties": { + "code": { + "example": 404, + "type": "integer" + }, + "msg": { + "example": "Project not found", + "type": "string" + } + }, + "required": [ + "code", + "msg" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "Error" + } + }, + "v1GenericName": { + "description": "The name for a General Object. Matches Names and also UUIDs.", + "example": "objectName26", + "maxLength": 63, + "pattern": "^[A-Za-z0-9]+((-|_|\\s|\\.)[A-Za-z0-9]+)*$", + "type": "string", + "x-stackit-sdk": { + "schema-name": "GenericName" + } + }, + "v1IP": { + "description": "Object that represents an IPv4 address.", + "example": "10.1.2.10", + "pattern": "((^\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\\s*$)|(^\\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$))", + "type": "string", + "x-stackit-sdk": { + "schema-name": "IPv4" + } + }, + "v1IPv6": { + "description": "Object that represents an IPv6 address.", + "example": "2001:db8:0:8d3:0:8a2e:70:7344", + "pattern": "^\\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$", + "type": "string", + "x-stackit-sdk": { + "schema-name": "IPv6" + } + }, + "v1Nameserver": { + "description": "A list containing DNS Servers/Nameservers for IPv4.", + "example": [ + "10.20.30.40", + "50.60.70.80" + ], + "items": { + "$ref": "#/components/schemas/v1IP" + }, + "maxItems": 3, + "type": "array", + "x-stackit-sdk": { + "schema-name": "Nameserver" + } + }, + "v1Nameserverv6": { + "description": "A list containing DNS Servers/Nameservers for IPv6.", + "example": [ + "2001:4860:4860::8888", + "2001:4860:4860::8844" + ], + "items": { + "$ref": "#/components/schemas/v1IPv6" + }, + "maxItems": 3, + "type": "array", + "x-stackit-sdk": { + "schema-name": "Nameserverv6" + } + }, + "v1Network": { + "description": "Object that represents a network.", + "properties": { + "name": { + "example": "My network", + "type": "string" + }, + "nameservers": { + "$ref": "#/components/schemas/v1Nameserver" + }, + "nameserversV6": { + "$ref": "#/components/schemas/v1Nameserverv6" + }, + "networkId": { + "$ref": "#/components/schemas/v1UUID" + }, + "prefixes": { + "example": [ + "10.1.2.0/24" + ], + "items": { + "$ref": "#/components/schemas/v1CIDR" + }, + "type": "array" + }, + "prefixesV6": { + "example": [ + "10.1.2.0/24" + ], + "items": { + "$ref": "#/components/schemas/v1CIDR" + }, + "type": "array" + }, + "publicIp": { + "$ref": "#/components/schemas/v1IP" + }, + "state": { + "$ref": "#/components/schemas/v1ResourceState" + } + }, + "required": [ + "networkId", + "name", + "state" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "Network" + } + }, + "v1NetworkArea": { + "description": "Object that represents a network area.", + "properties": { + "areaId": { + "$ref": "#/components/schemas/v1UUID" + }, + "ipv4": { + "$ref": "#/components/schemas/v1NetworkAreaIPv4" + }, + "name": { + "example": "My network area", + "type": "string" + }, + "projectCount": { + "$ref": "#/components/schemas/v1ProjectCount" + }, + "state": { + "$ref": "#/components/schemas/v1ResourceState" + } + }, + "required": [ + "areaId", + "name", + "projectCount", + "state" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "NetworkArea" + } + }, + "v1NetworkAreaIPv4": { + "allOf": [ + { + "$ref": "#/components/schemas/v1Area" + }, + { + "$ref": "#/components/schemas/v1AreaPrefixConfigIPv4" + } + ], + "description": "The IPv4 properties of a network area.", + "x-stackit-sdk": { + "schema-name": "NetworkAreaIPv4" + } + }, + "v1NetworkAreaList": { + "description": "A list of network areas.", + "items": { + "$ref": "#/components/schemas/v1NetworkArea" + }, + "type": "array", + "x-stackit-sdk": { + "schema-name": "NetworkAreaList" + } + }, + "v1NetworkAreaListResponse": { + "description": "Network area list response.", + "properties": { + "items": { + "$ref": "#/components/schemas/v1NetworkAreaList" + } + }, + "required": [ + "items" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "NetworkAreaListResponse" + } + }, + "v1NetworkList": { + "description": "A list of networks.", + "items": { + "$ref": "#/components/schemas/v1Network" + }, + "type": "array", + "x-stackit-sdk": { + "schema-name": "NetworkList" + } + }, + "v1NetworkListResponse": { + "description": "Network list response.", + "properties": { + "items": { + "$ref": "#/components/schemas/v1NetworkList" + } + }, + "required": [ + "items" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "NetworkListResponse" + } + }, + "v1NetworkRange": { + "description": "Object that represents a network range.", + "properties": { + "networkRangeId": { + "allOf": [ + { + "$ref": "#/components/schemas/v1UUID" + } + ], + "readOnly": true + }, + "prefix": { + "$ref": "#/components/schemas/v1CIDR" + } + }, + "required": [ + "prefix" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "NetworkRange" + } + }, + "v1NetworkRangeList": { + "description": "A list of network ranges.", + "items": { + "$ref": "#/components/schemas/v1NetworkRange" + }, + "maxItems": 64, + "minItems": 1, + "type": "array", + "x-stackit-sdk": { + "schema-name": "NetworkRangeList" + } + }, + "v1NetworkRangeListResponse": { + "description": "Network Range list response.", + "properties": { + "items": { + "$ref": "#/components/schemas/v1NetworkRangeList" + } + }, + "required": [ + "items" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "NetworkRangeListResponse" + } + }, + "v1ProjectCount": { + "description": "The amount of projects currently referencing a specific area.", + "example": 10, + "minimum": 0, + "type": "integer", + "x-stackit-sdk": { + "schema-name": "ProjectCount" + } + }, + "v1ProjectList": { + "description": "A list of STACKIT projects.", + "items": { + "$ref": "#/components/schemas/v1UUID" + }, + "type": "array", + "x-stackit-sdk": { + "schema-name": "ProjectList" + } + }, + "v1ProjectListResponse": { + "description": "Project list response.", + "properties": { + "items": { + "$ref": "#/components/schemas/v1ProjectList" + } + }, + "required": [ + "items" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "ProjectListResponse" + } + }, + "v1ResourceState": { + "description": "The state of a resource object.", + "example": "CREATING", + "type": "string", + "x-extensible-enum": [ + "CREATING", + "CREATED", + "DELETING", + "DELETED", + "FAILED", + "UPDATED", + "UPDATING" + ], + "x-stackit-sdk": { + "schema-name": "ResourceState" + } + }, + "v1Route": { + "description": "Object represents a network route.", + "properties": { + "nexthop": { + "$ref": "#/components/schemas/v1IP" + }, + "prefix": { + "$ref": "#/components/schemas/v1CIDR" + }, + "routeId": { + "allOf": [ + { + "$ref": "#/components/schemas/v1UUID" + } + ], + "readOnly": true + } + }, + "required": [ + "prefix", + "nexthop" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "Route" + } + }, + "v1RouteList": { + "description": "A list of routes.", + "items": { + "$ref": "#/components/schemas/v1Route" + }, + "type": "array", + "x-stackit-sdk": { + "schema-name": "RouteList" + } + }, + "v1RouteListResponse": { + "description": "Route list response.", + "properties": { + "items": { + "$ref": "#/components/schemas/v1RouteList" + } + }, + "required": [ + "items" + ], + "type": "object", + "x-stackit-sdk": { + "schema-name": "RouteListResponse" + } + }, + "v1UUID": { + "description": "Universally Unique Identifier (UUID).", + "example": "d61a8564-c8dd-4ffb-bc15-143e7d0c85ed", + "format": "uuid", + "maxLength": 36, + "minLength": 36, + "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", + "type": "string", + "x-stackit-sdk": { + "schema-name": "UUID" + } + }, + "v1UpdateAreaAddressFamily": { + "description": "The addressFamily object for a area update request.", + "minProperties": 1, + "properties": { + "ipv4": { + "$ref": "#/components/schemas/v1UpdateAreaIPv4" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "UpdateAreaAddressFamily" + } + }, + "v1UpdateAreaIPv4": { + "description": "The update object for a IPv4 network area.", + "properties": { + "defaultNameservers": { + "items": { + "$ref": "#/components/schemas/v1IP" + }, + "maxItems": 3, + "type": "array" + }, + "defaultPrefixLen": { + "$ref": "#/components/schemas/v1AreaDefaultPrefixLengthIPv4" + }, + "maxPrefixLen": { + "$ref": "#/components/schemas/v1AreaMaxPrefixLengthIPv4" + }, + "minPrefixLen": { + "$ref": "#/components/schemas/v1AreaMinPrefixLengthIPv4" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "UpdateAreaIPv4" + } + }, + "v1UpdateNetworkAddressFamily": { + "description": "The addressFamily object for a network update request.", + "minProperties": 1, + "properties": { + "ipv4": { + "$ref": "#/components/schemas/v1UpdateNetworkIPv4" + }, + "ipv6": { + "$ref": "#/components/schemas/v1UpdateNetworkIPv6" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "UpdateNetworkAddressFamily" + } + }, + "v1UpdateNetworkIPv4": { + "description": "The config object for a IPv4 network update.", + "properties": { + "nameservers": { + "$ref": "#/components/schemas/v1Nameserver" + } + }, + "type": "object", + "x-stackit-sdk": { + "schema-name": "UpdateNetworkIPv4" + } + }, + "v1UpdateNetworkIPv6": { + "description": "The config object for a IPv6 network update.", + "properties": { + "nameservers": { + "$ref": "#/components/schemas/v1Nameserverv6" + } + }, + "type": "object" + } + } + }, + "info": { + "contact": { + "email": "stackit-iaas@mail.schwarz", + "name": "STACKIT IaaS Teams", + "url": "https://support.stackit.cloud/servicedesk" + }, + "description": "This API allows you to create and modify IaaS resources.", + "termsOfService": "https://stackit.de/en/imprint", + "title": "IaaS-API", + "version": "1" + }, + "openapi": "3.0.1", + "paths": { + "/v1/organizations/{organizationId}/network-areas": { + "get": { + "description": "Get a list of all visible network areas defined in an organization.", + "operationId": "v1ListAreas", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkAreaListResponse" + } + } + }, + "description": "Get a list of all network areas." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "List all network areas in an organization.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.list" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.list" + ], + "implicit-actions": null + } + }, + "post": { + "description": "Create a new network area in an organization.", + "operationId": "v1CreateArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "addressFamily": { + "ipv4": { + "defaultNameservers": [ + "10.1.2.10" + ], + "defaultPrefixLen": 24, + "maxPrefixLen": 28, + "minPrefixLen": 22, + "networkRanges": [ + { + "prefix": "10.0.0.0/16" + } + ], + "routes": [ + { + "nexthop": "10.1.2.10", + "prefix": "192.168.0.0/24" + } + ], + "transferNetwork": "10.1.2.0/24" + } + }, + "name": "My STACKIT Internet Network Area" + }, + "schema": { + "properties": { + "addressFamily": { + "$ref": "#/components/schemas/v1CreateAreaAddressFamily" + }, + "name": { + "$ref": "#/components/schemas/v1GenericName" + } + }, + "required": [ + "name", + "addressFamily" + ], + "type": "object" + } + } + }, + "description": "Request an area creation.", + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkArea" + } + } + }, + "description": "Area has been successfully created." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Create new network area in an organization.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.create" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.create" + ], + "implicit-actions": null + } + } + }, + "/v1/organizations/{organizationId}/network-areas/{areaId}": { + "delete": { + "description": "Delete an existing network area in an organization. This is only possible if no projects are using the area anymore.", + "operationId": "v1DeleteArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "202": { + "description": "Delete request for area has been accepted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "content": { + "application/json": { + "example": { + "code": 409, + "msg": "Areas must no longer be referenced by any project to be deleted" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Tried to delete an area that was still in use by a project." + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Delete a network area.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.delete" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.delete" + ], + "implicit-actions": null + } + }, + "get": { + "description": "Get details about a network area in an organization.", + "operationId": "v1GetArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkArea" + } + } + }, + "description": "Show network area details." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Get details about a network area.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.get" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.get" + ], + "implicit-actions": null + } + }, + "patch": { + "description": "Update the settings of a network area in an organization.", + "operationId": "v1UpdateArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "addressFamily": { + "ipv4": { + "defaultNameservers": [ + "10.1.2.10" + ], + "defaultPrefixLen": 24, + "maxPrefixLen": 26, + "minPrefixLen": 22 + } + }, + "name": "My STACKIT Internet Network Area" + }, + "schema": { + "properties": { + "addressFamily": { + "$ref": "#/components/schemas/v1UpdateAreaAddressFamily" + }, + "name": { + "$ref": "#/components/schemas/v1GenericName" + } + }, + "type": "object" + } + } + }, + "description": "Request to update an area.", + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkArea" + } + } + }, + "description": "Area has been updated." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Update network area settings.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.update" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.update" + ], + "implicit-actions": null + } + } + }, + "/v1/organizations/{organizationId}/network-areas/{areaId}/network-ranges": { + "get": { + "description": "Get a list of all network ranges in a network area.", + "operationId": "v1ListNetworkRangesOfArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkRangeListResponse" + } + } + }, + "description": "List all network ranges." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "List all network ranges in a network area.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.range.list" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.range.list" + ], + "implicit-actions": null + } + }, + "post": { + "description": "Create a new network range in an existing network area.", + "operationId": "v1AddNetworkRangesToArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "ipv4": [ + { + "prefix": "10.1.2.0/24" + } + ] + }, + "schema": { + "properties": { + "ipv4": { + "$ref": "#/components/schemas/v1NetworkRangeList" + } + }, + "type": "object" + } + } + }, + "description": "Request an addition of network ranges to an area.", + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkRangeListResponse" + } + } + }, + "description": "Adding network ranges was successful." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "content": { + "application/json": { + "example": { + "code": 409, + "msg": "Network ranges must not overlap with other network ranges or transfer networks" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Tried to add a network range that conflicts with an existing network range or transfer range." + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Create new network range in a network area.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.range.create" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.range.create" + ], + "implicit-actions": null + } + } + }, + "/v1/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}": { + "delete": { + "description": "Delete a network range of a network area. The deletion will fail if the network range is still used.", + "operationId": "v1DeleteNetworkRangeFromArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Range.", + "in": "path", + "name": "networkRangeId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "202": { + "description": "Delete request for network range has been accepted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "content": { + "application/json": { + "example": { + "code": 409, + "msg": "Network ranges must no longer be used to be deleted" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Tried to delete a network range that is still in use." + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Delete a network range.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.range.delete" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.range.delete" + ], + "implicit-actions": null + } + }, + "get": { + "description": "Get details about a network range in a network area.", + "operationId": "v1GetNetworkRangeOfArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Range.", + "in": "path", + "name": "networkRangeId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkRange" + } + } + }, + "description": "Show network range details." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Get details about a network range.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.range.get" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.range.get" + ], + "implicit-actions": null + } + } + }, + "/v1/organizations/{organizationId}/network-areas/{areaId}/projects": { + "get": { + "description": "Get a list of all projects using a network area.", + "operationId": "v1GetProjectsUsingArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1ProjectListResponse" + } + } + }, + "description": "List projects for a network area." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "List all projects using a network area.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.project.list" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.project.list" + ], + "implicit-actions": null + } + } + }, + "/v1/organizations/{organizationId}/network-areas/{areaId}/routes": { + "get": { + "description": "Get a list of all network routes defined in a network area.", + "operationId": "v1ListRoutesOfArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1RouteListResponse" + } + } + }, + "description": "List network routes." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "List all network routes in a network area.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.route.list" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.route.list" + ], + "implicit-actions": null + } + }, + "post": { + "description": "Create one or several new network routes in a network area.", + "operationId": "v1AddRoutesToArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "ipv4": [ + { + "nexthop": "10.1.2.10", + "prefix": "192.168.0.0/24" + } + ] + }, + "schema": { + "properties": { + "ipv4": { + "$ref": "#/components/schemas/v1RouteList" + } + }, + "type": "object" + } + } + }, + "description": "Request an addition of routes to an area.", + "required": true + }, + "responses": { + "202": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1RouteListResponse" + } + } + }, + "description": "Create request for network routes has been accepted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "content": { + "application/json": { + "example": { + "code": 409, + "msg": "routes must not overlap with other network ranges or transfer networks" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Tried to add a route that conflicts with an existing network range or transfer range." + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Create new network routes.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.route.create" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.route.create" + ], + "implicit-actions": null + } + } + }, + "/v1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}": { + "delete": { + "description": "Delete a network route of a network area.", + "operationId": "v1DeleteRouteFromArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Route.", + "in": "path", + "name": "routeId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "202": { + "description": "Delete request for network route has been accepted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Delete a network route.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.route.delete" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.route.delete" + ], + "implicit-actions": null + } + }, + "get": { + "description": "Get details about a network route defined in a network area.", + "operationId": "v1GetRouteOfArea", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Organization.", + "in": "path", + "name": "organizationId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network Area.", + "in": "path", + "name": "areaId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Route.", + "in": "path", + "name": "routeId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1Route" + } + } + }, + "description": "Show route details." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Get details about a network route.", + "tags": [ + "Area" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network-area.route.get" + ], + "resource-id": "organizationId", + "resource-id-type": "dynamic", + "resource-type": "organization" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network-area.route.get" + ], + "implicit-actions": null + } + } + }, + "/v1/projects/{projectId}/networks": { + "get": { + "description": "Get a list of all networks inside a project.", + "operationId": "v1ListNetworksInProject", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Project.", + "in": "path", + "name": "projectId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1NetworkListResponse" + } + } + }, + "description": "List all networks of a project." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "List all networks inside a project.", + "tags": [ + "Network" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network.list" + ], + "resource-id": "projectId", + "resource-id-type": "dynamic", + "resource-type": "project" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network.list" + ], + "implicit-actions": null + } + }, + "post": { + "description": "Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost.", + "operationId": "v1CreateNetwork", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Project.", + "in": "path", + "name": "projectId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "addressFamily": { + "ipv4": { + "nameservers": [ + "10.1.2.10" + ], + "prefixLength": 24 + } + }, + "name": "My Network" + }, + "schema": { + "properties": { + "addressFamily": { + "$ref": "#/components/schemas/v1CreateNetworkAddressFamily" + }, + "name": { + "$ref": "#/components/schemas/v1GenericName" + } + }, + "required": [ + "name" + ], + "type": "object" + } + } + }, + "description": "Request a network creation.", + "required": true + }, + "responses": { + "202": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1Network" + } + } + }, + "description": "Network create has been accepted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "content": { + "application/json": { + "example": { + "code": 409, + "msg": "Can not allocate prefixes for network. Ensure the area has sufficient space in the configured network ranges" + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Can not allocate prefixes for network." + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Create new network.", + "tags": [ + "Network" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network.create" + ], + "resource-id": "projectId", + "resource-id-type": "dynamic", + "resource-type": "project" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network.create" + ], + "implicit-actions": null + } + } + }, + "/v1/projects/{projectId}/networks/{networkId}": { + "delete": { + "description": "Delete a network. If the network is still in use, the deletion will fail.", + "operationId": "v1DeleteNetwork", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Project.", + "in": "path", + "name": "projectId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network.", + "in": "path", + "name": "networkId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "202": { + "description": "Delete request for network has been accepted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "content": { + "application/json": { + "example": { + "code": 409, + "msg": "Can not delete network. It is still has systems connected to it." + }, + "schema": { + "$ref": "#/components/schemas/v1Error" + } + } + }, + "description": "Can not delete network that is still in use." + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Delete network.", + "tags": [ + "Network" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network.delete" + ], + "resource-id": "projectId", + "resource-id-type": "dynamic", + "resource-type": "project" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network.delete" + ], + "implicit-actions": null + } + }, + "get": { + "description": "Get details about a network of a project.", + "operationId": "v1GetNetwork", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Project.", + "in": "path", + "name": "projectId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network.", + "in": "path", + "name": "networkId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1Network" + } + } + }, + "description": "Show network details." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Get network details.", + "tags": [ + "Network" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network.get" + ], + "resource-id": "projectId", + "resource-id-type": "dynamic", + "resource-type": "project" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network.get" + ], + "implicit-actions": null + } + }, + "patch": { + "description": "Update the settings of a network inside a project.", + "operationId": "v1UpdateNetwork", + "parameters": [ + { + "description": "The identifier (ID) of a STACKIT Project.", + "in": "path", + "name": "projectId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + }, + { + "description": "The identifier (ID) of a STACKIT Network.", + "in": "path", + "name": "networkId", + "required": true, + "schema": { + "$ref": "#/components/schemas/v1UUID" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "example": { + "addressFamily": { + "ipv4": { + "nameservers": [ + "10.1.2.10" + ] + } + }, + "name": "My Network" + }, + "schema": { + "properties": { + "addressFamily": { + "$ref": "#/components/schemas/v1UpdateNetworkAddressFamily" + }, + "name": { + "$ref": "#/components/schemas/v1GenericName" + } + }, + "type": "object" + } + } + }, + "description": "Request an update of a network.", + "required": true + }, + "responses": { + "202": { + "$ref": "#/components/responses/UpdateAccepted" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + }, + "summary": "Update network settings.", + "tags": [ + "Network" + ], + "x-stackit-authorization": { + "actions": [ + "iaas.network.update" + ], + "resource-id": "projectId", + "resource-id-type": "dynamic", + "resource-type": "project" + }, + "x-viewer-permissions": { + "actions": [ + "iaas.network.update" + ], + "implicit-actions": null + } + } + } + }, + "servers": [ + { + "description": "This API allows you to create and modify IaaS resources.", + "url": "https://iaas.api.eu01.stackit.cloud" + } + ], + "tags": [ + { + "description": "Generic Tag for Network Area based Service.", + "name": "Area" + }, + { + "description": "Generic Tag for Backup based Service.", + "name": "Backups" + }, + { + "description": "Generic Tag for Flavor based Service.", + "name": "Flavors" + }, + { + "description": "Generic Tag for Image based Service.", + "name": "Images" + }, + { + "description": "Generic Tag for Key pair based Service.", + "name": "Keypairs" + }, + { + "description": "Generic Tag for Network based Service.", + "name": "Network" + }, + { + "description": "Generic Tag for Probes (healthz/readyz).", + "name": "Probes" + }, + { + "description": "Generic Tag for Project based Service.", + "name": "Project" + }, + { + "description": "Generic Tag for Request based Service.", + "name": "Request" + }, + { + "description": "Generic Tag for Server based Service.", + "name": "Servers" + } + ], + "x-stackit-api": { + "type": "stackit" + }, + "x-stackit-scope": { + "visibility": "public" + }, + "x-stackit-sdk": { + "include": false + }, + "x-stackit-signer": { + "audience": [ + "iaas" + ], + "inject-email": false + } +} \ No newline at end of file diff --git a/internal/config/iaas/v1/include/network/validate.go b/internal/config/iaas/v1/include/network/validate.go new file mode 100644 index 0000000..0972e66 --- /dev/null +++ b/internal/config/iaas/v1/include/network/validate.go @@ -0,0 +1,22 @@ +// this file is used for validating network data and properties + +package network + +import ( + "fmt" + "regexp" +) + +// ValidateNetworkName validates a given network name +func ValidateNetworkName(name string) error { + if len(name) > 63 || name == "" { + return fmt.Errorf("name bust be non-empty and < 64 characters") + } + + exp := `^[A-Za-z0-9]+((-|_|\s|\.)[A-Za-z0-9]+)*$` + r := regexp.MustCompile(exp) + if !r.MatchString(name) { + return fmt.Errorf("invalid cluster name. valid name is of: %s", exp) + } + return nil +} diff --git a/internal/config/iaas/v1/include/service.go b/internal/config/iaas/v1/include/service.go new file mode 100644 index 0000000..addf4b7 --- /dev/null +++ b/internal/config/iaas/v1/include/service.go @@ -0,0 +1,16 @@ +package iaas + +import ( + "github.com/SchwarzIT/community-stackit-go-client/pkg/baseurl" + "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1" +) + +var BaseURLs = baseurl.New( + "iaas", + "https://iaas.api.eu01.stackit.cloud/", +) + +func NewService(c contracts.BaseClientInterface) (*iaas.ClientWithResponses, error) { + return iaas.NewClient(BaseURLs.Get(), c) +} diff --git a/internal/config/iaas/v1/note.txt b/internal/config/iaas/v1/note.txt new file mode 100644 index 0000000..0128a36 --- /dev/null +++ b/internal/config/iaas/v1/note.txt @@ -0,0 +1 @@ +1. from the original openAPI config file, Request Params have been flattened and Tags removed \ No newline at end of file diff --git a/internal/config/kubernetes/v1.1/include/service.go b/internal/config/kubernetes/v1.1/include/service.go index 15dc863..3b6b31b 100644 --- a/internal/config/kubernetes/v1.1/include/service.go +++ b/internal/config/kubernetes/v1.1/include/service.go @@ -3,7 +3,7 @@ package kubernetes import ( "github.com/SchwarzIT/community-stackit-go-client/pkg/baseurl" "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" - kubernetes "github.com/SchwarzIT/community-stackit-go-client/pkg/services/kubernetes/v1.0" + kubernetes "github.com/SchwarzIT/community-stackit-go-client/pkg/services/kubernetes/v1.1" ) var BaseURLs = baseurl.New( diff --git a/pkg/services/iaas-api/v1/area/area.go b/pkg/services/iaas-api/v1/area/area.go new file mode 100644 index 0000000..fe41566 --- /dev/null +++ b/pkg/services/iaas-api/v1/area/area.go @@ -0,0 +1,2688 @@ +// Package area provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package area + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/pkg/errors" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" + "github.com/SchwarzIT/community-stackit-go-client/pkg/helpers/runtime" + openapiTypes "github.com/SchwarzIT/community-stackit-go-client/pkg/helpers/types" + "github.com/SchwarzIT/community-stackit-go-client/pkg/validate" +) + +// V1Area The basic properties of a network area. +type V1Area struct { + // DefaultNameservers A list containing DNS Servers/Nameservers for IPv4. + DefaultNameservers *V1Nameserver `json:"defaultNameservers,omitempty"` + + // NetworkRanges A list of network ranges. + NetworkRanges *V1NetworkRangeList `json:"networkRanges,omitempty"` + + // Routes A list of routes. + Routes *V1RouteList `json:"routes,omitempty"` + + // TransferNetwork Classless Inter-Domain Routing (CIDR). + TransferNetwork *V1CIDR `json:"transferNetwork,omitempty"` +} + +// V1AreaConfig The basic network area object. +type V1AreaConfig struct { + DefaultNameservers *[]V1IP `json:"defaultNameservers,omitempty"` + + // NetworkRanges A list of network ranges. + NetworkRanges V1NetworkRangeList `json:"networkRanges"` + + // Routes A list of routes. + Routes *V1RouteList `json:"routes,omitempty"` + + // TransferNetwork Classless Inter-Domain Routing (CIDR). + TransferNetwork V1CIDR `json:"transferNetwork"` +} + +// V1AreaDefaultPrefixLengthIPv4 The default prefix length for networks in the network area. +type V1AreaDefaultPrefixLengthIPv4 = int + +// V1AreaMaxPrefixLengthIPv4 The maximal prefix length for networks in the network area. +type V1AreaMaxPrefixLengthIPv4 = int + +// V1AreaMinPrefixLengthIPv4 The minimal prefix length for networks in the network area. +type V1AreaMinPrefixLengthIPv4 = int + +// V1AreaPrefixConfigIPv4 The IPv4 prefix config for a network area. +type V1AreaPrefixConfigIPv4 struct { + DefaultPrefixLen *V1AreaDefaultPrefixLengthIPv4 `json:"defaultPrefixLen,omitempty"` + MaxPrefixLen *V1AreaMaxPrefixLengthIPv4 `json:"maxPrefixLen,omitempty"` + MinPrefixLen *V1AreaMinPrefixLengthIPv4 `json:"minPrefixLen,omitempty"` +} + +// V1CIDR Classless Inter-Domain Routing (CIDR). +type V1CIDR = string + +// V1CreateAreaAddressFamily The addressFamily object for a area create request. +type V1CreateAreaAddressFamily struct { + // Ipv4 The config object for a IPv4 network area. + Ipv4 *V1CreateAreaIPv4 `json:"ipv4,omitempty"` +} + +// V1CreateAreaIPv4 defines model for v1CreateAreaIPv4. +type V1CreateAreaIPv4 struct { + DefaultNameservers *[]V1IP `json:"defaultNameservers,omitempty"` + DefaultPrefixLen *V1AreaDefaultPrefixLengthIPv4 `json:"defaultPrefixLen,omitempty"` + MaxPrefixLen *V1AreaMaxPrefixLengthIPv4 `json:"maxPrefixLen,omitempty"` + MinPrefixLen *V1AreaMinPrefixLengthIPv4 `json:"minPrefixLen,omitempty"` + + // NetworkRanges A list of network ranges. + NetworkRanges V1NetworkRangeList `json:"networkRanges"` + + // Routes A list of routes. + Routes *V1RouteList `json:"routes,omitempty"` + + // TransferNetwork Classless Inter-Domain Routing (CIDR). + TransferNetwork V1CIDR `json:"transferNetwork"` +} + +// V1Error Error with HTTP error code and an error message. +type V1Error struct { + Code int `json:"code"` + Msg string `json:"msg"` +} + +// V1GenericName The name for a General Object. Matches Names and also UUIDs. +type V1GenericName = string + +// V1IP Object that represents an IPv4 address. +type V1IP = string + +// V1Nameserver A list containing DNS Servers/Nameservers for IPv4. +type V1Nameserver = []V1IP + +// V1NetworkArea Object that represents a network area. +type V1NetworkArea struct { + // AreaId Universally Unique Identifier (UUID). + AreaID V1UUID `json:"areaId"` + + // Ipv4 The IPv4 properties of a network area. + Ipv4 *V1NetworkAreaIPv4 `json:"ipv4,omitempty"` + Name string `json:"name"` + + // ProjectCount The amount of projects currently referencing a specific area. + ProjectCount V1ProjectCount `json:"projectCount"` + + // State The state of a resource object. + State V1ResourceState `json:"state"` +} + +// V1NetworkAreaIPv4 defines model for v1NetworkAreaIPv4. +type V1NetworkAreaIPv4 struct { + // DefaultNameservers A list containing DNS Servers/Nameservers for IPv4. + DefaultNameservers *V1Nameserver `json:"defaultNameservers,omitempty"` + DefaultPrefixLen *V1AreaDefaultPrefixLengthIPv4 `json:"defaultPrefixLen,omitempty"` + MaxPrefixLen *V1AreaMaxPrefixLengthIPv4 `json:"maxPrefixLen,omitempty"` + MinPrefixLen *V1AreaMinPrefixLengthIPv4 `json:"minPrefixLen,omitempty"` + + // NetworkRanges A list of network ranges. + NetworkRanges *V1NetworkRangeList `json:"networkRanges,omitempty"` + + // Routes A list of routes. + Routes *V1RouteList `json:"routes,omitempty"` + + // TransferNetwork Classless Inter-Domain Routing (CIDR). + TransferNetwork *V1CIDR `json:"transferNetwork,omitempty"` +} + +// V1NetworkAreaList A list of network areas. +type V1NetworkAreaList = []V1NetworkArea + +// V1NetworkAreaListResponse Network area list response. +type V1NetworkAreaListResponse struct { + // Items A list of network areas. + Items V1NetworkAreaList `json:"items"` +} + +// V1NetworkRange Object that represents a network range. +type V1NetworkRange struct { + NetworkRangeID *V1UUID `json:"networkRangeId,omitempty"` + + // Prefix Classless Inter-Domain Routing (CIDR). + Prefix V1CIDR `json:"prefix"` +} + +// V1NetworkRangeList A list of network ranges. +type V1NetworkRangeList = []V1NetworkRange + +// V1NetworkRangeListResponse Network Range list response. +type V1NetworkRangeListResponse struct { + // Items A list of network ranges. + Items V1NetworkRangeList `json:"items"` +} + +// V1ProjectCount The amount of projects currently referencing a specific area. +type V1ProjectCount = int + +// V1ProjectList A list of STACKIT projects. +type V1ProjectList = []V1UUID + +// V1ProjectListResponse Project list response. +type V1ProjectListResponse struct { + // Items A list of STACKIT projects. + Items V1ProjectList `json:"items"` +} + +// V1ResourceState The state of a resource object. +type V1ResourceState = string + +// V1Route Object represents a network route. +type V1Route struct { + // Nexthop Object that represents an IPv4 address. + Nexthop V1IP `json:"nexthop"` + + // Prefix Classless Inter-Domain Routing (CIDR). + Prefix V1CIDR `json:"prefix"` + RouteID *V1UUID `json:"routeId,omitempty"` +} + +// V1RouteList A list of routes. +type V1RouteList = []V1Route + +// V1RouteListResponse Route list response. +type V1RouteListResponse struct { + // Items A list of routes. + Items V1RouteList `json:"items"` +} + +// V1UUID Universally Unique Identifier (UUID). +type V1UUID = openapiTypes.UUID + +// V1UpdateAreaAddressFamily The addressFamily object for a area update request. +type V1UpdateAreaAddressFamily struct { + // Ipv4 The update object for a IPv4 network area. + Ipv4 *V1UpdateAreaIPv4 `json:"ipv4,omitempty"` +} + +// V1UpdateAreaIPv4 The update object for a IPv4 network area. +type V1UpdateAreaIPv4 struct { + DefaultNameservers *[]V1IP `json:"defaultNameservers,omitempty"` + + // DefaultPrefixLen The default prefix length for networks in the network area. + DefaultPrefixLen *V1AreaDefaultPrefixLengthIPv4 `json:"defaultPrefixLen,omitempty"` + + // MaxPrefixLen The maximal prefix length for networks in the network area. + MaxPrefixLen *V1AreaMaxPrefixLengthIPv4 `json:"maxPrefixLen,omitempty"` + + // MinPrefixLen The minimal prefix length for networks in the network area. + MinPrefixLen *V1AreaMinPrefixLengthIPv4 `json:"minPrefixLen,omitempty"` +} + +// BadRequest Error with HTTP error code and an error message. +type BadRequest = V1Error + +// Forbidden Error with HTTP error code and an error message. +type Forbidden = V1Error + +// InternalServerError Error with HTTP error code and an error message. +type InternalServerError = V1Error + +// NotFound Error with HTTP error code and an error message. +type NotFound = V1Error + +// Unauthorized Error with HTTP error code and an error message. +type Unauthorized = V1Error + +// V1CreateAreaJSONBody defines parameters for V1CreateArea. +type V1CreateAreaJSONBody struct { + // AddressFamily The addressFamily object for a area create request. + AddressFamily V1CreateAreaAddressFamily `json:"addressFamily"` + + // Name The name for a General Object. Matches Names and also UUIDs. + Name V1GenericName `json:"name"` +} + +// V1UpdateAreaJSONBody defines parameters for V1UpdateArea. +type V1UpdateAreaJSONBody struct { + // AddressFamily The addressFamily object for a area update request. + AddressFamily *V1UpdateAreaAddressFamily `json:"addressFamily,omitempty"` + + // Name The name for a General Object. Matches Names and also UUIDs. + Name *V1GenericName `json:"name,omitempty"` +} + +// V1AddNetworkRangesToAreaJSONBody defines parameters for V1AddNetworkRangesToArea. +type V1AddNetworkRangesToAreaJSONBody struct { + // Ipv4 A list of network ranges. + Ipv4 *V1NetworkRangeList `json:"ipv4,omitempty"` +} + +// V1AddRoutesToAreaJSONBody defines parameters for V1AddRoutesToArea. +type V1AddRoutesToAreaJSONBody struct { + // Ipv4 A list of routes. + Ipv4 *V1RouteList `json:"ipv4,omitempty"` +} + +// V1CreateAreaJSONRequestBody defines body for V1CreateArea for application/json ContentType. +type V1CreateAreaJSONRequestBody V1CreateAreaJSONBody + +// V1UpdateAreaJSONRequestBody defines body for V1UpdateArea for application/json ContentType. +type V1UpdateAreaJSONRequestBody V1UpdateAreaJSONBody + +// V1AddNetworkRangesToAreaJSONRequestBody defines body for V1AddNetworkRangesToArea for application/json ContentType. +type V1AddNetworkRangesToAreaJSONRequestBody V1AddNetworkRangesToAreaJSONBody + +// V1AddRoutesToAreaJSONRequestBody defines body for V1AddRoutesToArea for application/json ContentType. +type V1AddRoutesToAreaJSONRequestBody V1AddRoutesToAreaJSONBody + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { + // V1ListAreas request + V1ListAreasRaw(ctx context.Context, organizationID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1CreateArea request with any body + V1CreateAreaRawWithBody(ctx context.Context, organizationID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1CreateAreaRaw(ctx context.Context, organizationID V1UUID, body V1CreateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1DeleteArea request + V1DeleteAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1GetArea request + V1GetAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1UpdateArea request with any body + V1UpdateAreaRawWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1UpdateAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1UpdateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1ListNetworkRangesOfArea request + V1ListNetworkRangesOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1AddNetworkRangesToArea request with any body + V1AddNetworkRangesToAreaRawWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1AddNetworkRangesToAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddNetworkRangesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1DeleteNetworkRangeFromArea request + V1DeleteNetworkRangeFromAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1GetNetworkRangeOfArea request + V1GetNetworkRangeOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1GetProjectsUsingArea request + V1GetProjectsUsingAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1ListRoutesOfArea request + V1ListRoutesOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1AddRoutesToArea request with any body + V1AddRoutesToAreaRawWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1AddRoutesToAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddRoutesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1DeleteRouteFromArea request + V1DeleteRouteFromAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1GetRouteOfArea request + V1GetRouteOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) +} + +func (c *Client) V1ListAreasRaw(ctx context.Context, organizationID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ListAreasRequest(ctx, c.Server, organizationID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateAreaRawWithBody(ctx context.Context, organizationID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateAreaRequestWithBody(ctx, c.Server, organizationID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateAreaRaw(ctx context.Context, organizationID V1UUID, body V1CreateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateAreaRequest(ctx, c.Server, organizationID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1DeleteAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteAreaRequest(ctx, c.Server, organizationID, areaID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1GetAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetAreaRequest(ctx, c.Server, organizationID, areaID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1UpdateAreaRawWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateAreaRequestWithBody(ctx, c.Server, organizationID, areaID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1UpdateAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1UpdateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateAreaRequest(ctx, c.Server, organizationID, areaID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1ListNetworkRangesOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ListNetworkRangesOfAreaRequest(ctx, c.Server, organizationID, areaID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1AddNetworkRangesToAreaRawWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1AddNetworkRangesToAreaRequestWithBody(ctx, c.Server, organizationID, areaID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1AddNetworkRangesToAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddNetworkRangesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1AddNetworkRangesToAreaRequest(ctx, c.Server, organizationID, areaID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1DeleteNetworkRangeFromAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteNetworkRangeFromAreaRequest(ctx, c.Server, organizationID, areaID, networkRangeID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1GetNetworkRangeOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetNetworkRangeOfAreaRequest(ctx, c.Server, organizationID, areaID, networkRangeID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1GetProjectsUsingAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetProjectsUsingAreaRequest(ctx, c.Server, organizationID, areaID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1ListRoutesOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ListRoutesOfAreaRequest(ctx, c.Server, organizationID, areaID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1AddRoutesToAreaRawWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1AddRoutesToAreaRequestWithBody(ctx, c.Server, organizationID, areaID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1AddRoutesToAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddRoutesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1AddRoutesToAreaRequest(ctx, c.Server, organizationID, areaID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1DeleteRouteFromAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteRouteFromAreaRequest(ctx, c.Server, organizationID, areaID, routeID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1GetRouteOfAreaRaw(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetRouteOfAreaRequest(ctx, c.Server, organizationID, areaID, routeID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// NewV1ListAreasRequest generates requests for V1ListAreas +func NewV1ListAreasRequest(ctx context.Context, server string, organizationID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1CreateAreaRequest calls the generic V1CreateArea builder with application/json body +func NewV1CreateAreaRequest(ctx context.Context, server string, organizationID V1UUID, body V1CreateAreaJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1CreateAreaRequestWithBody(ctx, server, organizationID, "application/json", bodyReader) +} + +// NewV1CreateAreaRequestWithBody generates requests for V1CreateArea with any type of body +func NewV1CreateAreaRequestWithBody(ctx context.Context, server string, organizationID V1UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1DeleteAreaRequest generates requests for V1DeleteArea +func NewV1DeleteAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1GetAreaRequest generates requests for V1GetArea +func NewV1GetAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1UpdateAreaRequest calls the generic V1UpdateArea builder with application/json body +func NewV1UpdateAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, body V1UpdateAreaJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1UpdateAreaRequestWithBody(ctx, server, organizationID, areaID, "application/json", bodyReader) +} + +// NewV1UpdateAreaRequestWithBody generates requests for V1UpdateArea with any type of body +func NewV1UpdateAreaRequestWithBody(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "PATCH", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1ListNetworkRangesOfAreaRequest generates requests for V1ListNetworkRangesOfArea +func NewV1ListNetworkRangesOfAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/network-ranges", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1AddNetworkRangesToAreaRequest calls the generic V1AddNetworkRangesToArea builder with application/json body +func NewV1AddNetworkRangesToAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, body V1AddNetworkRangesToAreaJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1AddNetworkRangesToAreaRequestWithBody(ctx, server, organizationID, areaID, "application/json", bodyReader) +} + +// NewV1AddNetworkRangesToAreaRequestWithBody generates requests for V1AddNetworkRangesToArea with any type of body +func NewV1AddNetworkRangesToAreaRequestWithBody(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/network-ranges", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1DeleteNetworkRangeFromAreaRequest generates requests for V1DeleteNetworkRangeFromArea +func NewV1DeleteNetworkRangeFromAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "networkRangeID", runtime.ParamLocationPath, networkRangeID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/network-ranges/%s", pathParam0, pathParam1, pathParam2) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1GetNetworkRangeOfAreaRequest generates requests for V1GetNetworkRangeOfArea +func NewV1GetNetworkRangeOfAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "networkRangeID", runtime.ParamLocationPath, networkRangeID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/network-ranges/%s", pathParam0, pathParam1, pathParam2) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1GetProjectsUsingAreaRequest generates requests for V1GetProjectsUsingArea +func NewV1GetProjectsUsingAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/projects", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1ListRoutesOfAreaRequest generates requests for V1ListRoutesOfArea +func NewV1ListRoutesOfAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/routes", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1AddRoutesToAreaRequest calls the generic V1AddRoutesToArea builder with application/json body +func NewV1AddRoutesToAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, body V1AddRoutesToAreaJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1AddRoutesToAreaRequestWithBody(ctx, server, organizationID, areaID, "application/json", bodyReader) +} + +// NewV1AddRoutesToAreaRequestWithBody generates requests for V1AddRoutesToArea with any type of body +func NewV1AddRoutesToAreaRequestWithBody(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/routes", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1DeleteRouteFromAreaRequest generates requests for V1DeleteRouteFromArea +func NewV1DeleteRouteFromAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, routeID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "routeID", runtime.ParamLocationPath, routeID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/routes/%s", pathParam0, pathParam1, pathParam2) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1GetRouteOfAreaRequest generates requests for V1GetRouteOfArea +func NewV1GetRouteOfAreaRequest(ctx context.Context, server string, organizationID V1UUID, areaID V1UUID, routeID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "organizationID", runtime.ParamLocationPath, organizationID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "areaID", runtime.ParamLocationPath, areaID) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "routeID", runtime.ParamLocationPath, routeID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/organizations/%s/network-areas/%s/routes/%s", pathParam0, pathParam1, pathParam2) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { + // V1ListAreas request + V1ListAreas(ctx context.Context, organizationID V1UUID, reqEditors ...RequestEditorFn) (*V1ListAreasResponse, error) + + // V1CreateArea request with any body + V1CreateAreaWithBody(ctx context.Context, organizationID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateAreaResponse, error) + + V1CreateArea(ctx context.Context, organizationID V1UUID, body V1CreateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateAreaResponse, error) + + // V1DeleteArea request + V1DeleteArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteAreaResponse, error) + + // V1GetArea request + V1GetArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1GetAreaResponse, error) + + // V1UpdateArea request with any body + V1UpdateAreaWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateAreaResponse, error) + + V1UpdateArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1UpdateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateAreaResponse, error) + + // V1ListNetworkRangesOfArea request + V1ListNetworkRangesOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1ListNetworkRangesOfAreaResponse, error) + + // V1AddNetworkRangesToArea request with any body + V1AddNetworkRangesToAreaWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1AddNetworkRangesToAreaResponse, error) + + V1AddNetworkRangesToArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddNetworkRangesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1AddNetworkRangesToAreaResponse, error) + + // V1DeleteNetworkRangeFromArea request + V1DeleteNetworkRangeFromArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteNetworkRangeFromAreaResponse, error) + + // V1GetNetworkRangeOfArea request + V1GetNetworkRangeOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*V1GetNetworkRangeOfAreaResponse, error) + + // V1GetProjectsUsingArea request + V1GetProjectsUsingArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1GetProjectsUsingAreaResponse, error) + + // V1ListRoutesOfArea request + V1ListRoutesOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1ListRoutesOfAreaResponse, error) + + // V1AddRoutesToArea request with any body + V1AddRoutesToAreaWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1AddRoutesToAreaResponse, error) + + V1AddRoutesToArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddRoutesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1AddRoutesToAreaResponse, error) + + // V1DeleteRouteFromArea request + V1DeleteRouteFromArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteRouteFromAreaResponse, error) + + // V1GetRouteOfArea request + V1GetRouteOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*V1GetRouteOfAreaResponse, error) +} + +type V1ListAreasResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkAreaListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1ListAreasResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ListAreasResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1CreateAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkArea + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1CreateAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1CreateAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1DeleteAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON409 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1DeleteAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeleteAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkArea + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1GetAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1UpdateAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkArea + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1UpdateAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1UpdateAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1ListNetworkRangesOfAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkRangeListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1ListNetworkRangesOfAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ListNetworkRangesOfAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1AddNetworkRangesToAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkRangeListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON409 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1AddNetworkRangesToAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1AddNetworkRangesToAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1DeleteNetworkRangeFromAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON409 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1DeleteNetworkRangeFromAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeleteNetworkRangeFromAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetNetworkRangeOfAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkRange + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1GetNetworkRangeOfAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetNetworkRangeOfAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetProjectsUsingAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1ProjectListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1GetProjectsUsingAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetProjectsUsingAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1ListRoutesOfAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1RouteListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1ListRoutesOfAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ListRoutesOfAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1AddRoutesToAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON202 *V1RouteListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON409 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1AddRoutesToAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1AddRoutesToAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1DeleteRouteFromAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1DeleteRouteFromAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeleteRouteFromAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetRouteOfAreaResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1Route + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1GetRouteOfAreaResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetRouteOfAreaResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// V1ListAreas request returning *V1ListAreasResponse +func (c *ClientWithResponses) V1ListAreas(ctx context.Context, organizationID V1UUID, reqEditors ...RequestEditorFn) (*V1ListAreasResponse, error) { + rsp, err := c.V1ListAreasRaw(ctx, organizationID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1ListAreasResponse(rsp) +} + +// V1CreateAreaWithBody request with arbitrary body returning *V1CreateAreaResponse +func (c *ClientWithResponses) V1CreateAreaWithBody(ctx context.Context, organizationID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateAreaResponse, error) { + rsp, err := c.V1CreateAreaRawWithBody(ctx, organizationID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1CreateAreaResponse(rsp) +} + +func (c *ClientWithResponses) V1CreateArea(ctx context.Context, organizationID V1UUID, body V1CreateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateAreaResponse, error) { + rsp, err := c.V1CreateAreaRaw(ctx, organizationID, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1CreateAreaResponse(rsp) +} + +// V1DeleteArea request returning *V1DeleteAreaResponse +func (c *ClientWithResponses) V1DeleteArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteAreaResponse, error) { + rsp, err := c.V1DeleteAreaRaw(ctx, organizationID, areaID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1DeleteAreaResponse(rsp) +} + +// V1GetArea request returning *V1GetAreaResponse +func (c *ClientWithResponses) V1GetArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1GetAreaResponse, error) { + rsp, err := c.V1GetAreaRaw(ctx, organizationID, areaID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1GetAreaResponse(rsp) +} + +// V1UpdateAreaWithBody request with arbitrary body returning *V1UpdateAreaResponse +func (c *ClientWithResponses) V1UpdateAreaWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateAreaResponse, error) { + rsp, err := c.V1UpdateAreaRawWithBody(ctx, organizationID, areaID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1UpdateAreaResponse(rsp) +} + +func (c *ClientWithResponses) V1UpdateArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1UpdateAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateAreaResponse, error) { + rsp, err := c.V1UpdateAreaRaw(ctx, organizationID, areaID, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1UpdateAreaResponse(rsp) +} + +// V1ListNetworkRangesOfArea request returning *V1ListNetworkRangesOfAreaResponse +func (c *ClientWithResponses) V1ListNetworkRangesOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1ListNetworkRangesOfAreaResponse, error) { + rsp, err := c.V1ListNetworkRangesOfAreaRaw(ctx, organizationID, areaID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1ListNetworkRangesOfAreaResponse(rsp) +} + +// V1AddNetworkRangesToAreaWithBody request with arbitrary body returning *V1AddNetworkRangesToAreaResponse +func (c *ClientWithResponses) V1AddNetworkRangesToAreaWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1AddNetworkRangesToAreaResponse, error) { + rsp, err := c.V1AddNetworkRangesToAreaRawWithBody(ctx, organizationID, areaID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1AddNetworkRangesToAreaResponse(rsp) +} + +func (c *ClientWithResponses) V1AddNetworkRangesToArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddNetworkRangesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1AddNetworkRangesToAreaResponse, error) { + rsp, err := c.V1AddNetworkRangesToAreaRaw(ctx, organizationID, areaID, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1AddNetworkRangesToAreaResponse(rsp) +} + +// V1DeleteNetworkRangeFromArea request returning *V1DeleteNetworkRangeFromAreaResponse +func (c *ClientWithResponses) V1DeleteNetworkRangeFromArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteNetworkRangeFromAreaResponse, error) { + rsp, err := c.V1DeleteNetworkRangeFromAreaRaw(ctx, organizationID, areaID, networkRangeID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1DeleteNetworkRangeFromAreaResponse(rsp) +} + +// V1GetNetworkRangeOfArea request returning *V1GetNetworkRangeOfAreaResponse +func (c *ClientWithResponses) V1GetNetworkRangeOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, networkRangeID V1UUID, reqEditors ...RequestEditorFn) (*V1GetNetworkRangeOfAreaResponse, error) { + rsp, err := c.V1GetNetworkRangeOfAreaRaw(ctx, organizationID, areaID, networkRangeID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1GetNetworkRangeOfAreaResponse(rsp) +} + +// V1GetProjectsUsingArea request returning *V1GetProjectsUsingAreaResponse +func (c *ClientWithResponses) V1GetProjectsUsingArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1GetProjectsUsingAreaResponse, error) { + rsp, err := c.V1GetProjectsUsingAreaRaw(ctx, organizationID, areaID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1GetProjectsUsingAreaResponse(rsp) +} + +// V1ListRoutesOfArea request returning *V1ListRoutesOfAreaResponse +func (c *ClientWithResponses) V1ListRoutesOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, reqEditors ...RequestEditorFn) (*V1ListRoutesOfAreaResponse, error) { + rsp, err := c.V1ListRoutesOfAreaRaw(ctx, organizationID, areaID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1ListRoutesOfAreaResponse(rsp) +} + +// V1AddRoutesToAreaWithBody request with arbitrary body returning *V1AddRoutesToAreaResponse +func (c *ClientWithResponses) V1AddRoutesToAreaWithBody(ctx context.Context, organizationID V1UUID, areaID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1AddRoutesToAreaResponse, error) { + rsp, err := c.V1AddRoutesToAreaRawWithBody(ctx, organizationID, areaID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1AddRoutesToAreaResponse(rsp) +} + +func (c *ClientWithResponses) V1AddRoutesToArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, body V1AddRoutesToAreaJSONRequestBody, reqEditors ...RequestEditorFn) (*V1AddRoutesToAreaResponse, error) { + rsp, err := c.V1AddRoutesToAreaRaw(ctx, organizationID, areaID, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1AddRoutesToAreaResponse(rsp) +} + +// V1DeleteRouteFromArea request returning *V1DeleteRouteFromAreaResponse +func (c *ClientWithResponses) V1DeleteRouteFromArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteRouteFromAreaResponse, error) { + rsp, err := c.V1DeleteRouteFromAreaRaw(ctx, organizationID, areaID, routeID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1DeleteRouteFromAreaResponse(rsp) +} + +// V1GetRouteOfArea request returning *V1GetRouteOfAreaResponse +func (c *ClientWithResponses) V1GetRouteOfArea(ctx context.Context, organizationID V1UUID, areaID V1UUID, routeID V1UUID, reqEditors ...RequestEditorFn) (*V1GetRouteOfAreaResponse, error) { + rsp, err := c.V1GetRouteOfAreaRaw(ctx, organizationID, areaID, routeID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1GetRouteOfAreaResponse(rsp) +} + +// ParseV1ListAreasResponse parses an HTTP response from a V1ListAreas call +func (c *ClientWithResponses) ParseV1ListAreasResponse(rsp *http.Response) (*V1ListAreasResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1ListAreasResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkAreaListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1CreateAreaResponse parses an HTTP response from a V1CreateArea call +func (c *ClientWithResponses) ParseV1CreateAreaResponse(rsp *http.Response) (*V1CreateAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1CreateAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkArea + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1DeleteAreaResponse parses an HTTP response from a V1DeleteArea call +func (c *ClientWithResponses) ParseV1DeleteAreaResponse(rsp *http.Response) (*V1DeleteAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1DeleteAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1GetAreaResponse parses an HTTP response from a V1GetArea call +func (c *ClientWithResponses) ParseV1GetAreaResponse(rsp *http.Response) (*V1GetAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkArea + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1UpdateAreaResponse parses an HTTP response from a V1UpdateArea call +func (c *ClientWithResponses) ParseV1UpdateAreaResponse(rsp *http.Response) (*V1UpdateAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1UpdateAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkArea + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1ListNetworkRangesOfAreaResponse parses an HTTP response from a V1ListNetworkRangesOfArea call +func (c *ClientWithResponses) ParseV1ListNetworkRangesOfAreaResponse(rsp *http.Response) (*V1ListNetworkRangesOfAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1ListNetworkRangesOfAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkRangeListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1AddNetworkRangesToAreaResponse parses an HTTP response from a V1AddNetworkRangesToArea call +func (c *ClientWithResponses) ParseV1AddNetworkRangesToAreaResponse(rsp *http.Response) (*V1AddNetworkRangesToAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1AddNetworkRangesToAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkRangeListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1DeleteNetworkRangeFromAreaResponse parses an HTTP response from a V1DeleteNetworkRangeFromArea call +func (c *ClientWithResponses) ParseV1DeleteNetworkRangeFromAreaResponse(rsp *http.Response) (*V1DeleteNetworkRangeFromAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1DeleteNetworkRangeFromAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1GetNetworkRangeOfAreaResponse parses an HTTP response from a V1GetNetworkRangeOfArea call +func (c *ClientWithResponses) ParseV1GetNetworkRangeOfAreaResponse(rsp *http.Response) (*V1GetNetworkRangeOfAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetNetworkRangeOfAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkRange + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1GetProjectsUsingAreaResponse parses an HTTP response from a V1GetProjectsUsingArea call +func (c *ClientWithResponses) ParseV1GetProjectsUsingAreaResponse(rsp *http.Response) (*V1GetProjectsUsingAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetProjectsUsingAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1ProjectListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1ListRoutesOfAreaResponse parses an HTTP response from a V1ListRoutesOfArea call +func (c *ClientWithResponses) ParseV1ListRoutesOfAreaResponse(rsp *http.Response) (*V1ListRoutesOfAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1ListRoutesOfAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1RouteListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1AddRoutesToAreaResponse parses an HTTP response from a V1AddRoutesToArea call +func (c *ClientWithResponses) ParseV1AddRoutesToAreaResponse(rsp *http.Response) (*V1AddRoutesToAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1AddRoutesToAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest V1RouteListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1DeleteRouteFromAreaResponse parses an HTTP response from a V1DeleteRouteFromArea call +func (c *ClientWithResponses) ParseV1DeleteRouteFromAreaResponse(rsp *http.Response) (*V1DeleteRouteFromAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1DeleteRouteFromAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1GetRouteOfAreaResponse parses an HTTP response from a V1GetRouteOfArea call +func (c *ClientWithResponses) ParseV1GetRouteOfAreaResponse(rsp *http.Response) (*V1GetRouteOfAreaResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetRouteOfAreaResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1Route + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} diff --git a/pkg/services/iaas-api/v1/backups/backups.go b/pkg/services/iaas-api/v1/backups/backups.go new file mode 100644 index 0000000..402995e --- /dev/null +++ b/pkg/services/iaas-api/v1/backups/backups.go @@ -0,0 +1,65 @@ +// Package backups provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package backups + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/flavors/flavors.go b/pkg/services/iaas-api/v1/flavors/flavors.go new file mode 100644 index 0000000..7c14e8a --- /dev/null +++ b/pkg/services/iaas-api/v1/flavors/flavors.go @@ -0,0 +1,65 @@ +// Package flavors provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package flavors + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/iaas.go b/pkg/services/iaas-api/v1/iaas.go new file mode 100644 index 0000000..7c66609 --- /dev/null +++ b/pkg/services/iaas-api/v1/iaas.go @@ -0,0 +1,140 @@ +// Package iaas provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package iaas + +import ( + "net/url" + "strings" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/area" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/backups" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/flavors" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/images" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/keypairs" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/network" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/probes" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/project" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/request" + "github.com/SchwarzIT/community-stackit-go-client/pkg/services/iaas-api/v1/servers" +) + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // list of connected client services + Area *area.Client + Backups *backups.Client + Flavors *flavors.Client + Images *images.Client + Keypairs *keypairs.Client + Network *network.Client + Probes *probes.Client + Project *project.Client + Request *request.Client + Servers *servers.Client + + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// ClientOption allows setting custom parameters during construction +type ClientOption func(*Client) error + +func NewRawClient(server string, opts ...ClientOption) (*Client, error) { + // create a factory client + client := Client{ + Server: server, + } + // mutate client and add all optional params + for _, o := range opts { + if err := o(&client); err != nil { + return nil, err + } + } + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" + } + + client.Area = area.NewRawClient(server, client.Client) + client.Backups = backups.NewRawClient(server, client.Client) + client.Flavors = flavors.NewRawClient(server, client.Client) + client.Images = images.NewRawClient(server, client.Client) + client.Keypairs = keypairs.NewRawClient(server, client.Client) + client.Network = network.NewRawClient(server, client.Client) + client.Probes = probes.NewRawClient(server, client.Client) + client.Project = project.NewRawClient(server, client.Client) + client.Request = request.NewRawClient(server, client.Client) + client.Servers = servers.NewRawClient(server, client.Client) + + return &client, nil +} + +// WithHTTPClient allows overriding the default Doer, which is +// automatically created using http.Client. This is useful for tests. +func WithHTTPClient(doer contracts.BaseClientInterface) ClientOption { + return func(c *Client) error { + c.Client = doer + return nil + } +} + +// WithBaseURL overrides the baseURL. +func WithBaseURL(baseURL string) ClientOption { + return func(c *Client) error { + newBaseURL, err := url.Parse(baseURL) + if err != nil { + return err + } + c.Server = newBaseURL.String() + return nil + } +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + Client *Client + + // list of connected client services + Area *area.ClientWithResponses + Backups *backups.ClientWithResponses + Flavors *flavors.ClientWithResponses + Images *images.ClientWithResponses + Keypairs *keypairs.ClientWithResponses + Network *network.ClientWithResponses + Probes *probes.ClientWithResponses + Project *project.ClientWithResponses + Request *request.ClientWithResponses + Servers *servers.ClientWithResponses +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, opts ...ClientOption) (*ClientWithResponses, error) { + client, err := NewRawClient(server, opts...) + if err != nil { + return nil, err + } + + cwr := &ClientWithResponses{Client: client} + cwr.Area = area.NewClient(server, client.Client) + cwr.Backups = backups.NewClient(server, client.Client) + cwr.Flavors = flavors.NewClient(server, client.Client) + cwr.Images = images.NewClient(server, client.Client) + cwr.Keypairs = keypairs.NewClient(server, client.Client) + cwr.Network = network.NewClient(server, client.Client) + cwr.Probes = probes.NewClient(server, client.Client) + cwr.Project = project.NewClient(server, client.Client) + cwr.Request = request.NewClient(server, client.Client) + cwr.Servers = servers.NewClient(server, client.Client) + + return cwr, nil +} diff --git a/pkg/services/iaas-api/v1/images/images.go b/pkg/services/iaas-api/v1/images/images.go new file mode 100644 index 0000000..d99e61f --- /dev/null +++ b/pkg/services/iaas-api/v1/images/images.go @@ -0,0 +1,65 @@ +// Package images provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package images + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/keypairs/keypairs.go b/pkg/services/iaas-api/v1/keypairs/keypairs.go new file mode 100644 index 0000000..0806126 --- /dev/null +++ b/pkg/services/iaas-api/v1/keypairs/keypairs.go @@ -0,0 +1,65 @@ +// Package keypairs provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package keypairs + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/network/network.go b/pkg/services/iaas-api/v1/network/network.go new file mode 100644 index 0000000..7367748 --- /dev/null +++ b/pkg/services/iaas-api/v1/network/network.go @@ -0,0 +1,1058 @@ +// Package network provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package network + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/pkg/errors" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" + "github.com/SchwarzIT/community-stackit-go-client/pkg/helpers/runtime" + openapiTypes "github.com/SchwarzIT/community-stackit-go-client/pkg/helpers/types" + "github.com/SchwarzIT/community-stackit-go-client/pkg/validate" +) + +// V1CIDR Classless Inter-Domain Routing (CIDR). +type V1CIDR = string + +// V1CreateNetworkAddressFamily The addressFamily object for a network create request. +type V1CreateNetworkAddressFamily struct { + // Ipv4 The config object for a IPv4 network. + Ipv4 *V1CreateNetworkIPv4 `json:"ipv4,omitempty"` + + // Ipv6 The config object for a IPv6 network. + Ipv6 *V1CreateNetworkIPv6 `json:"ipv6,omitempty"` +} + +// V1CreateNetworkIPv4 The config object for a IPv4 network. +type V1CreateNetworkIPv4 struct { + // Nameservers A list containing DNS Servers/Nameservers for IPv4. + Nameservers *V1Nameserver `json:"nameservers,omitempty"` + PrefixLength *int `json:"prefixLength,omitempty"` +} + +// V1CreateNetworkIPv6 The config object for a IPv6 network. +type V1CreateNetworkIPv6 struct { + // Nameservers A list containing DNS Servers/Nameservers for IPv6. + Nameservers *V1Nameserverv6 `json:"nameservers,omitempty"` + PrefixLength *int `json:"prefixLength,omitempty"` +} + +// V1Error Error with HTTP error code and an error message. +type V1Error struct { + Code int `json:"code"` + Msg string `json:"msg"` +} + +// V1GenericName The name for a General Object. Matches Names and also UUIDs. +type V1GenericName = string + +// V1IP Object that represents an IPv4 address. +type V1IP = string + +// V1IPv6 Object that represents an IPv6 address. +type V1IPv6 = string + +// V1Nameserver A list containing DNS Servers/Nameservers for IPv4. +type V1Nameserver = []V1IP + +// V1Nameserverv6 A list containing DNS Servers/Nameservers for IPv6. +type V1Nameserverv6 = []V1IPv6 + +// V1Network Object that represents a network. +type V1Network struct { + Name string `json:"name"` + + // Nameservers A list containing DNS Servers/Nameservers for IPv4. + Nameservers *V1Nameserver `json:"nameservers,omitempty"` + + // NameserversV6 A list containing DNS Servers/Nameservers for IPv6. + NameserversV6 *V1Nameserverv6 `json:"nameserversV6,omitempty"` + + // NetworkId Universally Unique Identifier (UUID). + NetworkID V1UUID `json:"networkId"` + Prefixes *[]V1CIDR `json:"prefixes,omitempty"` + PrefixesV6 *[]V1CIDR `json:"prefixesV6,omitempty"` + + // PublicIp Object that represents an IPv4 address. + PublicIp *V1IP `json:"publicIp,omitempty"` + + // State The state of a resource object. + State V1ResourceState `json:"state"` +} + +// V1NetworkList A list of networks. +type V1NetworkList = []V1Network + +// V1NetworkListResponse Network list response. +type V1NetworkListResponse struct { + // Items A list of networks. + Items V1NetworkList `json:"items"` +} + +// V1ResourceState The state of a resource object. +type V1ResourceState = string + +// V1UUID Universally Unique Identifier (UUID). +type V1UUID = openapiTypes.UUID + +// V1UpdateNetworkAddressFamily The addressFamily object for a network update request. +type V1UpdateNetworkAddressFamily struct { + // Ipv4 The config object for a IPv4 network update. + Ipv4 *V1UpdateNetworkIPv4 `json:"ipv4,omitempty"` + + // Ipv6 The config object for a IPv6 network update. + Ipv6 *V1UpdateNetworkIPv6 `json:"ipv6,omitempty"` +} + +// V1UpdateNetworkIPv4 The config object for a IPv4 network update. +type V1UpdateNetworkIPv4 struct { + // Nameservers A list containing DNS Servers/Nameservers for IPv4. + Nameservers *V1Nameserver `json:"nameservers,omitempty"` +} + +// V1UpdateNetworkIPv6 The config object for a IPv6 network update. +type V1UpdateNetworkIPv6 struct { + // Nameservers A list containing DNS Servers/Nameservers for IPv6. + Nameservers *V1Nameserverv6 `json:"nameservers,omitempty"` +} + +// BadRequest Error with HTTP error code and an error message. +type BadRequest = V1Error + +// Forbidden Error with HTTP error code and an error message. +type Forbidden = V1Error + +// InternalServerError Error with HTTP error code and an error message. +type InternalServerError = V1Error + +// NotFound Error with HTTP error code and an error message. +type NotFound = V1Error + +// Unauthorized Error with HTTP error code and an error message. +type Unauthorized = V1Error + +// V1CreateNetworkJSONBody defines parameters for V1CreateNetwork. +type V1CreateNetworkJSONBody struct { + // AddressFamily The addressFamily object for a network create request. + AddressFamily *V1CreateNetworkAddressFamily `json:"addressFamily,omitempty"` + + // Name The name for a General Object. Matches Names and also UUIDs. + Name V1GenericName `json:"name"` +} + +// V1UpdateNetworkJSONBody defines parameters for V1UpdateNetwork. +type V1UpdateNetworkJSONBody struct { + // AddressFamily The addressFamily object for a network update request. + AddressFamily *V1UpdateNetworkAddressFamily `json:"addressFamily,omitempty"` + + // Name The name for a General Object. Matches Names and also UUIDs. + Name *V1GenericName `json:"name,omitempty"` +} + +// V1CreateNetworkJSONRequestBody defines body for V1CreateNetwork for application/json ContentType. +type V1CreateNetworkJSONRequestBody V1CreateNetworkJSONBody + +// V1UpdateNetworkJSONRequestBody defines body for V1UpdateNetwork for application/json ContentType. +type V1UpdateNetworkJSONRequestBody V1UpdateNetworkJSONBody + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { + // V1ListNetworksInProject request + V1ListNetworksInProjectRaw(ctx context.Context, projectID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1CreateNetwork request with any body + V1CreateNetworkRawWithBody(ctx context.Context, projectID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1CreateNetworkRaw(ctx context.Context, projectID V1UUID, body V1CreateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1DeleteNetwork request + V1DeleteNetworkRaw(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1GetNetwork request + V1GetNetworkRaw(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1UpdateNetwork request with any body + V1UpdateNetworkRawWithBody(ctx context.Context, projectID V1UUID, networkID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1UpdateNetworkRaw(ctx context.Context, projectID V1UUID, networkID V1UUID, body V1UpdateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) +} + +func (c *Client) V1ListNetworksInProjectRaw(ctx context.Context, projectID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ListNetworksInProjectRequest(ctx, c.Server, projectID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateNetworkRawWithBody(ctx context.Context, projectID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateNetworkRequestWithBody(ctx, c.Server, projectID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CreateNetworkRaw(ctx context.Context, projectID V1UUID, body V1CreateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CreateNetworkRequest(ctx, c.Server, projectID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1DeleteNetworkRaw(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1DeleteNetworkRequest(ctx, c.Server, projectID, networkID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1GetNetworkRaw(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1GetNetworkRequest(ctx, c.Server, projectID, networkID) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1UpdateNetworkRawWithBody(ctx context.Context, projectID V1UUID, networkID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateNetworkRequestWithBody(ctx, c.Server, projectID, networkID, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1UpdateNetworkRaw(ctx context.Context, projectID V1UUID, networkID V1UUID, body V1UpdateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1UpdateNetworkRequest(ctx, c.Server, projectID, networkID, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// NewV1ListNetworksInProjectRequest generates requests for V1ListNetworksInProject +func NewV1ListNetworksInProjectRequest(ctx context.Context, server string, projectID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/networks", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1CreateNetworkRequest calls the generic V1CreateNetwork builder with application/json body +func NewV1CreateNetworkRequest(ctx context.Context, server string, projectID V1UUID, body V1CreateNetworkJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1CreateNetworkRequestWithBody(ctx, server, projectID, "application/json", bodyReader) +} + +// NewV1CreateNetworkRequestWithBody generates requests for V1CreateNetwork with any type of body +func NewV1CreateNetworkRequestWithBody(ctx context.Context, server string, projectID V1UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/networks", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1DeleteNetworkRequest generates requests for V1DeleteNetwork +func NewV1DeleteNetworkRequest(ctx context.Context, server string, projectID V1UUID, networkID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "networkID", runtime.ParamLocationPath, networkID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/networks/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1GetNetworkRequest generates requests for V1GetNetwork +func NewV1GetNetworkRequest(ctx context.Context, server string, projectID V1UUID, networkID V1UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "networkID", runtime.ParamLocationPath, networkID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/networks/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1UpdateNetworkRequest calls the generic V1UpdateNetwork builder with application/json body +func NewV1UpdateNetworkRequest(ctx context.Context, server string, projectID V1UUID, networkID V1UUID, body V1UpdateNetworkJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1UpdateNetworkRequestWithBody(ctx, server, projectID, networkID, "application/json", bodyReader) +} + +// NewV1UpdateNetworkRequestWithBody generates requests for V1UpdateNetwork with any type of body +func NewV1UpdateNetworkRequestWithBody(ctx context.Context, server string, projectID V1UUID, networkID V1UUID, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "projectID", runtime.ParamLocationPath, projectID) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "networkID", runtime.ParamLocationPath, networkID) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/networks/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "PATCH", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { + // V1ListNetworksInProject request + V1ListNetworksInProject(ctx context.Context, projectID V1UUID, reqEditors ...RequestEditorFn) (*V1ListNetworksInProjectResponse, error) + + // V1CreateNetwork request with any body + V1CreateNetworkWithBody(ctx context.Context, projectID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateNetworkResponse, error) + + V1CreateNetwork(ctx context.Context, projectID V1UUID, body V1CreateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateNetworkResponse, error) + + // V1DeleteNetwork request + V1DeleteNetwork(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteNetworkResponse, error) + + // V1GetNetwork request + V1GetNetwork(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*V1GetNetworkResponse, error) + + // V1UpdateNetwork request with any body + V1UpdateNetworkWithBody(ctx context.Context, projectID V1UUID, networkID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateNetworkResponse, error) + + V1UpdateNetwork(ctx context.Context, projectID V1UUID, networkID V1UUID, body V1UpdateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateNetworkResponse, error) +} + +type V1ListNetworksInProjectResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1NetworkListResponse + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1ListNetworksInProjectResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ListNetworksInProjectResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1CreateNetworkResponse struct { + Body []byte + HTTPResponse *http.Response + JSON202 *V1Network + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON409 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1CreateNetworkResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1CreateNetworkResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1DeleteNetworkResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON409 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1DeleteNetworkResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1DeleteNetworkResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1GetNetworkResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1Network + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1GetNetworkResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1GetNetworkResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1UpdateNetworkResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *V1Error + JSON401 *V1Error + JSON403 *V1Error + JSON404 *V1Error + JSON500 *V1Error +} + +// Status returns HTTPResponse.Status +func (r V1UpdateNetworkResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1UpdateNetworkResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// V1ListNetworksInProject request returning *V1ListNetworksInProjectResponse +func (c *ClientWithResponses) V1ListNetworksInProject(ctx context.Context, projectID V1UUID, reqEditors ...RequestEditorFn) (*V1ListNetworksInProjectResponse, error) { + rsp, err := c.V1ListNetworksInProjectRaw(ctx, projectID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1ListNetworksInProjectResponse(rsp) +} + +// V1CreateNetworkWithBody request with arbitrary body returning *V1CreateNetworkResponse +func (c *ClientWithResponses) V1CreateNetworkWithBody(ctx context.Context, projectID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1CreateNetworkResponse, error) { + rsp, err := c.V1CreateNetworkRawWithBody(ctx, projectID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1CreateNetworkResponse(rsp) +} + +func (c *ClientWithResponses) V1CreateNetwork(ctx context.Context, projectID V1UUID, body V1CreateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*V1CreateNetworkResponse, error) { + rsp, err := c.V1CreateNetworkRaw(ctx, projectID, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1CreateNetworkResponse(rsp) +} + +// V1DeleteNetwork request returning *V1DeleteNetworkResponse +func (c *ClientWithResponses) V1DeleteNetwork(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*V1DeleteNetworkResponse, error) { + rsp, err := c.V1DeleteNetworkRaw(ctx, projectID, networkID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1DeleteNetworkResponse(rsp) +} + +// V1GetNetwork request returning *V1GetNetworkResponse +func (c *ClientWithResponses) V1GetNetwork(ctx context.Context, projectID V1UUID, networkID V1UUID, reqEditors ...RequestEditorFn) (*V1GetNetworkResponse, error) { + rsp, err := c.V1GetNetworkRaw(ctx, projectID, networkID, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1GetNetworkResponse(rsp) +} + +// V1UpdateNetworkWithBody request with arbitrary body returning *V1UpdateNetworkResponse +func (c *ClientWithResponses) V1UpdateNetworkWithBody(ctx context.Context, projectID V1UUID, networkID V1UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1UpdateNetworkResponse, error) { + rsp, err := c.V1UpdateNetworkRawWithBody(ctx, projectID, networkID, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1UpdateNetworkResponse(rsp) +} + +func (c *ClientWithResponses) V1UpdateNetwork(ctx context.Context, projectID V1UUID, networkID V1UUID, body V1UpdateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateNetworkResponse, error) { + rsp, err := c.V1UpdateNetworkRaw(ctx, projectID, networkID, body, reqEditors...) + if err != nil { + return nil, err + } + return c.ParseV1UpdateNetworkResponse(rsp) +} + +// ParseV1ListNetworksInProjectResponse parses an HTTP response from a V1ListNetworksInProject call +func (c *ClientWithResponses) ParseV1ListNetworksInProjectResponse(rsp *http.Response) (*V1ListNetworksInProjectResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1ListNetworksInProjectResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1NetworkListResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1CreateNetworkResponse parses an HTTP response from a V1CreateNetwork call +func (c *ClientWithResponses) ParseV1CreateNetworkResponse(rsp *http.Response) (*V1CreateNetworkResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1CreateNetworkResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest V1Network + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1DeleteNetworkResponse parses an HTTP response from a V1DeleteNetwork call +func (c *ClientWithResponses) ParseV1DeleteNetworkResponse(rsp *http.Response) (*V1DeleteNetworkResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1DeleteNetworkResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1GetNetworkResponse parses an HTTP response from a V1GetNetwork call +func (c *ClientWithResponses) ParseV1GetNetworkResponse(rsp *http.Response) (*V1GetNetworkResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1GetNetworkResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1Network + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} + +// ParseV1UpdateNetworkResponse parses an HTTP response from a V1UpdateNetwork call +func (c *ClientWithResponses) ParseV1UpdateNetworkResponse(rsp *http.Response) (*V1UpdateNetworkResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1UpdateNetworkResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest V1Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, errors.Wrap(err, fmt.Sprintf("body was: %s", string(bodyBytes))) + } + response.JSON500 = &dest + + } + + return response, validate.ResponseObject(response) +} diff --git a/pkg/services/iaas-api/v1/probes/probes.go b/pkg/services/iaas-api/v1/probes/probes.go new file mode 100644 index 0000000..8a3595f --- /dev/null +++ b/pkg/services/iaas-api/v1/probes/probes.go @@ -0,0 +1,65 @@ +// Package probes provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package probes + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/project/project.go b/pkg/services/iaas-api/v1/project/project.go new file mode 100644 index 0000000..a9cdd16 --- /dev/null +++ b/pkg/services/iaas-api/v1/project/project.go @@ -0,0 +1,65 @@ +// Package project provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package project + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/request/request.go b/pkg/services/iaas-api/v1/request/request.go new file mode 100644 index 0000000..c05a0a9 --- /dev/null +++ b/pkg/services/iaas-api/v1/request/request.go @@ -0,0 +1,65 @@ +// Package request provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package request + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/servers/servers.go b/pkg/services/iaas-api/v1/servers/servers.go new file mode 100644 index 0000000..230202f --- /dev/null +++ b/pkg/services/iaas-api/v1/servers/servers.go @@ -0,0 +1,65 @@ +// Package servers provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/do87/stackit-client-generator version v0.0.2 DO NOT EDIT. +package servers + +import ( + "context" + "net/http" + + contracts "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client contracts.BaseClientInterface +} + +// NewRawClient Creates a new Client, with reasonable defaults +func NewRawClient(server string, httpClient contracts.BaseClientInterface) *Client { + // create a client with sane default values + client := Client{ + Server: server, + Client: httpClient, + } + return &client +} + +// The interface specification for the client above. +type rawClientInterface interface { +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on rawClientInterface to offer response payloads +type ClientWithResponses struct { + rawClientInterface +} + +// NewClient creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClient(server string, httpClient contracts.BaseClientInterface) *ClientWithResponses { + return &ClientWithResponses{NewRawClient(server, httpClient)} +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { +} diff --git a/pkg/services/iaas-api/v1/service.go b/pkg/services/iaas-api/v1/service.go new file mode 100644 index 0000000..b8429ed --- /dev/null +++ b/pkg/services/iaas-api/v1/service.go @@ -0,0 +1,16 @@ +package iaas + +import ( + "github.com/SchwarzIT/community-stackit-go-client/pkg/baseurl" + "github.com/SchwarzIT/community-stackit-go-client/pkg/contracts" +) + +var BaseURLs = baseurl.New( + "iaas", + "https://iaas.api.eu01.stackit.cloud/", +) + +func NewService(c contracts.BaseClientInterface) *ClientWithResponses { + nc, _ := NewClient(BaseURLs.Get(), WithHTTPClient(c)) + return nc +}