Files
Kristoffer Dalby ba90048cfb gen/client/v1: add the generated HTTP client
Generate a strongly-typed Go client (oapi-codegen) from the emitted spec, committed under gen/client/v1 as package clientv1. Tests exercise it against the in-memory Huma server over both TCP and the unix socket.
2026-06-19 15:21:00 +02:00

4729 lines
143 KiB
Go

// Package clientv1 provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT.
package clientv1
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/oapi-codegen/runtime"
)
const (
BearerScopes bearerContextKey = "bearer.Scopes"
)
// Defines values for NodeRegisterMethod.
const (
REGISTERMETHODAUTHKEY NodeRegisterMethod = "REGISTER_METHOD_AUTH_KEY"
REGISTERMETHODCLI NodeRegisterMethod = "REGISTER_METHOD_CLI"
REGISTERMETHODOIDC NodeRegisterMethod = "REGISTER_METHOD_OIDC"
REGISTERMETHODUNSPECIFIED NodeRegisterMethod = "REGISTER_METHOD_UNSPECIFIED"
)
// Valid indicates whether the value is a known member of the NodeRegisterMethod enum.
func (e NodeRegisterMethod) Valid() bool {
switch e {
case REGISTERMETHODAUTHKEY:
return true
case REGISTERMETHODCLI:
return true
case REGISTERMETHODOIDC:
return true
case REGISTERMETHODUNSPECIFIED:
return true
default:
return false
}
}
// ApiKey defines model for ApiKey.
type ApiKey struct {
CreatedAt *time.Time `json:"createdAt"`
Expiration *time.Time `json:"expiration"`
Id string `json:"id"`
LastSeen *time.Time `json:"lastSeen"`
Prefix string `json:"prefix"`
}
// AuthApproveOutputBody defines model for AuthApproveOutputBody.
type AuthApproveOutputBody = map[string]interface{}
// AuthApproveRequestBody defines model for AuthApproveRequestBody.
type AuthApproveRequestBody struct {
AuthId *string `json:"authId,omitempty"`
}
// AuthRegisterOutputBody defines model for AuthRegisterOutputBody.
type AuthRegisterOutputBody struct {
Node Node `json:"node"`
}
// AuthRegisterRequestBody defines model for AuthRegisterRequestBody.
type AuthRegisterRequestBody struct {
AuthId *string `json:"authId,omitempty"`
User *string `json:"user,omitempty"`
}
// AuthRejectOutputBody defines model for AuthRejectOutputBody.
type AuthRejectOutputBody = map[string]interface{}
// AuthRejectRequestBody defines model for AuthRejectRequestBody.
type AuthRejectRequestBody struct {
AuthId *string `json:"authId,omitempty"`
}
// BackfillNodeIPsOutputBody defines model for BackfillNodeIPsOutputBody.
type BackfillNodeIPsOutputBody struct {
Changes []string `json:"changes"`
}
// CheckPolicyOutputBody defines model for CheckPolicyOutputBody.
type CheckPolicyOutputBody = map[string]interface{}
// CreateApiKeyOutputBody defines model for CreateApiKeyOutputBody.
type CreateApiKeyOutputBody struct {
ApiKey string `json:"apiKey"`
}
// CreateApiKeyRequestBody defines model for CreateApiKeyRequestBody.
type CreateApiKeyRequestBody struct {
Expiration *time.Time `json:"expiration,omitempty"`
}
// CreatePreAuthKeyRequestBody defines model for CreatePreAuthKeyRequestBody.
type CreatePreAuthKeyRequestBody struct {
AclTags *[]string `json:"aclTags,omitempty"`
Ephemeral *bool `json:"ephemeral,omitempty"`
Expiration *time.Time `json:"expiration,omitempty"`
Reusable *bool `json:"reusable,omitempty"`
User *string `json:"user,omitempty"`
}
// CreateUserRequestBody defines model for CreateUserRequestBody.
type CreateUserRequestBody struct {
DisplayName *string `json:"displayName,omitempty"`
Email *string `json:"email,omitempty"`
Name *string `json:"name,omitempty"`
PictureUrl *string `json:"pictureUrl,omitempty"`
}
// DebugCreateNodeRequestBody defines model for DebugCreateNodeRequestBody.
type DebugCreateNodeRequestBody struct {
Key *string `json:"key,omitempty"`
Name *string `json:"name,omitempty"`
Routes *[]string `json:"routes,omitempty"`
User *string `json:"user,omitempty"`
}
// DeleteApiKeyOutputBody defines model for DeleteApiKeyOutputBody.
type DeleteApiKeyOutputBody = map[string]interface{}
// DeleteNodeOutputBody defines model for DeleteNodeOutputBody.
type DeleteNodeOutputBody = map[string]interface{}
// DeletePreAuthKeyOutputBody defines model for DeletePreAuthKeyOutputBody.
type DeletePreAuthKeyOutputBody = map[string]interface{}
// DeleteUserOutputBody defines model for DeleteUserOutputBody.
type DeleteUserOutputBody = map[string]interface{}
// ErrorDetail defines model for ErrorDetail.
type ErrorDetail struct {
// Location Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
Location *string `json:"location,omitempty"`
// Message Error message text
Message *string `json:"message,omitempty"`
// Value The value at the given location
Value interface{} `json:"value,omitempty"`
}
// ErrorModel defines model for ErrorModel.
type ErrorModel struct {
// Detail A human-readable explanation specific to this occurrence of the problem.
Detail *string `json:"detail,omitempty"`
// Errors Optional list of individual error details
Errors *[]ErrorDetail `json:"errors,omitempty"`
// Instance A URI reference that identifies the specific occurrence of the problem.
Instance *string `json:"instance,omitempty"`
// Status HTTP status code
Status *int64 `json:"status,omitempty"`
// Title A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
Title *string `json:"title,omitempty"`
// Type A URI reference to human-readable documentation for the error.
Type *string `json:"type,omitempty"`
}
// ExpireApiKeyOutputBody defines model for ExpireApiKeyOutputBody.
type ExpireApiKeyOutputBody = map[string]interface{}
// ExpireApiKeyRequestBody defines model for ExpireApiKeyRequestBody.
type ExpireApiKeyRequestBody struct {
Id *string `json:"id,omitempty"`
Prefix *string `json:"prefix,omitempty"`
}
// ExpireNodeRequestBody defines model for ExpireNodeRequestBody.
type ExpireNodeRequestBody struct {
DisableExpiry *bool `json:"disableExpiry,omitempty"`
Expiry *time.Time `json:"expiry,omitempty"`
}
// ExpirePreAuthKeyOutputBody defines model for ExpirePreAuthKeyOutputBody.
type ExpirePreAuthKeyOutputBody = map[string]interface{}
// ExpirePreAuthKeyRequestBody defines model for ExpirePreAuthKeyRequestBody.
type ExpirePreAuthKeyRequestBody struct {
Id *string `json:"id,omitempty"`
}
// HealthResponseBody defines model for HealthResponseBody.
type HealthResponseBody struct {
DatabaseConnectivity bool `json:"databaseConnectivity"`
}
// ListApiKeysOutputBody defines model for ListApiKeysOutputBody.
type ListApiKeysOutputBody struct {
ApiKeys []ApiKey `json:"apiKeys"`
}
// ListNodesOutputBody defines model for ListNodesOutputBody.
type ListNodesOutputBody struct {
Nodes []Node `json:"nodes"`
}
// ListPreAuthKeysOutputBody defines model for ListPreAuthKeysOutputBody.
type ListPreAuthKeysOutputBody struct {
PreAuthKeys []PreAuthKey `json:"preAuthKeys"`
}
// ListUsersOutputBody defines model for ListUsersOutputBody.
type ListUsersOutputBody struct {
Users []User `json:"users"`
}
// Node defines model for Node.
type Node struct {
ApprovedRoutes []string `json:"approvedRoutes"`
AvailableRoutes []string `json:"availableRoutes"`
CreatedAt time.Time `json:"createdAt"`
DiscoKey string `json:"discoKey"`
Expiry *time.Time `json:"expiry"`
GivenName string `json:"givenName"`
Id string `json:"id"`
IpAddresses []string `json:"ipAddresses"`
LastSeen *time.Time `json:"lastSeen"`
MachineKey string `json:"machineKey"`
Name string `json:"name"`
NodeKey string `json:"nodeKey"`
Online bool `json:"online"`
PreAuthKey NodePreAuthKey `json:"preAuthKey"`
RegisterMethod NodeRegisterMethod `json:"registerMethod"`
SubnetRoutes []string `json:"subnetRoutes"`
Tags []string `json:"tags"`
User User `json:"user"`
}
// NodeRegisterMethod defines model for Node.RegisterMethod.
type NodeRegisterMethod string
// NodeOutputBody defines model for NodeOutputBody.
type NodeOutputBody struct {
Node Node `json:"node"`
}
// NodePreAuthKey defines model for NodePreAuthKey.
type NodePreAuthKey struct {
AclTags []string `json:"aclTags"`
CreatedAt *time.Time `json:"createdAt"`
Ephemeral bool `json:"ephemeral"`
Expiration *time.Time `json:"expiration"`
Id string `json:"id"`
Key string `json:"key"`
Reusable bool `json:"reusable"`
Used bool `json:"used"`
User User `json:"user"`
}
// PolicyRequestBody defines model for PolicyRequestBody.
type PolicyRequestBody struct {
Policy *string `json:"policy,omitempty"`
}
// PolicyResponseBody defines model for PolicyResponseBody.
type PolicyResponseBody struct {
Policy string `json:"policy"`
UpdatedAt time.Time `json:"updatedAt"`
}
// PreAuthKey defines model for PreAuthKey.
type PreAuthKey struct {
AclTags []string `json:"aclTags"`
CreatedAt time.Time `json:"createdAt"`
Ephemeral bool `json:"ephemeral"`
Expiration time.Time `json:"expiration"`
Id string `json:"id"`
Key string `json:"key"`
Reusable bool `json:"reusable"`
Used bool `json:"used"`
User User `json:"user"`
}
// PreAuthKeyOutputBody defines model for PreAuthKeyOutputBody.
type PreAuthKeyOutputBody struct {
PreAuthKey PreAuthKey `json:"preAuthKey"`
}
// SetApprovedRoutesRequestBody defines model for SetApprovedRoutesRequestBody.
type SetApprovedRoutesRequestBody struct {
Routes *[]string `json:"routes,omitempty"`
}
// SetTagsRequestBody defines model for SetTagsRequestBody.
type SetTagsRequestBody struct {
Tags *[]string `json:"tags,omitempty"`
}
// User defines model for User.
type User struct {
CreatedAt time.Time `json:"createdAt"`
DisplayName string `json:"displayName"`
Email string `json:"email"`
Id string `json:"id"`
Name string `json:"name"`
ProfilePicUrl string `json:"profilePicUrl"`
Provider string `json:"provider"`
ProviderId string `json:"providerId"`
}
// UserOutputBody defines model for UserOutputBody.
type UserOutputBody struct {
User User `json:"user"`
}
// bearerContextKey is the context key for bearer security scheme
type bearerContextKey string
// DeleteApiKeyParams defines parameters for DeleteApiKey.
type DeleteApiKeyParams struct {
Id *string `form:"id,omitempty" json:"id,omitempty"`
}
// ListNodesParams defines parameters for ListNodes.
type ListNodesParams struct {
User *string `form:"user,omitempty" json:"user,omitempty"`
}
// BackfillNodeIPsParams defines parameters for BackfillNodeIPs.
type BackfillNodeIPsParams struct {
Confirmed *bool `form:"confirmed,omitempty" json:"confirmed,omitempty"`
}
// RegisterNodeParams defines parameters for RegisterNode.
type RegisterNodeParams struct {
User *string `form:"user,omitempty" json:"user,omitempty"`
Key *string `form:"key,omitempty" json:"key,omitempty"`
}
// DeletePreAuthKeyParams defines parameters for DeletePreAuthKey.
type DeletePreAuthKeyParams struct {
Id *string `form:"id,omitempty" json:"id,omitempty"`
}
// ListUsersParams defines parameters for ListUsers.
type ListUsersParams struct {
Id *string `form:"id,omitempty" json:"id,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty"`
Email *string `form:"email,omitempty" json:"email,omitempty"`
}
// CreateApiKeyJSONRequestBody defines body for CreateApiKey for application/json ContentType.
type CreateApiKeyJSONRequestBody = CreateApiKeyRequestBody
// ExpireApiKeyJSONRequestBody defines body for ExpireApiKey for application/json ContentType.
type ExpireApiKeyJSONRequestBody = ExpireApiKeyRequestBody
// AuthApproveJSONRequestBody defines body for AuthApprove for application/json ContentType.
type AuthApproveJSONRequestBody = AuthApproveRequestBody
// AuthRegisterJSONRequestBody defines body for AuthRegister for application/json ContentType.
type AuthRegisterJSONRequestBody = AuthRegisterRequestBody
// AuthRejectJSONRequestBody defines body for AuthReject for application/json ContentType.
type AuthRejectJSONRequestBody = AuthRejectRequestBody
// DebugCreateNodeJSONRequestBody defines body for DebugCreateNode for application/json ContentType.
type DebugCreateNodeJSONRequestBody = DebugCreateNodeRequestBody
// SetApprovedRoutesJSONRequestBody defines body for SetApprovedRoutes for application/json ContentType.
type SetApprovedRoutesJSONRequestBody = SetApprovedRoutesRequestBody
// ExpireNodeJSONRequestBody defines body for ExpireNode for application/json ContentType.
type ExpireNodeJSONRequestBody = ExpireNodeRequestBody
// SetTagsJSONRequestBody defines body for SetTags for application/json ContentType.
type SetTagsJSONRequestBody = SetTagsRequestBody
// SetPolicyJSONRequestBody defines body for SetPolicy for application/json ContentType.
type SetPolicyJSONRequestBody = PolicyRequestBody
// CheckPolicyJSONRequestBody defines body for CheckPolicy for application/json ContentType.
type CheckPolicyJSONRequestBody = PolicyRequestBody
// CreatePreAuthKeyJSONRequestBody defines body for CreatePreAuthKey for application/json ContentType.
type CreatePreAuthKeyJSONRequestBody = CreatePreAuthKeyRequestBody
// ExpirePreAuthKeyJSONRequestBody defines body for ExpirePreAuthKey for application/json ContentType.
type ExpirePreAuthKeyJSONRequestBody = ExpirePreAuthKeyRequestBody
// CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.
type CreateUserJSONRequestBody = CreateUserRequestBody
// 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 {
// ListApiKeys request
ListApiKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreateApiKeyWithBody request with any body
CreateApiKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateApiKey(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ExpireApiKeyWithBody request with any body
ExpireApiKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
ExpireApiKey(ctx context.Context, body ExpireApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteApiKey request
DeleteApiKey(ctx context.Context, prefix string, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// AuthApproveWithBody request with any body
AuthApproveWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
AuthApprove(ctx context.Context, body AuthApproveJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// AuthRegisterWithBody request with any body
AuthRegisterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
AuthRegister(ctx context.Context, body AuthRegisterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// AuthRejectWithBody request with any body
AuthRejectWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
AuthReject(ctx context.Context, body AuthRejectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DebugCreateNodeWithBody request with any body
DebugCreateNodeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
DebugCreateNode(ctx context.Context, body DebugCreateNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// Health request
Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListNodes request
ListNodes(ctx context.Context, params *ListNodesParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// BackfillNodeIPs request
BackfillNodeIPs(ctx context.Context, params *BackfillNodeIPsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// RegisterNode request
RegisterNode(ctx context.Context, params *RegisterNodeParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteNode request
DeleteNode(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetNode request
GetNode(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*http.Response, error)
// SetApprovedRoutesWithBody request with any body
SetApprovedRoutesWithBody(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SetApprovedRoutes(ctx context.Context, nodeId string, body SetApprovedRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ExpireNodeWithBody request with any body
ExpireNodeWithBody(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
ExpireNode(ctx context.Context, nodeId string, body ExpireNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// RenameNode request
RenameNode(ctx context.Context, nodeId string, newName string, reqEditors ...RequestEditorFn) (*http.Response, error)
// SetTagsWithBody request with any body
SetTagsWithBody(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SetTags(ctx context.Context, nodeId string, body SetTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetPolicy request
GetPolicy(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// SetPolicyWithBody request with any body
SetPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SetPolicy(ctx context.Context, body SetPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// CheckPolicyWithBody request with any body
CheckPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CheckPolicy(ctx context.Context, body CheckPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeletePreAuthKey request
DeletePreAuthKey(ctx context.Context, params *DeletePreAuthKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListPreAuthKeys request
ListPreAuthKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreatePreAuthKeyWithBody request with any body
CreatePreAuthKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreatePreAuthKey(ctx context.Context, body CreatePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ExpirePreAuthKeyWithBody request with any body
ExpirePreAuthKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
ExpirePreAuthKey(ctx context.Context, body ExpirePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListUsers request
ListUsers(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreateUserWithBody request with any body
CreateUserWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateUser(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// DeleteUser request
DeleteUser(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
// RenameUser request
RenameUser(ctx context.Context, oldId string, newName string, reqEditors ...RequestEditorFn) (*http.Response, error)
}
func (c *Client) ListApiKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListApiKeysRequest(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) CreateApiKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateApiKeyRequestWithBody(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) CreateApiKey(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateApiKeyRequest(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) ExpireApiKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewExpireApiKeyRequestWithBody(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) ExpireApiKey(ctx context.Context, body ExpireApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewExpireApiKeyRequest(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) DeleteApiKey(ctx context.Context, prefix string, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteApiKeyRequest(c.Server, prefix, 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) AuthApproveWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewAuthApproveRequestWithBody(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) AuthApprove(ctx context.Context, body AuthApproveJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewAuthApproveRequest(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) AuthRegisterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewAuthRegisterRequestWithBody(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) AuthRegister(ctx context.Context, body AuthRegisterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewAuthRegisterRequest(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) AuthRejectWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewAuthRejectRequestWithBody(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) AuthReject(ctx context.Context, body AuthRejectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewAuthRejectRequest(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) DebugCreateNodeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDebugCreateNodeRequestWithBody(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) DebugCreateNode(ctx context.Context, body DebugCreateNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDebugCreateNodeRequest(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) Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewHealthRequest(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) ListNodes(ctx context.Context, params *ListNodesParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListNodesRequest(c.Server, 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) BackfillNodeIPs(ctx context.Context, params *BackfillNodeIPsParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewBackfillNodeIPsRequest(c.Server, 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) RegisterNode(ctx context.Context, params *RegisterNodeParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewRegisterNodeRequest(c.Server, 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) DeleteNode(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteNodeRequest(c.Server, nodeId)
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) GetNode(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetNodeRequest(c.Server, nodeId)
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) SetApprovedRoutesWithBody(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewSetApprovedRoutesRequestWithBody(c.Server, nodeId, 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) SetApprovedRoutes(ctx context.Context, nodeId string, body SetApprovedRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewSetApprovedRoutesRequest(c.Server, nodeId, 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) ExpireNodeWithBody(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewExpireNodeRequestWithBody(c.Server, nodeId, 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) ExpireNode(ctx context.Context, nodeId string, body ExpireNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewExpireNodeRequest(c.Server, nodeId, 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) RenameNode(ctx context.Context, nodeId string, newName string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewRenameNodeRequest(c.Server, nodeId, newName)
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) SetTagsWithBody(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewSetTagsRequestWithBody(c.Server, nodeId, 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) SetTags(ctx context.Context, nodeId string, body SetTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewSetTagsRequest(c.Server, nodeId, 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) GetPolicy(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetPolicyRequest(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) SetPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewSetPolicyRequestWithBody(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) SetPolicy(ctx context.Context, body SetPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewSetPolicyRequest(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) CheckPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCheckPolicyRequestWithBody(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) CheckPolicy(ctx context.Context, body CheckPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCheckPolicyRequest(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) DeletePreAuthKey(ctx context.Context, params *DeletePreAuthKeyParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeletePreAuthKeyRequest(c.Server, 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) ListPreAuthKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListPreAuthKeysRequest(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) CreatePreAuthKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreatePreAuthKeyRequestWithBody(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) CreatePreAuthKey(ctx context.Context, body CreatePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreatePreAuthKeyRequest(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) ExpirePreAuthKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewExpirePreAuthKeyRequestWithBody(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) ExpirePreAuthKey(ctx context.Context, body ExpirePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewExpirePreAuthKeyRequest(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) ListUsers(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListUsersRequest(c.Server, 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) CreateUserWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateUserRequestWithBody(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) CreateUser(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewCreateUserRequest(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) DeleteUser(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewDeleteUserRequest(c.Server, id)
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) RenameUser(ctx context.Context, oldId string, newName string, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewRenameUserRequest(c.Server, oldId, newName)
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)
}
// NewListApiKeysRequest generates requests for ListApiKeys
func NewListApiKeysRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/apikey")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewCreateApiKeyRequest calls the generic CreateApiKey builder with application/json body
func NewCreateApiKeyRequest(server string, body CreateApiKeyJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewCreateApiKeyRequestWithBody(server, "application/json", bodyReader)
}
// NewCreateApiKeyRequestWithBody generates requests for CreateApiKey with any type of body
func NewCreateApiKeyRequestWithBody(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("/api/v1/apikey")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewExpireApiKeyRequest calls the generic ExpireApiKey builder with application/json body
func NewExpireApiKeyRequest(server string, body ExpireApiKeyJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewExpireApiKeyRequestWithBody(server, "application/json", bodyReader)
}
// NewExpireApiKeyRequestWithBody generates requests for ExpireApiKey with any type of body
func NewExpireApiKeyRequestWithBody(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("/api/v1/apikey/expire")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewDeleteApiKeyRequest generates requests for DeleteApiKey
func NewDeleteApiKeyRequest(server string, prefix string, params *DeleteApiKeyParams) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "prefix", prefix, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/apikey/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
// queryValues collects non-styled parameters (passthrough, JSON)
// that are safe to round-trip through url.Values.Encode().
queryValues := queryURL.Query()
// rawQueryFragments collects pre-encoded query fragments from
// styled parameters, preserving literal commas as delimiters
// per the OpenAPI spec (e.g. "color=blue,black,brown").
var rawQueryFragments []string
if params.Id != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "id", *params.Id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "uint64"}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if encoded := queryValues.Encode(); encoded != "" {
rawQueryFragments = append(rawQueryFragments, encoded)
}
queryURL.RawQuery = strings.Join(rawQueryFragments, "&")
}
req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewAuthApproveRequest calls the generic AuthApprove builder with application/json body
func NewAuthApproveRequest(server string, body AuthApproveJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewAuthApproveRequestWithBody(server, "application/json", bodyReader)
}
// NewAuthApproveRequestWithBody generates requests for AuthApprove with any type of body
func NewAuthApproveRequestWithBody(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("/api/v1/auth/approve")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewAuthRegisterRequest calls the generic AuthRegister builder with application/json body
func NewAuthRegisterRequest(server string, body AuthRegisterJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewAuthRegisterRequestWithBody(server, "application/json", bodyReader)
}
// NewAuthRegisterRequestWithBody generates requests for AuthRegister with any type of body
func NewAuthRegisterRequestWithBody(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("/api/v1/auth/register")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewAuthRejectRequest calls the generic AuthReject builder with application/json body
func NewAuthRejectRequest(server string, body AuthRejectJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewAuthRejectRequestWithBody(server, "application/json", bodyReader)
}
// NewAuthRejectRequestWithBody generates requests for AuthReject with any type of body
func NewAuthRejectRequestWithBody(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("/api/v1/auth/reject")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewDebugCreateNodeRequest calls the generic DebugCreateNode builder with application/json body
func NewDebugCreateNodeRequest(server string, body DebugCreateNodeJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewDebugCreateNodeRequestWithBody(server, "application/json", bodyReader)
}
// NewDebugCreateNodeRequestWithBody generates requests for DebugCreateNode with any type of body
func NewDebugCreateNodeRequestWithBody(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("/api/v1/debug/node")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewHealthRequest generates requests for Health
func NewHealthRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/health")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewListNodesRequest generates requests for ListNodes
func NewListNodesRequest(server string, params *ListNodesParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
// queryValues collects non-styled parameters (passthrough, JSON)
// that are safe to round-trip through url.Values.Encode().
queryValues := queryURL.Query()
// rawQueryFragments collects pre-encoded query fragments from
// styled parameters, preserving literal commas as delimiters
// per the OpenAPI spec (e.g. "color=blue,black,brown").
var rawQueryFragments []string
if params.User != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "user", *params.User, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if encoded := queryValues.Encode(); encoded != "" {
rawQueryFragments = append(rawQueryFragments, encoded)
}
queryURL.RawQuery = strings.Join(rawQueryFragments, "&")
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewBackfillNodeIPsRequest generates requests for BackfillNodeIPs
func NewBackfillNodeIPsRequest(server string, params *BackfillNodeIPsParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/backfillips")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
// queryValues collects non-styled parameters (passthrough, JSON)
// that are safe to round-trip through url.Values.Encode().
queryValues := queryURL.Query()
// rawQueryFragments collects pre-encoded query fragments from
// styled parameters, preserving literal commas as delimiters
// per the OpenAPI spec (e.g. "color=blue,black,brown").
var rawQueryFragments []string
if params.Confirmed != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "confirmed", *params.Confirmed, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "boolean", Format: ""}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if encoded := queryValues.Encode(); encoded != "" {
rawQueryFragments = append(rawQueryFragments, encoded)
}
queryURL.RawQuery = strings.Join(rawQueryFragments, "&")
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewRegisterNodeRequest generates requests for RegisterNode
func NewRegisterNodeRequest(server string, params *RegisterNodeParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/register")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
// queryValues collects non-styled parameters (passthrough, JSON)
// that are safe to round-trip through url.Values.Encode().
queryValues := queryURL.Query()
// rawQueryFragments collects pre-encoded query fragments from
// styled parameters, preserving literal commas as delimiters
// per the OpenAPI spec (e.g. "color=blue,black,brown").
var rawQueryFragments []string
if params.User != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "user", *params.User, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if params.Key != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "key", *params.Key, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if encoded := queryValues.Encode(); encoded != "" {
rawQueryFragments = append(rawQueryFragments, encoded)
}
queryURL.RawQuery = strings.Join(rawQueryFragments, "&")
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewDeleteNodeRequest generates requests for DeleteNode
func NewDeleteNodeRequest(server string, nodeId string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "nodeId", nodeId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetNodeRequest generates requests for GetNode
func NewGetNodeRequest(server string, nodeId string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "nodeId", nodeId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewSetApprovedRoutesRequest calls the generic SetApprovedRoutes builder with application/json body
func NewSetApprovedRoutesRequest(server string, nodeId string, body SetApprovedRoutesJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewSetApprovedRoutesRequestWithBody(server, nodeId, "application/json", bodyReader)
}
// NewSetApprovedRoutesRequestWithBody generates requests for SetApprovedRoutes with any type of body
func NewSetApprovedRoutesRequestWithBody(server string, nodeId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "nodeId", nodeId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/%s/approve_routes", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewExpireNodeRequest calls the generic ExpireNode builder with application/json body
func NewExpireNodeRequest(server string, nodeId string, body ExpireNodeJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewExpireNodeRequestWithBody(server, nodeId, "application/json", bodyReader)
}
// NewExpireNodeRequestWithBody generates requests for ExpireNode with any type of body
func NewExpireNodeRequestWithBody(server string, nodeId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "nodeId", nodeId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/%s/expire", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewRenameNodeRequest generates requests for RenameNode
func NewRenameNodeRequest(server string, nodeId string, newName string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "nodeId", nodeId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithOptions("simple", false, "newName", newName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/%s/rename/%s", pathParam0, pathParam1)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewSetTagsRequest calls the generic SetTags builder with application/json body
func NewSetTagsRequest(server string, nodeId string, body SetTagsJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewSetTagsRequestWithBody(server, nodeId, "application/json", bodyReader)
}
// NewSetTagsRequestWithBody generates requests for SetTags with any type of body
func NewSetTagsRequestWithBody(server string, nodeId string, contentType string, body io.Reader) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "nodeId", nodeId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/node/%s/tags", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewGetPolicyRequest generates requests for GetPolicy
func NewGetPolicyRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/policy")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewSetPolicyRequest calls the generic SetPolicy builder with application/json body
func NewSetPolicyRequest(server string, body SetPolicyJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewSetPolicyRequestWithBody(server, "application/json", bodyReader)
}
// NewSetPolicyRequestWithBody generates requests for SetPolicy with any type of body
func NewSetPolicyRequestWithBody(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("/api/v1/policy")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPut, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewCheckPolicyRequest calls the generic CheckPolicy builder with application/json body
func NewCheckPolicyRequest(server string, body CheckPolicyJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewCheckPolicyRequestWithBody(server, "application/json", bodyReader)
}
// NewCheckPolicyRequestWithBody generates requests for CheckPolicy with any type of body
func NewCheckPolicyRequestWithBody(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("/api/v1/policy/check")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewDeletePreAuthKeyRequest generates requests for DeletePreAuthKey
func NewDeletePreAuthKeyRequest(server string, params *DeletePreAuthKeyParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/preauthkey")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
// queryValues collects non-styled parameters (passthrough, JSON)
// that are safe to round-trip through url.Values.Encode().
queryValues := queryURL.Query()
// rawQueryFragments collects pre-encoded query fragments from
// styled parameters, preserving literal commas as delimiters
// per the OpenAPI spec (e.g. "color=blue,black,brown").
var rawQueryFragments []string
if params.Id != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "id", *params.Id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "uint64"}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if encoded := queryValues.Encode(); encoded != "" {
rawQueryFragments = append(rawQueryFragments, encoded)
}
queryURL.RawQuery = strings.Join(rawQueryFragments, "&")
}
req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewListPreAuthKeysRequest generates requests for ListPreAuthKeys
func NewListPreAuthKeysRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/preauthkey")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewCreatePreAuthKeyRequest calls the generic CreatePreAuthKey builder with application/json body
func NewCreatePreAuthKeyRequest(server string, body CreatePreAuthKeyJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewCreatePreAuthKeyRequestWithBody(server, "application/json", bodyReader)
}
// NewCreatePreAuthKeyRequestWithBody generates requests for CreatePreAuthKey with any type of body
func NewCreatePreAuthKeyRequestWithBody(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("/api/v1/preauthkey")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewExpirePreAuthKeyRequest calls the generic ExpirePreAuthKey builder with application/json body
func NewExpirePreAuthKeyRequest(server string, body ExpirePreAuthKeyJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewExpirePreAuthKeyRequestWithBody(server, "application/json", bodyReader)
}
// NewExpirePreAuthKeyRequestWithBody generates requests for ExpirePreAuthKey with any type of body
func NewExpirePreAuthKeyRequestWithBody(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("/api/v1/preauthkey/expire")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewListUsersRequest generates requests for ListUsers
func NewListUsersRequest(server string, params *ListUsersParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/user")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
// queryValues collects non-styled parameters (passthrough, JSON)
// that are safe to round-trip through url.Values.Encode().
queryValues := queryURL.Query()
// rawQueryFragments collects pre-encoded query fragments from
// styled parameters, preserving literal commas as delimiters
// per the OpenAPI spec (e.g. "color=blue,black,brown").
var rawQueryFragments []string
if params.Id != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "id", *params.Id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "uint64"}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if params.Name != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "name", *params.Name, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if params.Email != nil {
if queryFrag, err := runtime.StyleParamWithOptions("form", false, "email", *params.Email, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil {
return nil, err
} else {
for _, qp := range strings.Split(queryFrag, "&") {
rawQueryFragments = append(rawQueryFragments, qp)
}
}
}
if encoded := queryValues.Encode(); encoded != "" {
rawQueryFragments = append(rawQueryFragments, encoded)
}
queryURL.RawQuery = strings.Join(rawQueryFragments, "&")
}
req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewCreateUserRequest calls the generic CreateUser builder with application/json body
func NewCreateUserRequest(server string, body CreateUserJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewCreateUserRequestWithBody(server, "application/json", bodyReader)
}
// NewCreateUserRequestWithBody generates requests for CreateUser with any type of body
func NewCreateUserRequestWithBody(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("/api/v1/user")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewDeleteUserRequest generates requests for DeleteUser
func NewDeleteUserRequest(server string, id string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/user/%s", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewRenameUserRequest generates requests for RenameUser
func NewRenameUserRequest(server string, oldId string, newName string) (*http.Request, error) {
var err error
var pathParam0 string
pathParam0, err = runtime.StyleParamWithOptions("simple", false, "oldId", oldId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uint64"})
if err != nil {
return nil, err
}
var pathParam1 string
pathParam1, err = runtime.StyleParamWithOptions("simple", false, "newName", newName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})
if err != nil {
return nil, err
}
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v1/user/%s/rename/%s", pathParam0, pathParam1)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
for _, r := range 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 {
// ListApiKeysWithResponse request
ListApiKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListApiKeysResponse, error)
// CreateApiKeyWithBodyWithResponse request with any body
CreateApiKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error)
CreateApiKeyWithResponse(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error)
// ExpireApiKeyWithBodyWithResponse request with any body
ExpireApiKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExpireApiKeyResponse, error)
ExpireApiKeyWithResponse(ctx context.Context, body ExpireApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*ExpireApiKeyResponse, error)
// DeleteApiKeyWithResponse request
DeleteApiKeyWithResponse(ctx context.Context, prefix string, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*DeleteApiKeyResponse, error)
// AuthApproveWithBodyWithResponse request with any body
AuthApproveWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthApproveResponse, error)
AuthApproveWithResponse(ctx context.Context, body AuthApproveJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthApproveResponse, error)
// AuthRegisterWithBodyWithResponse request with any body
AuthRegisterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthRegisterResponse, error)
AuthRegisterWithResponse(ctx context.Context, body AuthRegisterJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthRegisterResponse, error)
// AuthRejectWithBodyWithResponse request with any body
AuthRejectWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthRejectResponse, error)
AuthRejectWithResponse(ctx context.Context, body AuthRejectJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthRejectResponse, error)
// DebugCreateNodeWithBodyWithResponse request with any body
DebugCreateNodeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DebugCreateNodeResponse, error)
DebugCreateNodeWithResponse(ctx context.Context, body DebugCreateNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*DebugCreateNodeResponse, error)
// HealthWithResponse request
HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)
// ListNodesWithResponse request
ListNodesWithResponse(ctx context.Context, params *ListNodesParams, reqEditors ...RequestEditorFn) (*ListNodesResponse, error)
// BackfillNodeIPsWithResponse request
BackfillNodeIPsWithResponse(ctx context.Context, params *BackfillNodeIPsParams, reqEditors ...RequestEditorFn) (*BackfillNodeIPsResponse, error)
// RegisterNodeWithResponse request
RegisterNodeWithResponse(ctx context.Context, params *RegisterNodeParams, reqEditors ...RequestEditorFn) (*RegisterNodeResponse, error)
// DeleteNodeWithResponse request
DeleteNodeWithResponse(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*DeleteNodeResponse, error)
// GetNodeWithResponse request
GetNodeWithResponse(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*GetNodeResponse, error)
// SetApprovedRoutesWithBodyWithResponse request with any body
SetApprovedRoutesWithBodyWithResponse(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetApprovedRoutesResponse, error)
SetApprovedRoutesWithResponse(ctx context.Context, nodeId string, body SetApprovedRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*SetApprovedRoutesResponse, error)
// ExpireNodeWithBodyWithResponse request with any body
ExpireNodeWithBodyWithResponse(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExpireNodeResponse, error)
ExpireNodeWithResponse(ctx context.Context, nodeId string, body ExpireNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*ExpireNodeResponse, error)
// RenameNodeWithResponse request
RenameNodeWithResponse(ctx context.Context, nodeId string, newName string, reqEditors ...RequestEditorFn) (*RenameNodeResponse, error)
// SetTagsWithBodyWithResponse request with any body
SetTagsWithBodyWithResponse(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetTagsResponse, error)
SetTagsWithResponse(ctx context.Context, nodeId string, body SetTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetTagsResponse, error)
// GetPolicyWithResponse request
GetPolicyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPolicyResponse, error)
// SetPolicyWithBodyWithResponse request with any body
SetPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetPolicyResponse, error)
SetPolicyWithResponse(ctx context.Context, body SetPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*SetPolicyResponse, error)
// CheckPolicyWithBodyWithResponse request with any body
CheckPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CheckPolicyResponse, error)
CheckPolicyWithResponse(ctx context.Context, body CheckPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*CheckPolicyResponse, error)
// DeletePreAuthKeyWithResponse request
DeletePreAuthKeyWithResponse(ctx context.Context, params *DeletePreAuthKeyParams, reqEditors ...RequestEditorFn) (*DeletePreAuthKeyResponse, error)
// ListPreAuthKeysWithResponse request
ListPreAuthKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListPreAuthKeysResponse, error)
// CreatePreAuthKeyWithBodyWithResponse request with any body
CreatePreAuthKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePreAuthKeyResponse, error)
CreatePreAuthKeyWithResponse(ctx context.Context, body CreatePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePreAuthKeyResponse, error)
// ExpirePreAuthKeyWithBodyWithResponse request with any body
ExpirePreAuthKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExpirePreAuthKeyResponse, error)
ExpirePreAuthKeyWithResponse(ctx context.Context, body ExpirePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*ExpirePreAuthKeyResponse, error)
// ListUsersWithResponse request
ListUsersWithResponse(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*ListUsersResponse, error)
// CreateUserWithBodyWithResponse request with any body
CreateUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateUserResponse, error)
CreateUserWithResponse(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUserResponse, error)
// DeleteUserWithResponse request
DeleteUserWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteUserResponse, error)
// RenameUserWithResponse request
RenameUserWithResponse(ctx context.Context, oldId string, newName string, reqEditors ...RequestEditorFn) (*RenameUserResponse, error)
}
type ListApiKeysResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ListApiKeysOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ListApiKeysResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ListApiKeysResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ListApiKeysResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type CreateApiKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CreateApiKeyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r CreateApiKeyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r CreateApiKeyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r CreateApiKeyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type ExpireApiKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ExpireApiKeyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ExpireApiKeyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ExpireApiKeyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ExpireApiKeyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type DeleteApiKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DeleteApiKeyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r DeleteApiKeyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DeleteApiKeyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r DeleteApiKeyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type AuthApproveResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *AuthApproveOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r AuthApproveResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r AuthApproveResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r AuthApproveResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type AuthRegisterResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *AuthRegisterOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r AuthRegisterResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r AuthRegisterResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r AuthRegisterResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type AuthRejectResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *AuthRejectOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r AuthRejectResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r AuthRejectResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r AuthRejectResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type DebugCreateNodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r DebugCreateNodeResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DebugCreateNodeResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r DebugCreateNodeResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type HealthResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *HealthResponseBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r HealthResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r HealthResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r HealthResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type ListNodesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ListNodesOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ListNodesResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ListNodesResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ListNodesResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type BackfillNodeIPsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *BackfillNodeIPsOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r BackfillNodeIPsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r BackfillNodeIPsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r BackfillNodeIPsResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type RegisterNodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r RegisterNodeResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r RegisterNodeResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r RegisterNodeResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type DeleteNodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DeleteNodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r DeleteNodeResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DeleteNodeResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r DeleteNodeResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type GetNodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r GetNodeResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetNodeResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r GetNodeResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type SetApprovedRoutesResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r SetApprovedRoutesResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r SetApprovedRoutesResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r SetApprovedRoutesResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type ExpireNodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ExpireNodeResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ExpireNodeResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ExpireNodeResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type RenameNodeResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r RenameNodeResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r RenameNodeResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r RenameNodeResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type SetTagsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *NodeOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r SetTagsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r SetTagsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r SetTagsResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type GetPolicyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *PolicyResponseBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r GetPolicyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetPolicyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r GetPolicyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type SetPolicyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *PolicyResponseBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r SetPolicyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r SetPolicyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r SetPolicyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type CheckPolicyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CheckPolicyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r CheckPolicyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r CheckPolicyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r CheckPolicyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type DeletePreAuthKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DeletePreAuthKeyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r DeletePreAuthKeyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DeletePreAuthKeyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r DeletePreAuthKeyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type ListPreAuthKeysResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ListPreAuthKeysOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ListPreAuthKeysResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ListPreAuthKeysResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ListPreAuthKeysResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type CreatePreAuthKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *PreAuthKeyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r CreatePreAuthKeyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r CreatePreAuthKeyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r CreatePreAuthKeyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type ExpirePreAuthKeyResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ExpirePreAuthKeyOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ExpirePreAuthKeyResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ExpirePreAuthKeyResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ExpirePreAuthKeyResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type ListUsersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ListUsersOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r ListUsersResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r ListUsersResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r ListUsersResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type CreateUserResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *UserOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r CreateUserResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r CreateUserResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r CreateUserResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type DeleteUserResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *DeleteUserOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r DeleteUserResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r DeleteUserResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r DeleteUserResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
type RenameUserResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *UserOutputBody
ApplicationproblemJSONDefault *ErrorModel
}
// Status returns HTTPResponse.Status
func (r RenameUserResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r RenameUserResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (r RenameUserResponse) ContentType() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Header.Get("Content-Type")
}
return ""
}
// ListApiKeysWithResponse request returning *ListApiKeysResponse
func (c *ClientWithResponses) ListApiKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListApiKeysResponse, error) {
rsp, err := c.ListApiKeys(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseListApiKeysResponse(rsp)
}
// CreateApiKeyWithBodyWithResponse request with arbitrary body returning *CreateApiKeyResponse
func (c *ClientWithResponses) CreateApiKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) {
rsp, err := c.CreateApiKeyWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreateApiKeyResponse(rsp)
}
func (c *ClientWithResponses) CreateApiKeyWithResponse(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) {
rsp, err := c.CreateApiKey(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreateApiKeyResponse(rsp)
}
// ExpireApiKeyWithBodyWithResponse request with arbitrary body returning *ExpireApiKeyResponse
func (c *ClientWithResponses) ExpireApiKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExpireApiKeyResponse, error) {
rsp, err := c.ExpireApiKeyWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseExpireApiKeyResponse(rsp)
}
func (c *ClientWithResponses) ExpireApiKeyWithResponse(ctx context.Context, body ExpireApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*ExpireApiKeyResponse, error) {
rsp, err := c.ExpireApiKey(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseExpireApiKeyResponse(rsp)
}
// DeleteApiKeyWithResponse request returning *DeleteApiKeyResponse
func (c *ClientWithResponses) DeleteApiKeyWithResponse(ctx context.Context, prefix string, params *DeleteApiKeyParams, reqEditors ...RequestEditorFn) (*DeleteApiKeyResponse, error) {
rsp, err := c.DeleteApiKey(ctx, prefix, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseDeleteApiKeyResponse(rsp)
}
// AuthApproveWithBodyWithResponse request with arbitrary body returning *AuthApproveResponse
func (c *ClientWithResponses) AuthApproveWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthApproveResponse, error) {
rsp, err := c.AuthApproveWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseAuthApproveResponse(rsp)
}
func (c *ClientWithResponses) AuthApproveWithResponse(ctx context.Context, body AuthApproveJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthApproveResponse, error) {
rsp, err := c.AuthApprove(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseAuthApproveResponse(rsp)
}
// AuthRegisterWithBodyWithResponse request with arbitrary body returning *AuthRegisterResponse
func (c *ClientWithResponses) AuthRegisterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthRegisterResponse, error) {
rsp, err := c.AuthRegisterWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseAuthRegisterResponse(rsp)
}
func (c *ClientWithResponses) AuthRegisterWithResponse(ctx context.Context, body AuthRegisterJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthRegisterResponse, error) {
rsp, err := c.AuthRegister(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseAuthRegisterResponse(rsp)
}
// AuthRejectWithBodyWithResponse request with arbitrary body returning *AuthRejectResponse
func (c *ClientWithResponses) AuthRejectWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthRejectResponse, error) {
rsp, err := c.AuthRejectWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseAuthRejectResponse(rsp)
}
func (c *ClientWithResponses) AuthRejectWithResponse(ctx context.Context, body AuthRejectJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthRejectResponse, error) {
rsp, err := c.AuthReject(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseAuthRejectResponse(rsp)
}
// DebugCreateNodeWithBodyWithResponse request with arbitrary body returning *DebugCreateNodeResponse
func (c *ClientWithResponses) DebugCreateNodeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DebugCreateNodeResponse, error) {
rsp, err := c.DebugCreateNodeWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseDebugCreateNodeResponse(rsp)
}
func (c *ClientWithResponses) DebugCreateNodeWithResponse(ctx context.Context, body DebugCreateNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*DebugCreateNodeResponse, error) {
rsp, err := c.DebugCreateNode(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseDebugCreateNodeResponse(rsp)
}
// HealthWithResponse request returning *HealthResponse
func (c *ClientWithResponses) HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error) {
rsp, err := c.Health(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseHealthResponse(rsp)
}
// ListNodesWithResponse request returning *ListNodesResponse
func (c *ClientWithResponses) ListNodesWithResponse(ctx context.Context, params *ListNodesParams, reqEditors ...RequestEditorFn) (*ListNodesResponse, error) {
rsp, err := c.ListNodes(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseListNodesResponse(rsp)
}
// BackfillNodeIPsWithResponse request returning *BackfillNodeIPsResponse
func (c *ClientWithResponses) BackfillNodeIPsWithResponse(ctx context.Context, params *BackfillNodeIPsParams, reqEditors ...RequestEditorFn) (*BackfillNodeIPsResponse, error) {
rsp, err := c.BackfillNodeIPs(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseBackfillNodeIPsResponse(rsp)
}
// RegisterNodeWithResponse request returning *RegisterNodeResponse
func (c *ClientWithResponses) RegisterNodeWithResponse(ctx context.Context, params *RegisterNodeParams, reqEditors ...RequestEditorFn) (*RegisterNodeResponse, error) {
rsp, err := c.RegisterNode(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseRegisterNodeResponse(rsp)
}
// DeleteNodeWithResponse request returning *DeleteNodeResponse
func (c *ClientWithResponses) DeleteNodeWithResponse(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*DeleteNodeResponse, error) {
rsp, err := c.DeleteNode(ctx, nodeId, reqEditors...)
if err != nil {
return nil, err
}
return ParseDeleteNodeResponse(rsp)
}
// GetNodeWithResponse request returning *GetNodeResponse
func (c *ClientWithResponses) GetNodeWithResponse(ctx context.Context, nodeId string, reqEditors ...RequestEditorFn) (*GetNodeResponse, error) {
rsp, err := c.GetNode(ctx, nodeId, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetNodeResponse(rsp)
}
// SetApprovedRoutesWithBodyWithResponse request with arbitrary body returning *SetApprovedRoutesResponse
func (c *ClientWithResponses) SetApprovedRoutesWithBodyWithResponse(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetApprovedRoutesResponse, error) {
rsp, err := c.SetApprovedRoutesWithBody(ctx, nodeId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseSetApprovedRoutesResponse(rsp)
}
func (c *ClientWithResponses) SetApprovedRoutesWithResponse(ctx context.Context, nodeId string, body SetApprovedRoutesJSONRequestBody, reqEditors ...RequestEditorFn) (*SetApprovedRoutesResponse, error) {
rsp, err := c.SetApprovedRoutes(ctx, nodeId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseSetApprovedRoutesResponse(rsp)
}
// ExpireNodeWithBodyWithResponse request with arbitrary body returning *ExpireNodeResponse
func (c *ClientWithResponses) ExpireNodeWithBodyWithResponse(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExpireNodeResponse, error) {
rsp, err := c.ExpireNodeWithBody(ctx, nodeId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseExpireNodeResponse(rsp)
}
func (c *ClientWithResponses) ExpireNodeWithResponse(ctx context.Context, nodeId string, body ExpireNodeJSONRequestBody, reqEditors ...RequestEditorFn) (*ExpireNodeResponse, error) {
rsp, err := c.ExpireNode(ctx, nodeId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseExpireNodeResponse(rsp)
}
// RenameNodeWithResponse request returning *RenameNodeResponse
func (c *ClientWithResponses) RenameNodeWithResponse(ctx context.Context, nodeId string, newName string, reqEditors ...RequestEditorFn) (*RenameNodeResponse, error) {
rsp, err := c.RenameNode(ctx, nodeId, newName, reqEditors...)
if err != nil {
return nil, err
}
return ParseRenameNodeResponse(rsp)
}
// SetTagsWithBodyWithResponse request with arbitrary body returning *SetTagsResponse
func (c *ClientWithResponses) SetTagsWithBodyWithResponse(ctx context.Context, nodeId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetTagsResponse, error) {
rsp, err := c.SetTagsWithBody(ctx, nodeId, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseSetTagsResponse(rsp)
}
func (c *ClientWithResponses) SetTagsWithResponse(ctx context.Context, nodeId string, body SetTagsJSONRequestBody, reqEditors ...RequestEditorFn) (*SetTagsResponse, error) {
rsp, err := c.SetTags(ctx, nodeId, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseSetTagsResponse(rsp)
}
// GetPolicyWithResponse request returning *GetPolicyResponse
func (c *ClientWithResponses) GetPolicyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPolicyResponse, error) {
rsp, err := c.GetPolicy(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetPolicyResponse(rsp)
}
// SetPolicyWithBodyWithResponse request with arbitrary body returning *SetPolicyResponse
func (c *ClientWithResponses) SetPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetPolicyResponse, error) {
rsp, err := c.SetPolicyWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseSetPolicyResponse(rsp)
}
func (c *ClientWithResponses) SetPolicyWithResponse(ctx context.Context, body SetPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*SetPolicyResponse, error) {
rsp, err := c.SetPolicy(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseSetPolicyResponse(rsp)
}
// CheckPolicyWithBodyWithResponse request with arbitrary body returning *CheckPolicyResponse
func (c *ClientWithResponses) CheckPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CheckPolicyResponse, error) {
rsp, err := c.CheckPolicyWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCheckPolicyResponse(rsp)
}
func (c *ClientWithResponses) CheckPolicyWithResponse(ctx context.Context, body CheckPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*CheckPolicyResponse, error) {
rsp, err := c.CheckPolicy(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCheckPolicyResponse(rsp)
}
// DeletePreAuthKeyWithResponse request returning *DeletePreAuthKeyResponse
func (c *ClientWithResponses) DeletePreAuthKeyWithResponse(ctx context.Context, params *DeletePreAuthKeyParams, reqEditors ...RequestEditorFn) (*DeletePreAuthKeyResponse, error) {
rsp, err := c.DeletePreAuthKey(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseDeletePreAuthKeyResponse(rsp)
}
// ListPreAuthKeysWithResponse request returning *ListPreAuthKeysResponse
func (c *ClientWithResponses) ListPreAuthKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListPreAuthKeysResponse, error) {
rsp, err := c.ListPreAuthKeys(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseListPreAuthKeysResponse(rsp)
}
// CreatePreAuthKeyWithBodyWithResponse request with arbitrary body returning *CreatePreAuthKeyResponse
func (c *ClientWithResponses) CreatePreAuthKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePreAuthKeyResponse, error) {
rsp, err := c.CreatePreAuthKeyWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreatePreAuthKeyResponse(rsp)
}
func (c *ClientWithResponses) CreatePreAuthKeyWithResponse(ctx context.Context, body CreatePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePreAuthKeyResponse, error) {
rsp, err := c.CreatePreAuthKey(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreatePreAuthKeyResponse(rsp)
}
// ExpirePreAuthKeyWithBodyWithResponse request with arbitrary body returning *ExpirePreAuthKeyResponse
func (c *ClientWithResponses) ExpirePreAuthKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExpirePreAuthKeyResponse, error) {
rsp, err := c.ExpirePreAuthKeyWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseExpirePreAuthKeyResponse(rsp)
}
func (c *ClientWithResponses) ExpirePreAuthKeyWithResponse(ctx context.Context, body ExpirePreAuthKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*ExpirePreAuthKeyResponse, error) {
rsp, err := c.ExpirePreAuthKey(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseExpirePreAuthKeyResponse(rsp)
}
// ListUsersWithResponse request returning *ListUsersResponse
func (c *ClientWithResponses) ListUsersWithResponse(ctx context.Context, params *ListUsersParams, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) {
rsp, err := c.ListUsers(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseListUsersResponse(rsp)
}
// CreateUserWithBodyWithResponse request with arbitrary body returning *CreateUserResponse
func (c *ClientWithResponses) CreateUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) {
rsp, err := c.CreateUserWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreateUserResponse(rsp)
}
func (c *ClientWithResponses) CreateUserWithResponse(ctx context.Context, body CreateUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUserResponse, error) {
rsp, err := c.CreateUser(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseCreateUserResponse(rsp)
}
// DeleteUserWithResponse request returning *DeleteUserResponse
func (c *ClientWithResponses) DeleteUserWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteUserResponse, error) {
rsp, err := c.DeleteUser(ctx, id, reqEditors...)
if err != nil {
return nil, err
}
return ParseDeleteUserResponse(rsp)
}
// RenameUserWithResponse request returning *RenameUserResponse
func (c *ClientWithResponses) RenameUserWithResponse(ctx context.Context, oldId string, newName string, reqEditors ...RequestEditorFn) (*RenameUserResponse, error) {
rsp, err := c.RenameUser(ctx, oldId, newName, reqEditors...)
if err != nil {
return nil, err
}
return ParseRenameUserResponse(rsp)
}
// ParseListApiKeysResponse parses an HTTP response from a ListApiKeysWithResponse call
func ParseListApiKeysResponse(rsp *http.Response) (*ListApiKeysResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ListApiKeysResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest ListApiKeysOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseCreateApiKeyResponse parses an HTTP response from a CreateApiKeyWithResponse call
func ParseCreateApiKeyResponse(rsp *http.Response) (*CreateApiKeyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &CreateApiKeyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest CreateApiKeyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseExpireApiKeyResponse parses an HTTP response from a ExpireApiKeyWithResponse call
func ParseExpireApiKeyResponse(rsp *http.Response) (*ExpireApiKeyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ExpireApiKeyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest ExpireApiKeyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseDeleteApiKeyResponse parses an HTTP response from a DeleteApiKeyWithResponse call
func ParseDeleteApiKeyResponse(rsp *http.Response) (*DeleteApiKeyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DeleteApiKeyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest DeleteApiKeyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseAuthApproveResponse parses an HTTP response from a AuthApproveWithResponse call
func ParseAuthApproveResponse(rsp *http.Response) (*AuthApproveResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &AuthApproveResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest AuthApproveOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseAuthRegisterResponse parses an HTTP response from a AuthRegisterWithResponse call
func ParseAuthRegisterResponse(rsp *http.Response) (*AuthRegisterResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &AuthRegisterResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest AuthRegisterOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseAuthRejectResponse parses an HTTP response from a AuthRejectWithResponse call
func ParseAuthRejectResponse(rsp *http.Response) (*AuthRejectResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &AuthRejectResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest AuthRejectOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseDebugCreateNodeResponse parses an HTTP response from a DebugCreateNodeWithResponse call
func ParseDebugCreateNodeResponse(rsp *http.Response) (*DebugCreateNodeResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DebugCreateNodeResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseHealthResponse parses an HTTP response from a HealthWithResponse call
func ParseHealthResponse(rsp *http.Response) (*HealthResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &HealthResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest HealthResponseBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseListNodesResponse parses an HTTP response from a ListNodesWithResponse call
func ParseListNodesResponse(rsp *http.Response) (*ListNodesResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ListNodesResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest ListNodesOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseBackfillNodeIPsResponse parses an HTTP response from a BackfillNodeIPsWithResponse call
func ParseBackfillNodeIPsResponse(rsp *http.Response) (*BackfillNodeIPsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &BackfillNodeIPsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest BackfillNodeIPsOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseRegisterNodeResponse parses an HTTP response from a RegisterNodeWithResponse call
func ParseRegisterNodeResponse(rsp *http.Response) (*RegisterNodeResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &RegisterNodeResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseDeleteNodeResponse parses an HTTP response from a DeleteNodeWithResponse call
func ParseDeleteNodeResponse(rsp *http.Response) (*DeleteNodeResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DeleteNodeResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest DeleteNodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseGetNodeResponse parses an HTTP response from a GetNodeWithResponse call
func ParseGetNodeResponse(rsp *http.Response) (*GetNodeResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetNodeResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseSetApprovedRoutesResponse parses an HTTP response from a SetApprovedRoutesWithResponse call
func ParseSetApprovedRoutesResponse(rsp *http.Response) (*SetApprovedRoutesResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &SetApprovedRoutesResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseExpireNodeResponse parses an HTTP response from a ExpireNodeWithResponse call
func ParseExpireNodeResponse(rsp *http.Response) (*ExpireNodeResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ExpireNodeResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseRenameNodeResponse parses an HTTP response from a RenameNodeWithResponse call
func ParseRenameNodeResponse(rsp *http.Response) (*RenameNodeResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &RenameNodeResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseSetTagsResponse parses an HTTP response from a SetTagsWithResponse call
func ParseSetTagsResponse(rsp *http.Response) (*SetTagsResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &SetTagsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest NodeOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseGetPolicyResponse parses an HTTP response from a GetPolicyWithResponse call
func ParseGetPolicyResponse(rsp *http.Response) (*GetPolicyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetPolicyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest PolicyResponseBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseSetPolicyResponse parses an HTTP response from a SetPolicyWithResponse call
func ParseSetPolicyResponse(rsp *http.Response) (*SetPolicyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &SetPolicyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest PolicyResponseBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseCheckPolicyResponse parses an HTTP response from a CheckPolicyWithResponse call
func ParseCheckPolicyResponse(rsp *http.Response) (*CheckPolicyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &CheckPolicyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest CheckPolicyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseDeletePreAuthKeyResponse parses an HTTP response from a DeletePreAuthKeyWithResponse call
func ParseDeletePreAuthKeyResponse(rsp *http.Response) (*DeletePreAuthKeyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DeletePreAuthKeyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest DeletePreAuthKeyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseListPreAuthKeysResponse parses an HTTP response from a ListPreAuthKeysWithResponse call
func ParseListPreAuthKeysResponse(rsp *http.Response) (*ListPreAuthKeysResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ListPreAuthKeysResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest ListPreAuthKeysOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseCreatePreAuthKeyResponse parses an HTTP response from a CreatePreAuthKeyWithResponse call
func ParseCreatePreAuthKeyResponse(rsp *http.Response) (*CreatePreAuthKeyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &CreatePreAuthKeyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest PreAuthKeyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseExpirePreAuthKeyResponse parses an HTTP response from a ExpirePreAuthKeyWithResponse call
func ParseExpirePreAuthKeyResponse(rsp *http.Response) (*ExpirePreAuthKeyResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ExpirePreAuthKeyResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest ExpirePreAuthKeyOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseListUsersResponse parses an HTTP response from a ListUsersWithResponse call
func ParseListUsersResponse(rsp *http.Response) (*ListUsersResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &ListUsersResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest ListUsersOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseCreateUserResponse parses an HTTP response from a CreateUserWithResponse call
func ParseCreateUserResponse(rsp *http.Response) (*CreateUserResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &CreateUserResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest UserOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseDeleteUserResponse parses an HTTP response from a DeleteUserWithResponse call
func ParseDeleteUserResponse(rsp *http.Response) (*DeleteUserResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &DeleteUserResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest DeleteUserOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}
// ParseRenameUserResponse parses an HTTP response from a RenameUserWithResponse call
func ParseRenameUserResponse(rsp *http.Response) (*RenameUserResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &RenameUserResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest UserOutputBody
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true:
var dest ErrorModel
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.ApplicationproblemJSONDefault = &dest
}
return response, nil
}