shared

package module
v0.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 19 Imported by: 51

Documentation

Index

Examples

Constants

View Source
const (
	IonosUsernameEnvVar       = "IONOS_USERNAME"
	IonosPasswordEnvVar       = "IONOS_PASSWORD"
	IonosTokenEnvVar          = "IONOS_TOKEN"
	IonosApiUrlEnvVar         = "IONOS_API_URL"
	IonosPinnedCertEnvVar     = "IONOS_PINNED_CERT"
	IonosLogLevelEnvVar       = "IONOS_LOG_LEVEL"
	IonosFilePathEnvVar       = "IONOS_CONFIG_FILE"
	IonosCurrentProfileEnvVar = "IONOS_CURRENT_PROFILE"
	IonosS3AccessKeyEnvVar    = "IONOS_S3_ACCESS_KEY"
	IonosS3SecretKeyEnvVar    = "IONOS_S3_SECRET_KEY"
	IonosObjectStorageRegion  = "IONOS_OBJECT_STORAGE_REGION"
	DefaultIonosServerUrl     = "https://api.ionos.com/"

	DefaultMaxRetries = 3
)
View Source
const EndpointOverridden = "endpoint from config file"

EndpointOverridden is a constant that is used to mark the endpoint as overridden and can be used to search for the location in the server configuration.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKeys takes a string apikey as authentication for the request
	ContextAPIKeys = contextKey("apiKeys")

	// ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request.
	ContextHttpSignatureAuth = contextKey("httpsignature")

	// ContextServerIndex uses a server configuration from the index.
	ContextServerIndex = contextKey("serverIndex")

	// ContextOperationServerIndices uses a server configuration from the index mapping.
	ContextOperationServerIndices = contextKey("serverOperationIndices")

	// ContextServerVariables overrides a server configuration variables.
	ContextServerVariables = contextKey("serverVariables")

	// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
	ContextOperationServerVariables = contextKey("serverOperationVariables")
)
View Source
var DefaultIonosBasePath = ""
View Source
var LogLevelMap = map[string]LogLevel{
	"off":   Off,
	"debug": Debug,
	"trace": Trace,
}

Functions

func AddCertsToClient added in v0.1.2

func AddCertsToClient(authorityData string) *x509.CertPool

AddCertsToClient adds certificates to the http client

func All added in v0.1.1

func All[T any](xs []T, f func(T) bool) bool

All returns true if all elements of a slice satisfy a given predicate function, and false otherwise.

func Any added in v0.1.1

func Any[T any](xs []T, f func(T) bool) bool

Any returns true if at least one element of a slice satisfies a given predicate function, and false otherwise.

func ApplyAndAggregateErrors added in v0.1.1

func ApplyAndAggregateErrors[T any](xs []T, f func(T) error) error

ApplyAndAggregateErrors applies the provided function for each element of the slice If the function returns an error, it accumulates the error and continues execution After all elements are processed, it returns the aggregated errors if any

func ApplyOrFail added in v0.1.1

func ApplyOrFail[T any](xs []T, f func(T) error) error

ApplyOrFail tries applying the provided function for each element of the slice If the function returns an error, we break execution and return the error

func CreateTransport added in v0.1.3

func CreateTransport(insecure bool, certificate string) *http.Transport

func EnsureURLFormat added in v0.1.4

func EnsureURLFormat(url string) string

EnsureURLFormat checks that the URL has the correct format (no trailing slash, has http/https scheme prefix) and updates it if necessary

func ExtractIDs added in v0.1.8

func ExtractIDs[T any, PT interface {
	*T
	Identifiable
}](items []T) []string

ExtractIDs returns the IDs from a slice of value-type items whose pointer type satisfies Identifiable. Works directly with SDK list results:

ids := shared.ExtractIDs(list.GetItems())
Example
package main

import (
	"fmt"

	"github.com/ionos-cloud/sdk-go-bundle/shared"
)

// Zone mirrors a properties type like dns.Zone.
type Zone struct {
	ZoneName string
}

func (o *Zone) GetZoneName() string { return o.ZoneName }

// ZoneRead mirrors a read-model type like dns.ZoneRead.
type ZoneRead struct {
	Id         string
	Href       string
	Properties Zone
}

func (o *ZoneRead) GetId() string       { return o.Id }
func (o *ZoneRead) GetHref() string     { return o.Href }
func (o *ZoneRead) GetProperties() Zone { return o.Properties }

// ZoneReadList mirrors a list-response type like dns.ZoneReadList.
type ZoneReadList struct {
	Items []ZoneRead
}

func (o *ZoneReadList) GetItems() []ZoneRead { return o.Items }

