client

package
v0.0.0-...-42349e2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package client provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateProviderRequest

func NewCreateProviderRequest(server string, params *CreateProviderParams, body CreateProviderJSONRequestBody) (*http.Request, error)

NewCreateProviderRequest calls the generic CreateProvider builder with application/json body

func NewCreateProviderRequestWithBody

func NewCreateProviderRequestWithBody(server string, params *CreateProviderParams, contentType string, body io.Reader) (*http.Request, error)

NewCreateProviderRequestWithBody constructs an http.Request for the CreateProvider method, with any body, and a specified content type

func NewGetHealthRequest

func NewGetHealthRequest(server string) (*http.Request, error)

NewGetHealthRequest constructs an http.Request for the GetHealth method

func NewGetProviderRequest

func NewGetProviderRequest(server string, providerId string) (*http.Request, error)

NewGetProviderRequest constructs an http.Request for the GetProvider method

func NewListProvidersRequest

func NewListProvidersRequest(server string, params *ListProvidersParams) (*http.Request, error)

NewListProvidersRequest constructs an http.Request for the ListProviders method

Types

type Client

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
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CreateProvider

func (c *Client) CreateProvider(ctx context.Context, params *CreateProviderParams, body CreateProviderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateProvider Register an external Service Provider

Register an external Service Provider with the agent. Registration is idempotent (name as natural key, create-or-update). Only one SP — embedded or external — may serve a given service type per agent. If the requested service type is already served by another SP, registration is rejected with 409 Conflict.

Takes a body of the `application/json` content type.

Corresponds with POST /providers (the `CreateProvider` operationId).

func (*Client) CreateProviderWithBody

func (c *Client) CreateProviderWithBody(ctx context.Context, params *CreateProviderParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

CreateProviderWithBody Register an external Service Provider

Register an external Service Provider with the agent. Registration is idempotent (name as natural key, create-or-update). Only one SP — embedded or external — may serve a given service type per agent. If the requested service type is already served by another SP, registration is rejected with 409 Conflict.

Takes any type of body and a specified content type.

Corresponds with POST /providers (the `CreateProvider` operationId).

func (*Client) GetHealth

func (c *Client) GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

GetHealth Health check

Liveness health check for the Environment Agent.

Corresponds with GET /health (the `GetHealth` operationId).

func (*Client) GetProvider

func (c *Client) GetProvider(ctx context.Context, providerId string, reqEditors ...RequestEditorFn) (*http.Response, error)

GetProvider Get a Service Provider

Returns a single registered Service Provider by ID, including its current health status.

Corresponds with GET /providers/{provider_id} (the `GetProvider` operationId).

func (*Client) ListProviders

func (c *Client) ListProviders(ctx context.Context, params *ListProvidersParams, reqEditors ...RequestEditorFn) (*http.Response, error)

ListProviders List all Service Providers

Returns all registered Service Providers (both embedded and external) including their current health status.

Corresponds with GET /providers (the `ListProviders` operationId).

type ClientInterface

type ClientInterface interface {

	// GetHealth Health check
	//
	// Liveness health check for the Environment Agent.
	//
	// Corresponds with GET /health (the `GetHealth` operationId).
	GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListProviders List all Service Providers
	//
	// Returns all registered Service Providers (both embedded and external)
	// including their current health status.
	//
	// Corresponds with GET /providers (the `ListProviders` operationId).
	ListProviders(ctx context.Context, params *ListProvidersParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateProviderWithBody Register an external Service Provider
	//
	// Register an external Service Provider with the agent.
	// Registration is idempotent (name as natural key, create-or-update).
	// Only one SP — embedded or external — may serve a given service type
	// per agent. If the requested service type is already served by another
	// SP, registration is rejected with 409 Conflict.
	//
	// Takes any type of body and a specified content type.
	//
	// Corresponds with POST /providers (the `CreateProvider` operationId).
	CreateProviderWithBody(ctx context.Context, params *CreateProviderParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateProvider Register an external Service Provider
	//
	// Register an external Service Provider with the agent.
	// Registration is idempotent (name as natural key, create-or-update).
	// Only one SP — embedded or external — may serve a given service type
	// per agent. If the requested service type is already served by another
	// SP, registration is rejected with 409 Conflict.
	//
	// Takes a body of the `application/json` content type.
	//
	// Corresponds with POST /providers (the `CreateProvider` operationId).
	CreateProvider(ctx context.Context, params *CreateProviderParams, body CreateProviderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetProvider Get a Service Provider
	//
	// Returns a single registered Service Provider by ID, including its
	// current health status.
	//
	// Corresponds with GET /providers/{provider_id} (the `GetProvider` operationId).
	GetProvider(ctx context.Context, providerId string, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CreateProviderWithBodyWithResponse

func (c *ClientWithResponses) CreateProviderWithBodyWithResponse(ctx context.Context, params *CreateProviderParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateProviderResponse, error)

CreateProviderWithBodyWithResponse Register an external Service Provider

Register an external Service Provider with the agent. Registration is idempotent (name as natural key, create-or-update). Only one SP — embedded or external — may serve a given service type per agent. If the requested service type is already served by another SP, registration is rejected with 409 Conflict.

Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /providers (the `CreateProvider` operationId).

func (*ClientWithResponses) CreateProviderWithResponse

func (c *ClientWithResponses) CreateProviderWithResponse(ctx context.Context, params *CreateProviderParams, body CreateProviderJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateProviderResponse, error)

CreateProviderWithResponse Register an external Service Provider

Register an external Service Provider with the agent. Registration is idempotent (name as natural key, create-or-update). Only one SP — embedded or external — may serve a given service type per agent. If the requested service type is already served by another SP, registration is rejected with 409 Conflict.

Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).

Corresponds with POST /providers (the `CreateProvider` operationId).

func (*ClientWithResponses) GetHealthWithResponse

func (c *ClientWithResponses) GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

GetHealthWithResponse Health check

Liveness health check for the Environment Agent.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /health (the `GetHealth` operationId).

func (*ClientWithResponses) GetProviderWithResponse

func (c *ClientWithResponses) GetProviderWithResponse(ctx context.Context, providerId string, reqEditors ...RequestEditorFn) (*GetProviderResponse, error)

GetProviderWithResponse Get a Service Provider

Returns a single registered Service Provider by ID, including its current health status.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /providers/{provider_id} (the `GetProvider` operationId).

func (*ClientWithResponses) ListProvidersWithResponse

func (c *ClientWithResponses) ListProvidersWithResponse(ctx context.Context, params *ListProvidersParams, reqEditors ...RequestEditorFn) (*ListProvidersResponse, error)

ListProvidersWithResponse List all Service Providers

Returns all registered Service Providers (both embedded and external) including their current health status.

Returns a wrapper object for the known response body format(s).

Corresponds with GET /providers (the `ListProviders` operationId).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// GetHealthWithResponse Health check
	//
	// Liveness health check for the Environment Agent.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /health (the `GetHealth` operationId).
	GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

	// ListProvidersWithResponse List all Service Providers
	//
	// Returns all registered Service Providers (both embedded and external)
	// including their current health status.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /providers (the `ListProviders` operationId).
	ListProvidersWithResponse(ctx context.Context, params *ListProvidersParams, reqEditors ...RequestEditorFn) (*ListProvidersResponse, error)

	// CreateProviderWithBodyWithResponse Register an external Service Provider
	//
	// Register an external Service Provider with the agent.
	// Registration is idempotent (name as natural key, create-or-update).
	// Only one SP — embedded or external — may serve a given service type
	// per agent. If the requested service type is already served by another
	// SP, registration is rejected with 409 Conflict.
	//
	// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /providers (the `CreateProvider` operationId).
	CreateProviderWithBodyWithResponse(ctx context.Context, params *CreateProviderParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateProviderResponse, error)

	// CreateProviderWithResponse Register an external Service Provider
	//
	// Register an external Service Provider with the agent.
	// Registration is idempotent (name as natural key, create-or-update).
	// Only one SP — embedded or external — may serve a given service type
	// per agent. If the requested service type is already served by another
	// SP, registration is rejected with 409 Conflict.
	//
	// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
	//
	// Corresponds with POST /providers (the `CreateProvider` operationId).
	CreateProviderWithResponse(ctx context.Context, params *CreateProviderParams, body CreateProviderJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateProviderResponse, error)

	// GetProviderWithResponse Get a Service Provider
	//
	// Returns a single registered Service Provider by ID, including its
	// current health status.
	//
	// Returns a wrapper object for the known response body format(s).
	//
	// Corresponds with GET /providers/{provider_id} (the `GetProvider` operationId).
	GetProviderWithResponse(ctx context.Context, providerId string, reqEditors ...RequestEditorFn) (*GetProviderResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CreateProviderResponse

type CreateProviderResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *Provider
	// JSON201 the response for an HTTP 201 `application/json` response
	JSON201 *Provider
	// ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response
	ApplicationproblemJSON400 *Error
	// ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response
	ApplicationproblemJSON401 *Error
	// ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response
	ApplicationproblemJSON409 *Error
	// ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response
	ApplicationproblemJSON422 *Error
	// ApplicationproblemJSON503 the response for an HTTP 503 `application/problem+json` response
	ApplicationproblemJSON503 *Error
}

func ParseCreateProviderResponse

func ParseCreateProviderResponse(rsp *http.Response) (*CreateProviderResponse, error)

ParseCreateProviderResponse parses an HTTP response from a CreateProviderWithResponse call

func (CreateProviderResponse) ContentType

func (r CreateProviderResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CreateProviderResponse) GetApplicationproblemJSON400

func (r CreateProviderResponse) GetApplicationproblemJSON400() *Error

GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response

func (CreateProviderResponse) GetApplicationproblemJSON401

func (r CreateProviderResponse) GetApplicationproblemJSON401() *Error

GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response

func (CreateProviderResponse) GetApplicationproblemJSON409

func (r CreateProviderResponse) GetApplicationproblemJSON409() *Error

GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response

func (CreateProviderResponse) GetApplicationproblemJSON422

func (r CreateProviderResponse) GetApplicationproblemJSON422() *Error

GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response

func (CreateProviderResponse) GetApplicationproblemJSON503

func (r CreateProviderResponse) GetApplicationproblemJSON503() *Error

GetApplicationproblemJSON503 returns the response for an HTTP 503 `application/problem+json` response

func (CreateProviderResponse) GetBody

func (r CreateProviderResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (CreateProviderResponse) GetJSON200

func (r CreateProviderResponse) GetJSON200() *Provider

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (CreateProviderResponse) GetJSON201

func (r CreateProviderResponse) GetJSON201() *Provider

GetJSON201 returns the response for an HTTP 201 `application/json` response

func (CreateProviderResponse) Status

func (r CreateProviderResponse) Status() string

Status returns HTTPResponse.Status

func (CreateProviderResponse) StatusCode

func (r CreateProviderResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHealthResponse

type GetHealthResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *Health
	// ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response
	ApplicationproblemJSON400 *Error
	// ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response
	ApplicationproblemJSON401 *Error
}

func ParseGetHealthResponse

func ParseGetHealthResponse(rsp *http.Response) (*GetHealthResponse, error)

ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call

func (GetHealthResponse) ContentType

func (r GetHealthResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetHealthResponse) GetApplicationproblemJSON400

func (r GetHealthResponse) GetApplicationproblemJSON400() *Error

GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response

func (GetHealthResponse) GetApplicationproblemJSON401

func (r GetHealthResponse) GetApplicationproblemJSON401() *Error

GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response

func (GetHealthResponse) GetBody

func (r GetHealthResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetHealthResponse) GetJSON200

func (r GetHealthResponse) GetJSON200() *Health

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetHealthResponse) Status

func (r GetHealthResponse) Status() string

Status returns HTTPResponse.Status

func (GetHealthResponse) StatusCode

func (r GetHealthResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetProviderResponse

type GetProviderResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *Provider
	// ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response
	ApplicationproblemJSON400 *Error
	// ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response
	ApplicationproblemJSON401 *Error
	// ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response
	ApplicationproblemJSON404 *Error
	// ApplicationproblemJSON503 the response for an HTTP 503 `application/problem+json` response
	ApplicationproblemJSON503 *Error
}

func ParseGetProviderResponse

func ParseGetProviderResponse(rsp *http.Response) (*GetProviderResponse, error)

ParseGetProviderResponse parses an HTTP response from a GetProviderWithResponse call

func (GetProviderResponse) ContentType

func (r GetProviderResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetProviderResponse) GetApplicationproblemJSON400

func (r GetProviderResponse) GetApplicationproblemJSON400() *Error

GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response

func (GetProviderResponse) GetApplicationproblemJSON401

func (r GetProviderResponse) GetApplicationproblemJSON401() *Error

GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response

func (GetProviderResponse) GetApplicationproblemJSON404

func (r GetProviderResponse) GetApplicationproblemJSON404() *Error

GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response

func (GetProviderResponse) GetApplicationproblemJSON503

func (r GetProviderResponse) GetApplicationproblemJSON503() *Error

GetApplicationproblemJSON503 returns the response for an HTTP 503 `application/problem+json` response

func (GetProviderResponse) GetBody

func (r GetProviderResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (GetProviderResponse) GetJSON200

func (r GetProviderResponse) GetJSON200() *Provider

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetProviderResponse) Status

func (r GetProviderResponse) Status() string

Status returns HTTPResponse.Status

func (GetProviderResponse) StatusCode

func (r GetProviderResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListProvidersResponse

type ListProvidersResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *ProviderList
	// ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response
	ApplicationproblemJSON400 *Error
	// ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response
	ApplicationproblemJSON401 *Error
	// ApplicationproblemJSON503 the response for an HTTP 503 `application/problem+json` response
	ApplicationproblemJSON503 *Error
}

func ParseListProvidersResponse

func ParseListProvidersResponse(rsp *http.Response) (*ListProvidersResponse, error)

ParseListProvidersResponse parses an HTTP response from a ListProvidersWithResponse call

func (ListProvidersResponse) ContentType

func (r ListProvidersResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (ListProvidersResponse) GetApplicationproblemJSON400

func (r ListProvidersResponse) GetApplicationproblemJSON400() *Error

GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response

func (ListProvidersResponse) GetApplicationproblemJSON401

func (r ListProvidersResponse) GetApplicationproblemJSON401() *Error

GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response

func (ListProvidersResponse) GetApplicationproblemJSON503

func (r ListProvidersResponse) GetApplicationproblemJSON503() *Error

GetApplicationproblemJSON503 returns the response for an HTTP 503 `application/problem+json` response

func (ListProvidersResponse) GetBody

func (r ListProvidersResponse) GetBody() []byte

GetBody returns the raw response body bytes

func (ListProvidersResponse) GetJSON200

func (r ListProvidersResponse) GetJSON200() *ProviderList

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (ListProvidersResponse) Status

func (r ListProvidersResponse) Status() string

Status returns HTTPResponse.Status

func (ListProvidersResponse) StatusCode

func (r ListProvidersResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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