Documentation ¶
Overview ¶
Package sdk contains a set of objects that simplify usage of `api.openshift.com`.
Index ¶
- Constants
- Variables
- func Dispatch(w http.ResponseWriter, r *http.Request, server Server, segments []string)
- type Adapter
- type Connection
- func (c *Connection) AccountsMgmt() *accountsmgmt.Client
- func (c *Connection) Agent() string
- func (c *Connection) AlternativeURLs() map[string]string
- func (c *Connection) Authorizations() *authorizations.Client
- func (c *Connection) Client() (id, secret string)
- func (c *Connection) Close() error
- func (c *Connection) ClustersMgmt() *clustersmgmt.Client
- func (c *Connection) Delete() *Request
- func (c *Connection) DisableKeepAlives() bool
- func (c *Connection) Get() *Request
- func (c *Connection) Insecure() bool
- func (c *Connection) JobQueue() *jobqueue.Client
- func (c *Connection) Logger() logging.Logger
- func (c *Connection) MetricsSubsystem() string
- func (c *Connection) Patch() *Request
- func (c *Connection) Post() *Request
- func (c *Connection) Put() *Request
- func (c *Connection) RetryInterval() time.Duration
- func (c *Connection) RetryJitter() float64
- func (c *Connection) RetryLimit() int
- func (c *Connection) RoundTrip(request *http.Request) (response *http.Response, err error)
- func (c *Connection) Scopes() []string
- func (c *Connection) ServiceLogs() *servicelogs.Client
- func (c *Connection) StatusBoard() *statusboard.Client
- func (c *Connection) TokenURL() string
- func (c *Connection) Tokens(expiresIn ...time.Duration) (access, refresh string, err error)
- func (c *Connection) TokensContext(ctx context.Context, expiresIn ...time.Duration) (access, refresh string, err error)
- func (c *Connection) TrustedCAs() *x509.CertPool
- func (c *Connection) URL() string
- func (c *Connection) User() (user, password string)
- type ConnectionBuilder
- func (b *ConnectionBuilder) Agent(agent string) *ConnectionBuilder
- func (b *ConnectionBuilder) AlternativeURL(prefix, base string) *ConnectionBuilder
- func (b *ConnectionBuilder) AlternativeURLs(entries map[string]string) *ConnectionBuilder
- func (b *ConnectionBuilder) Build() (connection *Connection, err error)
- func (b *ConnectionBuilder) BuildContext(ctx context.Context) (connection *Connection, err error)
- func (b *ConnectionBuilder) Client(id string, secret string) *ConnectionBuilder
- func (b *ConnectionBuilder) DisableKeepAlives(flag bool) *ConnectionBuilder
- func (b *ConnectionBuilder) Insecure(flag bool) *ConnectionBuilder
- func (b *ConnectionBuilder) Load(source interface{}) *ConnectionBuilder
- func (b *ConnectionBuilder) Logger(logger logging.Logger) *ConnectionBuilder
- func (b *ConnectionBuilder) Metrics(value string) *ConnectionBuilderdeprecated
- func (b *ConnectionBuilder) MetricsRegisterer(value prometheus.Registerer) *ConnectionBuilder
- func (b *ConnectionBuilder) MetricsSubsystem(value string) *ConnectionBuilder
- func (b *ConnectionBuilder) RetryInterval(value time.Duration) *ConnectionBuilder
- func (b *ConnectionBuilder) RetryJitter(value float64) *ConnectionBuilder
- func (b *ConnectionBuilder) RetryLimit(value int) *ConnectionBuilder
- func (b *ConnectionBuilder) Scopes(values ...string) *ConnectionBuilder
- func (b *ConnectionBuilder) TokenURL(url string) *ConnectionBuilder
- func (b *ConnectionBuilder) Tokens(tokens ...string) *ConnectionBuilder
- func (b *ConnectionBuilder) TransportWrapper(value TransportWrapper) *ConnectionBuilder
- func (b *ConnectionBuilder) TrustedCAFile(value string) *ConnectionBuilder
- func (b *ConnectionBuilder) TrustedCAs(value *x509.CertPool) *ConnectionBuilder
- func (b *ConnectionBuilder) URL(url string) *ConnectionBuilder
- func (b *ConnectionBuilder) User(name string, password string) *ConnectionBuilder
- type GlogLogger
- type GlogLoggerBuilder
- type GoLogger
- type GoLoggerBuilder
- type Logger
- type Request
- func (r *Request) Bytes(value []byte) *Request
- func (r *Request) GetMethod() string
- func (r *Request) GetPath() string
- func (r *Request) Header(name string, value interface{}) *Request
- func (r *Request) Parameter(name string, value interface{}) *Request
- func (r *Request) Path(value string) *Request
- func (r *Request) Send() (result *Response, err error)
- func (r *Request) SendContext(ctx context.Context) (result *Response, err error)
- func (r *Request) String(value string) *Request
- type Response
- type Server
- type StdLogger
- type StdLoggerBuilder
- type TransportWrapper
Constants ¶
const ( // #nosec G101 DefaultTokenURL = authentication.DefaultTokenURL DefaultClientID = authentication.DefaultClientID DefaultClientSecret = authentication.DefaultClientSecret DefaultURL = "https://api.openshift.com" DefaultAgent = "OCM-SDK/" + Version )
Default values:
const Version = "0.1.239"
Variables ¶
var DefaultScopes = []string{
"openid",
}
DefaultScopes is the ser of scopes used by default:
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is an HTTP handler that knows how to translate HTTP requests into calls to the methods of an object that implements the Server interface.
func NewAdapter ¶
NewAdapter creates a new adapter that will translate HTTP requests into calls to the given server.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection contains the data needed to connect to the `api.openshift.com`. Don't create instances of this type directly, use the builder instead.
func (*Connection) AccountsMgmt ¶
func (c *Connection) AccountsMgmt() *accountsmgmt.Client
AccountsMgmt returns the client for the accounts management service.
func (*Connection) Agent ¶
func (c *Connection) Agent() string
Agent returns the `User-Agent` header that the client is using for all HTTP requests.
func (*Connection) AlternativeURLs ¶ added in v0.0.329
func (c *Connection) AlternativeURLs() map[string]string
AlternativeURLs returns the alternative URLs in use by the connection. Note that the map returned is a copy of the data used internally, so changing it will have no effect on the connection.
func (*Connection) Authorizations ¶
func (c *Connection) Authorizations() *authorizations.Client
Authorizations returns the client for the authorizations service.
func (*Connection) Client ¶
func (c *Connection) Client() (id, secret string)
Client returns OpenID client identifier and secret that the connection is using to request OpenID access tokens.
func (*Connection) Close ¶
func (c *Connection) Close() error
Close releases all the resources used by the connection. It is very important to always close it once it is no longer needed, as otherwise those resources may be leaked. Trying to use a connection that has been closed will result in a error.
func (*Connection) ClustersMgmt ¶
func (c *Connection) ClustersMgmt() *clustersmgmt.Client
ClustersMgmt returns the client for the clusters management service.
func (*Connection) Delete ¶
func (c *Connection) Delete() *Request
Delete creates an HTTP DELETE request. Note that this request won't be sent till the Send method is called.
func (*Connection) DisableKeepAlives ¶ added in v0.0.329
func (c *Connection) DisableKeepAlives() bool
DisableKeepAlives returns the flag that indicates if HTTP keep alive is disabled.
func (*Connection) Get ¶
func (c *Connection) Get() *Request
Get creates an HTTP GET request. Note that this request won't be sent till the Send method is called.
func (*Connection) Insecure ¶
func (c *Connection) Insecure() bool
Insecure returns the flag that indicates if insecure communication with the server is enabled.
func (*Connection) JobQueue ¶ added in v0.0.329
func (c *Connection) JobQueue() *jobqueue.Client
JobQueue returns the client for the Job Queues service.
func (*Connection) Logger ¶
func (c *Connection) Logger() logging.Logger
Logger returns the logger that is used by the connection.
func (*Connection) MetricsSubsystem ¶ added in v0.0.329
func (c *Connection) MetricsSubsystem() string
MetricsSubsystem returns the name of the subsystem that is used by the connection to register metrics with Prometheus. An empty string means that no metrics are registered.
func (*Connection) Patch ¶
func (c *Connection) Patch() *Request
Patch creates an HTTP PATCH request. Note that this request won't be sent till the Send method is called.
func (*Connection) Post ¶
func (c *Connection) Post() *Request
Post creates an HTTP POST request. Note that this request won't be sent till the Send method is called.
func (*Connection) Put ¶
func (c *Connection) Put() *Request
Put creates an HTTP PUT request. Note that this request won't be sent till the Send method is called.
func (*Connection) RetryInterval ¶ added in v0.0.329
func (c *Connection) RetryInterval() time.Duration
RetryInteval returns the initial retry interval.
func (*Connection) RetryJitter ¶ added in v0.0.329
func (c *Connection) RetryJitter() float64
RetryJitter returns the retry interval jitter factor.
func (*Connection) RetryLimit ¶ added in v0.0.329
func (c *Connection) RetryLimit() int
RetryLimit gets the maximum number of retries for a request.
func (*Connection) Scopes ¶
func (c *Connection) Scopes() []string
Scopes returns the OpenID scopes that the connection is using to request OpenID access tokens.
func (*Connection) ServiceLogs ¶
func (c *Connection) ServiceLogs() *servicelogs.Client
ServiceLogs returns the client for the logs service.
func (*Connection) StatusBoard ¶ added in v0.0.329
func (c *Connection) StatusBoard() *statusboard.Client
Status board returns the client for the status board service.
func (*Connection) TokenURL ¶
func (c *Connection) TokenURL() string
TokenURL returns the URL that the connection is using request OpenID access tokens.
func (*Connection) Tokens ¶
func (c *Connection) Tokens(expiresIn ...time.Duration) (access, refresh string, err error)
Tokens returns the access and refresh tokens that are currently in use by the connection. If it is necessary to request new tokens because they weren't requested yet, or because they are expired, this method will do it and will return an error if it fails.
If new tokens are needed the request will be retried with an exponential backoff.
This operation is potentially lengthy, as it may require network communication. Consider using a context and the TokensContext method.
func (*Connection) TokensContext ¶
func (c *Connection) TokensContext(ctx context.Context, expiresIn ...time.Duration) (access, refresh string, err error)
TokensContext returns the access and refresh tokens that are currently in use by the connection. If it is necessary to request new tokens because they weren't requested yet, or because they are expired, this method will do it and will return an error if it fails.
If new tokens are needed the request will be retried with an exponential backoff.
func (*Connection) TrustedCAs ¶
func (c *Connection) TrustedCAs() *x509.CertPool
TrustedCAs sets returns the certificate pool that contains the certificate authorities that are trusted by the connection.
func (*Connection) URL ¶
func (c *Connection) URL() string
URL returns the base URL of the API gateway.
func (*Connection) User ¶
func (c *Connection) User() (user, password string)
User returns the user name and password that the is using to request OpenID access tokens.
type ConnectionBuilder ¶
type ConnectionBuilder struct {
// contains filtered or unexported fields
}
ConnectionBuilder contains the configuration and logic needed to create connections to `api.openshift.com`. Don't create instances of this type directly, use the NewConnectionBuilder function instead.
func NewConnectionBuilder ¶
func NewConnectionBuilder() *ConnectionBuilder
NewConnectionBuilder creates an builder that knows how to create connections with the default configuration.
func (*ConnectionBuilder) Agent ¶
func (b *ConnectionBuilder) Agent(agent string) *ConnectionBuilder
Agent sets the `User-Agent` header that the client will use in all the HTTP requests. The default is `OCM` followed by an slash and the version of the client, for example `OCM/0.0.0`.
func (*ConnectionBuilder) AlternativeURL ¶ added in v0.0.329
func (b *ConnectionBuilder) AlternativeURL(prefix, base string) *ConnectionBuilder
AlternativeURL sets an alternative base URL for the given path prefix. For example, to configure the connection so that it sends the requests for the clusters management service to `https://my.server.com`:
connection, err := client.NewConnectionBuilder(). URL("https://api.example.com"). AlternativeURL("/api/clusters_mgmt", "https://my.server.com"). Build()
Requests for other paths that don't start with the given prefix will still be sent to the default base URL.
This method can be called multiple times to set alternative URLs for multiple prefixes.
func (*ConnectionBuilder) AlternativeURLs ¶ added in v0.0.329
func (b *ConnectionBuilder) AlternativeURLs(entries map[string]string) *ConnectionBuilder
AlternativeURLs sets an collection of alternative base URLs. For example, to configure the connection so that it sends the requests for the clusters management service to `https://my.server.com` and the requests for the accounts management service to `https://your.server.com`:
connection, err := client.NewConnectionBuilder(). URL("https://api.example.com"). AlternativeURLs(map[string]string{ "/api/clusters_mgmt": "https://my.server.com", "/api/accounts_mgmt": "https://your.server.com", }). Build()
The effect is the same as calling the AlternativeURL multiple times.
func (*ConnectionBuilder) Build ¶
func (b *ConnectionBuilder) Build() (connection *Connection, err error)
Build uses the configuration stored in the builder to create a new connection. The builder can be reused to create multiple connections with the same configuration. It returns a pointer to the connection, and an error if something fails when trying to create it.
This operation is potentially lengthy, as it may require network communications. Consider using a context and the BuildContext method.
func (*ConnectionBuilder) BuildContext ¶
func (b *ConnectionBuilder) BuildContext(ctx context.Context) (connection *Connection, err error)
BuildContext uses the configuration stored in the builder to create a new connection. The builder can be reused to create multiple connections with the same configuration. It returns a pointer to the connection, and an error if something fails when trying to create it.
func (*ConnectionBuilder) Client ¶
func (b *ConnectionBuilder) Client(id string, secret string) *ConnectionBuilder
Client sets OpenID client identifier and secret that will be used to request OpenID tokens. The default identifier is `cloud-services`. The default secret is the empty string. When these two values are provided and no user name and password is provided, the connection will use the client credentials grant to obtain the token. For example, to create a connection using the client credentials grant do the following:
// Use the client credentials grant: connection, err := sdk.NewConnectionBuilder(). Client("myclientid", "myclientsecret"). Build()
Note that some OpenID providers (Keycloak, for example) require the client identifier also for the resource owner password grant. In that case use the set only the identifier, and let the secret blank. For example:
// Use the resource owner password grant: connection, err := sdk.NewConnectionBuilder(). User("myuser", "mypassword"). Client("myclientid", ""). Build()
Note the empty client secret.
func (*ConnectionBuilder) DisableKeepAlives ¶ added in v0.0.329
func (b *ConnectionBuilder) DisableKeepAlives(flag bool) *ConnectionBuilder
DisableKeepAlives disables HTTP keep-alives with the server. This is unrelated to similarly named TCP keep-alives.
func (*ConnectionBuilder) Insecure ¶
func (b *ConnectionBuilder) Insecure(flag bool) *ConnectionBuilder
Insecure enables insecure communication with the server. This disables verification of TLS certificates and host names and it isn't recommended for a production environment.
func (*ConnectionBuilder) Load ¶ added in v0.0.329
func (b *ConnectionBuilder) Load(source interface{}) *ConnectionBuilder
Load loads the connection configuration from the given source. The source must be a YAML document with content similar to this:
url: https://my.server.com alternative_urls: - /api/clusters_mgmt: https://your.server.com - /api/accounts_mgmt: https://her.server.com token_url: https://openid.server.com user: myuser password: mypassword client_id: myclient client_secret: mysecret tokens: - eY... - eY... scopes: - openid insecure: false trusted_cas: - /my/ca.pem - /your/ca.pem agent: myagent retry: true retry_limit: 1
Setting any of these fields in the file has the same effect that calling the corresponding method of the builder.
For details of the supported syntax see the documentation of the configuration package.
func (*ConnectionBuilder) Logger ¶
func (b *ConnectionBuilder) Logger(logger logging.Logger) *ConnectionBuilder
Logger sets the logger that will be used by the connection. By default it uses the Go `log` package, and with the debug level disabled and the rest enabled. If you need to change that you can create a logger and pass it to this method. For example:
// Create a logger with the debug level enabled: logger, err := logging.NewGoLoggerBuilder(). Debug(true). Build() if err != nil { panic(err) } // Create the connection: cl, err := client.NewConnectionBuilder(). Logger(logger). Build() if err != nil { panic(err) }
You can also build your own logger, implementing the Logger interface.
func (*ConnectionBuilder) Metrics
deprecated
func (b *ConnectionBuilder) Metrics(value string) *ConnectionBuilder
Metrics sets the name of the subsystem that will be used by the connection to register metrics with Prometheus.
Deprecated: has been replaced by MetricsSubsystem.
func (*ConnectionBuilder) MetricsRegisterer ¶ added in v0.0.329
func (b *ConnectionBuilder) MetricsRegisterer(value prometheus.Registerer) *ConnectionBuilder
MetricsRegisterer sets the Prometheus registerer that will be used to register the metrics. The default is to use the default Prometheus registerer and there is usually no need to change that. This is intended for unit tests, where it is convenient to have a registerer that doesn't interfere with the rest of the system.
func (*ConnectionBuilder) MetricsSubsystem ¶ added in v0.0.329
func (b *ConnectionBuilder) MetricsSubsystem(value string) *ConnectionBuilder
MetricsSubsystem sets the name of the subsystem that will be used by the connection to register metrics with Prometheus. If this isn't explicitly specified, or if it is an empty string, then no metrics will be registered. For example, if the value is `api_outbound` then the following metrics will be registered:
api_outbound_request_count - Number of API requests sent. api_outbound_request_duration_sum - Total time to send API requests, in seconds. api_outbound_request_duration_count - Total number of API requests measured. api_outbound_request_duration_bucket - Number of API requests organized in buckets. api_outbound_token_request_count - Number of token requests sent. api_outbound_token_request_duration_sum - Total time to send token requests, in seconds. api_outbound_token_request_duration_count - Total number of token requests measured. api_outbound_token_request_duration_bucket - Number of token requests organized in buckets.
The duration buckets metrics contain an `le` label that indicates the upper bound. For example if the `le` label is `1` then the value will be the number of requests that were processed in less than one second.
The API request metrics have the following labels:
method - Name of the HTTP method, for example GET or POST. path - Request path, for example /api/clusters_mgmt/v1/clusters. code - HTTP response code, for example 200 or 500.
To calculate the average request duration during the last 10 minutes, for example, use a Prometheus expression like this:
rate(api_outbound_request_duration_sum[10m]) / rate(api_outbound_request_duration_count[10m])
In order to reduce the cardinality of the metrics the path label is modified to remove the identifiers of the objects. For example, if the original path is .../clusters/123 then it will be replaced by .../clusters/-, and the values will be accumulated. The line returned by the metrics server will be like this:
api_outbound_request_count{code="200",method="GET",path="/api/clusters_mgmt/v1/clusters/-"} 56
The meaning of that is that there were a total of 56 requests to get specific clusters, independently of the specific identifier of the cluster.
The token request metrics will contain the following labels:
code - HTTP response code, for example 200 or 500.
The value of the `code` label will be zero when sending the request failed without a response code, for example if it wasn't possible to open the connection, or if there was a timeout waiting for the response.
Note that setting this attribute is not enough to have metrics published, you also need to create and start a metrics server, as described in the documentation of the Prometheus library.
func (*ConnectionBuilder) RetryInterval ¶ added in v0.0.329
func (b *ConnectionBuilder) RetryInterval(value time.Duration) *ConnectionBuilder
RetryInterval sets the time to wait before the first retry. The interval time will be doubled for each retry. For example, if this is set to one second then the first retry will happen approximately one second after the failure of the initial request, the second retry will happen affer four seconds, the third will happen after eitght seconds, so on.
func (*ConnectionBuilder) RetryJitter ¶ added in v0.0.329
func (b *ConnectionBuilder) RetryJitter(value float64) *ConnectionBuilder
RetryJitter sets a factor that will be used to randomize the retry intervals. For example, if this is set to 0.1 then a random adjustment between -10% and +10% will be done to the interval for each retry. This is intended to reduce simultaneous retries by clients when a server starts failing. The default value is 0.2.
func (*ConnectionBuilder) RetryLimit ¶ added in v0.0.329
func (b *ConnectionBuilder) RetryLimit(value int) *ConnectionBuilder
RetryLimit sets the maximum number of retries for a request. When this is zero no retries will be performed. The default value is two.
func (*ConnectionBuilder) Scopes ¶
func (b *ConnectionBuilder) Scopes(values ...string) *ConnectionBuilder
Scopes sets the OpenID scopes that will be included in the token request. The default is to use the `openid` scope. If this method is used then that default will be completely replaced, so you will need to specify it explicitly if you want to use it. For example, if you want to add the scope 'myscope' without loosing the default you will have to do something like this:
// Create a connection with the default 'openid' scope and some additional scopes: connection, err := sdk.NewConnectionBuilder(). User("myuser", "mypassword"). Scopes("openid", "myscope", "yourscope"). Build()
If you just want to use the default 'openid' then there is no need to use this method.
func (*ConnectionBuilder) TokenURL ¶
func (b *ConnectionBuilder) TokenURL(url string) *ConnectionBuilder
TokenURL sets the URL that will be used to request OpenID access tokens. The default is `https://sso.redhat.com/auth/realms/cloud-services/protocol/openid-connect/token`.
func (*ConnectionBuilder) Tokens ¶
func (b *ConnectionBuilder) Tokens(tokens ...string) *ConnectionBuilder
Tokens sets the OpenID tokens that will be used to authenticate. Multiple types of tokens are accepted, and used according to their type. For example, you can pass a single access token, or an access token and a refresh token, or just a refresh token. If no token is provided then the connection will the user name and password or the client identifier and client secret (see the User and Client methods) to request new ones.
If the connection is created with these tokens and no user or client credentials, it will stop working when both tokens expire. That can happen, for example, if the connection isn't used for a period of time longer than the life of the refresh token.
func (*ConnectionBuilder) TransportWrapper ¶
func (b *ConnectionBuilder) TransportWrapper(value TransportWrapper) *ConnectionBuilder
TransportWrapper allows setting a transport layer into the connection for capturing and manipulating the request or response.
func (*ConnectionBuilder) TrustedCAFile ¶ added in v0.0.329
func (b *ConnectionBuilder) TrustedCAFile(value string) *ConnectionBuilder
TrustedCAFile sets the name of a file that contains the certificate authorities that will be trusted by the connection. If this isn't explicitly specified then the client will trust the certificate authorities trusted by default by the system.
func (*ConnectionBuilder) TrustedCAs ¶
func (b *ConnectionBuilder) TrustedCAs(value *x509.CertPool) *ConnectionBuilder
TrustedCAs sets the certificate pool that contains the certificate authorities that will be trusted by the connection. If this isn't explicitly specified then the client will trust the certificate authorities trusted by default by the system.
func (*ConnectionBuilder) URL ¶
func (b *ConnectionBuilder) URL(url string) *ConnectionBuilder
URL sets the base URL of the API gateway. The default is `https://api.openshift.com`.
To connect using a Unix sockets and HTTP use the `unix` URL scheme and put the name of socket file in the URL path:
connection, err := sdk.NewConnectionBuilder(). URL("unix://my.server.com/tmp/api.socket"). Build()
To connect using Unix sockets and HTTPS use `unix+https://my.server.com/tmp/api.socket`.
To force use of HTTP/2 without TLS use `h2c://...`. This can also be combined with Unix sockets, for example `unix+h2c://...`.
Note that the host name is mandatory even when using Unix sockets because it is used to populate the `Host` header sent to the server.
func (*ConnectionBuilder) User ¶
func (b *ConnectionBuilder) User(name string, password string) *ConnectionBuilder
User sets the user name and password that will be used to request OpenID access tokens. When these two values are provided the connection will use the resource owner password grant type to obtain the token. For example:
// Use the resource owner password grant: connection, err := sdk.NewConnectionBuilder(). User("myuser", "mypassword"). Build()
Note that some OpenID providers (Keycloak, for example) require the client identifier also for the resource owner password grant. In that case use the set only the identifier, and let the secret blank. For example:
// Use the resource owner password grant: connection, err := sdk.NewConnectionBuilder(). User("myuser", "mypassword"). Client("myclientid", ""). Build()
Note the empty client secret.
type GlogLogger ¶
type GlogLogger = logging.GlogLogger
GlogLogger has been moved to the logging package.
type GlogLoggerBuilder ¶
type GlogLoggerBuilder = logging.GlogLoggerBuilder
GlogLoggerBuilder has been moved to the logging package.
func NewGlogLoggerBuilder ¶
func NewGlogLoggerBuilder() *GlogLoggerBuilder
NewGlogLoggerBuilder has been moved to the logging package.
type GoLoggerBuilder ¶
type GoLoggerBuilder = logging.GoLoggerBuilder
GoLoggerBuilder has been moved to the logging package.
func NewGoLoggerBuilder ¶
func NewGoLoggerBuilder() *GoLoggerBuilder
NewGoLoggerBuilder has been moved to the logging package.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request contains the information and logic needed to perform an HTTP request.
func (*Request) Path ¶
Path defines the request path, for example `/api/clusters_mgmt/v1/clusters`. This is mandatory; an error will be returned immediately when calling the Send method if this isn't provided.
func (*Request) Send ¶
Send sends this request to the server and returns the corresponding response, or an error if something fails. Note that any HTTP status code returned by the server is considered a valid response, and will not be translated into an error. It is up to the caller to check the status code and handle it.
This operation is potentially lengthy, as it requires network communication. Consider using a context and the SendContext method.
func (*Request) SendContext ¶
SendContext sends this request to the server and returns the corresponding response, or an error if something fails. Note that any HTTP status code returned by the server is considered a valid response, and will not be translated into an error. It is up to the caller to check the status code and handle it.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response contains the information extracted from an HTTP POST response.
func (*Response) Bytes ¶
Bytes returns an slice of bytes containing the response body. Not that this will never return nil; if the response body is empty it will return an empty slice.
type Server ¶
type Server interface { // AccountsMgmt returns the server for service 'accounts_mgmt'. AccountsMgmt() accountsmgmt.Server // Authorizations returns the server for service 'authorizations'. Authorizations() authorizations.Server // ClustersMgmt returns the server for service 'clusters_mgmt'. ClustersMgmt() clustersmgmt.Server // JobQueue returns the server for service 'job_queue'. JobQueue() jobqueue.Server // ServiceLogs returns the server for service 'service_logs'. ServiceLogs() servicelogs.Server // StatusBoard returns the server for service 'status_board'. StatusBoard() statusboard.Server }
Server is the interface of the top level server.
type StdLoggerBuilder ¶
type StdLoggerBuilder = logging.StdLoggerBuilder
StdLoggerBuilder has been moved to the logging package.
func NewStdLoggerBuilder ¶
func NewStdLoggerBuilder() *StdLoggerBuilder
NewStdLoggerBuilder has been moved to the logging package.
type TransportWrapper ¶
type TransportWrapper func(http.RoundTripper) http.RoundTripper
TransportWrapper is a wrapper for a transport of type http.RoundTripper. Creating a transport wrapper, enables to preform actions and manipulations on the transport request and response.