func main() {
	// Simulate: list, _, err := client.ZonesApi.ZonesGet(ctx).Execute()
	list := &ZoneReadList{
		Items: []ZoneRead{
			{Id: "aaa-111", Href: "/zones/aaa-111", Properties: Zone{ZoneName: "example.com"}},
			{Id: "bbb-222", Href: "/zones/bbb-222", Properties: Zone{ZoneName: "example.org"}},
			{Id: "ccc-333", Href: "/zones/ccc-333", Properties: Zone{ZoneName: "example.net"}},
		},
	}

	// Works directly with GetItems() — no []T to []*T conversion needed.
	ids := shared.ExtractIDs(list.GetItems())
	fmt.Println(ids)
}
Output:
[aaa-111 bbb-222 ccc-333]

func Filter added in v0.1.1

func Filter[T any](xs []T, f func(T) bool) []T

Filter applies a function to each element of a slice, returning a new slice with only the elements for which the function returns true.

func FindByID added in v0.1.8

func FindByID[T any, PT interface {
	*T
	Identifiable
}](items []T, id string) (*T, bool)

FindByID returns a pointer to the first item matching the given ID, and true if found. Works directly with SDK list results:

zone, ok := shared.FindByID(list.GetItems(), id)
Example
package main

import (
	"fmt"

	"github.com/ionos-cloud/sdk-go-bundle/shared"
)

// Zone mirrors a properties type like dns.Zone.
type Zone struct {
	ZoneName string
}

func (o *Zone) GetZoneName() string { return o.ZoneName }

// ZoneRead mirrors a read-model type like dns.ZoneRead.
type ZoneRead struct {
	Id         string
	Href       string
	Properties Zone
}

func (o *ZoneRead) GetId() string       { return o.Id }
func (o *ZoneRead) GetHref() string     { return o.Href }
func (o *ZoneRead) GetProperties() Zone { return o.Properties }

// ZoneReadList mirrors a list-response type like dns.ZoneReadList.
type ZoneReadList struct {
	Items []ZoneRead
}

func (o *ZoneReadList) GetItems() []ZoneRead { return o.Items }

func main() {
	// Simulate: list, _, err := client.ZonesApi.ZonesGet(ctx).Execute()
	list := &ZoneReadList{
		Items: []ZoneRead{
			{Id: "aaa-111", Properties: Zone{ZoneName: "example.com"}},
			{Id: "bbb-222", Properties: Zone{ZoneName: "example.org"}},
		},
	}

	// Returns a *ZoneRead pointer into the original slice.
	zone, ok := shared.FindByID(list.GetItems(), "bbb-222")
	if ok {
		props := zone.GetProperties()
		fmt.Println(props.GetZoneName())
	}
}
Output:
example.org

func Fold added in v0.1.1

func Fold[T any, Acc any](xs []T, f func(Acc, T) Acc, acc Acc) Acc

Fold (aka Reduce) accumulates the result of f into acc and returns acc by applying f over each element in the slice

func IsNil

func IsNil(i interface{}) bool

IsNil checks if an input is nil

func IsUUID added in v0.1.8

func IsUUID(s string) bool

IsUUID returns true if s matches the standard UUID format (any version).

Example
package main

import (
	"fmt"

	"github.com/ionos-cloud/sdk-go-bundle/shared"
)

func main() {
	fmt.Println(shared.IsUUID("550e8400-e29b-41d4-a716-446655440000"))
	fmt.Println(shared.IsUUID("example.com"))
}
Output:
true
false

func LogDebug added in v0.1.8

func LogDebug(format string, args ...interface{})

LogDebug logs a message at Debug level. It is a no-op when the SDK log level is below Debug.

func LogTrace added in v0.1.8

func LogTrace(format string, args ...interface{})

LogTrace logs a message at Trace level. It is a no-op when the SDK log level is below Trace.

func Map added in v0.1.1

func Map[T comparable, K any](s []T, f func(T) K) []K

Map applies a function to each element of a slice and returns the modified slice without considering the index of each element.

func MapIdx added in v0.1.1

func MapIdx[V comparable, R any](s []V, f func(int, V) R) []R

MapIdx applies a function to each element and index of a slice, returning the modified slice with consideration of the index.

func NewSdkLogger

func NewSdkLogger()

func OverrideLocationFor added in v0.1.2

func OverrideLocationFor(configProvider ConfigProvider, location, endpoint string, replaceServers bool)

OverrideLocationFor aims to override the server URL for a given client configuration, based on location and endpoint inputs. Mutates the client configuration. It searches for the location in the server configuration and overrides the endpoint. If the endpoint is empty, it early exits without making changes.

