client

package
v0.0.0-...-8a644c6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 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.5.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreatePolicyRequest

func NewCreatePolicyRequest(server string, params *CreatePolicyParams, body CreatePolicyJSONRequestBody) (*http.Request, error)

NewCreatePolicyRequest calls the generic CreatePolicy builder with application/json body

func NewCreatePolicyRequestWithBody

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

NewCreatePolicyRequestWithBody generates requests for CreatePolicy with any type of body

func NewDeletePolicyRequest

func NewDeletePolicyRequest(server string, policyId PolicyIdPath) (*http.Request, error)

NewDeletePolicyRequest generates requests for DeletePolicy

func NewGetHealthRequest

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

NewGetHealthRequest generates requests for GetHealth

func NewGetPolicyRequest

func NewGetPolicyRequest(server string, policyId PolicyIdPath) (*http.Request, error)

NewGetPolicyRequest generates requests for GetPolicy

func NewListPoliciesRequest

func NewListPoliciesRequest(server string, params *ListPoliciesParams) (*http.Request, error)

NewListPoliciesRequest generates requests for ListPolicies

func NewUpdatePolicyRequestWithApplicationMergePatchPlusJSONBody

func NewUpdatePolicyRequestWithApplicationMergePatchPlusJSONBody(server string, policyId PolicyIdPath, body UpdatePolicyApplicationMergePatchPlusJSONRequestBody) (*http.Request, error)

NewUpdatePolicyRequestWithApplicationMergePatchPlusJSONBody calls the generic UpdatePolicy builder with application/merge-patch+json body

func NewUpdatePolicyRequestWithBody

func NewUpdatePolicyRequestWithBody(server string, policyId PolicyIdPath, contentType string, body io.Reader) (*http.Request, error)

NewUpdatePolicyRequestWithBody generates requests for UpdatePolicy with any type of body

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) CreatePolicy

