oapigen

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

README

API Code Generation

Code Generation Library

oapi-codegen is a library which contains a set of utilities for generating Go boilerplate code based on an OpenAPI 3.0.0 specification.

Code Generation

To simplify code generation, the generation is set up using go:generation comments in api/handler.go and api/task_lifecycle_client.go.

To run code generation for CTS, including the API code generation:

  1. Install open-api: go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen
  2. Generate files: make generate

Files

api/openapi.yaml

Contains the CTS OpenAPI 3.0.0 specification. This file is not generated, and is maintained by the developers of CTS. It is used as the blueprint for generating Go API boilerplate

api/oapigen/server.go

Contains server boilerplate and functions for decoding the openapi spec to support validation middleware. This code is generated using the following command: oapi-codegen -package oapigen -generate chi-server,spec -o oapigen/server.go openapi.yaml

api/oapigen/types.go

Contains the API types which including requests, responses and all other API representations. This code is generated using the following command: api-codegen -package oapigen -generate types -o oapigen/types.go openapi.yaml

api/oapigen/client.go

Contains client boilerplate. This code is generated using the following command: api-codegen -package oapigen -generate client -o oapigen/client.go openapi.yaml

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewCreateTaskRequest

func NewCreateTaskRequest(server string, params *CreateTaskParams, body CreateTaskJSONRequestBody) (*http.Request, error)

NewCreateTaskRequest calls the generic CreateTask builder with application/json body

func NewCreateTaskRequestWithBody

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

NewCreateTaskRequestWithBody generates requests for CreateTask with any type of body

func NewDeleteTaskByNameRequest

func NewDeleteTaskByNameRequest(server string, name string) (*http.Request, error)

NewDeleteTaskByNameRequest generates requests for DeleteTaskByName

func NewGetAllTasksRequest added in v0.6.0

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

NewGetAllTasksRequest generates requests for GetAllTasks

func NewGetClusterStatusRequest added in v0.7.0

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

NewGetClusterStatusRequest generates requests for GetClusterStatus

func NewGetHealthRequest added in v0.6.0

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

NewGetHealthRequest generates requests for GetHealth

func NewGetTaskByNameRequest

func NewGetTaskByNameRequest(server string, name string) (*http.Request, error)

NewGetTaskByNameRequest generates requests for GetTaskByName

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type BufferPeriod

type BufferPeriod struct {
	// Whether the buffer period is enabled or disabled. Defaults to the global buffer period configured for CTS.
	Enabled *bool `json:"enabled,omitempty"`

	// The maximum period of time to wait after changes are detected before triggering the task. Defaults to the global buffer period configured for CTS.
	Max *string `json:"max,omitempty"`

	// The minimum period of time to wait after changes are detected before triggering the task. Defaults to the global buffer period configured for CTS.
	Min *string `json:"min,omitempty"`
}

The buffer period for triggering task execution.

type CatalogServicesCondition

type CatalogServicesCondition struct {
	Datacenter       *string                            `json:"datacenter,omitempty"`
	Namespace        *string                            `json:"namespace,omitempty"`
	NodeMeta         *CatalogServicesCondition_NodeMeta `json:"node_meta,omitempty"`
	Regexp           string                             `json:"regexp"`
	UseAsModuleInput *bool                              `json:"use_as_module_input,omitempty"`
}

CatalogServicesCondition defines model for CatalogServicesCondition.

type CatalogServicesCondition_NodeMeta

type CatalogServicesCondition_NodeMeta struct {
	AdditionalProperties map[string]string `json:"-"`
}

CatalogServicesCondition_NodeMeta defines model for CatalogServicesCondition.NodeMeta.

func (CatalogServicesCondition_NodeMeta) Get

func (a CatalogServicesCondition_NodeMeta) Get(fieldName string) (value string, found bool)

Getter for additional properties for CatalogServicesCondition_NodeMeta. Returns the specified element and whether it was found