func Resolve added in v0.1.8

func Resolve[T any, PT interface {
	*T
	Identifiable
}](
	ctx context.Context,
	nameOrID string,
	listByName func(ctx context.Context, name string) ([]T, error),
) (string, error)

Resolve resolves a human-readable name to a resource ID. Works directly with value-type slices returned by SDK list calls.

If nameOrID is already a valid UUID, it is returned as-is without making any API calls. Otherwise, listByName is called to find resources matching the given name. Exactly one match is expected; zero matches returns an error, and multiple matches returns an ambiguity error.

Example usage with the DNS SDK:

id, err := shared.Resolve(ctx, "example.com", func(ctx context.Context, name string) ([]dns.ZoneRead, error) {
    list, _, err := client.ZonesApi.ZonesGet(ctx).FilterZoneName(name).Limit(2).Execute()
    if err != nil {
        return nil, err
    }
    return list.GetItems(), nil
})
Example
// Simulate: if input is already a UUID, no API call is made.
id, _ := shared.Resolve(context.Background(), "550e8400-e29b-41d4-a716-446655440000",
	func(_ context.Context, _ string) ([]ZoneRead, error) {
		panic("should not be called")
	},
)
fmt.Println("UUID passthrough:", id)

// Simulate: resolve a zone name to its ID via a list callback.
id, _ = shared.Resolve(context.Background(), "example.com",
	func(_ context.Context, name string) ([]ZoneRead, error) {
		// In real code this would be:
		//   list, _, err := client.ZonesApi.ZonesGet(ctx).FilterZoneName(name).Limit(2).Execute()
		//   return list.GetItems(), err
		return []ZoneRead{
			{Id: "550e8400-e29b-41d4-a716-446655440000", Properties: Zone{ZoneName: name}},
		}, nil
	},
)
fmt.Println("Resolved:", id)
Output:
UUID passthrough: 550e8400-e29b-41d4-a716-446655440000
Resolved: 550e8400-e29b-41d4-a716-446655440000

func SetBasePath

func SetBasePath(basePath string)

func SetSkipTLSVerify added in v0.1.2

func SetSkipTLSVerify(configProvider ConfigProvider, skipTLSVerify bool)

func SliceToValueDefault

func SliceToValueDefault[T any](ptrSlice *[]T) []T

func Strlen

func Strlen(s string) int

func ToPtr

func ToPtr[T any](v T) *T

ToPtr - returns a pointer to the given value.

func ToValue

func ToValue[T any](ptr *T) T

ToValue - returns the value of the bool pointer passed in

func ToValueDefault

func ToValueDefault[T any](ptr *T) T

ToValueDefault - returns the value of the pointer passed in, or the default type value if the pointer is nil

