clients

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConsulCluster

func CreateConsulCluster(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	clusterID, datacenter, consulVersion string, numServers int32, private, connectEnabled bool, network *sharedmodels.HashicorpCloudLocationLink) (*consulmodels.HashicorpCloudConsul20200826CreateResponse, error)

CreateConsulCluster will make a call to the Consul service to initiate the create Consul cluster workflow.

func CreateCustomerRootACLToken

CreateCustomerRootACLToken invokes the consul-service endpoint to create privileged tokens for a Consul cluster. Example token: After cluster create, a customer would want a root token (or "bootstrap token") so they can continue to set-up their cluster.

func CreateSnapshot

CreateSnapshot will make a call to the Consul service to initiate the create Consul snapshot workflow.

func DeleteConsulCluster

DeleteConsulCluster will make a call to the Consul service to initiate the delete Consul cluster workflow.

func DeleteSnapshotByID

DeleteSnapshotByID deletes a Consul snapshot by its ID

func GetAvailableHCPConsulVersions

GetAvailableHCPConsulVersions gets the list of available Consul versions that HCP supports.

func GetConsulClientConfigFiles

GetConsulClientConfigFiles gets a Consul cluster set of client config files.

The files will be returned in base64-encoded format and will get passed in that format.

func GetConsulClusterByID

GetConsulClusterByID gets an Consul cluster by its ID

func GetHvnByID

GetHvnByID gets an HVN by its ID and location

func GetParentOrganizationIDByProjectID

func GetParentOrganizationIDByProjectID(ctx context.Context, client *Client, projectID string) (string, error)

GetParentOrganizationIDByProjectID gets the parent organization ID of a project

func GetPeeringByID

GetPeeringByID gets a peering by its ID, hvnID, and location

func GetProjectByID

func GetProjectByID(ctx context.Context, client *Client, projectID string) (*resourcemodels.HashicorpCloudResourcemanagerProject, error)

GetProjectByID gets a project by its ID

func GetSnapshotByID

GetSnapshotByID gets a Consul snapshot by its ID

func IsResponseCodeNotFound

func IsResponseCodeNotFound(err error) bool

IsResponseCodeNotFound takes an error returned from a client service request, and returns true if the response code was 404 not found

func ListConsulUpgradeVersions

GetAvailableHCPConsulVersions gets the list of available Consul versions that HCP supports.

func RenameSnapshotByID

RenameSnapshotByID renames a Consul snapshot by its ID

func ShouldLog

func ShouldLog() bool

ShouldLog determines if TF_LOG is set to a valid level.

func UpdateConsulCluster

func UpdateConsulCluster(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	clusterID, newConsulVersion string) (*consulmodels.HashicorpCloudConsul20200826UpdateResponse, error)

UpdateConsulCluster will make a call to the Consul service to initiate the update Consul cluster workflow.

func WaitForOperation

func WaitForOperation(ctx context.Context, client *Client, operationName string, loc *sharedmodels.HashicorpCloudLocationLocation, operationID string) error

WaitForOperation will poll the operation wait endpoint until an operation is DONE, ctx is canceled, or consecutive errors occur waiting for operation to complete.

func WaitForPeeringToBePendingAcceptance

func WaitForPeeringToBePendingAcceptance(ctx context.Context, client *Client, peeringID string, hvnID string, loc *sharedmodels.HashicorpCloudLocationLocation) (*networkmodels.HashicorpCloudNetwork20200907Peering, error)

WaitForPeeringToBePendingAcceptance will poll the GET peering endpoint until the state is PENDING_ACCEPTANCE, ctx is canceled, or an error occurs. This is required because AWS can return a newly created Network peering before it is ready to be accepted. See https://hashicorp.atlassian.net/browse/HCP-1658

Types

type Client

Client is an HCP client capable of making requests on behalf of a service principal

func NewClient

func NewClient(config ClientConfig) (*Client, error)

NewClient creates a new Client that is capable of making HCP requests

type ClientConfig

type ClientConfig struct {
	ClientID     string
	ClientSecret string

	// OrganizationID (optional) is the organization unique identifier to launch resources in.
	OrganizationID string

	// ProjectID (optional) is the project unique identifier to launch resources in.
	ProjectID string

	// SourceChannel denotes the client (channel) that originated the HCP cluster request.
	// this is synonymous to a user-agent.
	SourceChannel string
}

ClientConfig specifies configuration for the client that interacts with HCP

Jump to

Keyboard shortcuts

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