func (CatalogServicesCondition_NodeMeta) MarshalJSON

func (a CatalogServicesCondition_NodeMeta) MarshalJSON() ([]byte, error)

Override default JSON handling for CatalogServicesCondition_NodeMeta to handle AdditionalProperties

func (*CatalogServicesCondition_NodeMeta) Set

func (a *CatalogServicesCondition_NodeMeta) Set(fieldName string, value string)

Setter for additional properties for CatalogServicesCondition_NodeMeta

func (*CatalogServicesCondition_NodeMeta) UnmarshalJSON

func (a *CatalogServicesCondition_NodeMeta) UnmarshalJSON(b []byte) error

Override default JSON handling for CatalogServicesCondition_NodeMeta to handle AdditionalProperties

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

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

func (c *Client) CreateTask(ctx context.Context, params *CreateTaskParams, body CreateTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateTaskWithBody

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

func (*Client) DeleteTaskByName

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

func (*Client) GetAllTasks added in v0.6.0

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

func (*Client) GetClusterStatus added in v0.7.0

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

func (*Client) GetHealth added in v0.6.0

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

func (*Client) GetTaskByName

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

type ClientInterface

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

	// GetClusterStatus request
	GetClusterStatus(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetAllTasks request
	GetAllTasks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	CreateTask(ctx context.Context, params *CreateTaskParams, body CreateTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// DeleteTaskByName request
	DeleteTaskByName(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTaskByName request
	GetTaskByName(ctx context.Context, name 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) CreateTaskWithBodyWithResponse

func (c *ClientWithResponses) CreateTaskWithBodyWithResponse(ctx context.Context, params *CreateTaskParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTaskResponse, error)

CreateTaskWithBodyWithResponse request with arbitrary body returning *CreateTaskResponse

func (*ClientWithResponses) CreateTaskWithResponse

func (c *ClientWithResponses) CreateTaskWithResponse(ctx context.Context, params *CreateTaskParams, body CreateTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTaskResponse, error)

func (*ClientWithResponses) DeleteTaskByNameWithResponse

func (c *ClientWithResponses) DeleteTaskByNameWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteTaskByNameResponse, error)

DeleteTaskByNameWithResponse request returning *DeleteTaskByNameResponse

func (*ClientWithResponses) GetAllTasksWithResponse added in v0.6.0

func (c *ClientWithResponses) GetAllTasksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetAllTasksResponse, error)

GetAllTasksWithResponse request returning *GetAllTasksResponse

func (*ClientWithResponses) GetClusterStatusWithResponse added in v0.7.0

func (c *ClientWithResponses) GetClusterStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetClusterStatusResponse, error)

GetClusterStatusWithResponse request returning *GetClusterStatusResponse

func (*ClientWithResponses) GetHealthWithResponse added in v0.6.0

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

GetHealthWithResponse request returning *GetHealthResponse

func (*ClientWithResponses) GetTaskByNameWithResponse

func (c *ClientWithResponses) GetTaskByNameWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GetTaskByNameResponse, error)

GetTaskByNameWithResponse request returning *GetTaskByNameResponse

type ClientWithResponsesInterface

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

	// GetClusterStatus request
	GetClusterStatusWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetClusterStatusResponse, error)

	// GetAllTasks request
	GetAllTasksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetAllTasksResponse, error)

	// CreateTask request with any body
	CreateTaskWithBodyWithResponse(ctx context.Context, params *CreateTaskParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTaskResponse, error)

	CreateTaskWithResponse(ctx context.Context, params *CreateTaskParams, body CreateTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTaskResponse, error)

	// DeleteTaskByName request
	DeleteTaskByNameWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteTaskByNameResponse, error)

	// GetTaskByName request
	GetTaskByNameWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GetTaskByNameResponse, error)
}

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

type ClusterStatusResponse added in v0.7.0