Types

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// RequestTime is the time duration from the moment the APIClient sends
	// the HTTP request to the moment it receives an HTTP response.
	RequestTime time.Duration `json:"duration,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

func (*APIResponse) HttpNotFound

func (resp *APIResponse) HttpNotFound() bool

HttpNotFound - returns true if a 404 status code was returned returns false for nil APIResponse values

func (*APIResponse) LogInfo

func (resp *APIResponse) LogInfo()

LogInfo - logs APIResponse values like RequestTime, Operation and StatusCode does not print anything for nil APIResponse values

func (*APIResponse) SafeStatusCode added in v0.1.10

func (resp *APIResponse) SafeStatusCode() int

SafeStatusCode returns the HTTP status code from the embedded *http.Response. Returns 0 if the receiver or the embedded response is nil.

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type ClientOptions added in v0.1.2

type ClientOptions struct {
	// Endpoint is the endpoint that will be overridden
	Endpoint string
	// SkipTLSVerify skips tls verification. Not recommended for production!
	SkipTLSVerify bool
	// Certificate is the certificate that will be used for tls verification
	Certificate string
	// ObjectStorageRegion is the region that will be used for object storage authentication
	ObjectStorageRegion string
	// Credentials are the credentials that will be used for authentication
	Credentials Credentials
}

ClientOptions is a struct that represents the client options

type ConfigProvider added in v0.1.2

type ConfigProvider interface {
	GetConfig() *Configuration
}

ConfigProvider is an interface that allows to get the configuration of shared clients

type Configuration

type Configuration struct {
	Host               string                          `json:"host,omitempty"`
	Scheme             string                          `json:"scheme,omitempty"`
	DefaultHeader      map[string]string               `json:"defaultHeader,omitempty"`
	DefaultQueryParams url.Values                      `json:"defaultQueryParams,omitempty"`
	UserAgent          string                          `json:"userAgent,omitempty"`
	Servers            ServerConfigurations            `json:"servers,omitempty"`
	OperationServers   map[string]ServerConfigurations `json:"operationServers,omitempty"`
	HTTPClient         *http.Client                    `json:"-"` // blank out to avoid serialization on DeepCopy etc.
	Username           string                          `json:"username,omitempty"`
	Password           string                          `json:"password,omitempty"`
	Token              string                          `json:"token,omitempty"`
	MaxRetries         int                             `json:"maxRetries,omitempty"`
	WaitTime           time.Duration                   `json:"waitTime,omitempty"`
	MaxWaitTime        time.Duration                   `json:"maxWaitTime,omitempty"`
	PollInterval       time.Duration                   `json:"pollInterval,omitempty"`

	Middleware          MiddlewareFunction          `json:"-"`
	MiddlewareWithError MiddlewareFunctionWithError `json:"-"`
	ResponseMiddleware  ResponseMiddlewareFunction  `json:"-"`
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration(username, password, token, hostUrl string) *Configuration

NewConfiguration returns a new shared.Configuration object. We recommend using NewConfigurationFromOptions, which allows to set more options and initializes the object storage middleware

func NewConfigurationFromEnv

func NewConfigurationFromEnv() *Configuration

NewConfigurationFromEnv creates a new shared.Configuration object from the environment variables

func NewConfigurationFromOptions added in v0.1.2

func NewConfigurationFromOptions(clientOptions ClientOptions) *Configuration

NewConfigurationFromOptions returns a new shared.Configuration object created from the client options

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) AddDefaultQueryParam

func (c *Configuration) AddDefaultQueryParam(key string, value string)

AddDefaultQueryParam stores default query parameters as slices. Each call adds a value to the slice for that key, allowing multiple query parameters with the same name to be sent in the final request.

func (*Configuration) ServerURL

func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error)

ServerURL returns URL based on server settings

func (*Configuration) ServerURLWithContext

func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error)

ServerURLWithContext returns a new server URL given an endpoint

func (*Configuration) WithObjectStorage added in v0.1.6

func (c *Configuration) WithObjectStorage(clientOptions ClientOptions) *Configuration

WithObjectStorage configures the Configuration by setting the object storage middleware

type Credentials added in v0.1.2

type Credentials struct {
	Username    string `yaml:"username,omitempty"`
	Password    string `yaml:"password,omitempty"`
	Token       string `yaml:"token"`
	S3AccessKey string `yaml:"s3AccessKey"`
	S3SecretKey string `yaml:"s3SecretKey"`
}

Credentials are the credentials that will be used for authentication

type GenericOpenAPIError

type GenericOpenAPIError struct {
	// contains filtered or unexported fields
}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func NewGenericOpenAPIError

func NewGenericOpenAPIError(message string, body []byte, model interface{}, statusCode int) *GenericOpenAPIError

NewGenericOpenAPIError - constructor for GenericOpenAPIError

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

func (*GenericOpenAPIError) SetBody

func (e *GenericOpenAPIError) SetBody(body []byte)

SetBody sets the raw body of the error

func (*GenericOpenAPIError) SetError

func (e *GenericOpenAPIError) SetError(error string)

SetError sets the error string

func (*GenericOpenAPIError) SetModel

func (e *GenericOpenAPIError) SetModel(model interface{})

SetModel sets the model of the error

func (*GenericOpenAPIError) SetStatusCode

func (e *GenericOpenAPIError) SetStatusCode(statusCode int)

SetStatusCode sets the status code of the error

func (GenericOpenAPIError) StatusCode

func (e GenericOpenAPIError) StatusCode() int

StatusCode returns the status code of the error

type HasHref added in v0.1.8

type HasHref interface {
	GetHref() string
}

HasHref is satisfied by any SDK model type that exposes an href link.

type HasProperties added in v0.1.8

type HasProperties[P any] interface {
	GetProperties() P
}

HasProperties is satisfied by SDK model types that wrap a properties sub-object (e.g., dns.ZoneRead exposes GetProperties() dns.Zone).

type Identifiable added in v0.1.8

type Identifiable interface {
	GetId() string
}

Identifiable is satisfied by any SDK model type that exposes a string ID. All *Read types across SDK products (dns.ZoneRead, compute.Datacenter, vpn.WireguardGatewayRead, etc.) implement this interface via their generated GetId() method.

type Listable added in v0.1.8

type Listable[T any] interface {
	GetItems() []T
}

Listable is satisfied by SDK list response types that expose their items via GetItems(). Most generated list types (dns.ZoneReadList, vpn.IPSecGatewayReadList, compute.Datacenters, etc.) satisfy this.

type LogLevel

type LogLevel uint
const (
	Off LogLevel = 0x100 * iota
	Debug
	// Trace We recommend you only set this field for debugging purposes.
	// Disable it in your production environments because it can log sensitive data.
	// It logs the full request and response without encryption, even for an HTTPS call.
	// Verbose request and response logging can also significantly impact your application's performance.
	Trace
)
var SdkLogLevel LogLevel

func (*LogLevel) Get

func (l *LogLevel) Get() LogLevel

func (*LogLevel) Satisfies

func (l *LogLevel) Satisfies(v LogLevel) bool

Satisfies returns true if this LogLevel is at least high enough for v

type Logger

type Logger interface {
	Printf(format string, args ...interface{})
}
var SdkLogger Logger

type MiddlewareFunction added in v0.1.4

type MiddlewareFunction func(*http.Request)

MiddlewareFunction provides way to implement custom middleware in the prepareRequest

type MiddlewareFunctionWithError added in v0.1.4

type MiddlewareFunctionWithError func(*http.Request) error

MiddlewareFunctionWithError provides way to implement custom middleware with errors in the prepareRequest

func SignerMiddleware added in v0.1.4

func SignerMiddleware(region, service, accessKey, secretKey string) MiddlewareFunctionWithError

SignerMiddleware returns a middleware function that signs the request using AWS v4 signer. Used for S3 compatible services.

type Nullable

type Nullable[T any] struct {
	// contains filtered or unexported fields
}

func (Nullable[T]) Get

func (v Nullable[T]) Get() *T

func (Nullable[T]) IsSet

func (v Nullable[T]) IsSet() bool

func (*Nullable[T]) Set

func (v *Nullable[T]) Set(val *T)

func (*Nullable[T]) Unset

func (v *Nullable[T]) Unset()

type Resource added in v0.1.8

type Resource interface {
	Identifiable
	HasHref
}

Resource combines Identifiable and HasHref — the two universally consistent accessor methods across all SDK product model types.

Example

ExampleResource demonstrates that different SDK types (zones, records, or any other product) can be combined into a single collection through the shared interfaces and operated on uniformly.

package main

import (
	"fmt"

	"github.com/ionos-cloud/sdk-go-bundle/shared"
)

// Zone mirrors a properties type like dns.Zone.
type Zone struct {
	ZoneName string
}

func (o *Zone) GetZoneName() string { return o.ZoneName }

// ZoneRead mirrors a read-model type like dns.ZoneRead.
type ZoneRead struct {
	Id         string
	Href       string
	Properties Zone
}

func (o *ZoneRead) GetId() string       { return o.Id }
func (o *ZoneRead) GetHref() string     { return o.Href }
func (o *ZoneRead) GetProperties() Zone { return o.Properties }

// RecordRead mirrors a read-model type like dns.RecordRead.
type RecordRead struct {
	Id   string
	Href string
}

func (o *RecordRead) GetId() string   { return o.Id }
func (o *RecordRead) GetHref() string { return o.Href }

func main() {
	zones := []ZoneRead{
		{Id: "zone-aaa", Href: "/zones/zone-aaa"},
		{Id: "zone-bbb", Href: "/zones/zone-bbb"},
	}
	records := []RecordRead{
		{Id: "rec-111", Href: "/records/rec-111"},
		{Id: "rec-222", Href: "/records/rec-222"},
		{Id: "rec-333", Href: "/records/rec-333"},
	}

	// Both *ZoneRead and *RecordRead satisfy shared.Resource (GetId + GetHref),
	// so they can be combined into a single slice and operated on uniformly.
	var all []shared.Resource
	for i := range zones {
		all = append(all, &zones[i])
	}
	for i := range records {
		all = append(all, &records[i])
	}

	for _, r := range all {
		fmt.Printf("%s -> %s\n", r.GetId(), r.GetHref())
	}
}
Output:
zone-aaa -> /zones/zone-aaa
zone-bbb -> /zones/zone-bbb
rec-111 -> /records/rec-111
rec-222 -> /records/rec-222
rec-333 -> /records/rec-333

type ResponseMiddlewareFunction added in v0.1.4

type ResponseMiddlewareFunction func(*http.Response, []byte) error

ResponseMiddlewareFunction provides way to implement custom middleware with errors after the response is received

type ServerConfiguration

type ServerConfiguration struct {
	URL         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerConfigurations

type ServerConfigurations []ServerConfiguration

ServerConfigurations stores multiple ServerConfiguration items

func (ServerConfigurations) URL

func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error)

URL formats template on a index using given variables

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL