# 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

# Functions

GetSwagger returns the Swagger specification corresponding to the generated code in this file.
Handler creates http.Handler with routing matching OpenAPI spec.
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
No description provided by the author
HandlerWithOptions creates http.Handler with additional options.
Creates a new Client, with reasonable defaults.
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling.
NewCreateTaskRequest calls the generic CreateTask builder with application/json body.
NewCreateTaskRequestWithBody generates requests for CreateTask with any type of body.
NewDeleteTaskByNameRequest generates requests for DeleteTaskByName.
NewGetAllTasksRequest generates requests for GetAllTasks.
NewGetClusterStatusRequest generates requests for GetClusterStatus.
NewGetHealthRequest generates requests for GetHealth.
NewGetTaskByNameRequest generates requests for GetTaskByName.
ParseCreateTaskResponse parses an HTTP response from a CreateTaskWithResponse call.
ParseDeleteTaskByNameResponse parses an HTTP response from a DeleteTaskByNameWithResponse call.
ParseGetAllTasksResponse parses an HTTP response from a GetAllTasksWithResponse call.
ParseGetClusterStatusResponse parses an HTTP response from a GetClusterStatusWithResponse call.
ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call.
ParseGetTaskByNameResponse parses an HTTP response from a GetTaskByNameWithResponse call.
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
WithBaseURL overrides the baseURL.
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client.
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request.

# Structs

The buffer period for triggering task execution.
CatalogServicesCondition defines model for CatalogServicesCondition.
CatalogServicesCondition_NodeMeta defines model for CatalogServicesCondition.NodeMeta.
No description provided by the author
Client which conforms to the OpenAPI3 specification for this service.
ClientWithResponses builds on ClientInterface to offer response payloads.
ClusterStatusResponse defines model for ClusterStatusResponse.
The condition on which to trigger the task to execute.
ConsulKVCondition defines model for ConsulKVCondition.
ConsulKVModuleInput defines model for ConsulKVModuleInput.
CreateTaskParams defines parameters for CreateTask.
No description provided by the author
No description provided by the author
Error defines model for Error.
ErrorResponse defines model for ErrorResponse.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HealthCheckResponse defines model for HealthCheckResponse.
No description provided by the author
Member defines model for Member.
The additional module input(s) that the tasks provides to the Terraform module on execution.
No description provided by the author
No description provided by the author
Run defines model for Run.
ScheduleCondition defines model for ScheduleCondition.
ServerInterfaceWrapper converts contexts to parameters.
ServicesCondition defines model for ServicesCondition.
ServicesCondition_CtsUserDefinedMeta defines model for ServicesCondition.CtsUserDefinedMeta.
ServicesModuleInput defines model for ServicesModuleInput.
ServicesModuleInput_CtsUserDefinedMeta defines model for ServicesModuleInput.CtsUserDefinedMeta.
Task defines model for Task.
TaskDeleteResponse defines model for TaskDeleteResponse.
TaskRequest defines model for TaskRequest.
TaskResponse defines model for TaskResponse.
TasksResponse defines model for TasksResponse.
Enterprise only.
No description provided by the author
No description provided by the author
No description provided by the author
The map of variables that are provided to the task's module.

# Interfaces

The interface specification for the client above.
ClientWithResponsesInterface is the interface specification for the client with responses above.
Doer performs HTTP requests.
ServerInterface represents all server handlers.

# Type aliases

ClientOption allows setting custom parameters during construction.
CreateTaskJSONBody defines parameters for CreateTask.
CreateTaskJSONRequestBody defines body for CreateTask for application/json ContentType.
CreateTaskParamsRun defines parameters for CreateTask.
No description provided by the author
RequestEditorFn is the function signature for the RequestEditor callback function.
RequestID defines model for RequestID.