type ClusterStatusResponse struct {
	// the name of the CTS cluster
	ClusterName string `json:"cluster_name"`

	// the list of CTS instances which are part of this cluster
	Members   []Member  `json:"members"`
	RequestId RequestID `json:"request_id"`
}

ClusterStatusResponse defines model for ClusterStatusResponse.

type Condition

type Condition struct {
	CatalogServices *CatalogServicesCondition `json:"catalog_services,omitempty"`
	ConsulKv        *ConsulKVCondition        `json:"consul_kv,omitempty"`
	Schedule        *ScheduleCondition        `json:"schedule,omitempty"`
	Services        *ServicesCondition        `json:"services,omitempty"`
}

The condition on which to trigger the task to execute. If the task has the deprecated services field configured as a module input, it is represented here as condition.services.

type ConsulKVCondition

type ConsulKVCondition struct {
	Datacenter       *string `json:"datacenter,omitempty"`
	Namespace        *string `json:"namespace,omitempty"`
	Path             string  `json:"path"`
	Recurse          *bool   `json:"recurse,omitempty"`
	UseAsModuleInput *bool   `json:"use_as_module_input,omitempty"`
}

ConsulKVCondition defines model for ConsulKVCondition.

type ConsulKVModuleInput

type ConsulKVModuleInput struct {
	Datacenter *string `json:"datacenter,omitempty"`
	Namespace  *string `json:"namespace,omitempty"`
	Path       string  `json:"path"`
	Recurse    *bool   `json:"recurse,omitempty"`
}

ConsulKVModuleInput defines model for ConsulKVModuleInput.

type CreateTaskJSONBody

type CreateTaskJSONBody = TaskRequest

CreateTaskJSONBody defines parameters for CreateTask.

type CreateTaskJSONRequestBody

type CreateTaskJSONRequestBody = CreateTaskJSONBody

CreateTaskJSONRequestBody defines body for CreateTask for application/json ContentType.

type CreateTaskParams

type CreateTaskParams struct {
	// Different modes for running. Supports run now which runs the task immediately
	// and run inspect which creates a dry run task that is inspected and discarded
	// at the end of the inspection.
	Run *CreateTaskParamsRun `form:"run,omitempty" json:"run,omitempty"`
}

CreateTaskParams defines parameters for CreateTask.

type CreateTaskParamsRun

type CreateTaskParamsRun string

CreateTaskParamsRun defines parameters for CreateTask.

type CreateTaskResponse

type CreateTaskResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *TaskResponse
	JSON201      *TaskResponse
	JSONDefault  *ErrorResponse
}

func ParseCreateTaskResponse

func ParseCreateTaskResponse(rsp *http.Response) (*CreateTaskResponse, error)

ParseCreateTaskResponse parses an HTTP response from a CreateTaskWithResponse call

func (CreateTaskResponse) Status

func (r CreateTaskResponse) Status() string

Status returns HTTPResponse.Status

func (CreateTaskResponse) StatusCode

func (r CreateTaskResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type DeleteTaskByNameResponse

type DeleteTaskByNameResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON202      *TaskDeleteResponse
	JSONDefault  *ErrorResponse
}

func ParseDeleteTaskByNameResponse

func ParseDeleteTaskByNameResponse(rsp *http.Response) (*DeleteTaskByNameResponse, error)

ParseDeleteTaskByNameResponse parses an HTTP response from a DeleteTaskByNameWithResponse call

func (DeleteTaskByNameResponse) Status

func (r DeleteTaskByNameResponse) Status() string

Status returns HTTPResponse.Status

func (DeleteTaskByNameResponse) StatusCode

func (r DeleteTaskByNameResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Error

type Error struct {
	Message string `json:"message"`
}

Error defines model for Error.

type ErrorResponse

type ErrorResponse struct {
	Error     Error     `json:"error"`
	RequestId RequestID `json:"request_id"`
}

ErrorResponse defines model for ErrorResponse.

type GetAllTasksResponse added in v0.6.0

type GetAllTasksResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *TasksResponse
	JSONDefault  *ErrorResponse
}

