Files
ionosDnsClient/ionosDnsClient.go

2144 lines
62 KiB
Go

// Package ionosDnsClient provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
package ionosDnsClient
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"github.com/oapi-codegen/runtime"
)
const (
ApiKeyAuthScopes = "ApiKeyAuth.Scopes"
)
// Defines values for RecordTypes.
const (
A RecordTypes = "A"
AAAA RecordTypes = "AAAA"
CAA RecordTypes = "CAA"
CERT RecordTypes = "CERT"
CNAME RecordTypes = "CNAME"
DS RecordTypes = "DS"
HTTPS RecordTypes = "HTTPS"
LOC RecordTypes = "LOC"
MX RecordTypes = "MX"
NS RecordTypes = "NS"
OPENPGPKEY RecordTypes = "OPENPGPKEY"
RP RecordTypes = "RP"
SMIMEA RecordTypes = "SMIMEA"
SOA RecordTypes = "SOA"
SRV RecordTypes = "SRV"
SSHFP RecordTypes = "SSHFP"
SVCB RecordTypes = "SVCB"
TLSA RecordTypes = "TLSA"
TXT RecordTypes = "TXT"
URI RecordTypes = "URI"
)
// Defines values for ZoneTypes.
const (
NATIVE ZoneTypes = "NATIVE"
SLAVE ZoneTypes = "SLAVE"
)
// CustomerZone defines model for customer-zone.
type CustomerZone struct {
// Id The zone id.
Id *string `json:"id,omitempty"`
// Name The zone name
Name *string `json:"name,omitempty"`
Records *[]RecordResponse `json:"records,omitempty"`
// Type Represents the possible zone types.
Type *ZoneTypes `json:"type,omitempty"`
}
// DynDnsRequest defines model for dyn-dns-request.
type DynDnsRequest struct {
// Description Dynamic Dns description.
Description *string `json:"description,omitempty"`
Domains []string `json:"domains"`
}
// DynamicDns defines model for dynamic-dns.
type DynamicDns struct {
// BulkId DynDns configuration identifier.
BulkId *string `json:"bulkId,omitempty"`
// Description Dynamic Dns description.
Description *string `json:"description,omitempty"`
Domains *[]string `json:"domains,omitempty"`
// UpdateUrl Use the url with GET to update the ips of (sub)domains. Query parameters: ipv4, ipv6.
UpdateUrl *string `json:"updateUrl,omitempty"`
}
// Error defines model for error.
type Error struct {
// Code The error code.
Code *string `json:"code,omitempty"`
// Message The error message.
Message *string `json:"message,omitempty"`
}
// Errors defines model for errors.
type Errors = []struct {
ErrorRecord *Record `json:"errorRecord,omitempty"`
InputRecord *Record `json:"inputRecord,omitempty"`
Invalid *[]string `json:"invalid,omitempty"`
InvalidFields *[]string `json:"invalidFields,omitempty"`
RequiredFields *[]string `json:"requiredFields,omitempty"`
}
// Record defines model for record.
type Record struct {
Content *string `json:"content,omitempty"`
// Disabled When is true, the record is not visible for lookup.
Disabled *bool `json:"disabled,omitempty"`
Name *string `json:"name,omitempty"`
Prio *int `json:"prio,omitempty"`
// Ttl Time to live for the record, recommended 3600.
Ttl *int `json:"ttl,omitempty"`
// Type Holds supported dns record types.
Type *RecordTypes `json:"type,omitempty"`
}
// RecordResponse defines model for record-response.
type RecordResponse struct {
// ChangeDate The date of the last change formatted as yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
ChangeDate *string `json:"changeDate,omitempty"`
Content *string `json:"content,omitempty"`
// Disabled When is true, the record is not visible for lookup.
Disabled *bool `json:"disabled,omitempty"`
Id *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Prio *int `json:"prio,omitempty"`
// RootName Root zone name.
RootName *string `json:"rootName,omitempty"`
// Ttl Time to live for the record, recommended 3600.
Ttl *int `json:"ttl,omitempty"`
// Type Holds supported dns record types.
Type *RecordTypes `json:"type,omitempty"`
}
// RecordUpdate defines model for record-update.
type RecordUpdate struct {
Content *string `json:"content,omitempty"`
// Disabled When is true, the record is not visible for lookup.
Disabled *bool `json:"disabled,omitempty"`
Prio *int `json:"prio,omitempty"`
// Ttl Time to live for the record, recommended 3600.
Ttl *int `json:"ttl,omitempty"`
}
// RecordTypes Holds supported dns record types.
type RecordTypes string
// Zone defines model for zone.
type Zone struct {
// Id The zone id.
Id *string `json:"id,omitempty"`
// Name The zone name.
Name *string `json:"name,omitempty"`
// Type Represents the possible zone types.
Type *ZoneTypes `json:"type,omitempty"`
}
// ZoneTypes Represents the possible zone types.
type ZoneTypes string
// GetZoneParams defines parameters for GetZone.
type GetZoneParams struct {
// Suffix The FQDN used to filter all the record names that end with it.
Suffix *string `form:"suffix,omitempty" json:"suffix,omitempty"`
// RecordName The record names that should be included (same as name field of Record)
RecordName *string `form:"recordName,omitempty" json:"recordName,omitempty"`
// RecordType A comma-separated list of record types that should be included
RecordType *string `form:"recordType,omitempty" json:"recordType,omitempty"`
}
// PatchZoneJSONBody defines parameters for PatchZone.
type PatchZoneJSONBody = []Record
// UpdateZoneJSONBody defines parameters for UpdateZone.
type UpdateZoneJSONBody = []Record
// CreateRecordsJSONBody defines parameters for CreateRecords.
type CreateRecordsJSONBody = []Record
// ActivateDynDnsJSONRequestBody defines body for ActivateDynDns for application/json ContentType.
type ActivateDynDnsJSONRequestBody = DynDnsRequest
// UpdateDynDnsJSONRequestBody defines body for UpdateDynDns for application/json ContentType.
type UpdateDynDnsJSONRequestBody = DynDnsRequest
// PatchZoneJSONRequestBody defines body for PatchZone for application/json ContentType.
type PatchZoneJSONRequestBody = PatchZoneJSONBody
// UpdateZoneJSONRequestBody defines body for UpdateZone for application/json ContentType.
type UpdateZoneJSONRequestBody = UpdateZoneJSONBody
// CreateRecordsJSONRequestBody defines body for CreateRecords for application/json ContentType.
type CreateRecordsJSONRequestBody = CreateRecordsJSONBody
// UpdateRecordJSONRequestBody defines body for UpdateRecord for application/json ContentType.
type UpdateRecordJSONRequestBody = RecordUpdate
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func(ctx context.Context, req *http.Request) error
// Doer performs HTTP requests.
//
// The standard http.Client implements this interface.
type HttpRequestDoer interface {
Do(req *http.Request) (*http.Response, error)
}
// Client which conforms to the OpenAPI3 specification for this service.
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
// ClientOption allows setting custom parameters during construction
type ClientOption func(*Client) error
// Creates a new Client, with reasonable defaults
func NewClient(server string, opts ...ClientOption) (*Client, error) {
// create a client with sane default values
client := Client{
Server: server,
}
// mutate client and add all optional params
for _, o := range opts {
if err := o(&client); err != nil {
return nil, err
}
}
// ensure the server URL always has a trailing slash
if !strings.HasSuffix(client.Server, "/") {
client.Server += "/"
}
// create httpClient, if not already present
if client.Client == nil {
client.Client = &http.Client{}
}
return &client, nil
}
// WithHTTPClient allows overriding the default Doer, which is
// automatically created using http.Client. This is useful for tests.
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
return func(c *Client) error {
c.Client = doer
return nil
}
}
// WithRequestEditorFn allows setting up a callback function, which will be
// called right before sending the request. This can be used to mutate the request.
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
return func(c *Client) error {
c.RequestEditors = append(c.RequestEditors, fn)
return nil
}
}
// The interface specification for the client above.
type ClientInterface interface {
// DisableDynDns request
DisableDynDns(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// ActivateDynDnsWithBody request with any body
ActivateDynDnsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
ActivateDynDns(ctx context.Context, body ActivateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteDynDns request
DeleteDynDns(ctx context.Context, bulkId string, reqEditors ...RequestEditorFn) (*http.Response, error)
// UpdateDynDnsWithBody request with any body
UpdateDynDnsWithBody(ctx context.Context, bulkId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UpdateDynDns(ctx context.Context, bulkId string, body UpdateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetZones request
GetZones(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetZone request
GetZone(ctx context.Context, zoneId string, params *GetZoneParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// PatchZoneWithBody request with any body
PatchZoneWithBody(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PatchZone(ctx context.Context, zoneId string, body PatchZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// UpdateZoneWithBody request with any body
UpdateZoneWithBody(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UpdateZone(ctx context.Context, zoneId string, body UpdateZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreateRecordsWithBody request with any body
CreateRecordsWithBody(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateRecords(ctx context.Context, zoneId string, body CreateRecordsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteRecord request
DeleteRecord(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetRecord request
GetRecord(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error)
// UpdateRecordWithBody request with any body
UpdateRecordWithBody(ctx context.Context, zoneId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UpdateRecord(ctx context.Context, zoneId string, recordId string, body UpdateRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
func (c *Client) DisableDynDns(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDisableDynDnsRequest(c.Server)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) ActivateDynDnsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewActivateDynDnsRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) ActivateDynDns(ctx context.Context, body ActivateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewActivateDynDnsRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) DeleteDynDns(ctx context.Context, bulkId string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteDynDnsRequest(c.Server, bulkId)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateDynDnsWithBody(ctx context.Context, bulkId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateDynDnsRequestWithBody(c.Server, bulkId, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateDynDns(ctx context.Context, bulkId string, body UpdateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateDynDnsRequest(c.Server, bulkId, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetZones(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetZonesRequest(c.Server)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetZone(ctx context.Context, zoneId string, params *GetZoneParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetZoneRequest(c.Server, zoneId, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PatchZoneWithBody(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPatchZoneRequestWithBody(c.Server, zoneId, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PatchZone(ctx context.Context, zoneId string, body PatchZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPatchZoneRequest(c.Server, zoneId, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateZoneWithBody(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateZoneRequestWithBody(c.Server, zoneId, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateZone(ctx context.Context, zoneId string, body UpdateZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateZoneRequest(c.Server, zoneId, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) CreateRecordsWithBody(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateRecordsRequestWithBody(c.Server, zoneId, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) CreateRecords(ctx context.Context, zoneId string, body CreateRecordsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateRecordsRequest(c.Server, zoneId, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) DeleteRecord(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteRecordRequest(c.Server, zoneId, recordId)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetRecord(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetRecordRequest(c.Server, zoneId, recordId)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateRecordWithBody(ctx context.Context, zoneId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateRecordRequestWithBody(c.Server, zoneId, recordId, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) UpdateRecord(ctx context.Context, zoneId string, recordId string, body UpdateRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUpdateRecordRequest(c.Server, zoneId, recordId, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
// NewDisableDynDnsRequest generates requests for DisableDynDns
func NewDisableDynDnsRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/dyndns")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("DELETE", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewActivateDynDnsRequest calls the generic ActivateDynDns builder with application/json body
func NewActivateDynDnsRequest(server string, body ActivateDynDnsJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewActivateDynDnsRequestWithBody(server, "application/json", bodyReader)
}
// NewActivateDynDnsRequestWithBody generates requests for ActivateDynDns with any type of body
func NewActivateDynDnsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/dyndns")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewDeleteDynDnsRequest generates requests for DeleteDynDns
func NewDeleteDynDnsRequest(server string, bulkId string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bulkId", runtime.ParamLocationPath, bulkId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/dyndns/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("DELETE", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewUpdateDynDnsRequest calls the generic UpdateDynDns builder with application/json body
func NewUpdateDynDnsRequest(server string, bulkId string, body UpdateDynDnsJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewUpdateDynDnsRequestWithBody(server, bulkId, "application/json", bodyReader)
}
// NewUpdateDynDnsRequestWithBody generates requests for UpdateDynDns with any type of body
func NewUpdateDynDnsRequestWithBody(server string, bulkId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bulkId", runtime.ParamLocationPath, bulkId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/dyndns/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("PUT", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewGetZonesRequest generates requests for GetZones
func NewGetZonesRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetZoneRequest generates requests for GetZone
func NewGetZoneRequest(server string, zoneId string, params *GetZoneParams) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
queryValues := queryURL.Query()
if params.Suffix != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "suffix", runtime.ParamLocationQuery, *params.Suffix); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.RecordName != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "recordName", runtime.ParamLocationQuery, *params.RecordName); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.RecordType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "recordType", runtime.ParamLocationQuery, *params.RecordType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewPatchZoneRequest calls the generic PatchZone builder with application/json body
func NewPatchZoneRequest(server string, zoneId string, body PatchZoneJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPatchZoneRequestWithBody(server, zoneId, "application/json", bodyReader)
}
// NewPatchZoneRequestWithBody generates requests for PatchZone with any type of body
func NewPatchZoneRequestWithBody(server string, zoneId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("PATCH", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewUpdateZoneRequest calls the generic UpdateZone builder with application/json body
func NewUpdateZoneRequest(server string, zoneId string, body UpdateZoneJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewUpdateZoneRequestWithBody(server, zoneId, "application/json", bodyReader)
}
// NewUpdateZoneRequestWithBody generates requests for UpdateZone with any type of body
func NewUpdateZoneRequestWithBody(server string, zoneId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("PUT", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewCreateRecordsRequest calls the generic CreateRecords builder with application/json body
func NewCreateRecordsRequest(server string, zoneId string, body CreateRecordsJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewCreateRecordsRequestWithBody(server, zoneId, "application/json", bodyReader)
}
// NewCreateRecordsRequestWithBody generates requests for CreateRecords with any type of body
func NewCreateRecordsRequestWithBody(server string, zoneId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s/records", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewDeleteRecordRequest generates requests for DeleteRecord
func NewDeleteRecordRequest(server string, zoneId string, recordId string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "recordId", runtime.ParamLocationPath, recordId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s/records/%s", pathParam0, pathParam1)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("DELETE", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetRecordRequest generates requests for GetRecord
func NewGetRecordRequest(server string, zoneId string, recordId string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "recordId", runtime.ParamLocationPath, recordId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s/records/%s", pathParam0, pathParam1)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewUpdateRecordRequest calls the generic UpdateRecord builder with application/json body
func NewUpdateRecordRequest(server string, zoneId string, recordId string, body UpdateRecordJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewUpdateRecordRequestWithBody(server, zoneId, recordId, "application/json", bodyReader)
}
// NewUpdateRecordRequestWithBody generates requests for UpdateRecord with any type of body
func NewUpdateRecordRequestWithBody(server string, zoneId string, recordId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "zoneId", runtime.ParamLocationPath, zoneId)
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "recordId", runtime.ParamLocationPath, recordId)
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/v1/zones/%s/records/%s", pathParam0, pathParam1)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("PUT", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
for _, r := range c.RequestEditors {
if err := r(ctx, req); err != nil {
return err
}
}
for _, r := range additionalEditors {
if err := r(ctx, req); err != nil {
return err
}
}
return nil
}
// ClientWithResponses builds on ClientInterface to offer response payloads
type ClientWithResponses struct {
ClientInterface
}
// NewClientWithResponses creates a new ClientWithResponses, which wraps
// Client with return type handling
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
client, err := NewClient(server, opts...)
if err != nil {
return nil, err
}
return &ClientWithResponses{client}, nil
}
// WithBaseURL overrides the baseURL.
func WithBaseURL(baseURL string) ClientOption {
return func(c *Client) error {
newBaseURL, err := url.Parse(baseURL)
if err != nil {
return err
}
c.Server = newBaseURL.String()
return nil
}
}
// ClientWithResponsesInterface is the interface specification for the client with responses above.
type ClientWithResponsesInterface interface {
// DisableDynDnsWithResponse request
DisableDynDnsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*DisableDynDnsResponse, error)
// ActivateDynDnsWithBodyWithResponse request with any body
ActivateDynDnsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ActivateDynDnsResponse, error)
ActivateDynDnsWithResponse(ctx context.Context, body ActivateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*ActivateDynDnsResponse, error)
// DeleteDynDnsWithResponse request
DeleteDynDnsWithResponse(ctx context.Context, bulkId string, reqEditors ...RequestEditorFn) (*DeleteDynDnsResponse, error)
// UpdateDynDnsWithBodyWithResponse request with any body
UpdateDynDnsWithBodyWithResponse(ctx context.Context, bulkId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDynDnsResponse, error)
UpdateDynDnsWithResponse(ctx context.Context, bulkId string, body UpdateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDynDnsResponse, error)
// GetZonesWithResponse request
GetZonesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetZonesResponse, error)
// GetZoneWithResponse request
GetZoneWithResponse(ctx context.Context, zoneId string, params *GetZoneParams, reqEditors ...RequestEditorFn) (*GetZoneResponse, error)
// PatchZoneWithBodyWithResponse request with any body
PatchZoneWithBodyWithResponse(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchZoneResponse, error)
PatchZoneWithResponse(ctx context.Context, zoneId string, body PatchZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchZoneResponse, error)
// UpdateZoneWithBodyWithResponse request with any body
UpdateZoneWithBodyWithResponse(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateZoneResponse, error)
UpdateZoneWithResponse(ctx context.Context, zoneId string, body UpdateZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateZoneResponse, error)
// CreateRecordsWithBodyWithResponse request with any body
CreateRecordsWithBodyWithResponse(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRecordsResponse, error)
CreateRecordsWithResponse(ctx context.Context, zoneId string, body CreateRecordsJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRecordsResponse, error)
// DeleteRecordWithResponse request
DeleteRecordWithResponse(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*DeleteRecordResponse, error)
// GetRecordWithResponse request
GetRecordWithResponse(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*GetRecordResponse, error)
// UpdateRecordWithBodyWithResponse request with any body
UpdateRecordWithBodyWithResponse(ctx context.Context, zoneId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateRecordResponse, error)
UpdateRecordWithResponse(ctx context.Context, zoneId string, recordId string, body UpdateRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateRecordResponse, error)
}
type DisableDynDnsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r DisableDynDnsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DisableDynDnsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type ActivateDynDnsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DynamicDns
JSON400 *[]Error
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r ActivateDynDnsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ActivateDynDnsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type DeleteDynDnsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r DeleteDynDnsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DeleteDynDnsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type UpdateDynDnsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *[]Error
JSON401 *[]Error
JSON403 *[]Error
JSON404 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r UpdateDynDnsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r UpdateDynDnsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetZonesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *[]Zone
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r GetZonesResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetZonesResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetZoneResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CustomerZone
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r GetZoneResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetZoneResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PatchZoneResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *[]Errors
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r PatchZoneResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PatchZoneResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type UpdateZoneResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *[]Errors
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r UpdateZoneResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r UpdateZoneResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type CreateRecordsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON201 *[]RecordResponse
JSON400 *[]Error
JSON401 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r CreateRecordsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r CreateRecordsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type DeleteRecordResponse struct {
Body []byte
HTTPResponse *http.Response
JSON401 *[]Error
JSON404 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r DeleteRecordResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DeleteRecordResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetRecordResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *RecordResponse
JSON401 *[]Error
JSON404 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r GetRecordResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetRecordResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type UpdateRecordResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *RecordResponse
JSON400 *[]Errors
JSON401 *[]Error
JSON404 *[]Error
JSON500 *[]Error
}
// Status returns HTTPResponse.Status
func (r UpdateRecordResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r UpdateRecordResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// DisableDynDnsWithResponse request returning *DisableDynDnsResponse
func (c *ClientWithResponses) DisableDynDnsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*DisableDynDnsResponse, error) {
rsp, err := c.DisableDynDns(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseDisableDynDnsResponse(rsp)
}
// ActivateDynDnsWithBodyWithResponse request with arbitrary body returning *ActivateDynDnsResponse
func (c *ClientWithResponses) ActivateDynDnsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ActivateDynDnsResponse, error) {
rsp, err := c.ActivateDynDnsWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseActivateDynDnsResponse(rsp)
}
func (c *ClientWithResponses) ActivateDynDnsWithResponse(ctx context.Context, body ActivateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*ActivateDynDnsResponse, error) {
rsp, err := c.ActivateDynDns(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseActivateDynDnsResponse(rsp)
}
// DeleteDynDnsWithResponse request returning *DeleteDynDnsResponse
func (c *ClientWithResponses) DeleteDynDnsWithResponse(ctx context.Context, bulkId string, reqEditors ...RequestEditorFn) (*DeleteDynDnsResponse, error) {
rsp, err := c.DeleteDynDns(ctx, bulkId, reqEditors...)
if err != nil {
return nil, err
}
return ParseDeleteDynDnsResponse(rsp)
}
// UpdateDynDnsWithBodyWithResponse request with arbitrary body returning *UpdateDynDnsResponse
func (c *ClientWithResponses) UpdateDynDnsWithBodyWithResponse(ctx context.Context, bulkId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDynDnsResponse, error) {
rsp, err := c.UpdateDynDnsWithBody(ctx, bulkId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUpdateDynDnsResponse(rsp)
}
func (c *ClientWithResponses) UpdateDynDnsWithResponse(ctx context.Context, bulkId string, body UpdateDynDnsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDynDnsResponse, error) {
rsp, err := c.UpdateDynDns(ctx, bulkId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUpdateDynDnsResponse(rsp)
}
// GetZonesWithResponse request returning *GetZonesResponse
func (c *ClientWithResponses) GetZonesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetZonesResponse, error) {
rsp, err := c.GetZones(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetZonesResponse(rsp)
}
// GetZoneWithResponse request returning *GetZoneResponse
func (c *ClientWithResponses) GetZoneWithResponse(ctx context.Context, zoneId string, params *GetZoneParams, reqEditors ...RequestEditorFn) (*GetZoneResponse, error) {
rsp, err := c.GetZone(ctx, zoneId, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetZoneResponse(rsp)
}
// PatchZoneWithBodyWithResponse request with arbitrary body returning *PatchZoneResponse
func (c *ClientWithResponses) PatchZoneWithBodyWithResponse(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PatchZoneResponse, error) {
rsp, err := c.PatchZoneWithBody(ctx, zoneId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePatchZoneResponse(rsp)
}
func (c *ClientWithResponses) PatchZoneWithResponse(ctx context.Context, zoneId string, body PatchZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*PatchZoneResponse, error) {
rsp, err := c.PatchZone(ctx, zoneId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePatchZoneResponse(rsp)
}
// UpdateZoneWithBodyWithResponse request with arbitrary body returning *UpdateZoneResponse
func (c *ClientWithResponses) UpdateZoneWithBodyWithResponse(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateZoneResponse, error) {
rsp, err := c.UpdateZoneWithBody(ctx, zoneId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUpdateZoneResponse(rsp)
}
func (c *ClientWithResponses) UpdateZoneWithResponse(ctx context.Context, zoneId string, body UpdateZoneJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateZoneResponse, error) {
rsp, err := c.UpdateZone(ctx, zoneId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUpdateZoneResponse(rsp)
}
// CreateRecordsWithBodyWithResponse request with arbitrary body returning *CreateRecordsResponse
func (c *ClientWithResponses) CreateRecordsWithBodyWithResponse(ctx context.Context, zoneId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRecordsResponse, error) {
rsp, err := c.CreateRecordsWithBody(ctx, zoneId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreateRecordsResponse(rsp)
}
func (c *ClientWithResponses) CreateRecordsWithResponse(ctx context.Context, zoneId string, body CreateRecordsJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRecordsResponse, error) {
rsp, err := c.CreateRecords(ctx, zoneId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreateRecordsResponse(rsp)
}
// DeleteRecordWithResponse request returning *DeleteRecordResponse
func (c *ClientWithResponses) DeleteRecordWithResponse(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*DeleteRecordResponse, error) {
rsp, err := c.DeleteRecord(ctx, zoneId, recordId, reqEditors...)
if err != nil {
return nil, err
}
return ParseDeleteRecordResponse(rsp)
}
// GetRecordWithResponse request returning *GetRecordResponse
func (c *ClientWithResponses) GetRecordWithResponse(ctx context.Context, zoneId string, recordId string, reqEditors ...RequestEditorFn) (*GetRecordResponse, error) {
rsp, err := c.GetRecord(ctx, zoneId, recordId, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetRecordResponse(rsp)
}
// UpdateRecordWithBodyWithResponse request with arbitrary body returning *UpdateRecordResponse
func (c *ClientWithResponses) UpdateRecordWithBodyWithResponse(ctx context.Context, zoneId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateRecordResponse, error) {
rsp, err := c.UpdateRecordWithBody(ctx, zoneId, recordId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUpdateRecordResponse(rsp)
}
func (c *ClientWithResponses) UpdateRecordWithResponse(ctx context.Context, zoneId string, recordId string, body UpdateRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateRecordResponse, error) {
rsp, err := c.UpdateRecord(ctx, zoneId, recordId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUpdateRecordResponse(rsp)
}
// ParseDisableDynDnsResponse parses an HTTP response from a DisableDynDnsWithResponse call
func ParseDisableDynDnsResponse(rsp *http.Response) (*DisableDynDnsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DisableDynDnsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseActivateDynDnsResponse parses an HTTP response from a ActivateDynDnsWithResponse call
func ParseActivateDynDnsResponse(rsp *http.Response) (*ActivateDynDnsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ActivateDynDnsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest DynamicDns
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseDeleteDynDnsResponse parses an HTTP response from a DeleteDynDnsWithResponse call
func ParseDeleteDynDnsResponse(rsp *http.Response) (*DeleteDynDnsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DeleteDynDnsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseUpdateDynDnsResponse parses an HTTP response from a UpdateDynDnsWithResponse call
func ParseUpdateDynDnsResponse(rsp *http.Response) (*UpdateDynDnsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &UpdateDynDnsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON403 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON404 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseGetZonesResponse parses an HTTP response from a GetZonesWithResponse call
func ParseGetZonesResponse(rsp *http.Response) (*GetZonesResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetZonesResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest []Zone
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseGetZoneResponse parses an HTTP response from a GetZoneWithResponse call
func ParseGetZoneResponse(rsp *http.Response) (*GetZoneResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetZoneResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest CustomerZone
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParsePatchZoneResponse parses an HTTP response from a PatchZoneWithResponse call
func ParsePatchZoneResponse(rsp *http.Response) (*PatchZoneResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PatchZoneResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest []Errors
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseUpdateZoneResponse parses an HTTP response from a UpdateZoneWithResponse call
func ParseUpdateZoneResponse(rsp *http.Response) (*UpdateZoneResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &UpdateZoneResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest []Errors
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseCreateRecordsResponse parses an HTTP response from a CreateRecordsWithResponse call
func ParseCreateRecordsResponse(rsp *http.Response) (*CreateRecordsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &CreateRecordsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201:
var dest []RecordResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON201 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseDeleteRecordResponse parses an HTTP response from a DeleteRecordWithResponse call
func ParseDeleteRecordResponse(rsp *http.Response) (*DeleteRecordResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DeleteRecordResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON404 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseGetRecordResponse parses an HTTP response from a GetRecordWithResponse call
func ParseGetRecordResponse(rsp *http.Response) (*GetRecordResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetRecordResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest RecordResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON404 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseUpdateRecordResponse parses an HTTP response from a UpdateRecordWithResponse call
func ParseUpdateRecordResponse(rsp *http.Response) (*UpdateRecordResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &UpdateRecordResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest RecordResponse
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest []Errors
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON404 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest []Error
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}