func (c *Client) CreatePolicy(ctx context.Context, params *CreatePolicyParams, body CreatePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreatePolicyWithBody

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

func (*Client) DeletePolicy

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

func (*Client) GetHealth

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

func (*Client) GetPolicy

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

func (*Client) ListPolicies

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

func (*Client) UpdatePolicyWithApplicationMergePatchPlusJSONBody

func (c *Client) UpdatePolicyWithApplicationMergePatchPlusJSONBody(ctx context.Context, policyId PolicyIdPath, body UpdatePolicyApplicationMergePatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdatePolicyWithBody

func (c *Client) UpdatePolicyWithBody(ctx context.Context, policyId PolicyIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetHealth request
	GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListPolicies request
	ListPolicies(ctx context.Context, params *ListPoliciesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreatePolicyWithBody request with any body
	CreatePolicyWithBody(ctx context.Context, params *CreatePolicyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreatePolicy(ctx context.Context, params *CreatePolicyParams, body CreatePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeletePolicy request
	DeletePolicy(ctx context.Context, policyId PolicyIdPath, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPolicy request
	GetPolicy(ctx context.Context, policyId PolicyIdPath, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpdatePolicyWithBody request with any body
	UpdatePolicyWithBody(ctx context.Context, policyId PolicyIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpdatePolicyWithApplicationMergePatchPlusJSONBody(ctx context.Context, policyId PolicyIdPath, body UpdatePolicyApplicationMergePatchPlusJSONRequestBody, 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) CreatePolicyWithBodyWithResponse

func (c *ClientWithResponses) CreatePolicyWithBodyWithResponse(ctx context.Context, params *CreatePolicyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePolicyResponse, error)

CreatePolicyWithBodyWithResponse request with arbitrary body returning *CreatePolicyResponse

func (*ClientWithResponses) CreatePolicyWithResponse

func (c *ClientWithResponses) CreatePolicyWithResponse(ctx context.Context, params *CreatePolicyParams, body CreatePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePolicyResponse, error)

func (*ClientWithResponses) DeletePolicyWithResponse

func (c *ClientWithResponses) DeletePolicyWithResponse(ctx context.Context, policyId PolicyIdPath, reqEditors ...RequestEditorFn) (*DeletePolicyResponse, error)

DeletePolicyWithResponse request returning *DeletePolicyResponse

func (*ClientWithResponses) GetHealthWithResponse

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

GetHealthWithResponse request returning *GetHealthResponse

func (*ClientWithResponses) GetPolicyWithResponse

func (c *ClientWithResponses) GetPolicyWithResponse(ctx context.Context, policyId PolicyIdPath, reqEditors ...RequestEditorFn) (*GetPolicyResponse, error)

GetPolicyWithResponse request returning *GetPolicyResponse

func (*ClientWithResponses) ListPoliciesWithResponse

func (c *ClientWithResponses) ListPoliciesWithResponse(ctx context.Context, params *ListPoliciesParams, reqEditors ...RequestEditorFn) (*ListPoliciesResponse, error)

ListPoliciesWithResponse request returning *ListPoliciesResponse

func (*ClientWithResponses) UpdatePolicyWithApplicationMergePatchPlusJSONBodyWithResponse

func (c *ClientWithResponses) UpdatePolicyWithApplicationMergePatchPlusJSONBodyWithResponse(ctx context.Context, policyId PolicyIdPath, body UpdatePolicyApplicationMergePatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePolicyResponse, error)

func (*ClientWithResponses) UpdatePolicyWithBodyWithResponse

func (c *ClientWithResponses) UpdatePolicyWithBodyWithResponse(ctx context.Context, policyId PolicyIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePolicyResponse, error)

UpdatePolicyWithBodyWithResponse request with arbitrary body returning *UpdatePolicyResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetHealthWithResponse request
	GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

	// ListPoliciesWithResponse request
	ListPoliciesWithResponse(ctx context.Context, params *ListPoliciesParams, reqEditors ...RequestEditorFn) (*ListPoliciesResponse, error)

	// CreatePolicyWithBodyWithResponse request with any body
	CreatePolicyWithBodyWithResponse(ctx context.Context, params *CreatePolicyParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePolicyResponse, error)

	CreatePolicyWithResponse(ctx context.Context, params *CreatePolicyParams, body CreatePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePolicyResponse, error)

	// DeletePolicyWithResponse request
	DeletePolicyWithResponse(ctx context.Context, policyId PolicyIdPath, reqEditors ...RequestEditorFn) (*DeletePolicyResponse, error)

	// GetPolicyWithResponse request
	GetPolicyWithResponse(ctx context.Context, policyId PolicyIdPath, reqEditors ...RequestEditorFn) (*GetPolicyResponse, error)

	// UpdatePolicyWithBodyWithResponse request with any body
	UpdatePolicyWithBodyWithResponse(ctx context.Context, policyId PolicyIdPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePolicyResponse, error)

	UpdatePolicyWithApplicationMergePatchPlusJSONBodyWithResponse(ctx context.Context, policyId PolicyIdPath, body UpdatePolicyApplicationMergePatchPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePolicyResponse, error)
}

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

type CreatePolicyResponse

type CreatePolicyResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *Policy
	JSON400      *BadRequest
	JSON401      *Unauthorized
	JSON403      *Forbidden
	JSON409      *AlreadyExists
	JSON422      *ValidationError
	JSON500      *InternalServerError
}

func ParseCreatePolicyResponse

func ParseCreatePolicyResponse(rsp *http.Response) (*CreatePolicyResponse, error)

ParseCreatePolicyResponse parses an HTTP response from a CreatePolicyWithResponse call

func (CreatePolicyResponse) Status

func (r CreatePolicyResponse) Status() string

Status returns HTTPResponse.Status

func (CreatePolicyResponse) StatusCode

func (r CreatePolicyResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type DeletePolicyResponse

type DeletePolicyResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Unauthorized
	JSON403      *Forbidden
	JSON404      *NotFound
	JSON500      *InternalServerError
}

func ParseDeletePolicyResponse

func ParseDeletePolicyResponse(rsp *http.Response) (*DeletePolicyResponse, error)

ParseDeletePolicyResponse parses an HTTP response from a DeletePolicyWithResponse call

func (DeletePolicyResponse) Status

func (r DeletePolicyResponse) Status() string

Status returns HTTPResponse.Status

func (DeletePolicyResponse) StatusCode

func (r DeletePolicyResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHealthResponse

type GetHealthResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Health
}

func ParseGetHealthResponse

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

ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call

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 GetPolicyResponse

type GetPolicyResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Policy
	JSON401      *Unauthorized
	JSON403      *Forbidden
	JSON404      *NotFound
	JSON500      *InternalServerError
}

func ParseGetPolicyResponse

func ParseGetPolicyResponse(rsp *http.Response) (*GetPolicyResponse, error)

ParseGetPolicyResponse parses an HTTP response from a GetPolicyWithResponse call

func (GetPolicyResponse) Status

func (r GetPolicyResponse) Status() string

Status returns HTTPResponse.Status

func (GetPolicyResponse) StatusCode

func (r GetPolicyResponse) 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 ListPoliciesResponse

type ListPoliciesResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *PolicyList
	JSON400      *BadRequest
	JSON401      *Unauthorized
	JSON403      *Forbidden
	JSON500      *InternalServerError
}

func ParseListPoliciesResponse

func ParseListPoliciesResponse(rsp *http.Response) (*ListPoliciesResponse, error)

ParseListPoliciesResponse parses an HTTP response from a ListPoliciesWithResponse call

func (ListPoliciesResponse) Status

func (r ListPoliciesResponse) Status() string

Status returns HTTPResponse.Status

func (ListPoliciesResponse) StatusCode

func (r ListPoliciesResponse) 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

type UpdatePolicyResponse

type UpdatePolicyResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Policy
	JSON400      *BadRequest
	JSON401      *Unauthorized
	JSON403      *Forbidden
	JSON404      *NotFound
	JSON409      *AlreadyExists
	JSON500      *InternalServerError
}

func ParseUpdatePolicyResponse

func ParseUpdatePolicyResponse(rsp *http.Response) (*UpdatePolicyResponse, error)

ParseUpdatePolicyResponse parses an HTTP response from a UpdatePolicyWithResponse call

func (UpdatePolicyResponse) Status

func (r UpdatePolicyResponse) Status() string

Status returns HTTPResponse.Status

func (UpdatePolicyResponse) StatusCode

func (r UpdatePolicyResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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