func ParseGetAllTasksResponse added in v0.6.0

func ParseGetAllTasksResponse(rsp *http.Response) (*GetAllTasksResponse, error)

ParseGetAllTasksResponse parses an HTTP response from a GetAllTasksWithResponse call

func (GetAllTasksResponse) Status added in v0.6.0

func (r GetAllTasksResponse) Status() string

Status returns HTTPResponse.Status

func (GetAllTasksResponse) StatusCode added in v0.6.0

func (r GetAllTasksResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetClusterStatusResponse added in v0.7.0

type GetClusterStatusResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ClusterStatusResponse
	JSONDefault  *ErrorResponse
}

func ParseGetClusterStatusResponse added in v0.7.0

func ParseGetClusterStatusResponse(rsp *http.Response) (*GetClusterStatusResponse, error)

ParseGetClusterStatusResponse parses an HTTP response from a GetClusterStatusWithResponse call

func (GetClusterStatusResponse) Status added in v0.7.0

func (r GetClusterStatusResponse) Status() string

Status returns HTTPResponse.Status

func (GetClusterStatusResponse) StatusCode added in v0.7.0

func (r GetClusterStatusResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHealthResponse added in v0.6.0

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

func ParseGetHealthResponse added in v0.6.0

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

ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call

func (GetHealthResponse) Status added in v0.6.0

func (r GetHealthResponse) Status() string

Status returns HTTPResponse.Status

func (GetHealthResponse) StatusCode added in v0.6.0

func (r GetHealthResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTaskByNameResponse

type GetTaskByNameResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *TaskResponse
	JSONDefault  *ErrorResponse
}

func ParseGetTaskByNameResponse

func ParseGetTaskByNameResponse(rsp *http.Response) (*GetTaskByNameResponse, error)

ParseGetTaskByNameResponse parses an HTTP response from a GetTaskByNameWithResponse call

func (GetTaskByNameResponse) Status

func (r GetTaskByNameResponse) Status() string

Status returns HTTPResponse.Status

func (GetTaskByNameResponse) StatusCode

func (r GetTaskByNameResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HealthCheckResponse added in v0.6.0

type HealthCheckResponse struct {
	Error *Error `json:"error,omitempty"`
}

HealthCheckResponse defines model for HealthCheckResponse.

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InvalidParamFormatError added in v0.6.0

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error added in v0.6.0

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap added in v0.6.0

func (e *InvalidParamFormatError) Unwrap() error

type Member added in v0.7.0

type Member struct {
	// the address if this instance is the CTS leader, empty otherwise
	Address *string `json:"address,omitempty"`

	// the health status of the cts instance
	Healthy bool `json:"healthy"`

	// the id of the CTS instance
	Id string `json:"id"`

	// boolean true if CTS instance is a cluster leader, false otherwise
	Leader bool `json:"leader"`

	// the service name of the CTS instance
	ServiceName string `json:"service_name"`
}

Member defines model for Member.

type MiddlewareFunc

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

type ModuleInput

type ModuleInput struct {
	ConsulKv *ConsulKVModuleInput `json:"consul_kv,omitempty"`
	Services *ServicesModuleInput `json:"services,omitempty"`
}

The additional module input(s) that the tasks provides to the Terraform module on execution. If the task has the deprecated services field configured as a module input, it is represented here as module_input.services.

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type RequestID

type RequestID = openapi_types.UUID

RequestID defines model for RequestID.

type RequiredHeaderError added in v0.6.0

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error added in v0.6.0

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap added in v0.6.0

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError added in v0.6.0

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error added in v0.6.0

func (e *RequiredParamError) Error() string

type Run

type Run struct {
	// Whether or not infrastructure changes were detected during task inspection.
	ChangesPresent *bool   `json:"changes_present,omitempty"`
	Plan           *string `json:"plan,omitempty"`

	// Enterprise only. URL of Terraform Cloud run that corresponds to the task run.
	TfcRunUrl *string `json:"tfc_run_url,omitempty"`
}

Run defines model for Run.

type ScheduleCondition

type ScheduleCondition struct {
	Cron string `json:"cron"`
}

ScheduleCondition defines model for ScheduleCondition.

type ServerInterface

type ServerInterface interface {
	// Gets health status
	// (GET /v1/health)
	GetHealth(w http.ResponseWriter, r *http.Request)
	// Gets cluster status when CTS is configured with high availability
	// (GET /v1/status/cluster)
	GetClusterStatus(w http.ResponseWriter, r *http.Request)
	// Gets all tasks
	// (GET /v1/tasks)
	GetAllTasks(w http.ResponseWriter, r *http.Request)
	// Creates a new task
	// (POST /v1/tasks)
	CreateTask(w http.ResponseWriter, r *http.Request, params CreateTaskParams)
	// Marks a task for deletion
	// (DELETE /v1/tasks/{name})
	DeleteTaskByName(w http.ResponseWriter, r *http.Request, name string)
	// Gets a task by name
	// (GET /v1/tasks/{name})
	GetTaskByName(w http.ResponseWriter, r *http.Request, name string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateTask

func (siw *ServerInterfaceWrapper) CreateTask(w http.ResponseWriter, r *http.Request)

CreateTask operation middleware

func (*ServerInterfaceWrapper) DeleteTaskByName

func (siw *ServerInterfaceWrapper) DeleteTaskByName(w http.ResponseWriter, r *http.Request)

DeleteTaskByName operation middleware

func (*ServerInterfaceWrapper) GetAllTasks added in v0.6.0

func (siw *ServerInterfaceWrapper) GetAllTasks(w http.ResponseWriter, r *http.Request)

GetAllTasks operation middleware

func (*ServerInterfaceWrapper) GetClusterStatus added in v0.7.0

func (siw *ServerInterfaceWrapper) GetClusterStatus(w http.ResponseWriter, r *http.Request)

GetClusterStatus operation middleware

func (*ServerInterfaceWrapper) GetHealth added in v0.6.0

func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetTaskByName

func (siw *ServerInterfaceWrapper) GetTaskByName(w http.ResponseWriter, r *http.Request)

GetTaskByName operation middleware

type ServicesCondition

type ServicesCondition struct {
	CtsUserDefinedMeta *ServicesCondition_CtsUserDefinedMeta `json:"cts_user_defined_meta,omitempty"`
	Datacenter         *string                               `json:"datacenter,omitempty"`
	Filter             *string                               `json:"filter,omitempty"`
	Names              *[]string                             `json:"names,omitempty"`
	Namespace          *string                               `json:"namespace,omitempty"`
	Regexp             *string                               `json:"regexp,omitempty"`
	UseAsModuleInput   *bool                                 `json:"use_as_module_input,omitempty"`
}

ServicesCondition defines model for ServicesCondition.

type ServicesCondition_CtsUserDefinedMeta

type ServicesCondition_CtsUserDefinedMeta struct {
	AdditionalProperties map[string]string `json:"-"`
}

ServicesCondition_CtsUserDefinedMeta defines model for ServicesCondition.CtsUserDefinedMeta.

func (ServicesCondition_CtsUserDefinedMeta) Get

func (a ServicesCondition_CtsUserDefinedMeta) Get(fieldName string) (value string, found bool)

Getter for additional properties for ServicesCondition_CtsUserDefinedMeta. Returns the specified element and whether it was found

func (ServicesCondition_CtsUserDefinedMeta) MarshalJSON

func (a ServicesCondition_CtsUserDefinedMeta) MarshalJSON() ([]byte, error)

Override default JSON handling for ServicesCondition_CtsUserDefinedMeta to handle AdditionalProperties

func (*ServicesCondition_CtsUserDefinedMeta) Set

func (a *ServicesCondition_CtsUserDefinedMeta) Set(fieldName string, value string)

Setter for additional properties for ServicesCondition_CtsUserDefinedMeta

func (*ServicesCondition_CtsUserDefinedMeta) UnmarshalJSON

func (a *ServicesCondition_CtsUserDefinedMeta) UnmarshalJSON(b []byte) error

Override default JSON handling for ServicesCondition_CtsUserDefinedMeta to handle AdditionalProperties

type ServicesModuleInput

type ServicesModuleInput struct {
	CtsUserDefinedMeta *ServicesModuleInput_CtsUserDefinedMeta `json:"cts_user_defined_meta,omitempty"`
	Datacenter         *string                                 `json:"datacenter,omitempty"`
	Filter             *string                                 `json:"filter,omitempty"`
	Names              *[]string                               `json:"names,omitempty"`
	Namespace          *string                                 `json:"namespace,omitempty"`
	Regexp             *string                                 `json:"regexp,omitempty"`
}

ServicesModuleInput defines model for ServicesModuleInput.

type ServicesModuleInput_CtsUserDefinedMeta

type ServicesModuleInput_CtsUserDefinedMeta struct {
	AdditionalProperties map[string]string `json:"-"`
}

ServicesModuleInput_CtsUserDefinedMeta defines model for ServicesModuleInput.CtsUserDefinedMeta.

func (ServicesModuleInput_CtsUserDefinedMeta) Get

func (a ServicesModuleInput_CtsUserDefinedMeta) Get(fieldName string) (value string, found bool)

Getter for additional properties for ServicesModuleInput_CtsUserDefinedMeta. Returns the specified element and whether it was found

func (ServicesModuleInput_CtsUserDefinedMeta) MarshalJSON

func (a ServicesModuleInput_CtsUserDefinedMeta) MarshalJSON() ([]byte, error)

Override default JSON handling for ServicesModuleInput_CtsUserDefinedMeta to handle AdditionalProperties

func (*ServicesModuleInput_CtsUserDefinedMeta) Set

func (a *ServicesModuleInput_CtsUserDefinedMeta) Set(fieldName string, value string)

Setter for additional properties for ServicesModuleInput_CtsUserDefinedMeta

func (*ServicesModuleInput_CtsUserDefinedMeta) UnmarshalJSON

func (a *ServicesModuleInput_CtsUserDefinedMeta) UnmarshalJSON(b []byte) error

Override default JSON handling for ServicesModuleInput_CtsUserDefinedMeta to handle AdditionalProperties

type Task

type Task struct {
	// The buffer period for triggering task execution.
	BufferPeriod *BufferPeriod `json:"buffer_period,omitempty"`

	// The condition on which to trigger the task to execute. If the task has the deprecated services field configured as a module input, it is represented here as condition.services.
	Condition Condition `json:"condition"`

	// The human readable text to describe the task.
	Description *string `json:"description,omitempty"`

	// Whether the task is enabled or disabled from executing.
	Enabled *bool `json:"enabled,omitempty"`

	// The location of the Terraform module.
	Module string `json:"module"`

	// The additional module input(s) that the tasks provides to the Terraform module on execution. If the task has the deprecated services field configured as a module input, it is represented here as module_input.services.
	ModuleInput *ModuleInput `json:"module_input,omitempty"`

	// The unique name of the task.
	Name string `json:"name"`

	// The list of provider names that the task's module uses.
	Providers *[]string `json:"providers,omitempty"`

	// Enterprise only. Configuration values to use for the Terraform Cloud workspace associated with the task. This is only available when used with the Terraform Cloud driver.
	TerraformCloudWorkspace *TerraformCloudWorkspace `json:"terraform_cloud_workspace,omitempty"`

	// Deprecated, use task.terraform_cloud_workspace.terraform_version instead. Enterprise only. The version of Terraform to use for the Terraform Cloud workspace associated with the task. This is only available when used with the Terraform Cloud driver. Defaults to the latest compatible version if not set.
	TerraformVersion *string `json:"terraform_version,omitempty"`

	// The map of variables that are provided to the task's module.
	Variables *VariableMap `json:"variables,omitempty"`

	// The version of the configured module that the task uses. Defaults to the latest version if not set.
	Version *string `json:"version,omitempty"`
}

Task defines model for Task.

type TaskDeleteResponse

type TaskDeleteResponse struct {
	Error     *Error    `json:"error,omitempty"`
	RequestId RequestID `json:"request_id"`
}

TaskDeleteResponse defines model for TaskDeleteResponse.

type TaskRequest

type TaskRequest struct {
	Task Task `json:"task"`
}

TaskRequest defines model for TaskRequest.

type TaskResponse

type TaskResponse struct {
	Error     *Error    `json:"error,omitempty"`
	RequestId RequestID `json:"request_id"`
	Run       *Run      `json:"run,omitempty"`
	Task      *Task     `json:"task,omitempty"`
}

TaskResponse defines model for TaskResponse.

type TasksResponse added in v0.6.0

type TasksResponse struct {
	RequestId RequestID `json:"request_id"`
	Tasks     *[]Task   `json:"tasks,omitempty"`
}

TasksResponse defines model for TasksResponse.

type TerraformCloudWorkspace added in v0.6.0

type TerraformCloudWorkspace struct {
	// Enterprise only. Agent pool ID to set for the Terraform Cloud workspace associated with the task when the execution mode is "agent". Either agent_pool_id or agent_pool_name is required if execution mode is "agent". If both are set, then agent_pool_id takes precedence.
	AgentPoolId *string `json:"agent_pool_id,omitempty"`

	// Enterprise only. Name of agent pool to set for the Terraform Cloud workspace associated with the task when the execution mode is "agent". Either agent_pool_id or agent_pool_name is required if execution mode is "agent". If both are set, then agent_pool_id takes precedence.
	AgentPoolName *string `json:"agent_pool_name,omitempty"`

	// Enterprise only. Execution mode to set for the Terraform Cloud workspace associated with the task. Can only be "remote" or "agent". Defaults to "remote".
	ExecutionMode *string `json:"execution_mode,omitempty"`

	// Enterprise only. The version of Terraform to use for the Terraform Cloud workspace associated with the task. This is only available when used with the Terraform Cloud driver. Defaults to the latest compatible version if not set.
	TerraformVersion *string `json:"terraform_version,omitempty"`
}

Enterprise only. Configuration values to use for the Terraform Cloud workspace associated with the task. This is only available when used with the Terraform Cloud driver.

type TooManyValuesForParamError added in v0.6.0

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error added in v0.6.0

type UnescapedCookieParamError added in v0.6.0

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error added in v0.6.0

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap added in v0.6.0

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError added in v0.6.0

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error added in v0.6.0

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap added in v0.6.0

func (e *UnmarshalingParamError) Unwrap() error

type VariableMap

type VariableMap struct {
	AdditionalProperties map[string]string `json:"-"`
}

The map of variables that are provided to the task's module.

func (VariableMap) Get

func (a VariableMap) Get(fieldName string) (value string, found bool)

Getter for additional properties for VariableMap. Returns the specified element and whether it was found

func (VariableMap) MarshalJSON

func (a VariableMap) MarshalJSON() ([]byte, error)

Override default JSON handling for VariableMap to handle AdditionalProperties

func (*VariableMap) Set

func (a *VariableMap) Set(fieldName string, value string)

Setter for additional properties for VariableMap

func (*VariableMap) UnmarshalJSON

func (a *VariableMap) UnmarshalJSON(b []byte) error

Override default JSON handling for VariableMap to handle AdditionalProperties

Jump to

Keyboard shortcuts

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