Documentation ¶
Index ¶
- Constants
- Variables
- type APIClient
- func (c *APIClient) CreateService(ctx context.Context, createReq CreateServiceRequest) (*ServiceResponce, error)
- func (c *APIClient) DeleteService(ctx context.Context, serviceID string) error
- func (c *APIClient) GetService(ctx context.Context, id string) (*ServiceResponce, error)
- func (c *APIClient) Ping(ctx context.Context) (*PingResponse, error)
- func (c *APIClient) UpdateService(ctx context.Context, serviceID string, updateReq UpdateServiceRequest) (*ServiceResponce, error)
- type Actor
- type Client
- type CreateServiceRequest
- type OptFunc
- type PingResponse
- type ServiceResponce
- type UpdateServiceRequest
Constants ¶
const ( // MajorVersion is the major version MajorVersion = 0 // MinorVersion is the minor version MinorVersion = 1 // PatchVersion is the patch version PatchVersion = 0 // UserAgentPrefix is the prefix of User-Agent header that all Terraform REST calls perform UserAgentPrefix = "firehydrant-terraform-provider" )
const (
// DefaultBaseURL is the URL that is used to make requests to the FireHydrant API
DefaultBaseURL = "https://api.firehydrant.io/v1/"
)
Variables ¶
var Version = fmt.Sprintf("%d.%d.%d", MajorVersion, MinorVersion, PatchVersion)
Version is the semver of this provider
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is the client that accesses all of the api.firehydrant.io resources
func NewRestClient ¶
NewRestClient initializes a new API client for FireHydrant
func (*APIClient) CreateService ¶
func (c *APIClient) CreateService(ctx context.Context, createReq CreateServiceRequest) (*ServiceResponce, error)
CreateService creates a brand spanking new service in FireHydrant TODO: Check failure case
func (*APIClient) DeleteService ¶
DeleteService deletes a service in FireHydrant TODO: Check failure case
func (*APIClient) GetService ¶
GetService retrieves a service from the FireHydrant API TODO: Check failure case
func (*APIClient) Ping ¶
func (c *APIClient) Ping(ctx context.Context) (*PingResponse, error)
Ping hits and verifies the HTTP of FireHydrant TODO: Check failure case
func (*APIClient) UpdateService ¶
func (c *APIClient) UpdateService(ctx context.Context, serviceID string, updateReq UpdateServiceRequest) (*ServiceResponce, error)
UpdateService updates a old spanking service in FireHydrant TODO: Check failure case
type Actor ¶
type Actor struct { ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` Type string `json:"type"` }
Actor represents an actor doing things in the FireHydrant API
type Client ¶
type Client interface { Ping(ctx context.Context) (*PingResponse, error) GetService(ctx context.Context, id string) (*ServiceResponce, error) CreateService(ctx context.Context, req CreateServiceRequest) (*ServiceResponce, error) UpdateService(ctx context.Context, serviceID string, req UpdateServiceRequest) (*ServiceResponce, error) DeleteService(ctx context.Context, serviceID string) error }
Client is the client that makes requests to FireHydrant
type CreateServiceRequest ¶
type CreateServiceRequest struct { Name string `json:"name"` Description string `json:"description"` }
CreateServiceRequest is the payload for creating a service URL: POST https://api.firehydrant.io/v1/services
type OptFunc ¶
OptFunc is a function that sets a setting on a client
func WithBaseURL ¶
WithBaseURL modifies the base URL for all requests
type PingResponse ¶
type PingResponse struct {
Actor Actor `json:"actor"`
}
PingResponse is the response the ping endpoint gives from FireHydrant URL: GET https://api.firehydrant.io/v1/ping
type ServiceResponce ¶
type ServiceResponce struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Slug string `json:"slug"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Labels map[string]string `json:"labels"` }
ServiceResponce is the payload for retriving a service URL: GET https://api.firehydrant.io/v1/services/{id}
type UpdateServiceRequest ¶
type UpdateServiceRequest struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` }
UpdateServiceRequest is the payload for updating a service URL: PATCH https://api.firehydrant.io/v1/services/{id}