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") )
func ContainsUnparsedObject(i interface{}) (bool, interface{})
ContainsUnparsedObject returns true if the given data contains an unparsed object from the API.
func DeleteKeys[V any](obj map[string]V, keysToDelete *[]string)
DeleteKeys helper method to delete keys from a map
func Marshal(v interface{}) ([]byte, error)
func NewDecoder(r io.Reader) *json.Decoder
func NewDefaultContext(ctx context.Context) context.Context
NewDefaultContext returns a new context setup with environment variables.
func NewEncoder(w io.Writer) *json.Encoder
func ParameterToString(obj interface{}, collectionFormat string) string
ParameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func PtrBool(v bool) *bool
PtrBool is a helper routine that returns a pointer to given boolean value.
func PtrFloat32(v float32) *float32
PtrFloat32 is a helper routine that returns a pointer to given float value.
func PtrFloat64(v float64) *float64
PtrFloat64 is a helper routine that returns a pointer to given float value.
func PtrInt(v int) *int
PtrInt is a helper routine that returns a pointer to given integer value.
func PtrInt32(v int32) *int32
PtrInt32 is a helper routine that returns a pointer to given integer value.
func PtrInt64(v int64) *int64
PtrInt64 is a helper routine that returns a pointer to given integer value.
func PtrString(v string) *string
PtrString is a helper routine that returns a pointer to given string value.
func PtrTime(v time.Time) *time.Time
PtrTime is helper routine that returns a pointer to given Time value.
func ReadBody(response *http.Response) ([]byte, error)
ReadBody returns the byte content of the response and make it available again on the response object.
func ReportError(format string, a ...interface{}) error
ReportError Prevent trying to import "fmt".
func SetAuthKeys(ctx context.Context, headerParams *map[string]string, keys ...[2]string)
SetAuthKeys sets the appropriate values in the headers parameter.
func Strlen(s string) int
Strlen returns number of runes in string
func Unmarshal(data []byte, v interface{}) error
APIClient manages communication with the Datadog API V2 Collection API v1.0. In most cases there should be only one, shared, APIClient.
type APIClient struct { Cfg *Configuration }
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error)
CallAPI do the request.
func (c *APIClient) Decode(v interface{}, b []byte, contentType string) (err error)
Decode unmarshal bytes into an interface
func (c *APIClient) GetConfig() *Configuration
GetConfig allows modification of underlying config for alternate implementations and testing. Caution: modifying the configuration while live can cause data races and potentially unwanted behavior.
func (c *APIClient) PrepareRequest( ctx context.Context, path string, method string, postBody interface{}, headerParams map[string]string, queryParams url.Values, formParams url.Values, formFile *FormFile) (localVarRequest *http.Request, err error)
PrepareRequest build the request.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
type APIKey struct { Key string Prefix string }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
Configuration stores the configuration of the API client
type Configuration struct { Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` Debug bool `json:"debug,omitempty"` Compress bool `json:"compress,omitempty"` Servers ServerConfigurations OperationServers map[string]ServerConfigurations HTTPClient *http.Client RetryConfiguration RetryConfiguration // contains filtered or unexported fields }
func NewConfiguration() *Configuration
NewConfiguration returns a new Configuration object.
func (c *Configuration) AddDefaultHeader(key string, value string)
AddDefaultHeader adds a new HTTP header to the default header in the request.
func (c *Configuration) GetUnstableOperations() []string
GetUnstableOperations returns a slice with all unstable operation Ids.
func (c *Configuration) IsUnstableOperation(operation string) bool
IsUnstableOperation determines whether an operation is an unstable operation. This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo".
func (c *Configuration) IsUnstableOperationEnabled(operation string) bool
IsUnstableOperationEnabled determines whether an unstable operation is enabled. This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" Returns true if the operation is unstable and it is enabled, false otherwise.
func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error)
ServerURL returns URL based on server settings.
func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error)
ServerURLWithContext returns a new server URL given an endpoint.
func (c *Configuration) SetUnstableOperationEnabled(operation string, enabled bool) bool
SetUnstableOperationEnabled sets an unstable operation as enabled (true) or disabled (false). This function accepts operation ID as an argument - this is the name of the method on the API class, e.g. "CreateFoo" Returns true if the operation is marked as unstable and thus was enabled/disabled, false otherwise.
FormFile holds parameters for a file in multipart/form-data request.
type FormFile struct { FormFileName string FileName string FileBytes []byte }
GenericOpenAPIError Provides access to the body, error and model on returned errors.
type GenericOpenAPIError struct { ErrorBody []byte ErrorMessage string ErrorModel interface{} }
func (e GenericOpenAPIError) Body() []byte
Body returns the raw bytes of the response.
func (e GenericOpenAPIError) Error() string
Error returns non-empty string if there was an error.
func (e GenericOpenAPIError) Model() interface{}
Model returns the unpacked model of the error.
NullableBool is a struct to hold a nullable boolean value.
type NullableBool struct {
// contains filtered or unexported fields
}
func NewNullableBool(val *bool) *NullableBool
NewNullableBool instantiates a new nullable bool.
func (v NullableBool) Get() *bool
Get returns the value associated with the nullable bool.
func (v NullableBool) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableBool) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableBool) Set(val *bool)
Set sets the value associated with the nullable bool.
func (v *NullableBool) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableBool) Unset()
Unset resets fields of the nullable bool.
NullableFloat32 is a struct to hold a nullable float32 value.
type NullableFloat32 struct {
// contains filtered or unexported fields
}
func NewNullableFloat32(val *float32) *NullableFloat32
NewNullableFloat32 instantiates a new nullable float32.
func (v NullableFloat32) Get() *float32
Get returns the value associated with the nullable float32.
func (v NullableFloat32) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableFloat32) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableFloat32) Set(val *float32)
Set sets the value associated with the nullable float32.
func (v *NullableFloat32) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableFloat32) Unset()
Unset resets fields of the nullable float32.
NullableFloat64 is a struct to hold a nullable float64 value.
type NullableFloat64 struct {
// contains filtered or unexported fields
}
func NewNullableFloat64(val *float64) *NullableFloat64
NewNullableFloat64 instantiates a new nullable float64.
func (v NullableFloat64) Get() *float64
Get returns the value associated with the nullable float64.
func (v NullableFloat64) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableFloat64) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableFloat64) Set(val *float64)
Set sets the value associated with the nullable float64.
func (v *NullableFloat64) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableFloat64) Unset()
Unset resets fields of the nullable float64.
NullableInt is a struct to hold a nullable int value.
type NullableInt struct {
// contains filtered or unexported fields
}
func NewNullableInt(val *int) *NullableInt
NewNullableInt instantiates a new nullable int.
func (v NullableInt) Get() *int
Get returns the value associated with the nullable int.
func (v NullableInt) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableInt) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableInt) Set(val *int)
Set sets the value associated with the nullable int.
func (v *NullableInt) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableInt) Unset()
Unset resets fields of the nullable int.
NullableInt32 is a struct to hold a nullable int32 value.
type NullableInt32 struct {
// contains filtered or unexported fields
}
func NewNullableInt32(val *int32) *NullableInt32
NewNullableInt32 instantiates a new nullable int32.
func (v NullableInt32) Get() *int32
Get returns the value associated with the nullable int32.
func (v NullableInt32) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableInt32) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableInt32) Set(val *int32)
Set sets the value associated with the nullable int32.
func (v *NullableInt32) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableInt32) Unset()
Unset resets fields of the nullable int32.
NullableInt64 is a struct to hold a nullable int64 value.
type NullableInt64 struct {
// contains filtered or unexported fields
}
func NewNullableInt64(val *int64) *NullableInt64
NewNullableInt64 instantiates a new nullable int64.
func (v NullableInt64) Get() *int64
Get returns the value associated with the nullable int64.
func (v NullableInt64) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableInt64) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableInt64) Set(val *int64)
Set sets the value associated with the nullable int64.
func (v *NullableInt64) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableInt64) Unset()
Unset resets fields of the nullable int64.
NullableList struct to hold nullable list value.
type NullableList[T any] struct { // contains filtered or unexported fields }
func NewNullableList[T any](val *[]T) *NullableList[T]
NewNullableList instantiates a new nullable list.
func (v NullableList[T]) Get() *[]T
Get returns the value associated with the nullable list.
func (v NullableList[T]) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableList[T]) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableList[T]) Set(val *[]T)
Set sets the value associated with the nullable list.
func (v *NullableList[T]) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableList[T]) Unset()
Unset resets fields of the nullable list.
NullableString is a struct to hold a nullable string value.
type NullableString struct {
// contains filtered or unexported fields
}
func NewNullableString(val *string) *NullableString
NewNullableString instantiates a new nullable string.
func (v NullableString) Get() *string
Get returns the value associated with the nullable string.
func (v NullableString) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableString) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableString) Set(val *string)
Set sets the value associated with the nullable string.
func (v *NullableString) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableString) Unset()
Unset resets fields of the nullable string.
NullableTime is a struct to hold a nullable Time value.
type NullableTime struct {
// contains filtered or unexported fields
}
func NewNullableTime(val *time.Time) *NullableTime
NewNullableTime instantiates a new nullable Time.
func (v NullableTime) Get() *time.Time
Get returns the value associated with the nullable Time.
func (v NullableTime) IsSet() bool
IsSet returns true if the value has been set.
func (v NullableTime) MarshalJSON() ([]byte, error)
MarshalJSON serializes the associated value.
func (v *NullableTime) Set(val *time.Time)
Set sets the value associated with the nullable Time.
func (v *NullableTime) UnmarshalJSON(src []byte) error
UnmarshalJSON deserializes to the associated value.
func (v *NullableTime) Unset()
Unset resets fields of the nullable Time.
PaginationResult pagination item helper struct
type PaginationResult[T any] struct { Item T Error error }
RetryConfiguration stores the configuration of the retry behavior of the api client
type RetryConfiguration struct { EnableRetry bool BackOffMultiplier float64 BackOffBase float64 HTTPRetryTimeout time.Duration MaxRetries int }
ServerConfiguration stores the information about a server.
type ServerConfiguration struct { URL string Description string Variables map[string]ServerVariable }
ServerConfigurations stores multiple ServerConfiguration items.
type ServerConfigurations []ServerConfiguration
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error)
URL formats template on a index using given variables.
ServerVariable stores the information about a server variable.
type ServerVariable struct { Description string DefaultValue string EnumValues []string }
Service holds APIClient
type Service struct { Client *APIClient }