From f162c8c27451c11a82657275c41d5a23249436de Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Fri, 27 Dec 2024 10:12:36 +0100 Subject: [PATCH] feat: implement ips submodule --- ips/.gitignore | 24 + ips/.openapi-generator-ignore | 23 + ips/.openapi-generator/FILES | 49 + ips/.openapi-generator/VERSION | 1 + ips/.travis.yml | 8 + ips/README.md | 170 ++ ips/api/openapi.yaml | 1768 ++++++++++++++ ips/api_ips.go | 2067 +++++++++++++++++ ips/client.go | 657 ++++++ ips/configuration.go | 221 ++ ips/docs/AssignedContract.md | 51 + ips/docs/ErrorResult.md | 134 ++ ips/docs/GetIPListResult.md | 72 + ips/docs/GetNullRouteHistoryListResult.md | 72 + ips/docs/GetReverseLookupRecordListResult.md | 72 + ips/docs/Ip.md | 312 +++ ips/docs/IpType.md | 23 + ips/docs/IpsAPI.md | 757 ++++++ ips/docs/Metadata.md | 93 + ips/docs/NullRouteIPOpts.md | 108 + ips/docs/NullRoutedIP.md | 342 +++ ips/docs/ProtocolVersion.md | 13 + ips/docs/ReverseLookup.md | 82 + ips/docs/Subnet.md | 114 + ips/docs/UpdateIPOpts.md | 51 + ips/docs/UpdateNullRouteOpts.md | 108 + ips/docs/UpdateReverseLookupRecordsOpts.md | 51 + ips/docs/UpdateReverseLookupRecordsResult.md | 51 + ips/git_push.sh | 57 + ips/go.mod | 6 + ips/go.sum | 11 + ips/model__metadata.go | 233 ++ ips/model_assigned_contract.go | 169 ++ ips/model_error_result.go | 269 +++ ips/model_get_ip_list_result.go | 197 ++ ...odel_get_null_route_history_list_result.go | 197 ++ ...l_get_reverse_lookup_record_list_result.go | 197 ++ ips/model_ip.go | 509 ++++ ips/model_ip_type.go | 121 + ips/model_null_route_ip_opts.go | 233 ++ ips/model_null_routed_ip.go | 513 ++++ ips/model_protocol_version.go | 111 + ips/model_reverse_lookup.go | 201 ++ ips/model_subnet.go | 261 +++ ips/model_update_ip_opts.go | 168 ++ ips/model_update_null_route_opts.go | 233 ++ ...odel_update_reverse_lookup_records_opts.go | 168 ++ ...el_update_reverse_lookup_records_result.go | 168 ++ ips/response.go | 47 + ips/test/api_ips_test.go | 160 ++ ips/utils.go | 361 +++ main.go | 1 + 52 files changed, 12085 insertions(+) create mode 100644 ips/.gitignore create mode 100644 ips/.openapi-generator-ignore create mode 100644 ips/.openapi-generator/FILES create mode 100644 ips/.openapi-generator/VERSION create mode 100644 ips/.travis.yml create mode 100644 ips/README.md create mode 100644 ips/api/openapi.yaml create mode 100644 ips/api_ips.go create mode 100644 ips/client.go create mode 100644 ips/configuration.go create mode 100644 ips/docs/AssignedContract.md create mode 100644 ips/docs/ErrorResult.md create mode 100644 ips/docs/GetIPListResult.md create mode 100644 ips/docs/GetNullRouteHistoryListResult.md create mode 100644 ips/docs/GetReverseLookupRecordListResult.md create mode 100644 ips/docs/Ip.md create mode 100644 ips/docs/IpType.md create mode 100644 ips/docs/IpsAPI.md create mode 100644 ips/docs/Metadata.md create mode 100644 ips/docs/NullRouteIPOpts.md create mode 100644 ips/docs/NullRoutedIP.md create mode 100644 ips/docs/ProtocolVersion.md create mode 100644 ips/docs/ReverseLookup.md create mode 100644 ips/docs/Subnet.md create mode 100644 ips/docs/UpdateIPOpts.md create mode 100644 ips/docs/UpdateNullRouteOpts.md create mode 100644 ips/docs/UpdateReverseLookupRecordsOpts.md create mode 100644 ips/docs/UpdateReverseLookupRecordsResult.md create mode 100644 ips/git_push.sh create mode 100644 ips/go.mod create mode 100644 ips/go.sum create mode 100644 ips/model__metadata.go create mode 100644 ips/model_assigned_contract.go create mode 100644 ips/model_error_result.go create mode 100644 ips/model_get_ip_list_result.go create mode 100644 ips/model_get_null_route_history_list_result.go create mode 100644 ips/model_get_reverse_lookup_record_list_result.go create mode 100644 ips/model_ip.go create mode 100644 ips/model_ip_type.go create mode 100644 ips/model_null_route_ip_opts.go create mode 100644 ips/model_null_routed_ip.go create mode 100644 ips/model_protocol_version.go create mode 100644 ips/model_reverse_lookup.go create mode 100644 ips/model_subnet.go create mode 100644 ips/model_update_ip_opts.go create mode 100644 ips/model_update_null_route_opts.go create mode 100644 ips/model_update_reverse_lookup_records_opts.go create mode 100644 ips/model_update_reverse_lookup_records_result.go create mode 100644 ips/response.go create mode 100644 ips/test/api_ips_test.go create mode 100644 ips/utils.go diff --git a/ips/.gitignore b/ips/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/ips/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/ips/.openapi-generator-ignore b/ips/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/ips/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/ips/.openapi-generator/FILES b/ips/.openapi-generator/FILES new file mode 100644 index 0000000..fdfaa07 --- /dev/null +++ b/ips/.openapi-generator/FILES @@ -0,0 +1,49 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +api_ips.go +client.go +configuration.go +docs/AssignedContract.md +docs/ErrorResult.md +docs/GetIPListResult.md +docs/GetNullRouteHistoryListResult.md +docs/GetReverseLookupRecordListResult.md +docs/Ip.md +docs/IpType.md +docs/IpsAPI.md +docs/Metadata.md +docs/NullRouteIPOpts.md +docs/NullRoutedIP.md +docs/ProtocolVersion.md +docs/ReverseLookup.md +docs/Subnet.md +docs/UpdateIPOpts.md +docs/UpdateNullRouteOpts.md +docs/UpdateReverseLookupRecordsOpts.md +docs/UpdateReverseLookupRecordsResult.md +git_push.sh +go.mod +go.sum +model__metadata.go +model_assigned_contract.go +model_error_result.go +model_get_ip_list_result.go +model_get_null_route_history_list_result.go +model_get_reverse_lookup_record_list_result.go +model_ip.go +model_ip_type.go +model_null_route_ip_opts.go +model_null_routed_ip.go +model_protocol_version.go +model_reverse_lookup.go +model_subnet.go +model_update_ip_opts.go +model_update_null_route_opts.go +model_update_reverse_lookup_records_opts.go +model_update_reverse_lookup_records_result.go +response.go +test/api_ips_test.go +utils.go diff --git a/ips/.openapi-generator/VERSION b/ips/.openapi-generator/VERSION new file mode 100644 index 0000000..758bb9c --- /dev/null +++ b/ips/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.10.0 diff --git a/ips/.travis.yml b/ips/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/ips/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/ips/README.md b/ips/README.md new file mode 100644 index 0000000..c16d653 --- /dev/null +++ b/ips/README.md @@ -0,0 +1,170 @@ +# Go API client for ips + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: v2 +- Package version: 1.0.0 +- Generator version: 7.10.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```sh +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```go +import ips "github.com/leaseweb/leaseweb-go-sdk/ips" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```go +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `ips.ContextServerIndex` of type `int`. + +```go +ctx := context.WithValue(context.Background(), ips.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `ips.ContextServerVariables` of type `map[string]string`. + +```go +ctx := context.WithValue(context.Background(), ips.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `ips.ContextOperationServerIndices` and `ips.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), ips.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), ips.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.leaseweb.com/ipMgmt/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*IpsAPI* | [**GetIP**](docs/IpsAPI.md#getip) | **Get** /ips/{ip} | Inspect an IP +*IpsAPI* | [**GetIPList**](docs/IpsAPI.md#getiplist) | **Get** /ips | List IPs +*IpsAPI* | [**GetNullRouteHistory**](docs/IpsAPI.md#getnullroutehistory) | **Get** /nullRoutes/{id} | Inspect null route history +*IpsAPI* | [**GetNullRouteHistoryList**](docs/IpsAPI.md#getnullroutehistorylist) | **Get** /nullRoutes | Inspect null route history +*IpsAPI* | [**GetReverseLookupRecordList**](docs/IpsAPI.md#getreverselookuprecordlist) | **Get** /ips/{ip}/reverseLookup | List reverse lookup records for an IPv6 range +*IpsAPI* | [**NullRouteIP**](docs/IpsAPI.md#nullrouteip) | **Post** /ips/{ip}/nullRoute | Null route an IP +*IpsAPI* | [**RemoveIPNullRoute**](docs/IpsAPI.md#removeipnullroute) | **Delete** /ips/{ip}/nullRoute | Remove a null route +*IpsAPI* | [**UpdateIP**](docs/IpsAPI.md#updateip) | **Put** /ips/{ip} | Update an IP +*IpsAPI* | [**UpdateNullRoute**](docs/IpsAPI.md#updatenullroute) | **Put** /nullRoutes/{id} | Update a null route +*IpsAPI* | [**UpdateReverseLookupRecords**](docs/IpsAPI.md#updatereverselookuprecords) | **Put** /ips/{ip}/reverseLookup | Set or remove reverse lookup records for an IPv6 range + + +## Documentation For Models + + - [AssignedContract](docs/AssignedContract.md) + - [ErrorResult](docs/ErrorResult.md) + - [GetIPListResult](docs/GetIPListResult.md) + - [GetNullRouteHistoryListResult](docs/GetNullRouteHistoryListResult.md) + - [GetReverseLookupRecordListResult](docs/GetReverseLookupRecordListResult.md) + - [Ip](docs/Ip.md) + - [IpType](docs/IpType.md) + - [Metadata](docs/Metadata.md) + - [NullRouteIPOpts](docs/NullRouteIPOpts.md) + - [NullRoutedIP](docs/NullRoutedIP.md) + - [ProtocolVersion](docs/ProtocolVersion.md) + - [ReverseLookup](docs/ReverseLookup.md) + - [Subnet](docs/Subnet.md) + - [UpdateIPOpts](docs/UpdateIPOpts.md) + - [UpdateNullRouteOpts](docs/UpdateNullRouteOpts.md) + - [UpdateReverseLookupRecordsOpts](docs/UpdateReverseLookupRecordsOpts.md) + - [UpdateReverseLookupRecordsResult](docs/UpdateReverseLookupRecordsResult.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### BearerAuth + +- **Type**: HTTP Bearer token authentication + +Example + +```go +auth := context.WithValue(context.Background(), ips.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + +### X-LSW-Auth + +- **Type**: API key +- **API key parameter name**: X-LSW-Auth +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: X-LSW-Auth and passed in as the auth context for each request. + +Example + +```go +auth := context.WithValue( + context.Background(), + ips.ContextAPIKeys, + map[string]ips.APIKey{ + "X-LSW-Auth": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/ips/api/openapi.yaml b/ips/api/openapi.yaml new file mode 100644 index 0000000..0b5423a --- /dev/null +++ b/ips/api/openapi.yaml @@ -0,0 +1,1768 @@ +openapi: 3.0.0 +info: + contact: {} + description: "> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/**" + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: LeaseWeb API for IP address management + version: v2 + x-logo: + altText: Leaseweb developer documentation + backgroundColor: '#5484c6' + href: https://developer.leaseweb.com + url: https://developer.leaseweb.com/images/logo.png +servers: +- url: https://api.leaseweb.com/ipMgmt/v2 +security: +- X-LSW-Auth: [] +tags: +- description: | + The API uses standard HTTP status codes to indicate the success or failure of the API call. The response will be JSON. Most APIs use the following format: + + ```json + { + "errorCode": "APP00800", + "errorMessage": "The connection with the DB cannot be established.", + "correlationId": "550e8400-e29b-41d4-a716-446655440000", + "userMessage": "Cannot handle your request at the moment. Please try again later.", + "reference": "https://developer.leaseweb.com/errors/APP00800" + } + ``` + name: Errors + x-traitTag: true +- description: | + Authentication for the APIs is required. To authenticate your call, you will need to sent your API key as `X-LSW-Auth` header. + + You can generate API keys in the [Customer Portal](https://secure.leaseweb.com/api-client-management/). + name: API Key Authentication + x-traitTag: true +paths: + /ips: + get: + operationId: getIPList + parameters: + - description: Limit the number of results returned. + example: 20 + explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - description: Return results starting from the given offset. + example: 10 + explode: true + in: query + name: offset + required: false + schema: + type: integer + style: form + - description: Filter by subnet + explode: true + in: query + name: subnetId + required: false + schema: + type: string + style: form + - description: Filter by protocol version + explode: true + in: query + name: version + required: false + schema: + $ref: '#/components/schemas/protocolVersion' + style: form + - description: Filter by IP type + explode: true + in: query + name: type + required: false + schema: + $ref: '#/components/schemas/ipType' + style: form + - description: Filter by whether or not the IP has an active null route (true + or false) + explode: true + in: query + name: nullRouted + required: false + schema: + type: boolean + style: form + - description: Filter by whether or not the IP is primary (true or false) + explode: true + in: query + name: primary + required: false + schema: + type: boolean + style: form + - description: Return only IPs greater or equal to the specified address + explode: true + in: query + name: fromIp + required: false + schema: + type: string + style: form + - description: Return only IPs lower or equal to the specified address + explode: true + in: query + name: toIp + required: false + schema: + type: string + style: form + - description: Return only IPs specified as a comma-separated list + explode: true + in: query + name: ips + required: false + schema: + type: string + style: form + - description: Return only IPs assigned to equipment items specified as a comma-separated + list of IDs + explode: true + in: query + name: equipmentIds + required: false + schema: + type: string + style: form + - description: Return only IPs assigned to contracts specified as a comma-separated + list of IDs + explode: true + in: query + name: assignedContractIds + required: false + schema: + type: string + style: form + - description: "Comma-separated list of sort field names. Prepend the field\ + \ name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable\ + \ field names are ip, nullRouted, reverseLookup." + explode: true + in: query + name: sort + required: false + schema: + type: string + style: form + - description: Filter by reverse lookup. + example: mydomain1.example.com + explode: true + in: query + name: reverseLookup + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + example: + _metadata: + totalCount: 2 + offset: 0 + limit: 50 + ips: + - ip: 192.0.2.1 + version: 4 + type: NORMAL_IP + prefixLength: 32 + primary: true + reverseLookup: mydomain1.example.com + nullRouted: false + nullLevel: null + unnullingAllowed: false + equipmentId: "1234" + assignedContract: + id: "5643634" + subnet: + id: 192.0.2.0_24 + networkIp: 192.0.2.0 + prefixLength: 24 + gateway: 192.0.2.254 + - ip: 192.0.2.2 + version: 4 + type: NORMAL_IP + prefixLength: 32 + primary: false + reverseLookup: mydomain2.example.com + nullRouted: false + nullLevel: null + unnullingAllowed: false + equipmentId: "1235" + assignedContract: + id: "4363465" + subnet: + id: 192.0.2.0_24 + networkIp: 192.0.2.0 + prefixLength: 24 + gateway: 192.0.2.254 + schema: + $ref: '#/components/schemas/getIPListResult' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: List IPs + tags: + - ips + /ips/{ip}: + get: + operationId: getIP + parameters: + - description: "IP address or IP address with prefixLength {ip}_{prefix}. If\ + \ prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6).\ + \ PrefixLength is mandatory for IP range, for example, the IPv6 address\ + \ range with prefixLength = 112" + example: 192.0.2.1 + explode: false + in: path + name: ip + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + example: + ip: 192.0.2.1 + version: 4 + type: NORMAL_IP + prefixLength: 32 + primary: true + reverseLookup: mydomain1.example.com + nullRouted: false + nullLevel: null + unnullingAllowed: false + equipmentId: "1234" + assignedContract: + id: "5643634" + subnet: + id: 192.0.2.0_24 + networkIp: 192.0.2.0 + prefixLength: 24 + gateway: 192.0.2.254 + schema: + $ref: '#/components/schemas/ip' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Inspect an IP + tags: + - ips + put: + description: Use this operation to set reverse lookup for IPv4 IP addresses. + operationId: updateIP + parameters: + - description: "IP address or IP address with prefixLength {ip}_{prefix}. If\ + \ prefixLength is not given, then we assume 32" + explode: false + in: path + name: ip + required: true + schema: + format: ipv4 + type: string + style: simple + requestBody: + content: + application/json: + example: + reverseLookup: mydomain1.example.com + schema: + $ref: '#/components/schemas/updateIPOpts' + responses: + "200": + content: + application/json: + example: + ip: 192.0.2.1 + version: 4 + type: NORMAL_IP + prefixLength: 32 + primary: true + reverseLookup: mydomain1.example.com + nullRouted: false + nullLevel: null + unnullingAllowed: false + equipmentId: "1234" + assignedContract: + id: "5643634" + subnet: + id: 192.0.2.0_24 + networkIp: 192.0.2.0 + prefixLength: 24 + gateway: 192.0.2.254 + schema: + $ref: '#/components/schemas/ip' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Update an IP + tags: + - ips + /ips/{ip}/reverseLookup: + get: + description: Get reverse lookup values set for IPs in the specified range + operationId: getReverseLookupRecordList + parameters: + - description: "IP address or IP address with prefixLength {ip}_{prefix}. If\ + \ prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6).\ + \ PrefixLength is mandatory for IP range, for example, the IPv6 address\ + \ range with prefixLength = 112" + example: 192.0.2.1 + explode: false + in: path + name: ip + required: true + schema: + type: string + style: simple + - description: Filter by reverse lookup. + example: mydomain1.example.com + explode: true + in: query + name: reverseLookup + required: false + schema: + type: string + style: form + - description: Limit the number of results returned. + example: 20 + explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - description: Return results starting from the given offset. + example: 10 + explode: true + in: query + name: offset + required: false + schema: + type: integer + style: form + responses: + "200": + content: + application/json: + example: + _metadata: + totalCount: 3 + offset: 0 + limit: 2 + reverseLookups: + - ip: 2001:db8::0 + reverseLookup: name1.example.com + - ip: 2001:db8::1 + reverseLookup: name2.example.com + schema: + $ref: '#/components/schemas/getReverseLookupRecordListResult' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: List reverse lookup records for an IPv6 range + tags: + - ips + put: + description: | + This endpoint allows to set or unset reverse lookup for multiple IPv6 IPs in a specific IP range. To remove reverse lookup for an IP address set it to `null` or `""`. + Reverse lookup values of IPs not listed in the request body will not be affected. + You can set up to 20 records in a single request. + operationId: updateReverseLookupRecords + parameters: + - description: "IP address or IP address with prefixLength {ip}_{prefix}. If\ + \ prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6).\ + \ PrefixLength is mandatory for IP range, for example, the IPv6 address\ + \ range with prefixLength = 112" + example: 192.0.2.1 + explode: false + in: path + name: ip + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + example: + reverseLookups: + - ip: 2001:db8::0 + reverseLookup: name1.example.com + - ip: 2001:db8::1 + reverseLookup: name2.example.com + schema: + $ref: '#/components/schemas/updateReverseLookupRecordsOpts' + responses: + "200": + content: + application/json: + example: + reverseLookups: + - ip: 2001:db8::0 + reverseLookup: name1.example.com + - ip: 2001:db8::1 + reverseLookup: name2.example.com + schema: + $ref: '#/components/schemas/updateReverseLookupRecordsResult' + description: The request has been processed. + "400": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "400" + errorDetails: {} + errorMessage: The API could not interpret your request correctly. + schema: + $ref: '#/components/schemas/errorResult' + description: Bad Request. + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Set or remove reverse lookup records for an IPv6 range + tags: + - ips + /ips/{ip}/nullRoute: + delete: + operationId: removeIPNullRoute + parameters: + - description: "IP address or IP address with prefixLength {ip}_{prefix}. If\ + \ prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6).\ + \ PrefixLength is mandatory for IP range, for example, the IPv6 address\ + \ range with prefixLength = 112" + example: 192.0.2.1 + explode: false + in: path + name: ip + required: true + schema: + type: string + style: simple + responses: + "200": + content: {} + description: Null-route successfully deleted + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Remove a null route + tags: + - ips + post: + operationId: nullRouteIP + parameters: + - description: "IP address or IP address with prefixLength {ip}_{prefix}. If\ + \ prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6).\ + \ PrefixLength is mandatory for IP range, for example, the IPv6 address\ + \ range with prefixLength = 112" + example: 192.0.2.1 + explode: false + in: path + name: ip + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + example: + automatedUnnullingAt: 2015-06-25T11:13:00Z + comment: This IP is evil + ticketId: "188612" + schema: + $ref: '#/components/schemas/nullRouteIPOpts' + description: "" + responses: + "201": + content: + application/json: + example: + assignedContract: + id: "123456" + automatedUnnullingAt: 2015-06-25T11:13:00Z + comment: This IP is evil + equipmentId: "456" + id: "4534536" + ip: 192.0.2.1 + nullLevel: 1 + nulledAt: 2015-06-28T12:00:00Z + nulledBy: john.doe@example.com + ticketId: "188612" + unnulledAt: null + unnulledBy: null + schema: + $ref: '#/components/schemas/nullRoutedIP' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Null route an IP + tags: + - ips + /nullRoutes: + get: + operationId: getNullRouteHistoryList + parameters: + - description: Limit the number of results returned. + example: 20 + explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - description: Return results starting from the given offset. + example: 10 + explode: true + in: query + name: offset + required: false + schema: + type: integer + style: form + - description: Return only IPs greater or equal to the specified address + explode: true + in: query + name: fromIp + required: false + schema: + type: string + style: form + - description: Return only IPs lower or equal to the specified address + explode: true + in: query + name: toIp + required: false + schema: + type: string + style: form + - description: Return only null routes active after the specified date and time + explode: true + in: query + name: fromDate + required: false + schema: + format: date + type: string + style: form + - description: Return only null routes active before the specified date and + time + explode: true + in: query + name: toDate + required: false + schema: + format: date + type: string + style: form + - description: Filter by the email address of the user who created the null + route + explode: true + in: query + name: nulledBy + required: false + schema: + type: string + style: form + - description: Filter by the email address of the user who removed the null + route + explode: true + in: query + name: unnulledBy + required: false + schema: + type: string + style: form + - description: Filter by the reference stored with the null route + explode: true + in: query + name: ticketId + required: false + schema: + type: string + style: form + - description: Filter by ID of the contract assigned to the IP at the time of + null route creation + explode: true + in: query + name: contractId + required: false + schema: + type: string + style: form + - description: Filter by ID of the server assigned to the IP at the time of + null route creation + explode: true + in: query + name: equipmentId + required: false + schema: + type: string + style: form + - description: "Comma-separated list of sort field names. Prepend the field\ + \ name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable\ + \ field names are ip, nullRouted, reverseLookup." + explode: true + in: query + name: sort + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + example: + _metadata: + totalCount: 2 + offset: 0 + limit: 50 + nullroutes: + - id: "4534536" + ip: 192.0.2.1 + nulledAt: 2015-06-28T12:00:00Z + nulledBy: john.doe@example.com + nullLevel: 1 + automatedUnnullingAt: 2015-06-28T13:00:00Z + unnulledAt: null + unnulledBy: null + ticketId: "188612" + comment: This IP is evil + equipmentId: "456" + assignedContract: + id: "123456" + - id: "4534535" + ip: 192.0.2.1 + nulledAt: 2015-06-27T12:00:00Z + nulledBy: john.doe@example.com + nullLevel: 1 + automatedUnnullingAt: 2015-06-27T13:00:00Z + unnulledAt: 2015-06-27T13:00:05Z + unnulledBy: UnnullRunner + ticketId: "188612" + comment: This IP is evil + equipmentId: "456" + assignedContract: + id: "123456" + schema: + $ref: '#/components/schemas/getNullRouteHistoryListResult' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Inspect null route history + tags: + - ips + /nullRoutes/{id}: + get: + operationId: getNullRouteHistory + parameters: + - description: Null route ID + explode: false + in: path + name: id + required: true + schema: + example: "23234" + type: string + style: simple + responses: + "200": + content: + application/json: + example: + assignedContract: + id: "123456" + automatedUnnullingAt: 2015-06-25T11:13:00Z + comment: This IP is evil + equipmentId: "456" + id: "4534536" + ip: 192.0.2.1 + nullLevel: 1 + nulledAt: 2015-06-28T12:00:00Z + nulledBy: john.doe@example.com + ticketId: "188612" + unnulledAt: null + unnulledBy: null + schema: + $ref: '#/components/schemas/nullRoutedIP' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Inspect null route history + tags: + - ips + put: + operationId: updateNullRoute + parameters: + - description: Null route ID + explode: false + in: path + name: id + required: true + schema: + example: "23234" + type: string + style: simple + requestBody: + content: + application/json: + example: + automatedUnnullingAt: 2015-06-25T11:13:00Z + comment: This IP is evil + ticketId: "188612" + schema: + $ref: '#/components/schemas/updateNullRouteOpts' + responses: + "200": + content: + application/json: + example: + assignedContract: + id: "123456" + automatedUnnullingAt: 2015-06-25T11:13:00Z + comment: This IP is evil + equipmentId: "456" + id: "4534536" + ip: 192.0.2.1 + nullLevel: 1 + nulledAt: 2015-06-28T12:00:00Z + nulledBy: john.doe@example.com + ticketId: "188612" + unnulledAt: null + unnulledBy: null + schema: + $ref: '#/components/schemas/nullRoutedIP' + description: "" + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + summary: Update a null route + tags: + - ips +components: + parameters: + limit: + description: Limit the number of results returned. + example: 20 + explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + offset: + description: Return results starting from the given offset. + example: 10 + explode: true + in: query + name: offset + required: false + schema: + type: integer + style: form + fromIP: + description: Return only IPs greater or equal to the specified address + explode: true + in: query + name: fromIp + required: false + schema: + type: string + style: form + toIP: + description: Return only IPs lower or equal to the specified address + explode: true + in: query + name: toIp + required: false + schema: + type: string + style: form + sort: + description: "Comma-separated list of sort field names. Prepend the field name\ + \ with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field\ + \ names are ip, nullRouted, reverseLookup." + explode: true + in: query + name: sort + required: false + schema: + type: string + style: form + reverseLookup: + description: Filter by reverse lookup. + example: mydomain1.example.com + explode: true + in: query + name: reverseLookup + required: false + schema: + type: string + style: form + ip: + description: "IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength\ + \ is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength\ + \ is mandatory for IP range, for example, the IPv6 address range with prefixLength\ + \ = 112" + example: 192.0.2.1 + explode: false + in: path + name: ip + required: true + schema: + type: string + style: simple + ipv4: + description: "IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength\ + \ is not given, then we assume 32" + explode: false + in: path + name: ip + required: true + schema: + format: ipv4 + type: string + style: simple + responses: + "400": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "400" + errorDetails: {} + errorMessage: The API could not interpret your request correctly. + schema: + $ref: '#/components/schemas/errorResult' + description: Bad Request. + "401": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "401" + errorMessage: You are not authorized to view this resource. + schema: + $ref: '#/components/schemas/errorResult' + description: Not Authorized. + "403": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "403" + errorMessage: Access to the requested resource is forbidden. + schema: + $ref: '#/components/schemas/errorResult' + description: Forbidden. + "500": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "500" + errorMessage: '''The API could not handle your request at this time.' + schema: + $ref: '#/components/schemas/errorResult' + description: Internal Server Error. + "503": + content: + application/json: + example: + correlationId: 289346a1-3eaf-4da4-b707-62ef12eb08be + errorCode: "503" + errorMessage: The API is not available at the moment. + schema: + $ref: '#/components/schemas/errorResult' + description: Service Unavailable. + schemas: + protocolVersion: + description: Protocol version + enum: + - 4 + - 6 + type: integer + ipType: + enum: + - NORMAL_IP + - NETWORK + - BROADCAST + - GATEWAY + - ROUTER1 + - ROUTER2 + - IPMI + type: string + assignedContract: + description: An explanation about the purpose of this instance. + example: + id: "123456" + nullable: true + properties: + id: + description: ID of the contract connected to the IP. + example: "123456" + type: string + required: + - id + type: object + ip: + example: + prefixLength: 6 + nullLevel: 1 + subnet: + prefixLength: 5 + networkIp: networkIp + id: id + gateway: gateway + unnullingAllowed: false + reverseLookup: reverseLookup + ip: ip + nullRouted: false + assignedContract: + id: "123456" + type: NORMAL_IP + version: 0 + equipmentId: equipmentId + primary: true + properties: + ip: + description: IP address + type: string + version: + $ref: '#/components/schemas/protocolVersion' + type: + $ref: '#/components/schemas/ipType' + prefixLength: + default: 0 + description: "Prefix length of the IP range represented by the record. Note:\ + \ this is not the same as `subnet.prefixLength`." + type: integer + primary: + description: Boolean indicating if this is the primary IP of the assigned + equipment + type: boolean + reverseLookup: + description: "Reverse lookup set for the IP. This only applies to IPv4.\ + \ For IPv6 see [GET /ips/{ip}/reverseLookup](#operation/get/ips/{ip}/reverseLookup)." + nullable: true + type: string + nullRouted: + default: false + description: Boolean to indicate if the IP is null-routed + type: boolean + nullLevel: + description: Null route level + nullable: true + type: integer + unnullingAllowed: + default: false + description: Boolean indicating if the null route can be removed + type: boolean + equipmentId: + description: ID of the equipment using the IP + type: string + assignedContract: + $ref: '#/components/schemas/assignedContract' + subnet: + $ref: '#/components/schemas/subnet' + required: + - assignedContract + - equipmentId + - ip + - nullLevel + - nullRouted + - prefixLength + - primary + - reverseLookup + - subnet + - type + - unnullingAllowed + - version + title: ip + type: object + _metadata: + description: Metadata about the collection + example: + offset: 0 + limit: 5 + totalCount: 2 + properties: + totalCount: + description: Total amount of elements in this collection + example: 2 + minimum: 0 + type: integer + offset: + default: 0 + description: The offset used to generate this response + example: 0 + minimum: 0 + type: integer + limit: + default: 5 + description: The limit used to generate this response + example: 5 + minimum: 0 + type: integer + required: + - limit + - offset + - totalCount + title: metadata + type: object + getIPListResult: + example: + _metadata: + offset: 0 + limit: 5 + totalCount: 2 + ips: + - prefixLength: 6 + nullLevel: 1 + subnet: + prefixLength: 5 + networkIp: networkIp + id: id + gateway: gateway + unnullingAllowed: false + reverseLookup: reverseLookup + ip: ip + nullRouted: false + assignedContract: + id: "123456" + type: NORMAL_IP + version: 0 + equipmentId: equipmentId + primary: true + - prefixLength: 6 + nullLevel: 1 + subnet: + prefixLength: 5 + networkIp: networkIp + id: id + gateway: gateway + unnullingAllowed: false + reverseLookup: reverseLookup + ip: ip + nullRouted: false + assignedContract: + id: "123456" + type: NORMAL_IP + version: 0 + equipmentId: equipmentId + primary: true + properties: + ips: + items: + $ref: '#/components/schemas/ip' + type: array + _metadata: + $ref: '#/components/schemas/_metadata' + required: + - _metadata + - ips + type: object + errorResult: + example: + errorMessage: errorMessage + errorCode: errorCode + correlationId: correlationId + errorDetails: + key: + - errorDetails + - errorDetails + properties: + correlationId: + description: The correlation ID of the current request. + type: string + errorCode: + description: The error code. + type: string + errorMessage: + description: A human friendly description of the error. + type: string + errorDetails: + additionalProperties: + items: + type: string + type: array + title: errorDetails + type: object + type: object + updateIPOpts: + properties: + reverseLookup: + example: mydomain1.example.com + type: string + required: + - reverseLookup + type: object + reverseLookup: + description: Reverse lookup set for a specific IP address + example: + reverseLookup: reverseLookup + ip: ip + properties: + ip: + description: IP address + type: string + reverseLookup: + description: Reverse lookup value + nullable: true + type: string + required: + - ip + - reverseLookup + title: reverseLookup + type: object + getReverseLookupRecordListResult: + description: Object containing a list of reverse lookup values set for ips in + a specific range + example: + reverseLookups: + - reverseLookup: reverseLookup + ip: ip + - reverseLookup: reverseLookup + ip: ip + _metadata: + offset: 0 + limit: 5 + totalCount: 2 + properties: + reverseLookups: + items: + $ref: '#/components/schemas/reverseLookup' + type: array + _metadata: + $ref: '#/components/schemas/_metadata' + required: + - _metadata + - reverseLookups + type: object + updateReverseLookupRecordsOpts: + properties: + reverseLookups: + items: + $ref: '#/components/schemas/reverseLookup' + type: array + required: + - reverseLookups + type: object + updateReverseLookupRecordsResult: + example: + reverseLookups: + - reverseLookup: reverseLookup + ip: ip + - reverseLookup: reverseLookup + ip: ip + properties: + reverseLookups: + items: + $ref: '#/components/schemas/reverseLookup' + type: array + required: + - reverseLookups + type: object + nullRouteIPOpts: + properties: + automatedUnnullingAt: + description: The date and time when the null route is to be deactivated. + The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm + (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field + is not present then the null route will not be automatically removed. + example: 2015-06-25T11:13:00Z + format: date-time + type: string + comment: + description: A comment to be stored with the null route (e.g. null route + reason) + example: This IP is evil + type: string + ticketId: + description: A reference to be stored with the null route + example: "188612" + type: string + type: object + nullRoutedIP: + example: + nullLevel: 0 + ip: 192.0.2.1 + assignedContract: + id: "123456" + automatedUnnullingAt: 2000-01-23T04:56:07.000+00:00 + unnulledBy: unnulledBy + nulledBy: john.doe@example.com + comment: This IP is evil + id: "4534536" + unnulledAt: 2000-01-23T04:56:07.000+00:00 + equipmentId: "456" + nulledAt: 2000-01-23T04:56:07.000+00:00 + ticketId: "188612" + properties: + id: + description: Null route ID + example: "4534536" + type: string + ip: + description: IP address + example: 192.0.2.1 + type: string + nulledAt: + description: Null route date in UTC in format yyyy-mm-ddThh:mm:ssZ + format: date-time + type: string + nulledBy: + description: Email address of the user who created the null route or 'LeaseWeb' + if null route was created by LeaseWeb. + example: john.doe@example.com + type: string + nullLevel: + default: 0 + description: Null route permission level. If greater than 1 then the null + route can only be removed by LeaseWeb. + type: integer + automatedUnnullingAt: + description: The date and time when the null route is to be automatically + removed. + format: date-time + nullable: true + type: string + unnulledAt: + description: The date and time when the null route has been removed. If + null then the null route is still active. + format: date-time + nullable: true + type: string + unnulledBy: + description: Email address of the user who removed the null route or 'LeaseWeb' + if null route was removed by LeaseWeb. + nullable: true + type: string + ticketId: + description: Reference stored with the null route. + example: "188612" + nullable: true + type: string + comment: + description: Comment stored with the null route. + example: This IP is evil + nullable: true + type: string + equipmentId: + description: ID of the equipment which was assigned to the IP at the time + of null route creation. + example: "456" + type: string + assignedContract: + $ref: '#/components/schemas/assignedContract' + required: + - assignedContract + - automatedUnnullingAt + - comment + - equipmentId + - id + - ip + - nullLevel + - nulledAt + - nulledBy + - ticketId + - unnulledAt + - unnulledBy + getNullRouteHistoryListResult: + example: + nullroutes: + - nullLevel: 0 + ip: 192.0.2.1 + assignedContract: + id: "123456" + automatedUnnullingAt: 2000-01-23T04:56:07.000+00:00 + unnulledBy: unnulledBy + nulledBy: john.doe@example.com + comment: This IP is evil + id: "4534536" + unnulledAt: 2000-01-23T04:56:07.000+00:00 + equipmentId: "456" + nulledAt: 2000-01-23T04:56:07.000+00:00 + ticketId: "188612" + - nullLevel: 0 + ip: 192.0.2.1 + assignedContract: + id: "123456" + automatedUnnullingAt: 2000-01-23T04:56:07.000+00:00 + unnulledBy: unnulledBy + nulledBy: john.doe@example.com + comment: This IP is evil + id: "4534536" + unnulledAt: 2000-01-23T04:56:07.000+00:00 + equipmentId: "456" + nulledAt: 2000-01-23T04:56:07.000+00:00 + ticketId: "188612" + _metadata: + offset: 0 + limit: 5 + totalCount: 2 + properties: + nullroutes: + items: + $ref: '#/components/schemas/nullRoutedIP' + type: array + _metadata: + $ref: '#/components/schemas/_metadata' + required: + - _metadata + - nullroutes + type: object + updateNullRouteOpts: + properties: + automatedUnnullingAt: + description: The date and time when the null route is to be deactivated. + The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm + (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field + is not present then the null route will not be automatically removed. + example: 2015-06-25T11:13:00Z + format: date-time + type: string + comment: + description: A comment to be stored with the null route (e.g. null route + reason) + example: This IP is evil + type: string + ticketId: + description: A reference to be stored with the null route + example: "188612" + type: string + type: object + subnet: + default: {} + description: Object containing information about the network and gateway + example: + prefixLength: 5 + networkIp: networkIp + id: id + gateway: gateway + properties: + id: + description: Subnet identifier consisting of network IP and prefix length + separated by underscore (e.g. 192.0.2.0_24) + type: string + networkIp: + description: Network IP of the subnet + type: string + prefixLength: + default: 0 + description: Address prefix length + type: integer + gateway: + description: The gateway IP to be used in network settings + type: string + required: + - gateway + - id + - networkIp + - prefixLength + title: subnet + type: object + securitySchemes: + BearerAuth: + scheme: bearer + type: http + X-LSW-Auth: + description: API key authentication by setting `X-LSW-Auth` header. + in: header + name: X-LSW-Auth + type: apiKey diff --git a/ips/api_ips.go b/ips/api_ips.go new file mode 100644 index 0000000..0f50610 --- /dev/null +++ b/ips/api_ips.go @@ -0,0 +1,2067 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type IpsAPI interface { + + /* + GetIP Inspect an IP + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiGetIPRequest + */ + GetIP(ctx context.Context, ip string) ApiGetIPRequest + + // GetIPExecute executes the request + // @return Ip + GetIPExecute(r ApiGetIPRequest) (*Ip, *http.Response, error) + + /* + GetIPList List IPs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetIPListRequest + */ + GetIPList(ctx context.Context) ApiGetIPListRequest + + // GetIPListExecute executes the request + // @return GetIPListResult + GetIPListExecute(r ApiGetIPListRequest) (*GetIPListResult, *http.Response, error) + + /* + GetNullRouteHistory Inspect null route history + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Null route ID + @return ApiGetNullRouteHistoryRequest + */ + GetNullRouteHistory(ctx context.Context, id string) ApiGetNullRouteHistoryRequest + + // GetNullRouteHistoryExecute executes the request + // @return NullRoutedIP + GetNullRouteHistoryExecute(r ApiGetNullRouteHistoryRequest) (*NullRoutedIP, *http.Response, error) + + /* + GetNullRouteHistoryList Inspect null route history + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetNullRouteHistoryListRequest + */ + GetNullRouteHistoryList(ctx context.Context) ApiGetNullRouteHistoryListRequest + + // GetNullRouteHistoryListExecute executes the request + // @return GetNullRouteHistoryListResult + GetNullRouteHistoryListExecute(r ApiGetNullRouteHistoryListRequest) (*GetNullRouteHistoryListResult, *http.Response, error) + + /* + GetReverseLookupRecordList List reverse lookup records for an IPv6 range + + Get reverse lookup values set for IPs in the specified range + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiGetReverseLookupRecordListRequest + */ + GetReverseLookupRecordList(ctx context.Context, ip string) ApiGetReverseLookupRecordListRequest + + // GetReverseLookupRecordListExecute executes the request + // @return GetReverseLookupRecordListResult + GetReverseLookupRecordListExecute(r ApiGetReverseLookupRecordListRequest) (*GetReverseLookupRecordListResult, *http.Response, error) + + /* + NullRouteIP Null route an IP + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiNullRouteIPRequest + */ + NullRouteIP(ctx context.Context, ip string) ApiNullRouteIPRequest + + // NullRouteIPExecute executes the request + // @return NullRoutedIP + NullRouteIPExecute(r ApiNullRouteIPRequest) (*NullRoutedIP, *http.Response, error) + + /* + RemoveIPNullRoute Remove a null route + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiRemoveIPNullRouteRequest + */ + RemoveIPNullRoute(ctx context.Context, ip string) ApiRemoveIPNullRouteRequest + + // RemoveIPNullRouteExecute executes the request + RemoveIPNullRouteExecute(r ApiRemoveIPNullRouteRequest) (*http.Response, error) + + /* + UpdateIP Update an IP + + Use this operation to set reverse lookup for IPv4 IP addresses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 + @return ApiUpdateIPRequest + */ + UpdateIP(ctx context.Context, ip string) ApiUpdateIPRequest + + // UpdateIPExecute executes the request + // @return Ip + UpdateIPExecute(r ApiUpdateIPRequest) (*Ip, *http.Response, error) + + /* + UpdateNullRoute Update a null route + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Null route ID + @return ApiUpdateNullRouteRequest + */ + UpdateNullRoute(ctx context.Context, id string) ApiUpdateNullRouteRequest + + // UpdateNullRouteExecute executes the request + // @return NullRoutedIP + UpdateNullRouteExecute(r ApiUpdateNullRouteRequest) (*NullRoutedIP, *http.Response, error) + + /* + UpdateReverseLookupRecords Set or remove reverse lookup records for an IPv6 range + + This endpoint allows to set or unset reverse lookup for multiple IPv6 IPs in a specific IP range. To remove reverse lookup for an IP address set it to `null` or `""`. +Reverse lookup values of IPs not listed in the request body will not be affected. +You can set up to 20 records in a single request. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiUpdateReverseLookupRecordsRequest + */ + UpdateReverseLookupRecords(ctx context.Context, ip string) ApiUpdateReverseLookupRecordsRequest + + // UpdateReverseLookupRecordsExecute executes the request + // @return UpdateReverseLookupRecordsResult + UpdateReverseLookupRecordsExecute(r ApiUpdateReverseLookupRecordsRequest) (*UpdateReverseLookupRecordsResult, *http.Response, error) +} + +// IpsAPIService IpsAPI service +type IpsAPIService service + +type ApiGetIPRequest struct { + ctx context.Context + ApiService IpsAPI + ip string +} + +func (r ApiGetIPRequest) Execute() (*Ip, *http.Response, error) { + return r.ApiService.GetIPExecute(r) +} + +/* +GetIP Inspect an IP + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiGetIPRequest +*/ +func (a *IpsAPIService) GetIP(ctx context.Context, ip string) ApiGetIPRequest { + return ApiGetIPRequest{ + ApiService: a, + ctx: ctx, + ip: ip, + } +} + +// Execute executes the request +// @return Ip +func (a *IpsAPIService) GetIPExecute(r ApiGetIPRequest) (*Ip, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Ip + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.GetIP") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{ip}" + localVarPath = strings.Replace(localVarPath, "{"+"ip"+"}", url.PathEscape(parameterValueToString(r.ip, "ip")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetIPListRequest struct { + ctx context.Context + ApiService IpsAPI + limit *int32 + offset *int32 + subnetId *string + version *ProtocolVersion + type_ *IpType + nullRouted *bool + primary *bool + fromIp *string + toIp *string + ips *string + equipmentIds *string + assignedContractIds *string + sort *string + reverseLookup *string +} + +// Limit the number of results returned. +func (r ApiGetIPListRequest) Limit(limit int32) ApiGetIPListRequest { + r.limit = &limit + return r +} + +// Return results starting from the given offset. +func (r ApiGetIPListRequest) Offset(offset int32) ApiGetIPListRequest { + r.offset = &offset + return r +} + +// Filter by subnet +func (r ApiGetIPListRequest) SubnetId(subnetId string) ApiGetIPListRequest { + r.subnetId = &subnetId + return r +} + +// Filter by protocol version +func (r ApiGetIPListRequest) Version(version ProtocolVersion) ApiGetIPListRequest { + r.version = &version + return r +} + +// Filter by IP type +func (r ApiGetIPListRequest) Type_(type_ IpType) ApiGetIPListRequest { + r.type_ = &type_ + return r +} + +// Filter by whether or not the IP has an active null route (true or false) +func (r ApiGetIPListRequest) NullRouted(nullRouted bool) ApiGetIPListRequest { + r.nullRouted = &nullRouted + return r +} + +// Filter by whether or not the IP is primary (true or false) +func (r ApiGetIPListRequest) Primary(primary bool) ApiGetIPListRequest { + r.primary = &primary + return r +} + +// Return only IPs greater or equal to the specified address +func (r ApiGetIPListRequest) FromIp(fromIp string) ApiGetIPListRequest { + r.fromIp = &fromIp + return r +} + +// Return only IPs lower or equal to the specified address +func (r ApiGetIPListRequest) ToIp(toIp string) ApiGetIPListRequest { + r.toIp = &toIp + return r +} + +// Return only IPs specified as a comma-separated list +func (r ApiGetIPListRequest) Ips(ips string) ApiGetIPListRequest { + r.ips = &ips + return r +} + +// Return only IPs assigned to equipment items specified as a comma-separated list of IDs +func (r ApiGetIPListRequest) EquipmentIds(equipmentIds string) ApiGetIPListRequest { + r.equipmentIds = &equipmentIds + return r +} + +// Return only IPs assigned to contracts specified as a comma-separated list of IDs +func (r ApiGetIPListRequest) AssignedContractIds(assignedContractIds string) ApiGetIPListRequest { + r.assignedContractIds = &assignedContractIds + return r +} + +// Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. +func (r ApiGetIPListRequest) Sort(sort string) ApiGetIPListRequest { + r.sort = &sort + return r +} + +// Filter by reverse lookup. +func (r ApiGetIPListRequest) ReverseLookup(reverseLookup string) ApiGetIPListRequest { + r.reverseLookup = &reverseLookup + return r +} + +func (r ApiGetIPListRequest) Execute() (*GetIPListResult, *http.Response, error) { + return r.ApiService.GetIPListExecute(r) +} + +/* +GetIPList List IPs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetIPListRequest +*/ +func (a *IpsAPIService) GetIPList(ctx context.Context) ApiGetIPListRequest { + return ApiGetIPListRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return GetIPListResult +func (a *IpsAPIService) GetIPListExecute(r ApiGetIPListRequest) (*GetIPListResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetIPListResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.GetIPList") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } + if r.subnetId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "subnetId", r.subnetId, "form", "") + } + if r.version != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "version", r.version, "form", "") + } + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "form", "") + } + if r.nullRouted != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nullRouted", r.nullRouted, "form", "") + } + if r.primary != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "primary", r.primary, "form", "") + } + if r.fromIp != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "fromIp", r.fromIp, "form", "") + } + if r.toIp != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "toIp", r.toIp, "form", "") + } + if r.ips != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "ips", r.ips, "form", "") + } + if r.equipmentIds != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "equipmentIds", r.equipmentIds, "form", "") + } + if r.assignedContractIds != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "assignedContractIds", r.assignedContractIds, "form", "") + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + if r.reverseLookup != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "reverseLookup", r.reverseLookup, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetNullRouteHistoryRequest struct { + ctx context.Context + ApiService IpsAPI + id string +} + +func (r ApiGetNullRouteHistoryRequest) Execute() (*NullRoutedIP, *http.Response, error) { + return r.ApiService.GetNullRouteHistoryExecute(r) +} + +/* +GetNullRouteHistory Inspect null route history + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Null route ID + @return ApiGetNullRouteHistoryRequest +*/ +func (a *IpsAPIService) GetNullRouteHistory(ctx context.Context, id string) ApiGetNullRouteHistoryRequest { + return ApiGetNullRouteHistoryRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return NullRoutedIP +func (a *IpsAPIService) GetNullRouteHistoryExecute(r ApiGetNullRouteHistoryRequest) (*NullRoutedIP, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NullRoutedIP + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.GetNullRouteHistory") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/nullRoutes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetNullRouteHistoryListRequest struct { + ctx context.Context + ApiService IpsAPI + limit *int32 + offset *int32 + fromIp *string + toIp *string + fromDate *string + toDate *string + nulledBy *string + unnulledBy *string + ticketId *string + contractId *string + equipmentId *string + sort *string +} + +// Limit the number of results returned. +func (r ApiGetNullRouteHistoryListRequest) Limit(limit int32) ApiGetNullRouteHistoryListRequest { + r.limit = &limit + return r +} + +// Return results starting from the given offset. +func (r ApiGetNullRouteHistoryListRequest) Offset(offset int32) ApiGetNullRouteHistoryListRequest { + r.offset = &offset + return r +} + +// Return only IPs greater or equal to the specified address +func (r ApiGetNullRouteHistoryListRequest) FromIp(fromIp string) ApiGetNullRouteHistoryListRequest { + r.fromIp = &fromIp + return r +} + +// Return only IPs lower or equal to the specified address +func (r ApiGetNullRouteHistoryListRequest) ToIp(toIp string) ApiGetNullRouteHistoryListRequest { + r.toIp = &toIp + return r +} + +// Return only null routes active after the specified date and time +func (r ApiGetNullRouteHistoryListRequest) FromDate(fromDate string) ApiGetNullRouteHistoryListRequest { + r.fromDate = &fromDate + return r +} + +// Return only null routes active before the specified date and time +func (r ApiGetNullRouteHistoryListRequest) ToDate(toDate string) ApiGetNullRouteHistoryListRequest { + r.toDate = &toDate + return r +} + +// Filter by the email address of the user who created the null route +func (r ApiGetNullRouteHistoryListRequest) NulledBy(nulledBy string) ApiGetNullRouteHistoryListRequest { + r.nulledBy = &nulledBy + return r +} + +// Filter by the email address of the user who removed the null route +func (r ApiGetNullRouteHistoryListRequest) UnnulledBy(unnulledBy string) ApiGetNullRouteHistoryListRequest { + r.unnulledBy = &unnulledBy + return r +} + +// Filter by the reference stored with the null route +func (r ApiGetNullRouteHistoryListRequest) TicketId(ticketId string) ApiGetNullRouteHistoryListRequest { + r.ticketId = &ticketId + return r +} + +// Filter by ID of the contract assigned to the IP at the time of null route creation +func (r ApiGetNullRouteHistoryListRequest) ContractId(contractId string) ApiGetNullRouteHistoryListRequest { + r.contractId = &contractId + return r +} + +// Filter by ID of the server assigned to the IP at the time of null route creation +func (r ApiGetNullRouteHistoryListRequest) EquipmentId(equipmentId string) ApiGetNullRouteHistoryListRequest { + r.equipmentId = &equipmentId + return r +} + +// Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. +func (r ApiGetNullRouteHistoryListRequest) Sort(sort string) ApiGetNullRouteHistoryListRequest { + r.sort = &sort + return r +} + +func (r ApiGetNullRouteHistoryListRequest) Execute() (*GetNullRouteHistoryListResult, *http.Response, error) { + return r.ApiService.GetNullRouteHistoryListExecute(r) +} + +/* +GetNullRouteHistoryList Inspect null route history + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetNullRouteHistoryListRequest +*/ +func (a *IpsAPIService) GetNullRouteHistoryList(ctx context.Context) ApiGetNullRouteHistoryListRequest { + return ApiGetNullRouteHistoryListRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return GetNullRouteHistoryListResult +func (a *IpsAPIService) GetNullRouteHistoryListExecute(r ApiGetNullRouteHistoryListRequest) (*GetNullRouteHistoryListResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetNullRouteHistoryListResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.GetNullRouteHistoryList") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/nullRoutes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } + if r.fromIp != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "fromIp", r.fromIp, "form", "") + } + if r.toIp != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "toIp", r.toIp, "form", "") + } + if r.fromDate != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "fromDate", r.fromDate, "form", "") + } + if r.toDate != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "toDate", r.toDate, "form", "") + } + if r.nulledBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nulledBy", r.nulledBy, "form", "") + } + if r.unnulledBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "unnulledBy", r.unnulledBy, "form", "") + } + if r.ticketId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "ticketId", r.ticketId, "form", "") + } + if r.contractId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "contractId", r.contractId, "form", "") + } + if r.equipmentId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "equipmentId", r.equipmentId, "form", "") + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetReverseLookupRecordListRequest struct { + ctx context.Context + ApiService IpsAPI + ip string + reverseLookup *string + limit *int32 + offset *int32 +} + +// Filter by reverse lookup. +func (r ApiGetReverseLookupRecordListRequest) ReverseLookup(reverseLookup string) ApiGetReverseLookupRecordListRequest { + r.reverseLookup = &reverseLookup + return r +} + +// Limit the number of results returned. +func (r ApiGetReverseLookupRecordListRequest) Limit(limit int32) ApiGetReverseLookupRecordListRequest { + r.limit = &limit + return r +} + +// Return results starting from the given offset. +func (r ApiGetReverseLookupRecordListRequest) Offset(offset int32) ApiGetReverseLookupRecordListRequest { + r.offset = &offset + return r +} + +func (r ApiGetReverseLookupRecordListRequest) Execute() (*GetReverseLookupRecordListResult, *http.Response, error) { + return r.ApiService.GetReverseLookupRecordListExecute(r) +} + +/* +GetReverseLookupRecordList List reverse lookup records for an IPv6 range + +Get reverse lookup values set for IPs in the specified range + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiGetReverseLookupRecordListRequest +*/ +func (a *IpsAPIService) GetReverseLookupRecordList(ctx context.Context, ip string) ApiGetReverseLookupRecordListRequest { + return ApiGetReverseLookupRecordListRequest{ + ApiService: a, + ctx: ctx, + ip: ip, + } +} + +// Execute executes the request +// @return GetReverseLookupRecordListResult +func (a *IpsAPIService) GetReverseLookupRecordListExecute(r ApiGetReverseLookupRecordListRequest) (*GetReverseLookupRecordListResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetReverseLookupRecordListResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.GetReverseLookupRecordList") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{ip}/reverseLookup" + localVarPath = strings.Replace(localVarPath, "{"+"ip"+"}", url.PathEscape(parameterValueToString(r.ip, "ip")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.reverseLookup != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "reverseLookup", r.reverseLookup, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiNullRouteIPRequest struct { + ctx context.Context + ApiService IpsAPI + ip string + nullRouteIPOpts *NullRouteIPOpts +} + +// +func (r ApiNullRouteIPRequest) NullRouteIPOpts(nullRouteIPOpts NullRouteIPOpts) ApiNullRouteIPRequest { + r.nullRouteIPOpts = &nullRouteIPOpts + return r +} + +func (r ApiNullRouteIPRequest) Execute() (*NullRoutedIP, *http.Response, error) { + return r.ApiService.NullRouteIPExecute(r) +} + +/* +NullRouteIP Null route an IP + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiNullRouteIPRequest +*/ +func (a *IpsAPIService) NullRouteIP(ctx context.Context, ip string) ApiNullRouteIPRequest { + return ApiNullRouteIPRequest{ + ApiService: a, + ctx: ctx, + ip: ip, + } +} + +// Execute executes the request +// @return NullRoutedIP +func (a *IpsAPIService) NullRouteIPExecute(r ApiNullRouteIPRequest) (*NullRoutedIP, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NullRoutedIP + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.NullRouteIP") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{ip}/nullRoute" + localVarPath = strings.Replace(localVarPath, "{"+"ip"+"}", url.PathEscape(parameterValueToString(r.ip, "ip")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.nullRouteIPOpts + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRemoveIPNullRouteRequest struct { + ctx context.Context + ApiService IpsAPI + ip string +} + +func (r ApiRemoveIPNullRouteRequest) Execute() (*http.Response, error) { + return r.ApiService.RemoveIPNullRouteExecute(r) +} + +/* +RemoveIPNullRoute Remove a null route + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiRemoveIPNullRouteRequest +*/ +func (a *IpsAPIService) RemoveIPNullRoute(ctx context.Context, ip string) ApiRemoveIPNullRouteRequest { + return ApiRemoveIPNullRouteRequest{ + ApiService: a, + ctx: ctx, + ip: ip, + } +} + +// Execute executes the request +func (a *IpsAPIService) RemoveIPNullRouteExecute(r ApiRemoveIPNullRouteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.RemoveIPNullRoute") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{ip}/nullRoute" + localVarPath = strings.Replace(localVarPath, "{"+"ip"+"}", url.PathEscape(parameterValueToString(r.ip, "ip")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUpdateIPRequest struct { + ctx context.Context + ApiService IpsAPI + ip string + updateIPOpts *UpdateIPOpts +} + +func (r ApiUpdateIPRequest) UpdateIPOpts(updateIPOpts UpdateIPOpts) ApiUpdateIPRequest { + r.updateIPOpts = &updateIPOpts + return r +} + +func (r ApiUpdateIPRequest) Execute() (*Ip, *http.Response, error) { + return r.ApiService.UpdateIPExecute(r) +} + +/* +UpdateIP Update an IP + +Use this operation to set reverse lookup for IPv4 IP addresses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 + @return ApiUpdateIPRequest +*/ +func (a *IpsAPIService) UpdateIP(ctx context.Context, ip string) ApiUpdateIPRequest { + return ApiUpdateIPRequest{ + ApiService: a, + ctx: ctx, + ip: ip, + } +} + +// Execute executes the request +// @return Ip +func (a *IpsAPIService) UpdateIPExecute(r ApiUpdateIPRequest) (*Ip, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Ip + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.UpdateIP") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{ip}" + localVarPath = strings.Replace(localVarPath, "{"+"ip"+"}", url.PathEscape(parameterValueToString(r.ip, "ip")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateIPOpts + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateNullRouteRequest struct { + ctx context.Context + ApiService IpsAPI + id string + updateNullRouteOpts *UpdateNullRouteOpts +} + +func (r ApiUpdateNullRouteRequest) UpdateNullRouteOpts(updateNullRouteOpts UpdateNullRouteOpts) ApiUpdateNullRouteRequest { + r.updateNullRouteOpts = &updateNullRouteOpts + return r +} + +func (r ApiUpdateNullRouteRequest) Execute() (*NullRoutedIP, *http.Response, error) { + return r.ApiService.UpdateNullRouteExecute(r) +} + +/* +UpdateNullRoute Update a null route + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Null route ID + @return ApiUpdateNullRouteRequest +*/ +func (a *IpsAPIService) UpdateNullRoute(ctx context.Context, id string) ApiUpdateNullRouteRequest { + return ApiUpdateNullRouteRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return NullRoutedIP +func (a *IpsAPIService) UpdateNullRouteExecute(r ApiUpdateNullRouteRequest) (*NullRoutedIP, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NullRoutedIP + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.UpdateNullRoute") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/nullRoutes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateNullRouteOpts + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateReverseLookupRecordsRequest struct { + ctx context.Context + ApiService IpsAPI + ip string + updateReverseLookupRecordsOpts *UpdateReverseLookupRecordsOpts +} + +func (r ApiUpdateReverseLookupRecordsRequest) UpdateReverseLookupRecordsOpts(updateReverseLookupRecordsOpts UpdateReverseLookupRecordsOpts) ApiUpdateReverseLookupRecordsRequest { + r.updateReverseLookupRecordsOpts = &updateReverseLookupRecordsOpts + return r +} + +func (r ApiUpdateReverseLookupRecordsRequest) Execute() (*UpdateReverseLookupRecordsResult, *http.Response, error) { + return r.ApiService.UpdateReverseLookupRecordsExecute(r) +} + +/* +UpdateReverseLookupRecords Set or remove reverse lookup records for an IPv6 range + +This endpoint allows to set or unset reverse lookup for multiple IPv6 IPs in a specific IP range. To remove reverse lookup for an IP address set it to `null` or `""`. +Reverse lookup values of IPs not listed in the request body will not be affected. +You can set up to 20 records in a single request. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param ip IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + @return ApiUpdateReverseLookupRecordsRequest +*/ +func (a *IpsAPIService) UpdateReverseLookupRecords(ctx context.Context, ip string) ApiUpdateReverseLookupRecordsRequest { + return ApiUpdateReverseLookupRecordsRequest{ + ApiService: a, + ctx: ctx, + ip: ip, + } +} + +// Execute executes the request +// @return UpdateReverseLookupRecordsResult +func (a *IpsAPIService) UpdateReverseLookupRecordsExecute(r ApiUpdateReverseLookupRecordsRequest) (*UpdateReverseLookupRecordsResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateReverseLookupRecordsResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IpsAPIService.UpdateReverseLookupRecords") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/ips/{ip}/reverseLookup" + localVarPath = strings.Replace(localVarPath, "{"+"ip"+"}", url.PathEscape(parameterValueToString(r.ip, "ip")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateReverseLookupRecordsOpts + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["X-LSW-Auth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-LSW-Auth"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v ErrorResult + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/ips/client.go b/ips/client.go new file mode 100644 index 0000000..6fe5ccc --- /dev/null +++ b/ips/client.go @@ -0,0 +1,657 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the LeaseWeb API for IP address management API vv2 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + IpsAPI IpsAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.IpsAPI = (*IpsAPIService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/ips/configuration.go b/ips/configuration.go new file mode 100644 index 0000000..086c7d5 --- /dev/null +++ b/ips/configuration.go @@ -0,0 +1,221 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "lsw-go-sdk", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://api.leaseweb.com/ipMgmt/v2", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/ips/docs/AssignedContract.md b/ips/docs/AssignedContract.md new file mode 100644 index 0000000..e36dc31 --- /dev/null +++ b/ips/docs/AssignedContract.md @@ -0,0 +1,51 @@ +# AssignedContract + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | ID of the contract connected to the IP. | + +## Methods + +### NewAssignedContract + +`func NewAssignedContract(id string, ) *AssignedContract` + +NewAssignedContract instantiates a new AssignedContract object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAssignedContractWithDefaults + +`func NewAssignedContractWithDefaults() *AssignedContract` + +NewAssignedContractWithDefaults instantiates a new AssignedContract object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *AssignedContract) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *AssignedContract) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *AssignedContract) SetId(v string)` + +SetId sets Id field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/ErrorResult.md b/ips/docs/ErrorResult.md new file mode 100644 index 0000000..f6325ab --- /dev/null +++ b/ips/docs/ErrorResult.md @@ -0,0 +1,134 @@ +# ErrorResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**CorrelationId** | Pointer to **string** | The correlation ID of the current request. | [optional] +**ErrorCode** | Pointer to **string** | The error code. | [optional] +**ErrorMessage** | Pointer to **string** | A human friendly description of the error. | [optional] +**ErrorDetails** | Pointer to **map[string][]string** | | [optional] + +## Methods + +### NewErrorResult + +`func NewErrorResult() *ErrorResult` + +NewErrorResult instantiates a new ErrorResult object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorResultWithDefaults + +`func NewErrorResultWithDefaults() *ErrorResult` + +NewErrorResultWithDefaults instantiates a new ErrorResult object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCorrelationId + +`func (o *ErrorResult) GetCorrelationId() string` + +GetCorrelationId returns the CorrelationId field if non-nil, zero value otherwise. + +### GetCorrelationIdOk + +`func (o *ErrorResult) GetCorrelationIdOk() (*string, bool)` + +GetCorrelationIdOk returns a tuple with the CorrelationId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCorrelationId + +`func (o *ErrorResult) SetCorrelationId(v string)` + +SetCorrelationId sets CorrelationId field to given value. + +### HasCorrelationId + +`func (o *ErrorResult) HasCorrelationId() bool` + +HasCorrelationId returns a boolean if a field has been set. + +### GetErrorCode + +`func (o *ErrorResult) GetErrorCode() string` + +GetErrorCode returns the ErrorCode field if non-nil, zero value otherwise. + +### GetErrorCodeOk + +`func (o *ErrorResult) GetErrorCodeOk() (*string, bool)` + +GetErrorCodeOk returns a tuple with the ErrorCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorCode + +`func (o *ErrorResult) SetErrorCode(v string)` + +SetErrorCode sets ErrorCode field to given value. + +### HasErrorCode + +`func (o *ErrorResult) HasErrorCode() bool` + +HasErrorCode returns a boolean if a field has been set. + +### GetErrorMessage + +`func (o *ErrorResult) GetErrorMessage() string` + +GetErrorMessage returns the ErrorMessage field if non-nil, zero value otherwise. + +### GetErrorMessageOk + +`func (o *ErrorResult) GetErrorMessageOk() (*string, bool)` + +GetErrorMessageOk returns a tuple with the ErrorMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorMessage + +`func (o *ErrorResult) SetErrorMessage(v string)` + +SetErrorMessage sets ErrorMessage field to given value. + +### HasErrorMessage + +`func (o *ErrorResult) HasErrorMessage() bool` + +HasErrorMessage returns a boolean if a field has been set. + +### GetErrorDetails + +`func (o *ErrorResult) GetErrorDetails() map[string][]string` + +GetErrorDetails returns the ErrorDetails field if non-nil, zero value otherwise. + +### GetErrorDetailsOk + +`func (o *ErrorResult) GetErrorDetailsOk() (*map[string][]string, bool)` + +GetErrorDetailsOk returns a tuple with the ErrorDetails field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorDetails + +`func (o *ErrorResult) SetErrorDetails(v map[string][]string)` + +SetErrorDetails sets ErrorDetails field to given value. + +### HasErrorDetails + +`func (o *ErrorResult) HasErrorDetails() bool` + +HasErrorDetails returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/GetIPListResult.md b/ips/docs/GetIPListResult.md new file mode 100644 index 0000000..ba5c072 --- /dev/null +++ b/ips/docs/GetIPListResult.md @@ -0,0 +1,72 @@ +# GetIPListResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Ips** | [**[]Ip**](Ip.md) | | +**Metadata** | [**Metadata**](Metadata.md) | | + +## Methods + +### NewGetIPListResult + +`func NewGetIPListResult(ips []Ip, metadata Metadata, ) *GetIPListResult` + +NewGetIPListResult instantiates a new GetIPListResult object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGetIPListResultWithDefaults + +`func NewGetIPListResultWithDefaults() *GetIPListResult` + +NewGetIPListResultWithDefaults instantiates a new GetIPListResult object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIps + +`func (o *GetIPListResult) GetIps() []Ip` + +GetIps returns the Ips field if non-nil, zero value otherwise. + +### GetIpsOk + +`func (o *GetIPListResult) GetIpsOk() (*[]Ip, bool)` + +GetIpsOk returns a tuple with the Ips field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIps + +`func (o *GetIPListResult) SetIps(v []Ip)` + +SetIps sets Ips field to given value. + + +### GetMetadata + +`func (o *GetIPListResult) GetMetadata() Metadata` + +GetMetadata returns the Metadata field if non-nil, zero value otherwise. + +### GetMetadataOk + +`func (o *GetIPListResult) GetMetadataOk() (*Metadata, bool)` + +GetMetadataOk returns a tuple with the Metadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetadata + +`func (o *GetIPListResult) SetMetadata(v Metadata)` + +SetMetadata sets Metadata field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/GetNullRouteHistoryListResult.md b/ips/docs/GetNullRouteHistoryListResult.md new file mode 100644 index 0000000..8cebbb2 --- /dev/null +++ b/ips/docs/GetNullRouteHistoryListResult.md @@ -0,0 +1,72 @@ +# GetNullRouteHistoryListResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Nullroutes** | [**[]NullRoutedIP**](NullRoutedIP.md) | | +**Metadata** | [**Metadata**](Metadata.md) | | + +## Methods + +### NewGetNullRouteHistoryListResult + +`func NewGetNullRouteHistoryListResult(nullroutes []NullRoutedIP, metadata Metadata, ) *GetNullRouteHistoryListResult` + +NewGetNullRouteHistoryListResult instantiates a new GetNullRouteHistoryListResult object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGetNullRouteHistoryListResultWithDefaults + +`func NewGetNullRouteHistoryListResultWithDefaults() *GetNullRouteHistoryListResult` + +NewGetNullRouteHistoryListResultWithDefaults instantiates a new GetNullRouteHistoryListResult object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNullroutes + +`func (o *GetNullRouteHistoryListResult) GetNullroutes() []NullRoutedIP` + +GetNullroutes returns the Nullroutes field if non-nil, zero value otherwise. + +### GetNullroutesOk + +`func (o *GetNullRouteHistoryListResult) GetNullroutesOk() (*[]NullRoutedIP, bool)` + +GetNullroutesOk returns a tuple with the Nullroutes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNullroutes + +`func (o *GetNullRouteHistoryListResult) SetNullroutes(v []NullRoutedIP)` + +SetNullroutes sets Nullroutes field to given value. + + +### GetMetadata + +`func (o *GetNullRouteHistoryListResult) GetMetadata() Metadata` + +GetMetadata returns the Metadata field if non-nil, zero value otherwise. + +### GetMetadataOk + +`func (o *GetNullRouteHistoryListResult) GetMetadataOk() (*Metadata, bool)` + +GetMetadataOk returns a tuple with the Metadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetadata + +`func (o *GetNullRouteHistoryListResult) SetMetadata(v Metadata)` + +SetMetadata sets Metadata field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/GetReverseLookupRecordListResult.md b/ips/docs/GetReverseLookupRecordListResult.md new file mode 100644 index 0000000..f4183be --- /dev/null +++ b/ips/docs/GetReverseLookupRecordListResult.md @@ -0,0 +1,72 @@ +# GetReverseLookupRecordListResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ReverseLookups** | [**[]ReverseLookup**](ReverseLookup.md) | | +**Metadata** | [**Metadata**](Metadata.md) | | + +## Methods + +### NewGetReverseLookupRecordListResult + +`func NewGetReverseLookupRecordListResult(reverseLookups []ReverseLookup, metadata Metadata, ) *GetReverseLookupRecordListResult` + +NewGetReverseLookupRecordListResult instantiates a new GetReverseLookupRecordListResult object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGetReverseLookupRecordListResultWithDefaults + +`func NewGetReverseLookupRecordListResultWithDefaults() *GetReverseLookupRecordListResult` + +NewGetReverseLookupRecordListResultWithDefaults instantiates a new GetReverseLookupRecordListResult object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetReverseLookups + +`func (o *GetReverseLookupRecordListResult) GetReverseLookups() []ReverseLookup` + +GetReverseLookups returns the ReverseLookups field if non-nil, zero value otherwise. + +### GetReverseLookupsOk + +`func (o *GetReverseLookupRecordListResult) GetReverseLookupsOk() (*[]ReverseLookup, bool)` + +GetReverseLookupsOk returns a tuple with the ReverseLookups field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReverseLookups + +`func (o *GetReverseLookupRecordListResult) SetReverseLookups(v []ReverseLookup)` + +SetReverseLookups sets ReverseLookups field to given value. + + +### GetMetadata + +`func (o *GetReverseLookupRecordListResult) GetMetadata() Metadata` + +GetMetadata returns the Metadata field if non-nil, zero value otherwise. + +### GetMetadataOk + +`func (o *GetReverseLookupRecordListResult) GetMetadataOk() (*Metadata, bool)` + +GetMetadataOk returns a tuple with the Metadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetadata + +`func (o *GetReverseLookupRecordListResult) SetMetadata(v Metadata)` + +SetMetadata sets Metadata field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/Ip.md b/ips/docs/Ip.md new file mode 100644 index 0000000..bed6423 --- /dev/null +++ b/ips/docs/Ip.md @@ -0,0 +1,312 @@ +# Ip + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Ip** | **string** | IP address | +**Version** | [**ProtocolVersion**](ProtocolVersion.md) | | +**Type** | [**IpType**](IpType.md) | | +**PrefixLength** | **int32** | Prefix length of the IP range represented by the record. Note: this is not the same as `subnet.prefixLength`. | [default to 0] +**Primary** | **bool** | Boolean indicating if this is the primary IP of the assigned equipment | +**ReverseLookup** | **NullableString** | Reverse lookup set for the IP. This only applies to IPv4. For IPv6 see [GET /ips/{ip}/reverseLookup](#operation/get/ips/{ip}/reverseLookup). | +**NullRouted** | **bool** | Boolean to indicate if the IP is null-routed | [default to false] +**NullLevel** | **NullableInt32** | Null route level | +**UnnullingAllowed** | **bool** | Boolean indicating if the null route can be removed | [default to false] +**EquipmentId** | **string** | ID of the equipment using the IP | +**AssignedContract** | [**NullableAssignedContract**](AssignedContract.md) | | +**Subnet** | [**Subnet**](Subnet.md) | | [default to {}] + +## Methods + +### NewIp + +`func NewIp(ip string, version ProtocolVersion, type_ IpType, prefixLength int32, primary bool, reverseLookup NullableString, nullRouted bool, nullLevel NullableInt32, unnullingAllowed bool, equipmentId string, assignedContract NullableAssignedContract, subnet Subnet, ) *Ip` + +NewIp instantiates a new Ip object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIpWithDefaults + +`func NewIpWithDefaults() *Ip` + +NewIpWithDefaults instantiates a new Ip object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIp + +`func (o *Ip) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *Ip) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *Ip) SetIp(v string)` + +SetIp sets Ip field to given value. + + +### GetVersion + +`func (o *Ip) GetVersion() ProtocolVersion` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *Ip) GetVersionOk() (*ProtocolVersion, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *Ip) SetVersion(v ProtocolVersion)` + +SetVersion sets Version field to given value. + + +### GetType + +`func (o *Ip) GetType() IpType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *Ip) GetTypeOk() (*IpType, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *Ip) SetType(v IpType)` + +SetType sets Type field to given value. + + +### GetPrefixLength + +`func (o *Ip) GetPrefixLength() int32` + +GetPrefixLength returns the PrefixLength field if non-nil, zero value otherwise. + +### GetPrefixLengthOk + +`func (o *Ip) GetPrefixLengthOk() (*int32, bool)` + +GetPrefixLengthOk returns a tuple with the PrefixLength field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixLength + +`func (o *Ip) SetPrefixLength(v int32)` + +SetPrefixLength sets PrefixLength field to given value. + + +### GetPrimary + +`func (o *Ip) GetPrimary() bool` + +GetPrimary returns the Primary field if non-nil, zero value otherwise. + +### GetPrimaryOk + +`func (o *Ip) GetPrimaryOk() (*bool, bool)` + +GetPrimaryOk returns a tuple with the Primary field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrimary + +`func (o *Ip) SetPrimary(v bool)` + +SetPrimary sets Primary field to given value. + + +### GetReverseLookup + +`func (o *Ip) GetReverseLookup() string` + +GetReverseLookup returns the ReverseLookup field if non-nil, zero value otherwise. + +### GetReverseLookupOk + +`func (o *Ip) GetReverseLookupOk() (*string, bool)` + +GetReverseLookupOk returns a tuple with the ReverseLookup field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReverseLookup + +`func (o *Ip) SetReverseLookup(v string)` + +SetReverseLookup sets ReverseLookup field to given value. + + +### SetReverseLookupNil + +`func (o *Ip) SetReverseLookupNil(b bool)` + + SetReverseLookupNil sets the value for ReverseLookup to be an explicit nil + +### UnsetReverseLookup +`func (o *Ip) UnsetReverseLookup()` + +UnsetReverseLookup ensures that no value is present for ReverseLookup, not even an explicit nil +### GetNullRouted + +`func (o *Ip) GetNullRouted() bool` + +GetNullRouted returns the NullRouted field if non-nil, zero value otherwise. + +### GetNullRoutedOk + +`func (o *Ip) GetNullRoutedOk() (*bool, bool)` + +GetNullRoutedOk returns a tuple with the NullRouted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNullRouted + +`func (o *Ip) SetNullRouted(v bool)` + +SetNullRouted sets NullRouted field to given value. + + +### GetNullLevel + +`func (o *Ip) GetNullLevel() int32` + +GetNullLevel returns the NullLevel field if non-nil, zero value otherwise. + +### GetNullLevelOk + +`func (o *Ip) GetNullLevelOk() (*int32, bool)` + +GetNullLevelOk returns a tuple with the NullLevel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNullLevel + +`func (o *Ip) SetNullLevel(v int32)` + +SetNullLevel sets NullLevel field to given value. + + +### SetNullLevelNil + +`func (o *Ip) SetNullLevelNil(b bool)` + + SetNullLevelNil sets the value for NullLevel to be an explicit nil + +### UnsetNullLevel +`func (o *Ip) UnsetNullLevel()` + +UnsetNullLevel ensures that no value is present for NullLevel, not even an explicit nil +### GetUnnullingAllowed + +`func (o *Ip) GetUnnullingAllowed() bool` + +GetUnnullingAllowed returns the UnnullingAllowed field if non-nil, zero value otherwise. + +### GetUnnullingAllowedOk + +`func (o *Ip) GetUnnullingAllowedOk() (*bool, bool)` + +GetUnnullingAllowedOk returns a tuple with the UnnullingAllowed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUnnullingAllowed + +`func (o *Ip) SetUnnullingAllowed(v bool)` + +SetUnnullingAllowed sets UnnullingAllowed field to given value. + + +### GetEquipmentId + +`func (o *Ip) GetEquipmentId() string` + +GetEquipmentId returns the EquipmentId field if non-nil, zero value otherwise. + +### GetEquipmentIdOk + +`func (o *Ip) GetEquipmentIdOk() (*string, bool)` + +GetEquipmentIdOk returns a tuple with the EquipmentId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEquipmentId + +`func (o *Ip) SetEquipmentId(v string)` + +SetEquipmentId sets EquipmentId field to given value. + + +### GetAssignedContract + +`func (o *Ip) GetAssignedContract() AssignedContract` + +GetAssignedContract returns the AssignedContract field if non-nil, zero value otherwise. + +### GetAssignedContractOk + +`func (o *Ip) GetAssignedContractOk() (*AssignedContract, bool)` + +GetAssignedContractOk returns a tuple with the AssignedContract field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAssignedContract + +`func (o *Ip) SetAssignedContract(v AssignedContract)` + +SetAssignedContract sets AssignedContract field to given value. + + +### SetAssignedContractNil + +`func (o *Ip) SetAssignedContractNil(b bool)` + + SetAssignedContractNil sets the value for AssignedContract to be an explicit nil + +### UnsetAssignedContract +`func (o *Ip) UnsetAssignedContract()` + +UnsetAssignedContract ensures that no value is present for AssignedContract, not even an explicit nil +### GetSubnet + +`func (o *Ip) GetSubnet() Subnet` + +GetSubnet returns the Subnet field if non-nil, zero value otherwise. + +### GetSubnetOk + +`func (o *Ip) GetSubnetOk() (*Subnet, bool)` + +GetSubnetOk returns a tuple with the Subnet field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubnet + +`func (o *Ip) SetSubnet(v Subnet)` + +SetSubnet sets Subnet field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/IpType.md b/ips/docs/IpType.md new file mode 100644 index 0000000..4b5d71e --- /dev/null +++ b/ips/docs/IpType.md @@ -0,0 +1,23 @@ +# IpType + +## Enum + + +* `NORMAL_IP` (value: `"NORMAL_IP"`) + +* `NETWORK` (value: `"NETWORK"`) + +* `BROADCAST` (value: `"BROADCAST"`) + +* `GATEWAY` (value: `"GATEWAY"`) + +* `ROUTER1` (value: `"ROUTER1"`) + +* `ROUTER2` (value: `"ROUTER2"`) + +* `IPMI` (value: `"IPMI"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/IpsAPI.md b/ips/docs/IpsAPI.md new file mode 100644 index 0000000..74ac2f6 --- /dev/null +++ b/ips/docs/IpsAPI.md @@ -0,0 +1,757 @@ +# \IpsAPI + +All URIs are relative to *https://api.leaseweb.com/ipMgmt/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetIP**](IpsAPI.md#GetIP) | **Get** /ips/{ip} | Inspect an IP +[**GetIPList**](IpsAPI.md#GetIPList) | **Get** /ips | List IPs +[**GetNullRouteHistory**](IpsAPI.md#GetNullRouteHistory) | **Get** /nullRoutes/{id} | Inspect null route history +[**GetNullRouteHistoryList**](IpsAPI.md#GetNullRouteHistoryList) | **Get** /nullRoutes | Inspect null route history +[**GetReverseLookupRecordList**](IpsAPI.md#GetReverseLookupRecordList) | **Get** /ips/{ip}/reverseLookup | List reverse lookup records for an IPv6 range +[**NullRouteIP**](IpsAPI.md#NullRouteIP) | **Post** /ips/{ip}/nullRoute | Null route an IP +[**RemoveIPNullRoute**](IpsAPI.md#RemoveIPNullRoute) | **Delete** /ips/{ip}/nullRoute | Remove a null route +[**UpdateIP**](IpsAPI.md#UpdateIP) | **Put** /ips/{ip} | Update an IP +[**UpdateNullRoute**](IpsAPI.md#UpdateNullRoute) | **Put** /nullRoutes/{id} | Update a null route +[**UpdateReverseLookupRecords**](IpsAPI.md#UpdateReverseLookupRecords) | **Put** /ips/{ip}/reverseLookup | Set or remove reverse lookup records for an IPv6 range + + + +## GetIP + +> Ip GetIP(ctx, ip).Execute() + +Inspect an IP + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + ip := "192.0.2.1" // string | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.GetIP(context.Background(), ip).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.GetIP``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetIP`: Ip + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.GetIP`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ip** | **string** | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetIPRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**Ip**](Ip.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetIPList + +> GetIPListResult GetIPList(ctx).Limit(limit).Offset(offset).SubnetId(subnetId).Version(version).Type_(type_).NullRouted(nullRouted).Primary(primary).FromIp(fromIp).ToIp(toIp).Ips(ips).EquipmentIds(equipmentIds).AssignedContractIds(assignedContractIds).Sort(sort).ReverseLookup(reverseLookup).Execute() + +List IPs + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + limit := int32(20) // int32 | Limit the number of results returned. (optional) + offset := int32(10) // int32 | Return results starting from the given offset. (optional) + subnetId := "subnetId_example" // string | Filter by subnet (optional) + version := openapiclient.protocolVersion(4) // ProtocolVersion | Filter by protocol version (optional) + type_ := openapiclient.ipType("NORMAL_IP") // IpType | Filter by IP type (optional) + nullRouted := true // bool | Filter by whether or not the IP has an active null route (true or false) (optional) + primary := true // bool | Filter by whether or not the IP is primary (true or false) (optional) + fromIp := "fromIp_example" // string | Return only IPs greater or equal to the specified address (optional) + toIp := "toIp_example" // string | Return only IPs lower or equal to the specified address (optional) + ips := "ips_example" // string | Return only IPs specified as a comma-separated list (optional) + equipmentIds := "equipmentIds_example" // string | Return only IPs assigned to equipment items specified as a comma-separated list of IDs (optional) + assignedContractIds := "assignedContractIds_example" // string | Return only IPs assigned to contracts specified as a comma-separated list of IDs (optional) + sort := "sort_example" // string | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. (optional) + reverseLookup := "mydomain1.example.com" // string | Filter by reverse lookup. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.GetIPList(context.Background()).Limit(limit).Offset(offset).SubnetId(subnetId).Version(version).Type_(type_).NullRouted(nullRouted).Primary(primary).FromIp(fromIp).ToIp(toIp).Ips(ips).EquipmentIds(equipmentIds).AssignedContractIds(assignedContractIds).Sort(sort).ReverseLookup(reverseLookup).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.GetIPList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetIPList`: GetIPListResult + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.GetIPList`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetIPListRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int32** | Limit the number of results returned. | + **offset** | **int32** | Return results starting from the given offset. | + **subnetId** | **string** | Filter by subnet | + **version** | [**ProtocolVersion**](ProtocolVersion.md) | Filter by protocol version | + **type_** | [**IpType**](IpType.md) | Filter by IP type | + **nullRouted** | **bool** | Filter by whether or not the IP has an active null route (true or false) | + **primary** | **bool** | Filter by whether or not the IP is primary (true or false) | + **fromIp** | **string** | Return only IPs greater or equal to the specified address | + **toIp** | **string** | Return only IPs lower or equal to the specified address | + **ips** | **string** | Return only IPs specified as a comma-separated list | + **equipmentIds** | **string** | Return only IPs assigned to equipment items specified as a comma-separated list of IDs | + **assignedContractIds** | **string** | Return only IPs assigned to contracts specified as a comma-separated list of IDs | + **sort** | **string** | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. | + **reverseLookup** | **string** | Filter by reverse lookup. | + +### Return type + +[**GetIPListResult**](GetIPListResult.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetNullRouteHistory + +> NullRoutedIP GetNullRouteHistory(ctx, id).Execute() + +Inspect null route history + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + id := "23234" // string | Null route ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.GetNullRouteHistory(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.GetNullRouteHistory``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetNullRouteHistory`: NullRoutedIP + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.GetNullRouteHistory`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Null route ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetNullRouteHistoryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**NullRoutedIP**](NullRoutedIP.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetNullRouteHistoryList + +> GetNullRouteHistoryListResult GetNullRouteHistoryList(ctx).Limit(limit).Offset(offset).FromIp(fromIp).ToIp(toIp).FromDate(fromDate).ToDate(toDate).NulledBy(nulledBy).UnnulledBy(unnulledBy).TicketId(ticketId).ContractId(contractId).EquipmentId(equipmentId).Sort(sort).Execute() + +Inspect null route history + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + "time" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + limit := int32(20) // int32 | Limit the number of results returned. (optional) + offset := int32(10) // int32 | Return results starting from the given offset. (optional) + fromIp := "fromIp_example" // string | Return only IPs greater or equal to the specified address (optional) + toIp := "toIp_example" // string | Return only IPs lower or equal to the specified address (optional) + fromDate := time.Now() // string | Return only null routes active after the specified date and time (optional) + toDate := time.Now() // string | Return only null routes active before the specified date and time (optional) + nulledBy := "nulledBy_example" // string | Filter by the email address of the user who created the null route (optional) + unnulledBy := "unnulledBy_example" // string | Filter by the email address of the user who removed the null route (optional) + ticketId := "ticketId_example" // string | Filter by the reference stored with the null route (optional) + contractId := "contractId_example" // string | Filter by ID of the contract assigned to the IP at the time of null route creation (optional) + equipmentId := "equipmentId_example" // string | Filter by ID of the server assigned to the IP at the time of null route creation (optional) + sort := "sort_example" // string | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.GetNullRouteHistoryList(context.Background()).Limit(limit).Offset(offset).FromIp(fromIp).ToIp(toIp).FromDate(fromDate).ToDate(toDate).NulledBy(nulledBy).UnnulledBy(unnulledBy).TicketId(ticketId).ContractId(contractId).EquipmentId(equipmentId).Sort(sort).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.GetNullRouteHistoryList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetNullRouteHistoryList`: GetNullRouteHistoryListResult + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.GetNullRouteHistoryList`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetNullRouteHistoryListRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int32** | Limit the number of results returned. | + **offset** | **int32** | Return results starting from the given offset. | + **fromIp** | **string** | Return only IPs greater or equal to the specified address | + **toIp** | **string** | Return only IPs lower or equal to the specified address | + **fromDate** | **string** | Return only null routes active after the specified date and time | + **toDate** | **string** | Return only null routes active before the specified date and time | + **nulledBy** | **string** | Filter by the email address of the user who created the null route | + **unnulledBy** | **string** | Filter by the email address of the user who removed the null route | + **ticketId** | **string** | Filter by the reference stored with the null route | + **contractId** | **string** | Filter by ID of the contract assigned to the IP at the time of null route creation | + **equipmentId** | **string** | Filter by ID of the server assigned to the IP at the time of null route creation | + **sort** | **string** | Comma-separated list of sort field names. Prepend the field name with '-' for descending order. E.g. `sort=ip,-nullrouted`. Sortable field names are ip, nullRouted, reverseLookup. | + +### Return type + +[**GetNullRouteHistoryListResult**](GetNullRouteHistoryListResult.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetReverseLookupRecordList + +> GetReverseLookupRecordListResult GetReverseLookupRecordList(ctx, ip).ReverseLookup(reverseLookup).Limit(limit).Offset(offset).Execute() + +List reverse lookup records for an IPv6 range + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + ip := "192.0.2.1" // string | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + reverseLookup := "mydomain1.example.com" // string | Filter by reverse lookup. (optional) + limit := int32(20) // int32 | Limit the number of results returned. (optional) + offset := int32(10) // int32 | Return results starting from the given offset. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.GetReverseLookupRecordList(context.Background(), ip).ReverseLookup(reverseLookup).Limit(limit).Offset(offset).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.GetReverseLookupRecordList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetReverseLookupRecordList`: GetReverseLookupRecordListResult + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.GetReverseLookupRecordList`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ip** | **string** | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetReverseLookupRecordListRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **reverseLookup** | **string** | Filter by reverse lookup. | + **limit** | **int32** | Limit the number of results returned. | + **offset** | **int32** | Return results starting from the given offset. | + +### Return type + +[**GetReverseLookupRecordListResult**](GetReverseLookupRecordListResult.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## NullRouteIP + +> NullRoutedIP NullRouteIP(ctx, ip).NullRouteIPOpts(nullRouteIPOpts).Execute() + +Null route an IP + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + ip := "192.0.2.1" // string | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + nullRouteIPOpts := *openapiclient.NewNullRouteIPOpts() // NullRouteIPOpts | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.NullRouteIP(context.Background(), ip).NullRouteIPOpts(nullRouteIPOpts).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.NullRouteIP``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `NullRouteIP`: NullRoutedIP + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.NullRouteIP`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ip** | **string** | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 | + +### Other Parameters + +Other parameters are passed through a pointer to a apiNullRouteIPRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **nullRouteIPOpts** | [**NullRouteIPOpts**](NullRouteIPOpts.md) | | + +### Return type + +[**NullRoutedIP**](NullRoutedIP.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## RemoveIPNullRoute + +> RemoveIPNullRoute(ctx, ip).Execute() + +Remove a null route + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + ip := "192.0.2.1" // string | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.IpsAPI.RemoveIPNullRoute(context.Background(), ip).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.RemoveIPNullRoute``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ip** | **string** | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 | + +### Other Parameters + +Other parameters are passed through a pointer to a apiRemoveIPNullRouteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateIP + +> Ip UpdateIP(ctx, ip).UpdateIPOpts(updateIPOpts).Execute() + +Update an IP + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + ip := "ip_example" // string | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 + updateIPOpts := *openapiclient.NewUpdateIPOpts("mydomain1.example.com") // UpdateIPOpts | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.UpdateIP(context.Background(), ip).UpdateIPOpts(updateIPOpts).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.UpdateIP``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateIP`: Ip + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.UpdateIP`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ip** | **string** | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateIPRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **updateIPOpts** | [**UpdateIPOpts**](UpdateIPOpts.md) | | + +### Return type + +[**Ip**](Ip.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateNullRoute + +> NullRoutedIP UpdateNullRoute(ctx, id).UpdateNullRouteOpts(updateNullRouteOpts).Execute() + +Update a null route + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + id := "23234" // string | Null route ID + updateNullRouteOpts := *openapiclient.NewUpdateNullRouteOpts() // UpdateNullRouteOpts | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.UpdateNullRoute(context.Background(), id).UpdateNullRouteOpts(updateNullRouteOpts).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.UpdateNullRoute``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateNullRoute`: NullRoutedIP + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.UpdateNullRoute`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**id** | **string** | Null route ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateNullRouteRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **updateNullRouteOpts** | [**UpdateNullRouteOpts**](UpdateNullRouteOpts.md) | | + +### Return type + +[**NullRoutedIP**](NullRoutedIP.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateReverseLookupRecords + +> UpdateReverseLookupRecordsResult UpdateReverseLookupRecords(ctx, ip).UpdateReverseLookupRecordsOpts(updateReverseLookupRecordsOpts).Execute() + +Set or remove reverse lookup records for an IPv6 range + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func main() { + ip := "192.0.2.1" // string | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 + updateReverseLookupRecordsOpts := *openapiclient.NewUpdateReverseLookupRecordsOpts([]openapiclient.ReverseLookup{*openapiclient.NewReverseLookup("Ip_example", "ReverseLookup_example")}) // UpdateReverseLookupRecordsOpts | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.IpsAPI.UpdateReverseLookupRecords(context.Background(), ip).UpdateReverseLookupRecordsOpts(updateReverseLookupRecordsOpts).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IpsAPI.UpdateReverseLookupRecords``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateReverseLookupRecords`: UpdateReverseLookupRecordsResult + fmt.Fprintf(os.Stdout, "Response from `IpsAPI.UpdateReverseLookupRecords`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ip** | **string** | IP address or IP address with prefixLength {ip}_{prefix}. If prefixLength is not given, then we assume 32 (for IPv4) or 128 (for IPv6). PrefixLength is mandatory for IP range, for example, the IPv6 address range with prefixLength = 112 | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateReverseLookupRecordsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **updateReverseLookupRecordsOpts** | [**UpdateReverseLookupRecordsOpts**](UpdateReverseLookupRecordsOpts.md) | | + +### Return type + +[**UpdateReverseLookupRecordsResult**](UpdateReverseLookupRecordsResult.md) + +### Authorization + +[X-LSW-Auth](../README.md#X-LSW-Auth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/ips/docs/Metadata.md b/ips/docs/Metadata.md new file mode 100644 index 0000000..e4c33f5 --- /dev/null +++ b/ips/docs/Metadata.md @@ -0,0 +1,93 @@ +# Metadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TotalCount** | **int32** | Total amount of elements in this collection | +**Offset** | **int32** | The offset used to generate this response | [default to 0] +**Limit** | **int32** | The limit used to generate this response | [default to 5] + +## Methods + +### NewMetadata + +`func NewMetadata(totalCount int32, offset int32, limit int32, ) *Metadata` + +NewMetadata instantiates a new Metadata object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewMetadataWithDefaults + +`func NewMetadataWithDefaults() *Metadata` + +NewMetadataWithDefaults instantiates a new Metadata object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetTotalCount + +`func (o *Metadata) GetTotalCount() int32` + +GetTotalCount returns the TotalCount field if non-nil, zero value otherwise. + +### GetTotalCountOk + +`func (o *Metadata) GetTotalCountOk() (*int32, bool)` + +GetTotalCountOk returns a tuple with the TotalCount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotalCount + +`func (o *Metadata) SetTotalCount(v int32)` + +SetTotalCount sets TotalCount field to given value. + + +### GetOffset + +`func (o *Metadata) GetOffset() int32` + +GetOffset returns the Offset field if non-nil, zero value otherwise. + +### GetOffsetOk + +`func (o *Metadata) GetOffsetOk() (*int32, bool)` + +GetOffsetOk returns a tuple with the Offset field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOffset + +`func (o *Metadata) SetOffset(v int32)` + +SetOffset sets Offset field to given value. + + +### GetLimit + +`func (o *Metadata) GetLimit() int32` + +GetLimit returns the Limit field if non-nil, zero value otherwise. + +### GetLimitOk + +`func (o *Metadata) GetLimitOk() (*int32, bool)` + +GetLimitOk returns a tuple with the Limit field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLimit + +`func (o *Metadata) SetLimit(v int32)` + +SetLimit sets Limit field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/NullRouteIPOpts.md b/ips/docs/NullRouteIPOpts.md new file mode 100644 index 0000000..bb6ac8e --- /dev/null +++ b/ips/docs/NullRouteIPOpts.md @@ -0,0 +1,108 @@ +# NullRouteIPOpts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AutomatedUnnullingAt** | Pointer to **time.Time** | The date and time when the null route is to be deactivated. The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field is not present then the null route will not be automatically removed. | [optional] +**Comment** | Pointer to **string** | A comment to be stored with the null route (e.g. null route reason) | [optional] +**TicketId** | Pointer to **string** | A reference to be stored with the null route | [optional] + +## Methods + +### NewNullRouteIPOpts + +`func NewNullRouteIPOpts() *NullRouteIPOpts` + +NewNullRouteIPOpts instantiates a new NullRouteIPOpts object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNullRouteIPOptsWithDefaults + +`func NewNullRouteIPOptsWithDefaults() *NullRouteIPOpts` + +NewNullRouteIPOptsWithDefaults instantiates a new NullRouteIPOpts object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAutomatedUnnullingAt + +`func (o *NullRouteIPOpts) GetAutomatedUnnullingAt() time.Time` + +GetAutomatedUnnullingAt returns the AutomatedUnnullingAt field if non-nil, zero value otherwise. + +### GetAutomatedUnnullingAtOk + +`func (o *NullRouteIPOpts) GetAutomatedUnnullingAtOk() (*time.Time, bool)` + +GetAutomatedUnnullingAtOk returns a tuple with the AutomatedUnnullingAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutomatedUnnullingAt + +`func (o *NullRouteIPOpts) SetAutomatedUnnullingAt(v time.Time)` + +SetAutomatedUnnullingAt sets AutomatedUnnullingAt field to given value. + +### HasAutomatedUnnullingAt + +`func (o *NullRouteIPOpts) HasAutomatedUnnullingAt() bool` + +HasAutomatedUnnullingAt returns a boolean if a field has been set. + +### GetComment + +`func (o *NullRouteIPOpts) GetComment() string` + +GetComment returns the Comment field if non-nil, zero value otherwise. + +### GetCommentOk + +`func (o *NullRouteIPOpts) GetCommentOk() (*string, bool)` + +GetCommentOk returns a tuple with the Comment field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComment + +`func (o *NullRouteIPOpts) SetComment(v string)` + +SetComment sets Comment field to given value. + +### HasComment + +`func (o *NullRouteIPOpts) HasComment() bool` + +HasComment returns a boolean if a field has been set. + +### GetTicketId + +`func (o *NullRouteIPOpts) GetTicketId() string` + +GetTicketId returns the TicketId field if non-nil, zero value otherwise. + +### GetTicketIdOk + +`func (o *NullRouteIPOpts) GetTicketIdOk() (*string, bool)` + +GetTicketIdOk returns a tuple with the TicketId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTicketId + +`func (o *NullRouteIPOpts) SetTicketId(v string)` + +SetTicketId sets TicketId field to given value. + +### HasTicketId + +`func (o *NullRouteIPOpts) HasTicketId() bool` + +HasTicketId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/NullRoutedIP.md b/ips/docs/NullRoutedIP.md new file mode 100644 index 0000000..ee47083 --- /dev/null +++ b/ips/docs/NullRoutedIP.md @@ -0,0 +1,342 @@ +# NullRoutedIP + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Null route ID | +**Ip** | **string** | IP address | +**NulledAt** | **time.Time** | Null route date in UTC in format yyyy-mm-ddThh:mm:ssZ | +**NulledBy** | **string** | Email address of the user who created the null route or 'LeaseWeb' if null route was created by LeaseWeb. | +**NullLevel** | **int32** | Null route permission level. If greater than 1 then the null route can only be removed by LeaseWeb. | [default to 0] +**AutomatedUnnullingAt** | **NullableTime** | The date and time when the null route is to be automatically removed. | +**UnnulledAt** | **NullableTime** | The date and time when the null route has been removed. If null then the null route is still active. | +**UnnulledBy** | **NullableString** | Email address of the user who removed the null route or 'LeaseWeb' if null route was removed by LeaseWeb. | +**TicketId** | **NullableString** | Reference stored with the null route. | +**Comment** | **NullableString** | Comment stored with the null route. | +**EquipmentId** | **string** | ID of the equipment which was assigned to the IP at the time of null route creation. | +**AssignedContract** | [**NullableAssignedContract**](AssignedContract.md) | | + +## Methods + +### NewNullRoutedIP + +`func NewNullRoutedIP(id string, ip string, nulledAt time.Time, nulledBy string, nullLevel int32, automatedUnnullingAt NullableTime, unnulledAt NullableTime, unnulledBy NullableString, ticketId NullableString, comment NullableString, equipmentId string, assignedContract NullableAssignedContract, ) *NullRoutedIP` + +NewNullRoutedIP instantiates a new NullRoutedIP object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNullRoutedIPWithDefaults + +`func NewNullRoutedIPWithDefaults() *NullRoutedIP` + +NewNullRoutedIPWithDefaults instantiates a new NullRoutedIP object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *NullRoutedIP) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NullRoutedIP) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NullRoutedIP) SetId(v string)` + +SetId sets Id field to given value. + + +### GetIp + +`func (o *NullRoutedIP) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *NullRoutedIP) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *NullRoutedIP) SetIp(v string)` + +SetIp sets Ip field to given value. + + +### GetNulledAt + +`func (o *NullRoutedIP) GetNulledAt() time.Time` + +GetNulledAt returns the NulledAt field if non-nil, zero value otherwise. + +### GetNulledAtOk + +`func (o *NullRoutedIP) GetNulledAtOk() (*time.Time, bool)` + +GetNulledAtOk returns a tuple with the NulledAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNulledAt + +`func (o *NullRoutedIP) SetNulledAt(v time.Time)` + +SetNulledAt sets NulledAt field to given value. + + +### GetNulledBy + +`func (o *NullRoutedIP) GetNulledBy() string` + +GetNulledBy returns the NulledBy field if non-nil, zero value otherwise. + +### GetNulledByOk + +`func (o *NullRoutedIP) GetNulledByOk() (*string, bool)` + +GetNulledByOk returns a tuple with the NulledBy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNulledBy + +`func (o *NullRoutedIP) SetNulledBy(v string)` + +SetNulledBy sets NulledBy field to given value. + + +### GetNullLevel + +`func (o *NullRoutedIP) GetNullLevel() int32` + +GetNullLevel returns the NullLevel field if non-nil, zero value otherwise. + +### GetNullLevelOk + +`func (o *NullRoutedIP) GetNullLevelOk() (*int32, bool)` + +GetNullLevelOk returns a tuple with the NullLevel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNullLevel + +`func (o *NullRoutedIP) SetNullLevel(v int32)` + +SetNullLevel sets NullLevel field to given value. + + +### GetAutomatedUnnullingAt + +`func (o *NullRoutedIP) GetAutomatedUnnullingAt() time.Time` + +GetAutomatedUnnullingAt returns the AutomatedUnnullingAt field if non-nil, zero value otherwise. + +### GetAutomatedUnnullingAtOk + +`func (o *NullRoutedIP) GetAutomatedUnnullingAtOk() (*time.Time, bool)` + +GetAutomatedUnnullingAtOk returns a tuple with the AutomatedUnnullingAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutomatedUnnullingAt + +`func (o *NullRoutedIP) SetAutomatedUnnullingAt(v time.Time)` + +SetAutomatedUnnullingAt sets AutomatedUnnullingAt field to given value. + + +### SetAutomatedUnnullingAtNil + +`func (o *NullRoutedIP) SetAutomatedUnnullingAtNil(b bool)` + + SetAutomatedUnnullingAtNil sets the value for AutomatedUnnullingAt to be an explicit nil + +### UnsetAutomatedUnnullingAt +`func (o *NullRoutedIP) UnsetAutomatedUnnullingAt()` + +UnsetAutomatedUnnullingAt ensures that no value is present for AutomatedUnnullingAt, not even an explicit nil +### GetUnnulledAt + +`func (o *NullRoutedIP) GetUnnulledAt() time.Time` + +GetUnnulledAt returns the UnnulledAt field if non-nil, zero value otherwise. + +### GetUnnulledAtOk + +`func (o *NullRoutedIP) GetUnnulledAtOk() (*time.Time, bool)` + +GetUnnulledAtOk returns a tuple with the UnnulledAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUnnulledAt + +`func (o *NullRoutedIP) SetUnnulledAt(v time.Time)` + +SetUnnulledAt sets UnnulledAt field to given value. + + +### SetUnnulledAtNil + +`func (o *NullRoutedIP) SetUnnulledAtNil(b bool)` + + SetUnnulledAtNil sets the value for UnnulledAt to be an explicit nil + +### UnsetUnnulledAt +`func (o *NullRoutedIP) UnsetUnnulledAt()` + +UnsetUnnulledAt ensures that no value is present for UnnulledAt, not even an explicit nil +### GetUnnulledBy + +`func (o *NullRoutedIP) GetUnnulledBy() string` + +GetUnnulledBy returns the UnnulledBy field if non-nil, zero value otherwise. + +### GetUnnulledByOk + +`func (o *NullRoutedIP) GetUnnulledByOk() (*string, bool)` + +GetUnnulledByOk returns a tuple with the UnnulledBy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUnnulledBy + +`func (o *NullRoutedIP) SetUnnulledBy(v string)` + +SetUnnulledBy sets UnnulledBy field to given value. + + +### SetUnnulledByNil + +`func (o *NullRoutedIP) SetUnnulledByNil(b bool)` + + SetUnnulledByNil sets the value for UnnulledBy to be an explicit nil + +### UnsetUnnulledBy +`func (o *NullRoutedIP) UnsetUnnulledBy()` + +UnsetUnnulledBy ensures that no value is present for UnnulledBy, not even an explicit nil +### GetTicketId + +`func (o *NullRoutedIP) GetTicketId() string` + +GetTicketId returns the TicketId field if non-nil, zero value otherwise. + +### GetTicketIdOk + +`func (o *NullRoutedIP) GetTicketIdOk() (*string, bool)` + +GetTicketIdOk returns a tuple with the TicketId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTicketId + +`func (o *NullRoutedIP) SetTicketId(v string)` + +SetTicketId sets TicketId field to given value. + + +### SetTicketIdNil + +`func (o *NullRoutedIP) SetTicketIdNil(b bool)` + + SetTicketIdNil sets the value for TicketId to be an explicit nil + +### UnsetTicketId +`func (o *NullRoutedIP) UnsetTicketId()` + +UnsetTicketId ensures that no value is present for TicketId, not even an explicit nil +### GetComment + +`func (o *NullRoutedIP) GetComment() string` + +GetComment returns the Comment field if non-nil, zero value otherwise. + +### GetCommentOk + +`func (o *NullRoutedIP) GetCommentOk() (*string, bool)` + +GetCommentOk returns a tuple with the Comment field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComment + +`func (o *NullRoutedIP) SetComment(v string)` + +SetComment sets Comment field to given value. + + +### SetCommentNil + +`func (o *NullRoutedIP) SetCommentNil(b bool)` + + SetCommentNil sets the value for Comment to be an explicit nil + +### UnsetComment +`func (o *NullRoutedIP) UnsetComment()` + +UnsetComment ensures that no value is present for Comment, not even an explicit nil +### GetEquipmentId + +`func (o *NullRoutedIP) GetEquipmentId() string` + +GetEquipmentId returns the EquipmentId field if non-nil, zero value otherwise. + +### GetEquipmentIdOk + +`func (o *NullRoutedIP) GetEquipmentIdOk() (*string, bool)` + +GetEquipmentIdOk returns a tuple with the EquipmentId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEquipmentId + +`func (o *NullRoutedIP) SetEquipmentId(v string)` + +SetEquipmentId sets EquipmentId field to given value. + + +### GetAssignedContract + +`func (o *NullRoutedIP) GetAssignedContract() AssignedContract` + +GetAssignedContract returns the AssignedContract field if non-nil, zero value otherwise. + +### GetAssignedContractOk + +`func (o *NullRoutedIP) GetAssignedContractOk() (*AssignedContract, bool)` + +GetAssignedContractOk returns a tuple with the AssignedContract field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAssignedContract + +`func (o *NullRoutedIP) SetAssignedContract(v AssignedContract)` + +SetAssignedContract sets AssignedContract field to given value. + + +### SetAssignedContractNil + +`func (o *NullRoutedIP) SetAssignedContractNil(b bool)` + + SetAssignedContractNil sets the value for AssignedContract to be an explicit nil + +### UnsetAssignedContract +`func (o *NullRoutedIP) UnsetAssignedContract()` + +UnsetAssignedContract ensures that no value is present for AssignedContract, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/ProtocolVersion.md b/ips/docs/ProtocolVersion.md new file mode 100644 index 0000000..c28d098 --- /dev/null +++ b/ips/docs/ProtocolVersion.md @@ -0,0 +1,13 @@ +# ProtocolVersion + +## Enum + + +* `_4` (value: `4`) + +* `_6` (value: `6`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/ReverseLookup.md b/ips/docs/ReverseLookup.md new file mode 100644 index 0000000..c1c3868 --- /dev/null +++ b/ips/docs/ReverseLookup.md @@ -0,0 +1,82 @@ +# ReverseLookup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Ip** | **string** | IP address | +**ReverseLookup** | **NullableString** | Reverse lookup value | + +## Methods + +### NewReverseLookup + +`func NewReverseLookup(ip string, reverseLookup NullableString, ) *ReverseLookup` + +NewReverseLookup instantiates a new ReverseLookup object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewReverseLookupWithDefaults + +`func NewReverseLookupWithDefaults() *ReverseLookup` + +NewReverseLookupWithDefaults instantiates a new ReverseLookup object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIp + +`func (o *ReverseLookup) GetIp() string` + +GetIp returns the Ip field if non-nil, zero value otherwise. + +### GetIpOk + +`func (o *ReverseLookup) GetIpOk() (*string, bool)` + +GetIpOk returns a tuple with the Ip field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIp + +`func (o *ReverseLookup) SetIp(v string)` + +SetIp sets Ip field to given value. + + +### GetReverseLookup + +`func (o *ReverseLookup) GetReverseLookup() string` + +GetReverseLookup returns the ReverseLookup field if non-nil, zero value otherwise. + +### GetReverseLookupOk + +`func (o *ReverseLookup) GetReverseLookupOk() (*string, bool)` + +GetReverseLookupOk returns a tuple with the ReverseLookup field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReverseLookup + +`func (o *ReverseLookup) SetReverseLookup(v string)` + +SetReverseLookup sets ReverseLookup field to given value. + + +### SetReverseLookupNil + +`func (o *ReverseLookup) SetReverseLookupNil(b bool)` + + SetReverseLookupNil sets the value for ReverseLookup to be an explicit nil + +### UnsetReverseLookup +`func (o *ReverseLookup) UnsetReverseLookup()` + +UnsetReverseLookup ensures that no value is present for ReverseLookup, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/Subnet.md b/ips/docs/Subnet.md new file mode 100644 index 0000000..233518f --- /dev/null +++ b/ips/docs/Subnet.md @@ -0,0 +1,114 @@ +# Subnet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | Subnet identifier consisting of network IP and prefix length separated by underscore (e.g. 192.0.2.0_24) | +**NetworkIp** | **string** | Network IP of the subnet | +**PrefixLength** | **int32** | Address prefix length | [default to 0] +**Gateway** | **string** | The gateway IP to be used in network settings | + +## Methods + +### NewSubnet + +`func NewSubnet(id string, networkIp string, prefixLength int32, gateway string, ) *Subnet` + +NewSubnet instantiates a new Subnet object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewSubnetWithDefaults + +`func NewSubnetWithDefaults() *Subnet` + +NewSubnetWithDefaults instantiates a new Subnet object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *Subnet) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *Subnet) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *Subnet) SetId(v string)` + +SetId sets Id field to given value. + + +### GetNetworkIp + +`func (o *Subnet) GetNetworkIp() string` + +GetNetworkIp returns the NetworkIp field if non-nil, zero value otherwise. + +### GetNetworkIpOk + +`func (o *Subnet) GetNetworkIpOk() (*string, bool)` + +GetNetworkIpOk returns a tuple with the NetworkIp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetworkIp + +`func (o *Subnet) SetNetworkIp(v string)` + +SetNetworkIp sets NetworkIp field to given value. + + +### GetPrefixLength + +`func (o *Subnet) GetPrefixLength() int32` + +GetPrefixLength returns the PrefixLength field if non-nil, zero value otherwise. + +### GetPrefixLengthOk + +`func (o *Subnet) GetPrefixLengthOk() (*int32, bool)` + +GetPrefixLengthOk returns a tuple with the PrefixLength field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPrefixLength + +`func (o *Subnet) SetPrefixLength(v int32)` + +SetPrefixLength sets PrefixLength field to given value. + + +### GetGateway + +`func (o *Subnet) GetGateway() string` + +GetGateway returns the Gateway field if non-nil, zero value otherwise. + +### GetGatewayOk + +`func (o *Subnet) GetGatewayOk() (*string, bool)` + +GetGatewayOk returns a tuple with the Gateway field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGateway + +`func (o *Subnet) SetGateway(v string)` + +SetGateway sets Gateway field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/UpdateIPOpts.md b/ips/docs/UpdateIPOpts.md new file mode 100644 index 0000000..5734976 --- /dev/null +++ b/ips/docs/UpdateIPOpts.md @@ -0,0 +1,51 @@ +# UpdateIPOpts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ReverseLookup** | **string** | | + +## Methods + +### NewUpdateIPOpts + +`func NewUpdateIPOpts(reverseLookup string, ) *UpdateIPOpts` + +NewUpdateIPOpts instantiates a new UpdateIPOpts object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUpdateIPOptsWithDefaults + +`func NewUpdateIPOptsWithDefaults() *UpdateIPOpts` + +NewUpdateIPOptsWithDefaults instantiates a new UpdateIPOpts object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetReverseLookup + +`func (o *UpdateIPOpts) GetReverseLookup() string` + +GetReverseLookup returns the ReverseLookup field if non-nil, zero value otherwise. + +### GetReverseLookupOk + +`func (o *UpdateIPOpts) GetReverseLookupOk() (*string, bool)` + +GetReverseLookupOk returns a tuple with the ReverseLookup field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReverseLookup + +`func (o *UpdateIPOpts) SetReverseLookup(v string)` + +SetReverseLookup sets ReverseLookup field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/UpdateNullRouteOpts.md b/ips/docs/UpdateNullRouteOpts.md new file mode 100644 index 0000000..daf1d84 --- /dev/null +++ b/ips/docs/UpdateNullRouteOpts.md @@ -0,0 +1,108 @@ +# UpdateNullRouteOpts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AutomatedUnnullingAt** | Pointer to **time.Time** | The date and time when the null route is to be deactivated. The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field is not present then the null route will not be automatically removed. | [optional] +**Comment** | Pointer to **string** | A comment to be stored with the null route (e.g. null route reason) | [optional] +**TicketId** | Pointer to **string** | A reference to be stored with the null route | [optional] + +## Methods + +### NewUpdateNullRouteOpts + +`func NewUpdateNullRouteOpts() *UpdateNullRouteOpts` + +NewUpdateNullRouteOpts instantiates a new UpdateNullRouteOpts object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUpdateNullRouteOptsWithDefaults + +`func NewUpdateNullRouteOptsWithDefaults() *UpdateNullRouteOpts` + +NewUpdateNullRouteOptsWithDefaults instantiates a new UpdateNullRouteOpts object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAutomatedUnnullingAt + +`func (o *UpdateNullRouteOpts) GetAutomatedUnnullingAt() time.Time` + +GetAutomatedUnnullingAt returns the AutomatedUnnullingAt field if non-nil, zero value otherwise. + +### GetAutomatedUnnullingAtOk + +`func (o *UpdateNullRouteOpts) GetAutomatedUnnullingAtOk() (*time.Time, bool)` + +GetAutomatedUnnullingAtOk returns a tuple with the AutomatedUnnullingAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAutomatedUnnullingAt + +`func (o *UpdateNullRouteOpts) SetAutomatedUnnullingAt(v time.Time)` + +SetAutomatedUnnullingAt sets AutomatedUnnullingAt field to given value. + +### HasAutomatedUnnullingAt + +`func (o *UpdateNullRouteOpts) HasAutomatedUnnullingAt() bool` + +HasAutomatedUnnullingAt returns a boolean if a field has been set. + +### GetComment + +`func (o *UpdateNullRouteOpts) GetComment() string` + +GetComment returns the Comment field if non-nil, zero value otherwise. + +### GetCommentOk + +`func (o *UpdateNullRouteOpts) GetCommentOk() (*string, bool)` + +GetCommentOk returns a tuple with the Comment field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComment + +`func (o *UpdateNullRouteOpts) SetComment(v string)` + +SetComment sets Comment field to given value. + +### HasComment + +`func (o *UpdateNullRouteOpts) HasComment() bool` + +HasComment returns a boolean if a field has been set. + +### GetTicketId + +`func (o *UpdateNullRouteOpts) GetTicketId() string` + +GetTicketId returns the TicketId field if non-nil, zero value otherwise. + +### GetTicketIdOk + +`func (o *UpdateNullRouteOpts) GetTicketIdOk() (*string, bool)` + +GetTicketIdOk returns a tuple with the TicketId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTicketId + +`func (o *UpdateNullRouteOpts) SetTicketId(v string)` + +SetTicketId sets TicketId field to given value. + +### HasTicketId + +`func (o *UpdateNullRouteOpts) HasTicketId() bool` + +HasTicketId returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/UpdateReverseLookupRecordsOpts.md b/ips/docs/UpdateReverseLookupRecordsOpts.md new file mode 100644 index 0000000..6da1dd4 --- /dev/null +++ b/ips/docs/UpdateReverseLookupRecordsOpts.md @@ -0,0 +1,51 @@ +# UpdateReverseLookupRecordsOpts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ReverseLookups** | [**[]ReverseLookup**](ReverseLookup.md) | | + +## Methods + +### NewUpdateReverseLookupRecordsOpts + +`func NewUpdateReverseLookupRecordsOpts(reverseLookups []ReverseLookup, ) *UpdateReverseLookupRecordsOpts` + +NewUpdateReverseLookupRecordsOpts instantiates a new UpdateReverseLookupRecordsOpts object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUpdateReverseLookupRecordsOptsWithDefaults + +`func NewUpdateReverseLookupRecordsOptsWithDefaults() *UpdateReverseLookupRecordsOpts` + +NewUpdateReverseLookupRecordsOptsWithDefaults instantiates a new UpdateReverseLookupRecordsOpts object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetReverseLookups + +`func (o *UpdateReverseLookupRecordsOpts) GetReverseLookups() []ReverseLookup` + +GetReverseLookups returns the ReverseLookups field if non-nil, zero value otherwise. + +### GetReverseLookupsOk + +`func (o *UpdateReverseLookupRecordsOpts) GetReverseLookupsOk() (*[]ReverseLookup, bool)` + +GetReverseLookupsOk returns a tuple with the ReverseLookups field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReverseLookups + +`func (o *UpdateReverseLookupRecordsOpts) SetReverseLookups(v []ReverseLookup)` + +SetReverseLookups sets ReverseLookups field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/docs/UpdateReverseLookupRecordsResult.md b/ips/docs/UpdateReverseLookupRecordsResult.md new file mode 100644 index 0000000..86d45d2 --- /dev/null +++ b/ips/docs/UpdateReverseLookupRecordsResult.md @@ -0,0 +1,51 @@ +# UpdateReverseLookupRecordsResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ReverseLookups** | [**[]ReverseLookup**](ReverseLookup.md) | | + +## Methods + +### NewUpdateReverseLookupRecordsResult + +`func NewUpdateReverseLookupRecordsResult(reverseLookups []ReverseLookup, ) *UpdateReverseLookupRecordsResult` + +NewUpdateReverseLookupRecordsResult instantiates a new UpdateReverseLookupRecordsResult object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUpdateReverseLookupRecordsResultWithDefaults + +`func NewUpdateReverseLookupRecordsResultWithDefaults() *UpdateReverseLookupRecordsResult` + +NewUpdateReverseLookupRecordsResultWithDefaults instantiates a new UpdateReverseLookupRecordsResult object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetReverseLookups + +`func (o *UpdateReverseLookupRecordsResult) GetReverseLookups() []ReverseLookup` + +GetReverseLookups returns the ReverseLookups field if non-nil, zero value otherwise. + +### GetReverseLookupsOk + +`func (o *UpdateReverseLookupRecordsResult) GetReverseLookupsOk() (*[]ReverseLookup, bool)` + +GetReverseLookupsOk returns a tuple with the ReverseLookups field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReverseLookups + +`func (o *UpdateReverseLookupRecordsResult) SetReverseLookups(v []ReverseLookup)` + +SetReverseLookups sets ReverseLookups field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/ips/git_push.sh b/ips/git_push.sh new file mode 100644 index 0000000..94889a3 --- /dev/null +++ b/ips/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="leaseweb" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="leaseweb-go-sdk" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/ips/go.mod b/ips/go.mod new file mode 100644 index 0000000..1fc7074 --- /dev/null +++ b/ips/go.mod @@ -0,0 +1,6 @@ +module github.com/leaseweb/leaseweb-go-sdk/ips + +go 1.18 + +require ( +) diff --git a/ips/go.sum b/ips/go.sum new file mode 100644 index 0000000..c966c8d --- /dev/null +++ b/ips/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/ips/model__metadata.go b/ips/model__metadata.go new file mode 100644 index 0000000..4b9ab52 --- /dev/null +++ b/ips/model__metadata.go @@ -0,0 +1,233 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the Metadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Metadata{} + +// Metadata Metadata about the collection +type Metadata struct { + // Total amount of elements in this collection + TotalCount int32 `json:"totalCount"` + // The offset used to generate this response + Offset int32 `json:"offset"` + // The limit used to generate this response + Limit int32 `json:"limit"` + AdditionalProperties map[string]interface{} +} + +type _Metadata Metadata + +// NewMetadata instantiates a new Metadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMetadata(totalCount int32, offset int32, limit int32) *Metadata { + this := Metadata{} + this.TotalCount = totalCount + this.Offset = offset + this.Limit = limit + return &this +} + +// NewMetadataWithDefaults instantiates a new Metadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMetadataWithDefaults() *Metadata { + this := Metadata{} + var offset int32 = 0 + this.Offset = offset + var limit int32 = 5 + this.Limit = limit + return &this +} + +// GetTotalCount returns the TotalCount field value +func (o *Metadata) GetTotalCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value +// and a boolean to check if the value has been set. +func (o *Metadata) GetTotalCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalCount, true +} + +// SetTotalCount sets field value +func (o *Metadata) SetTotalCount(v int32) { + o.TotalCount = v +} + +// GetOffset returns the Offset field value +func (o *Metadata) GetOffset() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +func (o *Metadata) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Offset, true +} + +// SetOffset sets field value +func (o *Metadata) SetOffset(v int32) { + o.Offset = v +} + +// GetLimit returns the Limit field value +func (o *Metadata) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *Metadata) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *Metadata) SetLimit(v int32) { + o.Limit = v +} + +func (o Metadata) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Metadata) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["totalCount"] = o.TotalCount + toSerialize["offset"] = o.Offset + toSerialize["limit"] = o.Limit + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Metadata) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "totalCount", + "offset", + "limit", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varMetadata := _Metadata{} + + err = json.Unmarshal(data, &varMetadata) + + if err != nil { + return err + } + + *o = Metadata(varMetadata) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "totalCount") + delete(additionalProperties, "offset") + delete(additionalProperties, "limit") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMetadata struct { + value *Metadata + isSet bool +} + +func (v NullableMetadata) Get() *Metadata { + return v.value +} + +func (v *NullableMetadata) Set(val *Metadata) { + v.value = val + v.isSet = true +} + +func (v NullableMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadata(val *Metadata) *NullableMetadata { + return &NullableMetadata{value: val, isSet: true} +} + +func (v NullableMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_assigned_contract.go b/ips/model_assigned_contract.go new file mode 100644 index 0000000..5093dcd --- /dev/null +++ b/ips/model_assigned_contract.go @@ -0,0 +1,169 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the AssignedContract type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AssignedContract{} + +// AssignedContract An explanation about the purpose of this instance. +type AssignedContract struct { + // ID of the contract connected to the IP. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _AssignedContract AssignedContract + +// NewAssignedContract instantiates a new AssignedContract object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAssignedContract(id string) *AssignedContract { + this := AssignedContract{} + this.Id = id + return &this +} + +// NewAssignedContractWithDefaults instantiates a new AssignedContract object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAssignedContractWithDefaults() *AssignedContract { + this := AssignedContract{} + return &this +} + +// GetId returns the Id field value +func (o *AssignedContract) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AssignedContract) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AssignedContract) SetId(v string) { + o.Id = v +} + +func (o AssignedContract) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AssignedContract) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AssignedContract) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAssignedContract := _AssignedContract{} + + err = json.Unmarshal(data, &varAssignedContract) + + if err != nil { + return err + } + + *o = AssignedContract(varAssignedContract) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAssignedContract struct { + value *AssignedContract + isSet bool +} + +func (v NullableAssignedContract) Get() *AssignedContract { + return v.value +} + +func (v *NullableAssignedContract) Set(val *AssignedContract) { + v.value = val + v.isSet = true +} + +func (v NullableAssignedContract) IsSet() bool { + return v.isSet +} + +func (v *NullableAssignedContract) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAssignedContract(val *AssignedContract) *NullableAssignedContract { + return &NullableAssignedContract{value: val, isSet: true} +} + +func (v NullableAssignedContract) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAssignedContract) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_error_result.go b/ips/model_error_result.go new file mode 100644 index 0000000..a6311a8 --- /dev/null +++ b/ips/model_error_result.go @@ -0,0 +1,269 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" +) + +// checks if the ErrorResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResult{} + +// ErrorResult struct for ErrorResult +type ErrorResult struct { + // The correlation ID of the current request. + CorrelationId *string `json:"correlationId,omitempty"` + // The error code. + ErrorCode *string `json:"errorCode,omitempty"` + // A human friendly description of the error. + ErrorMessage *string `json:"errorMessage,omitempty"` + ErrorDetails *map[string][]string `json:"errorDetails,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ErrorResult ErrorResult + +// NewErrorResult instantiates a new ErrorResult object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorResult() *ErrorResult { + this := ErrorResult{} + return &this +} + +// NewErrorResultWithDefaults instantiates a new ErrorResult object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorResultWithDefaults() *ErrorResult { + this := ErrorResult{} + return &this +} + +// GetCorrelationId returns the CorrelationId field value if set, zero value otherwise. +func (o *ErrorResult) GetCorrelationId() string { + if o == nil || IsNil(o.CorrelationId) { + var ret string + return ret + } + return *o.CorrelationId +} + +// GetCorrelationIdOk returns a tuple with the CorrelationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResult) GetCorrelationIdOk() (*string, bool) { + if o == nil || IsNil(o.CorrelationId) { + return nil, false + } + return o.CorrelationId, true +} + +// HasCorrelationId returns a boolean if a field has been set. +func (o *ErrorResult) HasCorrelationId() bool { + if o != nil && !IsNil(o.CorrelationId) { + return true + } + + return false +} + +// SetCorrelationId gets a reference to the given string and assigns it to the CorrelationId field. +func (o *ErrorResult) SetCorrelationId(v string) { + o.CorrelationId = &v +} + +// GetErrorCode returns the ErrorCode field value if set, zero value otherwise. +func (o *ErrorResult) GetErrorCode() string { + if o == nil || IsNil(o.ErrorCode) { + var ret string + return ret + } + return *o.ErrorCode +} + +// GetErrorCodeOk returns a tuple with the ErrorCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResult) GetErrorCodeOk() (*string, bool) { + if o == nil || IsNil(o.ErrorCode) { + return nil, false + } + return o.ErrorCode, true +} + +// HasErrorCode returns a boolean if a field has been set. +func (o *ErrorResult) HasErrorCode() bool { + if o != nil && !IsNil(o.ErrorCode) { + return true + } + + return false +} + +// SetErrorCode gets a reference to the given string and assigns it to the ErrorCode field. +func (o *ErrorResult) SetErrorCode(v string) { + o.ErrorCode = &v +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *ErrorResult) GetErrorMessage() string { + if o == nil || IsNil(o.ErrorMessage) { + var ret string + return ret + } + return *o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResult) GetErrorMessageOk() (*string, bool) { + if o == nil || IsNil(o.ErrorMessage) { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *ErrorResult) HasErrorMessage() bool { + if o != nil && !IsNil(o.ErrorMessage) { + return true + } + + return false +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *ErrorResult) SetErrorMessage(v string) { + o.ErrorMessage = &v +} + +// GetErrorDetails returns the ErrorDetails field value if set, zero value otherwise. +func (o *ErrorResult) GetErrorDetails() map[string][]string { + if o == nil || IsNil(o.ErrorDetails) { + var ret map[string][]string + return ret + } + return *o.ErrorDetails +} + +// GetErrorDetailsOk returns a tuple with the ErrorDetails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResult) GetErrorDetailsOk() (*map[string][]string, bool) { + if o == nil || IsNil(o.ErrorDetails) { + return nil, false + } + return o.ErrorDetails, true +} + +// HasErrorDetails returns a boolean if a field has been set. +func (o *ErrorResult) HasErrorDetails() bool { + if o != nil && !IsNil(o.ErrorDetails) { + return true + } + + return false +} + +// SetErrorDetails gets a reference to the given map[string][]string and assigns it to the ErrorDetails field. +func (o *ErrorResult) SetErrorDetails(v map[string][]string) { + o.ErrorDetails = &v +} + +func (o ErrorResult) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CorrelationId) { + toSerialize["correlationId"] = o.CorrelationId + } + if !IsNil(o.ErrorCode) { + toSerialize["errorCode"] = o.ErrorCode + } + if !IsNil(o.ErrorMessage) { + toSerialize["errorMessage"] = o.ErrorMessage + } + if !IsNil(o.ErrorDetails) { + toSerialize["errorDetails"] = o.ErrorDetails + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ErrorResult) UnmarshalJSON(data []byte) (err error) { + varErrorResult := _ErrorResult{} + + err = json.Unmarshal(data, &varErrorResult) + + if err != nil { + return err + } + + *o = ErrorResult(varErrorResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "correlationId") + delete(additionalProperties, "errorCode") + delete(additionalProperties, "errorMessage") + delete(additionalProperties, "errorDetails") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableErrorResult struct { + value *ErrorResult + isSet bool +} + +func (v NullableErrorResult) Get() *ErrorResult { + return v.value +} + +func (v *NullableErrorResult) Set(val *ErrorResult) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResult) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResult(val *ErrorResult) *NullableErrorResult { + return &NullableErrorResult{value: val, isSet: true} +} + +func (v NullableErrorResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_get_ip_list_result.go b/ips/model_get_ip_list_result.go new file mode 100644 index 0000000..cddda56 --- /dev/null +++ b/ips/model_get_ip_list_result.go @@ -0,0 +1,197 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetIPListResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetIPListResult{} + +// GetIPListResult struct for GetIPListResult +type GetIPListResult struct { + Ips []Ip `json:"ips"` + Metadata Metadata `json:"_metadata"` + AdditionalProperties map[string]interface{} +} + +type _GetIPListResult GetIPListResult + +// NewGetIPListResult instantiates a new GetIPListResult object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetIPListResult(ips []Ip, metadata Metadata) *GetIPListResult { + this := GetIPListResult{} + this.Ips = ips + this.Metadata = metadata + return &this +} + +// NewGetIPListResultWithDefaults instantiates a new GetIPListResult object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetIPListResultWithDefaults() *GetIPListResult { + this := GetIPListResult{} + return &this +} + +// GetIps returns the Ips field value +func (o *GetIPListResult) GetIps() []Ip { + if o == nil { + var ret []Ip + return ret + } + + return o.Ips +} + +// GetIpsOk returns a tuple with the Ips field value +// and a boolean to check if the value has been set. +func (o *GetIPListResult) GetIpsOk() ([]Ip, bool) { + if o == nil { + return nil, false + } + return o.Ips, true +} + +// SetIps sets field value +func (o *GetIPListResult) SetIps(v []Ip) { + o.Ips = v +} + +// GetMetadata returns the Metadata field value +func (o *GetIPListResult) GetMetadata() Metadata { + if o == nil { + var ret Metadata + return ret + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +func (o *GetIPListResult) GetMetadataOk() (*Metadata, bool) { + if o == nil { + return nil, false + } + return &o.Metadata, true +} + +// SetMetadata sets field value +func (o *GetIPListResult) SetMetadata(v Metadata) { + o.Metadata = v +} + +func (o GetIPListResult) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetIPListResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ips"] = o.Ips + toSerialize["_metadata"] = o.Metadata + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetIPListResult) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "ips", + "_metadata", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetIPListResult := _GetIPListResult{} + + err = json.Unmarshal(data, &varGetIPListResult) + + if err != nil { + return err + } + + *o = GetIPListResult(varGetIPListResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ips") + delete(additionalProperties, "_metadata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetIPListResult struct { + value *GetIPListResult + isSet bool +} + +func (v NullableGetIPListResult) Get() *GetIPListResult { + return v.value +} + +func (v *NullableGetIPListResult) Set(val *GetIPListResult) { + v.value = val + v.isSet = true +} + +func (v NullableGetIPListResult) IsSet() bool { + return v.isSet +} + +func (v *NullableGetIPListResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetIPListResult(val *GetIPListResult) *NullableGetIPListResult { + return &NullableGetIPListResult{value: val, isSet: true} +} + +func (v NullableGetIPListResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetIPListResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_get_null_route_history_list_result.go b/ips/model_get_null_route_history_list_result.go new file mode 100644 index 0000000..b5a6bed --- /dev/null +++ b/ips/model_get_null_route_history_list_result.go @@ -0,0 +1,197 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetNullRouteHistoryListResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetNullRouteHistoryListResult{} + +// GetNullRouteHistoryListResult struct for GetNullRouteHistoryListResult +type GetNullRouteHistoryListResult struct { + Nullroutes []NullRoutedIP `json:"nullroutes"` + Metadata Metadata `json:"_metadata"` + AdditionalProperties map[string]interface{} +} + +type _GetNullRouteHistoryListResult GetNullRouteHistoryListResult + +// NewGetNullRouteHistoryListResult instantiates a new GetNullRouteHistoryListResult object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetNullRouteHistoryListResult(nullroutes []NullRoutedIP, metadata Metadata) *GetNullRouteHistoryListResult { + this := GetNullRouteHistoryListResult{} + this.Nullroutes = nullroutes + this.Metadata = metadata + return &this +} + +// NewGetNullRouteHistoryListResultWithDefaults instantiates a new GetNullRouteHistoryListResult object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetNullRouteHistoryListResultWithDefaults() *GetNullRouteHistoryListResult { + this := GetNullRouteHistoryListResult{} + return &this +} + +// GetNullroutes returns the Nullroutes field value +func (o *GetNullRouteHistoryListResult) GetNullroutes() []NullRoutedIP { + if o == nil { + var ret []NullRoutedIP + return ret + } + + return o.Nullroutes +} + +// GetNullroutesOk returns a tuple with the Nullroutes field value +// and a boolean to check if the value has been set. +func (o *GetNullRouteHistoryListResult) GetNullroutesOk() ([]NullRoutedIP, bool) { + if o == nil { + return nil, false + } + return o.Nullroutes, true +} + +// SetNullroutes sets field value +func (o *GetNullRouteHistoryListResult) SetNullroutes(v []NullRoutedIP) { + o.Nullroutes = v +} + +// GetMetadata returns the Metadata field value +func (o *GetNullRouteHistoryListResult) GetMetadata() Metadata { + if o == nil { + var ret Metadata + return ret + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +func (o *GetNullRouteHistoryListResult) GetMetadataOk() (*Metadata, bool) { + if o == nil { + return nil, false + } + return &o.Metadata, true +} + +// SetMetadata sets field value +func (o *GetNullRouteHistoryListResult) SetMetadata(v Metadata) { + o.Metadata = v +} + +func (o GetNullRouteHistoryListResult) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetNullRouteHistoryListResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nullroutes"] = o.Nullroutes + toSerialize["_metadata"] = o.Metadata + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetNullRouteHistoryListResult) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "nullroutes", + "_metadata", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetNullRouteHistoryListResult := _GetNullRouteHistoryListResult{} + + err = json.Unmarshal(data, &varGetNullRouteHistoryListResult) + + if err != nil { + return err + } + + *o = GetNullRouteHistoryListResult(varGetNullRouteHistoryListResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nullroutes") + delete(additionalProperties, "_metadata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetNullRouteHistoryListResult struct { + value *GetNullRouteHistoryListResult + isSet bool +} + +func (v NullableGetNullRouteHistoryListResult) Get() *GetNullRouteHistoryListResult { + return v.value +} + +func (v *NullableGetNullRouteHistoryListResult) Set(val *GetNullRouteHistoryListResult) { + v.value = val + v.isSet = true +} + +func (v NullableGetNullRouteHistoryListResult) IsSet() bool { + return v.isSet +} + +func (v *NullableGetNullRouteHistoryListResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetNullRouteHistoryListResult(val *GetNullRouteHistoryListResult) *NullableGetNullRouteHistoryListResult { + return &NullableGetNullRouteHistoryListResult{value: val, isSet: true} +} + +func (v NullableGetNullRouteHistoryListResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetNullRouteHistoryListResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_get_reverse_lookup_record_list_result.go b/ips/model_get_reverse_lookup_record_list_result.go new file mode 100644 index 0000000..6a421e4 --- /dev/null +++ b/ips/model_get_reverse_lookup_record_list_result.go @@ -0,0 +1,197 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetReverseLookupRecordListResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetReverseLookupRecordListResult{} + +// GetReverseLookupRecordListResult Object containing a list of reverse lookup values set for ips in a specific range +type GetReverseLookupRecordListResult struct { + ReverseLookups []ReverseLookup `json:"reverseLookups"` + Metadata Metadata `json:"_metadata"` + AdditionalProperties map[string]interface{} +} + +type _GetReverseLookupRecordListResult GetReverseLookupRecordListResult + +// NewGetReverseLookupRecordListResult instantiates a new GetReverseLookupRecordListResult object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetReverseLookupRecordListResult(reverseLookups []ReverseLookup, metadata Metadata) *GetReverseLookupRecordListResult { + this := GetReverseLookupRecordListResult{} + this.ReverseLookups = reverseLookups + this.Metadata = metadata + return &this +} + +// NewGetReverseLookupRecordListResultWithDefaults instantiates a new GetReverseLookupRecordListResult object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetReverseLookupRecordListResultWithDefaults() *GetReverseLookupRecordListResult { + this := GetReverseLookupRecordListResult{} + return &this +} + +// GetReverseLookups returns the ReverseLookups field value +func (o *GetReverseLookupRecordListResult) GetReverseLookups() []ReverseLookup { + if o == nil { + var ret []ReverseLookup + return ret + } + + return o.ReverseLookups +} + +// GetReverseLookupsOk returns a tuple with the ReverseLookups field value +// and a boolean to check if the value has been set. +func (o *GetReverseLookupRecordListResult) GetReverseLookupsOk() ([]ReverseLookup, bool) { + if o == nil { + return nil, false + } + return o.ReverseLookups, true +} + +// SetReverseLookups sets field value +func (o *GetReverseLookupRecordListResult) SetReverseLookups(v []ReverseLookup) { + o.ReverseLookups = v +} + +// GetMetadata returns the Metadata field value +func (o *GetReverseLookupRecordListResult) GetMetadata() Metadata { + if o == nil { + var ret Metadata + return ret + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +func (o *GetReverseLookupRecordListResult) GetMetadataOk() (*Metadata, bool) { + if o == nil { + return nil, false + } + return &o.Metadata, true +} + +// SetMetadata sets field value +func (o *GetReverseLookupRecordListResult) SetMetadata(v Metadata) { + o.Metadata = v +} + +func (o GetReverseLookupRecordListResult) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetReverseLookupRecordListResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["reverseLookups"] = o.ReverseLookups + toSerialize["_metadata"] = o.Metadata + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetReverseLookupRecordListResult) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "reverseLookups", + "_metadata", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetReverseLookupRecordListResult := _GetReverseLookupRecordListResult{} + + err = json.Unmarshal(data, &varGetReverseLookupRecordListResult) + + if err != nil { + return err + } + + *o = GetReverseLookupRecordListResult(varGetReverseLookupRecordListResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "reverseLookups") + delete(additionalProperties, "_metadata") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetReverseLookupRecordListResult struct { + value *GetReverseLookupRecordListResult + isSet bool +} + +func (v NullableGetReverseLookupRecordListResult) Get() *GetReverseLookupRecordListResult { + return v.value +} + +func (v *NullableGetReverseLookupRecordListResult) Set(val *GetReverseLookupRecordListResult) { + v.value = val + v.isSet = true +} + +func (v NullableGetReverseLookupRecordListResult) IsSet() bool { + return v.isSet +} + +func (v *NullableGetReverseLookupRecordListResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetReverseLookupRecordListResult(val *GetReverseLookupRecordListResult) *NullableGetReverseLookupRecordListResult { + return &NullableGetReverseLookupRecordListResult{value: val, isSet: true} +} + +func (v NullableGetReverseLookupRecordListResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetReverseLookupRecordListResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_ip.go b/ips/model_ip.go new file mode 100644 index 0000000..63473ab --- /dev/null +++ b/ips/model_ip.go @@ -0,0 +1,509 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the Ip type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Ip{} + +// Ip struct for Ip +type Ip struct { + // IP address + Ip string `json:"ip"` + Version ProtocolVersion `json:"version"` + Type IpType `json:"type"` + // Prefix length of the IP range represented by the record. Note: this is not the same as `subnet.prefixLength`. + PrefixLength int32 `json:"prefixLength"` + // Boolean indicating if this is the primary IP of the assigned equipment + Primary bool `json:"primary"` + // Reverse lookup set for the IP. This only applies to IPv4. For IPv6 see [GET /ips/{ip}/reverseLookup](#operation/get/ips/{ip}/reverseLookup). + ReverseLookup NullableString `json:"reverseLookup"` + // Boolean to indicate if the IP is null-routed + NullRouted bool `json:"nullRouted"` + // Null route level + NullLevel NullableInt32 `json:"nullLevel"` + // Boolean indicating if the null route can be removed + UnnullingAllowed bool `json:"unnullingAllowed"` + // ID of the equipment using the IP + EquipmentId string `json:"equipmentId"` + AssignedContract NullableAssignedContract `json:"assignedContract"` + Subnet Subnet `json:"subnet"` + AdditionalProperties map[string]interface{} +} + +type _Ip Ip + +// NewIp instantiates a new Ip object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIp(ip string, version ProtocolVersion, type_ IpType, prefixLength int32, primary bool, reverseLookup NullableString, nullRouted bool, nullLevel NullableInt32, unnullingAllowed bool, equipmentId string, assignedContract NullableAssignedContract, subnet Subnet) *Ip { + this := Ip{} + this.Ip = ip + this.Version = version + this.Type = type_ + this.PrefixLength = prefixLength + this.Primary = primary + this.ReverseLookup = reverseLookup + this.NullRouted = nullRouted + this.NullLevel = nullLevel + this.UnnullingAllowed = unnullingAllowed + this.EquipmentId = equipmentId + this.AssignedContract = assignedContract + this.Subnet = subnet + return &this +} + +// NewIpWithDefaults instantiates a new Ip object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIpWithDefaults() *Ip { + this := Ip{} + var prefixLength int32 = 0 + this.PrefixLength = prefixLength + var nullRouted bool = false + this.NullRouted = nullRouted + var unnullingAllowed bool = false + this.UnnullingAllowed = unnullingAllowed + var subnet Subnet = {} + this.Subnet = subnet + return &this +} + +// GetIp returns the Ip field value +func (o *Ip) GetIp() string { + if o == nil { + var ret string + return ret + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +func (o *Ip) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Ip, true +} + +// SetIp sets field value +func (o *Ip) SetIp(v string) { + o.Ip = v +} + +// GetVersion returns the Version field value +func (o *Ip) GetVersion() ProtocolVersion { + if o == nil { + var ret ProtocolVersion + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *Ip) GetVersionOk() (*ProtocolVersion, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *Ip) SetVersion(v ProtocolVersion) { + o.Version = v +} + +// GetType returns the Type field value +func (o *Ip) GetType() IpType { + if o == nil { + var ret IpType + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Ip) GetTypeOk() (*IpType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *Ip) SetType(v IpType) { + o.Type = v +} + +// GetPrefixLength returns the PrefixLength field value +func (o *Ip) GetPrefixLength() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PrefixLength +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *Ip) GetPrefixLengthOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PrefixLength, true +} + +// SetPrefixLength sets field value +func (o *Ip) SetPrefixLength(v int32) { + o.PrefixLength = v +} + +// GetPrimary returns the Primary field value +func (o *Ip) GetPrimary() bool { + if o == nil { + var ret bool + return ret + } + + return o.Primary +} + +// GetPrimaryOk returns a tuple with the Primary field value +// and a boolean to check if the value has been set. +func (o *Ip) GetPrimaryOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Primary, true +} + +// SetPrimary sets field value +func (o *Ip) SetPrimary(v bool) { + o.Primary = v +} + +// GetReverseLookup returns the ReverseLookup field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Ip) GetReverseLookup() string { + if o == nil || o.ReverseLookup.Get() == nil { + var ret string + return ret + } + + return *o.ReverseLookup.Get() +} + +// GetReverseLookupOk returns a tuple with the ReverseLookup field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Ip) GetReverseLookupOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ReverseLookup.Get(), o.ReverseLookup.IsSet() +} + +// SetReverseLookup sets field value +func (o *Ip) SetReverseLookup(v string) { + o.ReverseLookup.Set(&v) +} + +// GetNullRouted returns the NullRouted field value +func (o *Ip) GetNullRouted() bool { + if o == nil { + var ret bool + return ret + } + + return o.NullRouted +} + +// GetNullRoutedOk returns a tuple with the NullRouted field value +// and a boolean to check if the value has been set. +func (o *Ip) GetNullRoutedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.NullRouted, true +} + +// SetNullRouted sets field value +func (o *Ip) SetNullRouted(v bool) { + o.NullRouted = v +} + +// GetNullLevel returns the NullLevel field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Ip) GetNullLevel() int32 { + if o == nil || o.NullLevel.Get() == nil { + var ret int32 + return ret + } + + return *o.NullLevel.Get() +} + +// GetNullLevelOk returns a tuple with the NullLevel field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Ip) GetNullLevelOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NullLevel.Get(), o.NullLevel.IsSet() +} + +// SetNullLevel sets field value +func (o *Ip) SetNullLevel(v int32) { + o.NullLevel.Set(&v) +} + +// GetUnnullingAllowed returns the UnnullingAllowed field value +func (o *Ip) GetUnnullingAllowed() bool { + if o == nil { + var ret bool + return ret + } + + return o.UnnullingAllowed +} + +// GetUnnullingAllowedOk returns a tuple with the UnnullingAllowed field value +// and a boolean to check if the value has been set. +func (o *Ip) GetUnnullingAllowedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.UnnullingAllowed, true +} + +// SetUnnullingAllowed sets field value +func (o *Ip) SetUnnullingAllowed(v bool) { + o.UnnullingAllowed = v +} + +// GetEquipmentId returns the EquipmentId field value +func (o *Ip) GetEquipmentId() string { + if o == nil { + var ret string + return ret + } + + return o.EquipmentId +} + +// GetEquipmentIdOk returns a tuple with the EquipmentId field value +// and a boolean to check if the value has been set. +func (o *Ip) GetEquipmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EquipmentId, true +} + +// SetEquipmentId sets field value +func (o *Ip) SetEquipmentId(v string) { + o.EquipmentId = v +} + +// GetAssignedContract returns the AssignedContract field value +// If the value is explicit nil, the zero value for AssignedContract will be returned +func (o *Ip) GetAssignedContract() AssignedContract { + if o == nil || o.AssignedContract.Get() == nil { + var ret AssignedContract + return ret + } + + return *o.AssignedContract.Get() +} + +// GetAssignedContractOk returns a tuple with the AssignedContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Ip) GetAssignedContractOk() (*AssignedContract, bool) { + if o == nil { + return nil, false + } + return o.AssignedContract.Get(), o.AssignedContract.IsSet() +} + +// SetAssignedContract sets field value +func (o *Ip) SetAssignedContract(v AssignedContract) { + o.AssignedContract.Set(&v) +} + +// GetSubnet returns the Subnet field value +func (o *Ip) GetSubnet() Subnet { + if o == nil { + var ret Subnet + return ret + } + + return o.Subnet +} + +// GetSubnetOk returns a tuple with the Subnet field value +// and a boolean to check if the value has been set. +func (o *Ip) GetSubnetOk() (*Subnet, bool) { + if o == nil { + return nil, false + } + return &o.Subnet, true +} + +// SetSubnet sets field value +func (o *Ip) SetSubnet(v Subnet) { + o.Subnet = v +} + +func (o Ip) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Ip) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ip"] = o.Ip + toSerialize["version"] = o.Version + toSerialize["type"] = o.Type + toSerialize["prefixLength"] = o.PrefixLength + toSerialize["primary"] = o.Primary + toSerialize["reverseLookup"] = o.ReverseLookup.Get() + toSerialize["nullRouted"] = o.NullRouted + toSerialize["nullLevel"] = o.NullLevel.Get() + toSerialize["unnullingAllowed"] = o.UnnullingAllowed + toSerialize["equipmentId"] = o.EquipmentId + toSerialize["assignedContract"] = o.AssignedContract.Get() + toSerialize["subnet"] = o.Subnet + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Ip) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "ip", + "version", + "type", + "prefixLength", + "primary", + "reverseLookup", + "nullRouted", + "nullLevel", + "unnullingAllowed", + "equipmentId", + "assignedContract", + "subnet", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIp := _Ip{} + + err = json.Unmarshal(data, &varIp) + + if err != nil { + return err + } + + *o = Ip(varIp) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip") + delete(additionalProperties, "version") + delete(additionalProperties, "type") + delete(additionalProperties, "prefixLength") + delete(additionalProperties, "primary") + delete(additionalProperties, "reverseLookup") + delete(additionalProperties, "nullRouted") + delete(additionalProperties, "nullLevel") + delete(additionalProperties, "unnullingAllowed") + delete(additionalProperties, "equipmentId") + delete(additionalProperties, "assignedContract") + delete(additionalProperties, "subnet") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIp struct { + value *Ip + isSet bool +} + +func (v NullableIp) Get() *Ip { + return v.value +} + +func (v *NullableIp) Set(val *Ip) { + v.value = val + v.isSet = true +} + +func (v NullableIp) IsSet() bool { + return v.isSet +} + +func (v *NullableIp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIp(val *Ip) *NullableIp { + return &NullableIp{value: val, isSet: true} +} + +func (v NullableIp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_ip_type.go b/ips/model_ip_type.go new file mode 100644 index 0000000..5af006c --- /dev/null +++ b/ips/model_ip_type.go @@ -0,0 +1,121 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// IpType the model 'IpType' +type IpType string + +// List of ipType +const ( + IPTYPE_NORMAL_IP IpType = "NORMAL_IP" + IPTYPE_NETWORK IpType = "NETWORK" + IPTYPE_BROADCAST IpType = "BROADCAST" + IPTYPE_GATEWAY IpType = "GATEWAY" + IPTYPE_ROUTER1 IpType = "ROUTER1" + IPTYPE_ROUTER2 IpType = "ROUTER2" + IPTYPE_IPMI IpType = "IPMI" +) + +// All allowed values of IpType enum +var AllowedIpTypeEnumValues = []IpType{ + "NORMAL_IP", + "NETWORK", + "BROADCAST", + "GATEWAY", + "ROUTER1", + "ROUTER2", + "IPMI", +} + +func (v *IpType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := IpType(value) + for _, existing := range AllowedIpTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IpType", value) +} + +// NewIpTypeFromValue returns a pointer to a valid IpType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIpTypeFromValue(v string) (*IpType, error) { + ev := IpType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IpType: valid values are %v", v, AllowedIpTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IpType) IsValid() bool { + for _, existing := range AllowedIpTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ipType value +func (v IpType) Ptr() *IpType { + return &v +} + +type NullableIpType struct { + value *IpType + isSet bool +} + +func (v NullableIpType) Get() *IpType { + return v.value +} + +func (v *NullableIpType) Set(val *IpType) { + v.value = val + v.isSet = true +} + +func (v NullableIpType) IsSet() bool { + return v.isSet +} + +func (v *NullableIpType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIpType(val *IpType) *NullableIpType { + return &NullableIpType{value: val, isSet: true} +} + +func (v NullableIpType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIpType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/ips/model_null_route_ip_opts.go b/ips/model_null_route_ip_opts.go new file mode 100644 index 0000000..477cbf9 --- /dev/null +++ b/ips/model_null_route_ip_opts.go @@ -0,0 +1,233 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "time" +) + +// checks if the NullRouteIPOpts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NullRouteIPOpts{} + +// NullRouteIPOpts struct for NullRouteIPOpts +type NullRouteIPOpts struct { + // The date and time when the null route is to be deactivated. The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field is not present then the null route will not be automatically removed. + AutomatedUnnullingAt *time.Time `json:"automatedUnnullingAt,omitempty"` + // A comment to be stored with the null route (e.g. null route reason) + Comment *string `json:"comment,omitempty"` + // A reference to be stored with the null route + TicketId *string `json:"ticketId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _NullRouteIPOpts NullRouteIPOpts + +// NewNullRouteIPOpts instantiates a new NullRouteIPOpts object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNullRouteIPOpts() *NullRouteIPOpts { + this := NullRouteIPOpts{} + return &this +} + +// NewNullRouteIPOptsWithDefaults instantiates a new NullRouteIPOpts object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNullRouteIPOptsWithDefaults() *NullRouteIPOpts { + this := NullRouteIPOpts{} + return &this +} + +// GetAutomatedUnnullingAt returns the AutomatedUnnullingAt field value if set, zero value otherwise. +func (o *NullRouteIPOpts) GetAutomatedUnnullingAt() time.Time { + if o == nil || IsNil(o.AutomatedUnnullingAt) { + var ret time.Time + return ret + } + return *o.AutomatedUnnullingAt +} + +// GetAutomatedUnnullingAtOk returns a tuple with the AutomatedUnnullingAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NullRouteIPOpts) GetAutomatedUnnullingAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.AutomatedUnnullingAt) { + return nil, false + } + return o.AutomatedUnnullingAt, true +} + +// HasAutomatedUnnullingAt returns a boolean if a field has been set. +func (o *NullRouteIPOpts) HasAutomatedUnnullingAt() bool { + if o != nil && !IsNil(o.AutomatedUnnullingAt) { + return true + } + + return false +} + +// SetAutomatedUnnullingAt gets a reference to the given time.Time and assigns it to the AutomatedUnnullingAt field. +func (o *NullRouteIPOpts) SetAutomatedUnnullingAt(v time.Time) { + o.AutomatedUnnullingAt = &v +} + +// GetComment returns the Comment field value if set, zero value otherwise. +func (o *NullRouteIPOpts) GetComment() string { + if o == nil || IsNil(o.Comment) { + var ret string + return ret + } + return *o.Comment +} + +// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NullRouteIPOpts) GetCommentOk() (*string, bool) { + if o == nil || IsNil(o.Comment) { + return nil, false + } + return o.Comment, true +} + +// HasComment returns a boolean if a field has been set. +func (o *NullRouteIPOpts) HasComment() bool { + if o != nil && !IsNil(o.Comment) { + return true + } + + return false +} + +// SetComment gets a reference to the given string and assigns it to the Comment field. +func (o *NullRouteIPOpts) SetComment(v string) { + o.Comment = &v +} + +// GetTicketId returns the TicketId field value if set, zero value otherwise. +func (o *NullRouteIPOpts) GetTicketId() string { + if o == nil || IsNil(o.TicketId) { + var ret string + return ret + } + return *o.TicketId +} + +// GetTicketIdOk returns a tuple with the TicketId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NullRouteIPOpts) GetTicketIdOk() (*string, bool) { + if o == nil || IsNil(o.TicketId) { + return nil, false + } + return o.TicketId, true +} + +// HasTicketId returns a boolean if a field has been set. +func (o *NullRouteIPOpts) HasTicketId() bool { + if o != nil && !IsNil(o.TicketId) { + return true + } + + return false +} + +// SetTicketId gets a reference to the given string and assigns it to the TicketId field. +func (o *NullRouteIPOpts) SetTicketId(v string) { + o.TicketId = &v +} + +func (o NullRouteIPOpts) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NullRouteIPOpts) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AutomatedUnnullingAt) { + toSerialize["automatedUnnullingAt"] = o.AutomatedUnnullingAt + } + if !IsNil(o.Comment) { + toSerialize["comment"] = o.Comment + } + if !IsNil(o.TicketId) { + toSerialize["ticketId"] = o.TicketId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NullRouteIPOpts) UnmarshalJSON(data []byte) (err error) { + varNullRouteIPOpts := _NullRouteIPOpts{} + + err = json.Unmarshal(data, &varNullRouteIPOpts) + + if err != nil { + return err + } + + *o = NullRouteIPOpts(varNullRouteIPOpts) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "automatedUnnullingAt") + delete(additionalProperties, "comment") + delete(additionalProperties, "ticketId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNullRouteIPOpts struct { + value *NullRouteIPOpts + isSet bool +} + +func (v NullableNullRouteIPOpts) Get() *NullRouteIPOpts { + return v.value +} + +func (v *NullableNullRouteIPOpts) Set(val *NullRouteIPOpts) { + v.value = val + v.isSet = true +} + +func (v NullableNullRouteIPOpts) IsSet() bool { + return v.isSet +} + +func (v *NullableNullRouteIPOpts) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNullRouteIPOpts(val *NullRouteIPOpts) *NullableNullRouteIPOpts { + return &NullableNullRouteIPOpts{value: val, isSet: true} +} + +func (v NullableNullRouteIPOpts) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNullRouteIPOpts) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_null_routed_ip.go b/ips/model_null_routed_ip.go new file mode 100644 index 0000000..26f49e4 --- /dev/null +++ b/ips/model_null_routed_ip.go @@ -0,0 +1,513 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "time" + "fmt" +) + +// checks if the NullRoutedIP type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NullRoutedIP{} + +// NullRoutedIP struct for NullRoutedIP +type NullRoutedIP struct { + // Null route ID + Id string `json:"id"` + // IP address + Ip string `json:"ip"` + // Null route date in UTC in format yyyy-mm-ddThh:mm:ssZ + NulledAt time.Time `json:"nulledAt"` + // Email address of the user who created the null route or 'LeaseWeb' if null route was created by LeaseWeb. + NulledBy string `json:"nulledBy"` + // Null route permission level. If greater than 1 then the null route can only be removed by LeaseWeb. + NullLevel int32 `json:"nullLevel"` + // The date and time when the null route is to be automatically removed. + AutomatedUnnullingAt NullableTime `json:"automatedUnnullingAt"` + // The date and time when the null route has been removed. If null then the null route is still active. + UnnulledAt NullableTime `json:"unnulledAt"` + // Email address of the user who removed the null route or 'LeaseWeb' if null route was removed by LeaseWeb. + UnnulledBy NullableString `json:"unnulledBy"` + // Reference stored with the null route. + TicketId NullableString `json:"ticketId"` + // Comment stored with the null route. + Comment NullableString `json:"comment"` + // ID of the equipment which was assigned to the IP at the time of null route creation. + EquipmentId string `json:"equipmentId"` + AssignedContract NullableAssignedContract `json:"assignedContract"` + AdditionalProperties map[string]interface{} +} + +type _NullRoutedIP NullRoutedIP + +// NewNullRoutedIP instantiates a new NullRoutedIP object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNullRoutedIP(id string, ip string, nulledAt time.Time, nulledBy string, nullLevel int32, automatedUnnullingAt NullableTime, unnulledAt NullableTime, unnulledBy NullableString, ticketId NullableString, comment NullableString, equipmentId string, assignedContract NullableAssignedContract) *NullRoutedIP { + this := NullRoutedIP{} + this.Id = id + this.Ip = ip + this.NulledAt = nulledAt + this.NulledBy = nulledBy + this.NullLevel = nullLevel + this.AutomatedUnnullingAt = automatedUnnullingAt + this.UnnulledAt = unnulledAt + this.UnnulledBy = unnulledBy + this.TicketId = ticketId + this.Comment = comment + this.EquipmentId = equipmentId + this.AssignedContract = assignedContract + return &this +} + +// NewNullRoutedIPWithDefaults instantiates a new NullRoutedIP object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNullRoutedIPWithDefaults() *NullRoutedIP { + this := NullRoutedIP{} + var nullLevel int32 = 0 + this.NullLevel = nullLevel + return &this +} + +// GetId returns the Id field value +func (o *NullRoutedIP) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *NullRoutedIP) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *NullRoutedIP) SetId(v string) { + o.Id = v +} + +// GetIp returns the Ip field value +func (o *NullRoutedIP) GetIp() string { + if o == nil { + var ret string + return ret + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +func (o *NullRoutedIP) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Ip, true +} + +// SetIp sets field value +func (o *NullRoutedIP) SetIp(v string) { + o.Ip = v +} + +// GetNulledAt returns the NulledAt field value +func (o *NullRoutedIP) GetNulledAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.NulledAt +} + +// GetNulledAtOk returns a tuple with the NulledAt field value +// and a boolean to check if the value has been set. +func (o *NullRoutedIP) GetNulledAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.NulledAt, true +} + +// SetNulledAt sets field value +func (o *NullRoutedIP) SetNulledAt(v time.Time) { + o.NulledAt = v +} + +// GetNulledBy returns the NulledBy field value +func (o *NullRoutedIP) GetNulledBy() string { + if o == nil { + var ret string + return ret + } + + return o.NulledBy +} + +// GetNulledByOk returns a tuple with the NulledBy field value +// and a boolean to check if the value has been set. +func (o *NullRoutedIP) GetNulledByOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NulledBy, true +} + +// SetNulledBy sets field value +func (o *NullRoutedIP) SetNulledBy(v string) { + o.NulledBy = v +} + +// GetNullLevel returns the NullLevel field value +func (o *NullRoutedIP) GetNullLevel() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NullLevel +} + +// GetNullLevelOk returns a tuple with the NullLevel field value +// and a boolean to check if the value has been set. +func (o *NullRoutedIP) GetNullLevelOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NullLevel, true +} + +// SetNullLevel sets field value +func (o *NullRoutedIP) SetNullLevel(v int32) { + o.NullLevel = v +} + +// GetAutomatedUnnullingAt returns the AutomatedUnnullingAt field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *NullRoutedIP) GetAutomatedUnnullingAt() time.Time { + if o == nil || o.AutomatedUnnullingAt.Get() == nil { + var ret time.Time + return ret + } + + return *o.AutomatedUnnullingAt.Get() +} + +// GetAutomatedUnnullingAtOk returns a tuple with the AutomatedUnnullingAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullRoutedIP) GetAutomatedUnnullingAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.AutomatedUnnullingAt.Get(), o.AutomatedUnnullingAt.IsSet() +} + +// SetAutomatedUnnullingAt sets field value +func (o *NullRoutedIP) SetAutomatedUnnullingAt(v time.Time) { + o.AutomatedUnnullingAt.Set(&v) +} + +// GetUnnulledAt returns the UnnulledAt field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *NullRoutedIP) GetUnnulledAt() time.Time { + if o == nil || o.UnnulledAt.Get() == nil { + var ret time.Time + return ret + } + + return *o.UnnulledAt.Get() +} + +// GetUnnulledAtOk returns a tuple with the UnnulledAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullRoutedIP) GetUnnulledAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.UnnulledAt.Get(), o.UnnulledAt.IsSet() +} + +// SetUnnulledAt sets field value +func (o *NullRoutedIP) SetUnnulledAt(v time.Time) { + o.UnnulledAt.Set(&v) +} + +// GetUnnulledBy returns the UnnulledBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NullRoutedIP) GetUnnulledBy() string { + if o == nil || o.UnnulledBy.Get() == nil { + var ret string + return ret + } + + return *o.UnnulledBy.Get() +} + +// GetUnnulledByOk returns a tuple with the UnnulledBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullRoutedIP) GetUnnulledByOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.UnnulledBy.Get(), o.UnnulledBy.IsSet() +} + +// SetUnnulledBy sets field value +func (o *NullRoutedIP) SetUnnulledBy(v string) { + o.UnnulledBy.Set(&v) +} + +// GetTicketId returns the TicketId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NullRoutedIP) GetTicketId() string { + if o == nil || o.TicketId.Get() == nil { + var ret string + return ret + } + + return *o.TicketId.Get() +} + +// GetTicketIdOk returns a tuple with the TicketId field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullRoutedIP) GetTicketIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TicketId.Get(), o.TicketId.IsSet() +} + +// SetTicketId sets field value +func (o *NullRoutedIP) SetTicketId(v string) { + o.TicketId.Set(&v) +} + +// GetComment returns the Comment field value +// If the value is explicit nil, the zero value for string will be returned +func (o *NullRoutedIP) GetComment() string { + if o == nil || o.Comment.Get() == nil { + var ret string + return ret + } + + return *o.Comment.Get() +} + +// GetCommentOk returns a tuple with the Comment field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullRoutedIP) GetCommentOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Comment.Get(), o.Comment.IsSet() +} + +// SetComment sets field value +func (o *NullRoutedIP) SetComment(v string) { + o.Comment.Set(&v) +} + +// GetEquipmentId returns the EquipmentId field value +func (o *NullRoutedIP) GetEquipmentId() string { + if o == nil { + var ret string + return ret + } + + return o.EquipmentId +} + +// GetEquipmentIdOk returns a tuple with the EquipmentId field value +// and a boolean to check if the value has been set. +func (o *NullRoutedIP) GetEquipmentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EquipmentId, true +} + +// SetEquipmentId sets field value +func (o *NullRoutedIP) SetEquipmentId(v string) { + o.EquipmentId = v +} + +// GetAssignedContract returns the AssignedContract field value +// If the value is explicit nil, the zero value for AssignedContract will be returned +func (o *NullRoutedIP) GetAssignedContract() AssignedContract { + if o == nil || o.AssignedContract.Get() == nil { + var ret AssignedContract + return ret + } + + return *o.AssignedContract.Get() +} + +// GetAssignedContractOk returns a tuple with the AssignedContract field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NullRoutedIP) GetAssignedContractOk() (*AssignedContract, bool) { + if o == nil { + return nil, false + } + return o.AssignedContract.Get(), o.AssignedContract.IsSet() +} + +// SetAssignedContract sets field value +func (o *NullRoutedIP) SetAssignedContract(v AssignedContract) { + o.AssignedContract.Set(&v) +} + +func (o NullRoutedIP) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NullRoutedIP) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["ip"] = o.Ip + toSerialize["nulledAt"] = o.NulledAt + toSerialize["nulledBy"] = o.NulledBy + toSerialize["nullLevel"] = o.NullLevel + toSerialize["automatedUnnullingAt"] = o.AutomatedUnnullingAt.Get() + toSerialize["unnulledAt"] = o.UnnulledAt.Get() + toSerialize["unnulledBy"] = o.UnnulledBy.Get() + toSerialize["ticketId"] = o.TicketId.Get() + toSerialize["comment"] = o.Comment.Get() + toSerialize["equipmentId"] = o.EquipmentId + toSerialize["assignedContract"] = o.AssignedContract.Get() + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *NullRoutedIP) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "ip", + "nulledAt", + "nulledBy", + "nullLevel", + "automatedUnnullingAt", + "unnulledAt", + "unnulledBy", + "ticketId", + "comment", + "equipmentId", + "assignedContract", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varNullRoutedIP := _NullRoutedIP{} + + err = json.Unmarshal(data, &varNullRoutedIP) + + if err != nil { + return err + } + + *o = NullRoutedIP(varNullRoutedIP) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "ip") + delete(additionalProperties, "nulledAt") + delete(additionalProperties, "nulledBy") + delete(additionalProperties, "nullLevel") + delete(additionalProperties, "automatedUnnullingAt") + delete(additionalProperties, "unnulledAt") + delete(additionalProperties, "unnulledBy") + delete(additionalProperties, "ticketId") + delete(additionalProperties, "comment") + delete(additionalProperties, "equipmentId") + delete(additionalProperties, "assignedContract") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNullRoutedIP struct { + value *NullRoutedIP + isSet bool +} + +func (v NullableNullRoutedIP) Get() *NullRoutedIP { + return v.value +} + +func (v *NullableNullRoutedIP) Set(val *NullRoutedIP) { + v.value = val + v.isSet = true +} + +func (v NullableNullRoutedIP) IsSet() bool { + return v.isSet +} + +func (v *NullableNullRoutedIP) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNullRoutedIP(val *NullRoutedIP) *NullableNullRoutedIP { + return &NullableNullRoutedIP{value: val, isSet: true} +} + +func (v NullableNullRoutedIP) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNullRoutedIP) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_protocol_version.go b/ips/model_protocol_version.go new file mode 100644 index 0000000..61e340c --- /dev/null +++ b/ips/model_protocol_version.go @@ -0,0 +1,111 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// ProtocolVersion Protocol version +type ProtocolVersion int32 + +// List of protocolVersion +const ( + PROTOCOLVERSION__4 ProtocolVersion = 4 + PROTOCOLVERSION__6 ProtocolVersion = 6 +) + +// All allowed values of ProtocolVersion enum +var AllowedProtocolVersionEnumValues = []ProtocolVersion{ + 4, + 6, +} + +func (v *ProtocolVersion) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ProtocolVersion(value) + for _, existing := range AllowedProtocolVersionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ProtocolVersion", value) +} + +// NewProtocolVersionFromValue returns a pointer to a valid ProtocolVersion +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProtocolVersionFromValue(v int32) (*ProtocolVersion, error) { + ev := ProtocolVersion(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ProtocolVersion: valid values are %v", v, AllowedProtocolVersionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ProtocolVersion) IsValid() bool { + for _, existing := range AllowedProtocolVersionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to protocolVersion value +func (v ProtocolVersion) Ptr() *ProtocolVersion { + return &v +} + +type NullableProtocolVersion struct { + value *ProtocolVersion + isSet bool +} + +func (v NullableProtocolVersion) Get() *ProtocolVersion { + return v.value +} + +func (v *NullableProtocolVersion) Set(val *ProtocolVersion) { + v.value = val + v.isSet = true +} + +func (v NullableProtocolVersion) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocolVersion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocolVersion(val *ProtocolVersion) *NullableProtocolVersion { + return &NullableProtocolVersion{value: val, isSet: true} +} + +func (v NullableProtocolVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocolVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/ips/model_reverse_lookup.go b/ips/model_reverse_lookup.go new file mode 100644 index 0000000..ec8e54a --- /dev/null +++ b/ips/model_reverse_lookup.go @@ -0,0 +1,201 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the ReverseLookup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReverseLookup{} + +// ReverseLookup Reverse lookup set for a specific IP address +type ReverseLookup struct { + // IP address + Ip string `json:"ip"` + // Reverse lookup value + ReverseLookup NullableString `json:"reverseLookup"` + AdditionalProperties map[string]interface{} +} + +type _ReverseLookup ReverseLookup + +// NewReverseLookup instantiates a new ReverseLookup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewReverseLookup(ip string, reverseLookup NullableString) *ReverseLookup { + this := ReverseLookup{} + this.Ip = ip + this.ReverseLookup = reverseLookup + return &this +} + +// NewReverseLookupWithDefaults instantiates a new ReverseLookup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewReverseLookupWithDefaults() *ReverseLookup { + this := ReverseLookup{} + return &this +} + +// GetIp returns the Ip field value +func (o *ReverseLookup) GetIp() string { + if o == nil { + var ret string + return ret + } + + return o.Ip +} + +// GetIpOk returns a tuple with the Ip field value +// and a boolean to check if the value has been set. +func (o *ReverseLookup) GetIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Ip, true +} + +// SetIp sets field value +func (o *ReverseLookup) SetIp(v string) { + o.Ip = v +} + +// GetReverseLookup returns the ReverseLookup field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ReverseLookup) GetReverseLookup() string { + if o == nil || o.ReverseLookup.Get() == nil { + var ret string + return ret + } + + return *o.ReverseLookup.Get() +} + +// GetReverseLookupOk returns a tuple with the ReverseLookup field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ReverseLookup) GetReverseLookupOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ReverseLookup.Get(), o.ReverseLookup.IsSet() +} + +// SetReverseLookup sets field value +func (o *ReverseLookup) SetReverseLookup(v string) { + o.ReverseLookup.Set(&v) +} + +func (o ReverseLookup) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReverseLookup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ip"] = o.Ip + toSerialize["reverseLookup"] = o.ReverseLookup.Get() + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ReverseLookup) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "ip", + "reverseLookup", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varReverseLookup := _ReverseLookup{} + + err = json.Unmarshal(data, &varReverseLookup) + + if err != nil { + return err + } + + *o = ReverseLookup(varReverseLookup) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "ip") + delete(additionalProperties, "reverseLookup") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableReverseLookup struct { + value *ReverseLookup + isSet bool +} + +func (v NullableReverseLookup) Get() *ReverseLookup { + return v.value +} + +func (v *NullableReverseLookup) Set(val *ReverseLookup) { + v.value = val + v.isSet = true +} + +func (v NullableReverseLookup) IsSet() bool { + return v.isSet +} + +func (v *NullableReverseLookup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReverseLookup(val *ReverseLookup) *NullableReverseLookup { + return &NullableReverseLookup{value: val, isSet: true} +} + +func (v NullableReverseLookup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReverseLookup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_subnet.go b/ips/model_subnet.go new file mode 100644 index 0000000..43290b7 --- /dev/null +++ b/ips/model_subnet.go @@ -0,0 +1,261 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the Subnet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Subnet{} + +// Subnet Object containing information about the network and gateway +type Subnet struct { + // Subnet identifier consisting of network IP and prefix length separated by underscore (e.g. 192.0.2.0_24) + Id string `json:"id"` + // Network IP of the subnet + NetworkIp string `json:"networkIp"` + // Address prefix length + PrefixLength int32 `json:"prefixLength"` + // The gateway IP to be used in network settings + Gateway string `json:"gateway"` + AdditionalProperties map[string]interface{} +} + +type _Subnet Subnet + +// NewSubnet instantiates a new Subnet object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSubnet(id string, networkIp string, prefixLength int32, gateway string) *Subnet { + this := Subnet{} + this.Id = id + this.NetworkIp = networkIp + this.PrefixLength = prefixLength + this.Gateway = gateway + return &this +} + +// NewSubnetWithDefaults instantiates a new Subnet object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSubnetWithDefaults() *Subnet { + this := Subnet{} + var prefixLength int32 = 0 + this.PrefixLength = prefixLength + return &this +} + +// GetId returns the Id field value +func (o *Subnet) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Subnet) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Subnet) SetId(v string) { + o.Id = v +} + +// GetNetworkIp returns the NetworkIp field value +func (o *Subnet) GetNetworkIp() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkIp +} + +// GetNetworkIpOk returns a tuple with the NetworkIp field value +// and a boolean to check if the value has been set. +func (o *Subnet) GetNetworkIpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkIp, true +} + +// SetNetworkIp sets field value +func (o *Subnet) SetNetworkIp(v string) { + o.NetworkIp = v +} + +// GetPrefixLength returns the PrefixLength field value +func (o *Subnet) GetPrefixLength() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PrefixLength +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *Subnet) GetPrefixLengthOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PrefixLength, true +} + +// SetPrefixLength sets field value +func (o *Subnet) SetPrefixLength(v int32) { + o.PrefixLength = v +} + +// GetGateway returns the Gateway field value +func (o *Subnet) GetGateway() string { + if o == nil { + var ret string + return ret + } + + return o.Gateway +} + +// GetGatewayOk returns a tuple with the Gateway field value +// and a boolean to check if the value has been set. +func (o *Subnet) GetGatewayOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Gateway, true +} + +// SetGateway sets field value +func (o *Subnet) SetGateway(v string) { + o.Gateway = v +} + +func (o Subnet) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Subnet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["networkIp"] = o.NetworkIp + toSerialize["prefixLength"] = o.PrefixLength + toSerialize["gateway"] = o.Gateway + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Subnet) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "networkIp", + "prefixLength", + "gateway", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSubnet := _Subnet{} + + err = json.Unmarshal(data, &varSubnet) + + if err != nil { + return err + } + + *o = Subnet(varSubnet) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "networkIp") + delete(additionalProperties, "prefixLength") + delete(additionalProperties, "gateway") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSubnet struct { + value *Subnet + isSet bool +} + +func (v NullableSubnet) Get() *Subnet { + return v.value +} + +func (v *NullableSubnet) Set(val *Subnet) { + v.value = val + v.isSet = true +} + +func (v NullableSubnet) IsSet() bool { + return v.isSet +} + +func (v *NullableSubnet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSubnet(val *Subnet) *NullableSubnet { + return &NullableSubnet{value: val, isSet: true} +} + +func (v NullableSubnet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSubnet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_update_ip_opts.go b/ips/model_update_ip_opts.go new file mode 100644 index 0000000..7e6a208 --- /dev/null +++ b/ips/model_update_ip_opts.go @@ -0,0 +1,168 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateIPOpts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateIPOpts{} + +// UpdateIPOpts struct for UpdateIPOpts +type UpdateIPOpts struct { + ReverseLookup string `json:"reverseLookup"` + AdditionalProperties map[string]interface{} +} + +type _UpdateIPOpts UpdateIPOpts + +// NewUpdateIPOpts instantiates a new UpdateIPOpts object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateIPOpts(reverseLookup string) *UpdateIPOpts { + this := UpdateIPOpts{} + this.ReverseLookup = reverseLookup + return &this +} + +// NewUpdateIPOptsWithDefaults instantiates a new UpdateIPOpts object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateIPOptsWithDefaults() *UpdateIPOpts { + this := UpdateIPOpts{} + return &this +} + +// GetReverseLookup returns the ReverseLookup field value +func (o *UpdateIPOpts) GetReverseLookup() string { + if o == nil { + var ret string + return ret + } + + return o.ReverseLookup +} + +// GetReverseLookupOk returns a tuple with the ReverseLookup field value +// and a boolean to check if the value has been set. +func (o *UpdateIPOpts) GetReverseLookupOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ReverseLookup, true +} + +// SetReverseLookup sets field value +func (o *UpdateIPOpts) SetReverseLookup(v string) { + o.ReverseLookup = v +} + +func (o UpdateIPOpts) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateIPOpts) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["reverseLookup"] = o.ReverseLookup + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateIPOpts) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "reverseLookup", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateIPOpts := _UpdateIPOpts{} + + err = json.Unmarshal(data, &varUpdateIPOpts) + + if err != nil { + return err + } + + *o = UpdateIPOpts(varUpdateIPOpts) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "reverseLookup") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateIPOpts struct { + value *UpdateIPOpts + isSet bool +} + +func (v NullableUpdateIPOpts) Get() *UpdateIPOpts { + return v.value +} + +func (v *NullableUpdateIPOpts) Set(val *UpdateIPOpts) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateIPOpts) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateIPOpts) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateIPOpts(val *UpdateIPOpts) *NullableUpdateIPOpts { + return &NullableUpdateIPOpts{value: val, isSet: true} +} + +func (v NullableUpdateIPOpts) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateIPOpts) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_update_null_route_opts.go b/ips/model_update_null_route_opts.go new file mode 100644 index 0000000..7296cd7 --- /dev/null +++ b/ips/model_update_null_route_opts.go @@ -0,0 +1,233 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "time" +) + +// checks if the UpdateNullRouteOpts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNullRouteOpts{} + +// UpdateNullRouteOpts struct for UpdateNullRouteOpts +type UpdateNullRouteOpts struct { + // The date and time when the null route is to be deactivated. The date and time should be specified using the format yyyy-mm-ddThh:mm:ss±hh:mm (with time zone designator) or yyyy-mm-ddThh:mm:ssZ (UTC). If this field is not present then the null route will not be automatically removed. + AutomatedUnnullingAt *time.Time `json:"automatedUnnullingAt,omitempty"` + // A comment to be stored with the null route (e.g. null route reason) + Comment *string `json:"comment,omitempty"` + // A reference to be stored with the null route + TicketId *string `json:"ticketId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateNullRouteOpts UpdateNullRouteOpts + +// NewUpdateNullRouteOpts instantiates a new UpdateNullRouteOpts object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNullRouteOpts() *UpdateNullRouteOpts { + this := UpdateNullRouteOpts{} + return &this +} + +// NewUpdateNullRouteOptsWithDefaults instantiates a new UpdateNullRouteOpts object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNullRouteOptsWithDefaults() *UpdateNullRouteOpts { + this := UpdateNullRouteOpts{} + return &this +} + +// GetAutomatedUnnullingAt returns the AutomatedUnnullingAt field value if set, zero value otherwise. +func (o *UpdateNullRouteOpts) GetAutomatedUnnullingAt() time.Time { + if o == nil || IsNil(o.AutomatedUnnullingAt) { + var ret time.Time + return ret + } + return *o.AutomatedUnnullingAt +} + +// GetAutomatedUnnullingAtOk returns a tuple with the AutomatedUnnullingAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNullRouteOpts) GetAutomatedUnnullingAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.AutomatedUnnullingAt) { + return nil, false + } + return o.AutomatedUnnullingAt, true +} + +// HasAutomatedUnnullingAt returns a boolean if a field has been set. +func (o *UpdateNullRouteOpts) HasAutomatedUnnullingAt() bool { + if o != nil && !IsNil(o.AutomatedUnnullingAt) { + return true + } + + return false +} + +// SetAutomatedUnnullingAt gets a reference to the given time.Time and assigns it to the AutomatedUnnullingAt field. +func (o *UpdateNullRouteOpts) SetAutomatedUnnullingAt(v time.Time) { + o.AutomatedUnnullingAt = &v +} + +// GetComment returns the Comment field value if set, zero value otherwise. +func (o *UpdateNullRouteOpts) GetComment() string { + if o == nil || IsNil(o.Comment) { + var ret string + return ret + } + return *o.Comment +} + +// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNullRouteOpts) GetCommentOk() (*string, bool) { + if o == nil || IsNil(o.Comment) { + return nil, false + } + return o.Comment, true +} + +// HasComment returns a boolean if a field has been set. +func (o *UpdateNullRouteOpts) HasComment() bool { + if o != nil && !IsNil(o.Comment) { + return true + } + + return false +} + +// SetComment gets a reference to the given string and assigns it to the Comment field. +func (o *UpdateNullRouteOpts) SetComment(v string) { + o.Comment = &v +} + +// GetTicketId returns the TicketId field value if set, zero value otherwise. +func (o *UpdateNullRouteOpts) GetTicketId() string { + if o == nil || IsNil(o.TicketId) { + var ret string + return ret + } + return *o.TicketId +} + +// GetTicketIdOk returns a tuple with the TicketId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNullRouteOpts) GetTicketIdOk() (*string, bool) { + if o == nil || IsNil(o.TicketId) { + return nil, false + } + return o.TicketId, true +} + +// HasTicketId returns a boolean if a field has been set. +func (o *UpdateNullRouteOpts) HasTicketId() bool { + if o != nil && !IsNil(o.TicketId) { + return true + } + + return false +} + +// SetTicketId gets a reference to the given string and assigns it to the TicketId field. +func (o *UpdateNullRouteOpts) SetTicketId(v string) { + o.TicketId = &v +} + +func (o UpdateNullRouteOpts) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateNullRouteOpts) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AutomatedUnnullingAt) { + toSerialize["automatedUnnullingAt"] = o.AutomatedUnnullingAt + } + if !IsNil(o.Comment) { + toSerialize["comment"] = o.Comment + } + if !IsNil(o.TicketId) { + toSerialize["ticketId"] = o.TicketId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateNullRouteOpts) UnmarshalJSON(data []byte) (err error) { + varUpdateNullRouteOpts := _UpdateNullRouteOpts{} + + err = json.Unmarshal(data, &varUpdateNullRouteOpts) + + if err != nil { + return err + } + + *o = UpdateNullRouteOpts(varUpdateNullRouteOpts) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "automatedUnnullingAt") + delete(additionalProperties, "comment") + delete(additionalProperties, "ticketId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateNullRouteOpts struct { + value *UpdateNullRouteOpts + isSet bool +} + +func (v NullableUpdateNullRouteOpts) Get() *UpdateNullRouteOpts { + return v.value +} + +func (v *NullableUpdateNullRouteOpts) Set(val *UpdateNullRouteOpts) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNullRouteOpts) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNullRouteOpts) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNullRouteOpts(val *UpdateNullRouteOpts) *NullableUpdateNullRouteOpts { + return &NullableUpdateNullRouteOpts{value: val, isSet: true} +} + +func (v NullableUpdateNullRouteOpts) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNullRouteOpts) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_update_reverse_lookup_records_opts.go b/ips/model_update_reverse_lookup_records_opts.go new file mode 100644 index 0000000..ac41935 --- /dev/null +++ b/ips/model_update_reverse_lookup_records_opts.go @@ -0,0 +1,168 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateReverseLookupRecordsOpts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateReverseLookupRecordsOpts{} + +// UpdateReverseLookupRecordsOpts struct for UpdateReverseLookupRecordsOpts +type UpdateReverseLookupRecordsOpts struct { + ReverseLookups []ReverseLookup `json:"reverseLookups"` + AdditionalProperties map[string]interface{} +} + +type _UpdateReverseLookupRecordsOpts UpdateReverseLookupRecordsOpts + +// NewUpdateReverseLookupRecordsOpts instantiates a new UpdateReverseLookupRecordsOpts object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateReverseLookupRecordsOpts(reverseLookups []ReverseLookup) *UpdateReverseLookupRecordsOpts { + this := UpdateReverseLookupRecordsOpts{} + this.ReverseLookups = reverseLookups + return &this +} + +// NewUpdateReverseLookupRecordsOptsWithDefaults instantiates a new UpdateReverseLookupRecordsOpts object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateReverseLookupRecordsOptsWithDefaults() *UpdateReverseLookupRecordsOpts { + this := UpdateReverseLookupRecordsOpts{} + return &this +} + +// GetReverseLookups returns the ReverseLookups field value +func (o *UpdateReverseLookupRecordsOpts) GetReverseLookups() []ReverseLookup { + if o == nil { + var ret []ReverseLookup + return ret + } + + return o.ReverseLookups +} + +// GetReverseLookupsOk returns a tuple with the ReverseLookups field value +// and a boolean to check if the value has been set. +func (o *UpdateReverseLookupRecordsOpts) GetReverseLookupsOk() ([]ReverseLookup, bool) { + if o == nil { + return nil, false + } + return o.ReverseLookups, true +} + +// SetReverseLookups sets field value +func (o *UpdateReverseLookupRecordsOpts) SetReverseLookups(v []ReverseLookup) { + o.ReverseLookups = v +} + +func (o UpdateReverseLookupRecordsOpts) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateReverseLookupRecordsOpts) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["reverseLookups"] = o.ReverseLookups + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateReverseLookupRecordsOpts) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "reverseLookups", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateReverseLookupRecordsOpts := _UpdateReverseLookupRecordsOpts{} + + err = json.Unmarshal(data, &varUpdateReverseLookupRecordsOpts) + + if err != nil { + return err + } + + *o = UpdateReverseLookupRecordsOpts(varUpdateReverseLookupRecordsOpts) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "reverseLookups") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateReverseLookupRecordsOpts struct { + value *UpdateReverseLookupRecordsOpts + isSet bool +} + +func (v NullableUpdateReverseLookupRecordsOpts) Get() *UpdateReverseLookupRecordsOpts { + return v.value +} + +func (v *NullableUpdateReverseLookupRecordsOpts) Set(val *UpdateReverseLookupRecordsOpts) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateReverseLookupRecordsOpts) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateReverseLookupRecordsOpts) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateReverseLookupRecordsOpts(val *UpdateReverseLookupRecordsOpts) *NullableUpdateReverseLookupRecordsOpts { + return &NullableUpdateReverseLookupRecordsOpts{value: val, isSet: true} +} + +func (v NullableUpdateReverseLookupRecordsOpts) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateReverseLookupRecordsOpts) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/model_update_reverse_lookup_records_result.go b/ips/model_update_reverse_lookup_records_result.go new file mode 100644 index 0000000..7ec2e02 --- /dev/null +++ b/ips/model_update_reverse_lookup_records_result.go @@ -0,0 +1,168 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateReverseLookupRecordsResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateReverseLookupRecordsResult{} + +// UpdateReverseLookupRecordsResult struct for UpdateReverseLookupRecordsResult +type UpdateReverseLookupRecordsResult struct { + ReverseLookups []ReverseLookup `json:"reverseLookups"` + AdditionalProperties map[string]interface{} +} + +type _UpdateReverseLookupRecordsResult UpdateReverseLookupRecordsResult + +// NewUpdateReverseLookupRecordsResult instantiates a new UpdateReverseLookupRecordsResult object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateReverseLookupRecordsResult(reverseLookups []ReverseLookup) *UpdateReverseLookupRecordsResult { + this := UpdateReverseLookupRecordsResult{} + this.ReverseLookups = reverseLookups + return &this +} + +// NewUpdateReverseLookupRecordsResultWithDefaults instantiates a new UpdateReverseLookupRecordsResult object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateReverseLookupRecordsResultWithDefaults() *UpdateReverseLookupRecordsResult { + this := UpdateReverseLookupRecordsResult{} + return &this +} + +// GetReverseLookups returns the ReverseLookups field value +func (o *UpdateReverseLookupRecordsResult) GetReverseLookups() []ReverseLookup { + if o == nil { + var ret []ReverseLookup + return ret + } + + return o.ReverseLookups +} + +// GetReverseLookupsOk returns a tuple with the ReverseLookups field value +// and a boolean to check if the value has been set. +func (o *UpdateReverseLookupRecordsResult) GetReverseLookupsOk() ([]ReverseLookup, bool) { + if o == nil { + return nil, false + } + return o.ReverseLookups, true +} + +// SetReverseLookups sets field value +func (o *UpdateReverseLookupRecordsResult) SetReverseLookups(v []ReverseLookup) { + o.ReverseLookups = v +} + +func (o UpdateReverseLookupRecordsResult) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateReverseLookupRecordsResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["reverseLookups"] = o.ReverseLookups + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateReverseLookupRecordsResult) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "reverseLookups", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUpdateReverseLookupRecordsResult := _UpdateReverseLookupRecordsResult{} + + err = json.Unmarshal(data, &varUpdateReverseLookupRecordsResult) + + if err != nil { + return err + } + + *o = UpdateReverseLookupRecordsResult(varUpdateReverseLookupRecordsResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "reverseLookups") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateReverseLookupRecordsResult struct { + value *UpdateReverseLookupRecordsResult + isSet bool +} + +func (v NullableUpdateReverseLookupRecordsResult) Get() *UpdateReverseLookupRecordsResult { + return v.value +} + +func (v *NullableUpdateReverseLookupRecordsResult) Set(val *UpdateReverseLookupRecordsResult) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateReverseLookupRecordsResult) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateReverseLookupRecordsResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateReverseLookupRecordsResult(val *UpdateReverseLookupRecordsResult) *NullableUpdateReverseLookupRecordsResult { + return &NullableUpdateReverseLookupRecordsResult{value: val, isSet: true} +} + +func (v NullableUpdateReverseLookupRecordsResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateReverseLookupRecordsResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/ips/response.go b/ips/response.go new file mode 100644 index 0000000..4200514 --- /dev/null +++ b/ips/response.go @@ -0,0 +1,47 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/ips/test/api_ips_test.go b/ips/test/api_ips_test.go new file mode 100644 index 0000000..2c4c339 --- /dev/null +++ b/ips/test/api_ips_test.go @@ -0,0 +1,160 @@ +/* +LeaseWeb API for IP address management + +Testing IpsAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package ips + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/leaseweb/leaseweb-go-sdk/ips" +) + +func Test_ips_IpsAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test IpsAPIService GetIP", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var ip string + + resp, httpRes, err := apiClient.IpsAPI.GetIP(context.Background(), ip).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService GetIPList", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.IpsAPI.GetIPList(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService GetNullRouteHistory", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.IpsAPI.GetNullRouteHistory(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService GetNullRouteHistoryList", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.IpsAPI.GetNullRouteHistoryList(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService GetReverseLookupRecordList", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var ip string + + resp, httpRes, err := apiClient.IpsAPI.GetReverseLookupRecordList(context.Background(), ip).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService NullRouteIP", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var ip string + + resp, httpRes, err := apiClient.IpsAPI.NullRouteIP(context.Background(), ip).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService RemoveIPNullRoute", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var ip string + + httpRes, err := apiClient.IpsAPI.RemoveIPNullRoute(context.Background(), ip).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService UpdateIP", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var ip string + + resp, httpRes, err := apiClient.IpsAPI.UpdateIP(context.Background(), ip).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService UpdateNullRoute", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var id string + + resp, httpRes, err := apiClient.IpsAPI.UpdateNullRoute(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test IpsAPIService UpdateReverseLookupRecords", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var ip string + + resp, httpRes, err := apiClient.IpsAPI.UpdateReverseLookupRecords(context.Background(), ip).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/ips/utils.go b/ips/utils.go new file mode 100644 index 0000000..dab93b1 --- /dev/null +++ b/ips/utils.go @@ -0,0 +1,361 @@ +/* +LeaseWeb API for IP address management + +> The base URL for this API is: **https://api.leaseweb.com/ipMgmt/v2/_** + +API version: v2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ips + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} \ No newline at end of file diff --git a/main.go b/main.go index 5996ffb..45d42f6 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( _ "github.com/leaseweb/leaseweb-go-sdk/dedicatedserver" _ "github.com/leaseweb/leaseweb-go-sdk/dns" _ "github.com/leaseweb/leaseweb-go-sdk/invoice" + _ "github.com/leaseweb/leaseweb-go-sdk/ips" _ "github.com/leaseweb/leaseweb-go-sdk/publiccloud" )