firehydrant

package
v0.0.0-...-a1d2b9e Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// DefaultBaseURL is the URL that is used to make requests to the FireHydrant API
	DefaultBaseURL = "https://api.firehydrant.io/v1/"
)

Variables

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

func NewRestClient(token string, opts ...OptFunc) (*APIClient, error)

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

func (c *APIClient) DeleteService(ctx context.Context, serviceID string) error

DeleteService deletes a service in FireHydrant TODO: Check failure case

func (*APIClient) GetService

func (c *APIClient) GetService(ctx context.Context, id string) (*ServiceResponce, error)

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

type OptFunc func(c *APIClient) error

OptFunc is a function that sets a setting on a client

func WithBaseURL

func WithBaseURL(baseURL string) OptFunc

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}

Jump to

Keyboard shortcuts

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