clients

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MPL-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HvnRouteStateCreating is the CREATING state of an HVN route
	HvnRouteStateCreating = string(networkmodels.HashicorpCloudNetwork20200907HVNRouteStateCREATING)

	// HvnRouteStateActive is the ACTIVE state of an HVN route
	HvnRouteStateActive = string(networkmodels.HashicorpCloudNetwork20200907HVNRouteStateACTIVE)

	// HvnRouteStatePending is the PENDING state of an HVN route
	HvnRouteStatePending = string(networkmodels.HashicorpCloudNetwork20200907HVNRouteStatePENDING)
)
View Source
const (
	// PeeringStateCreating is the CREATING state of a peering connection
	PeeringStateCreating = string(networkmodels.HashicorpCloudNetwork20200907PeeringStateCREATING)

	// PeeringStatePendingAcceptance is the PENDING_ACCEPTANCE state of a peering connection
	PeeringStatePendingAcceptance = string(networkmodels.HashicorpCloudNetwork20200907PeeringStatePENDINGACCEPTANCE)

	// PeeringStateAccepted is the ACCEPTED state of a peering connection
	PeeringStateAccepted = string(networkmodels.HashicorpCloudNetwork20200907PeeringStateACCEPTED)

	// PeeringStateActive is the ACTIVE state of a peering connection
	PeeringStateActive = string(networkmodels.HashicorpCloudNetwork20200907PeeringStateACTIVE)
)
View Source
const (
	// TgwAttachmentStateCreating is the CREATING state of a TGW attachment
	TgwAttachmentStateCreating = string(networkmodels.HashicorpCloudNetwork20200907TGWAttachmentStateCREATING)

	// TgwAttachmentStatePendingAcceptance is the PENDING_ACCEPTANCE state of a TGW attachment
	TgwAttachmentStatePendingAcceptance = string(networkmodels.HashicorpCloudNetwork20200907TGWAttachmentStatePENDINGACCEPTANCE)

	// TgwAttachmentStateAccepted is the ACCEPTED state of a TGW attachment
	TgwAttachmentStateAccepted = string(networkmodels.HashicorpCloudNetwork20200907TGWAttachmentStateACCEPTED)

	// TgwAttachmentStateActive is the ACTIVE state of a TGW attachment
	TgwAttachmentStateActive = string(networkmodels.HashicorpCloudNetwork20200907TGWAttachmentStateACTIVE)
)

Variables

View Source
var WaitForPeeringToBeAccepted = waitForPeeringToBe(peeringState{
	Target:  PeeringStateAccepted,
	Pending: []string{PeeringStateCreating, PeeringStatePendingAcceptance},
})

WaitForPeeringToBeAccepted will poll the GET peering endpoint until the state is ACCEPTED, ctx is canceled, or an error occurs.

View Source
var WaitForPeeringToBeActive = waitForPeeringToBe(peeringState{
	Target:  PeeringStateActive,
	Pending: WaitForPeeringToBeActiveStates,
})

WaitForPeeringToBeActive will poll the GET peering endpoint until the state is ACTIVE, ctx is canceled, or an error occurs.

WaitForPeeringToBeActiveStates are those from which we'd expect an ACTIVE state to be possible.

View Source
var WaitForPeeringToBePendingAcceptance = waitForPeeringToBe(peeringState{
	Target:  PeeringStatePendingAcceptance,
	Pending: []string{PeeringStateCreating},
})

WaitForPeeringToBePendingAcceptance will poll the GET peering endpoint until the state is PENDING_ACCEPTANCE, ctx is canceled, or an error occurs.

WaitForTGWAttachmentToBeActiveStates is the set of states of the attachment which we'll wait on.

Functions

func AddPlugin added in v0.70.0

AddPlugin will make a call to the Vault service to add a plugin to a Vault cluster

func BatchGetPrincipals added in v0.77.0

func BatchGetPrincipals(ctx context.Context, client *Client, principals []string, view *models.HashicorpCloudIamPrincipalView) ([]*models.HashicorpCloudIamPrincipal, error)

BatchGetPrincipals retrieves the requested principals in a batch. If the number of principals exceeds the batch limit, multiple requests will be made.

func CreateBoundaryCluster added in v0.43.0

CreateBoundaryCluster will make a call to the Boundary service to initiate the create Boundary cluster workflow.

func CreateConsulCluster

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 CreatePackerChannel added in v0.68.0

CreatePackerChannel creates a channel on the named bucket.

func CreateProject added in v0.57.0

func CreateProject(ctx context.Context, client *Client, name, organizationID string) (*resourcemodels.HashicorpCloudResourcemanagerProject, error)

func CreateSnapshot

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

func CreateVaultCluster added in v0.4.0

CreateVaultCluster will make a call to the Vault service to initiate the create Vault cluster workflow.

func CreateVaultClusterAdminToken added in v0.4.0

CreateVaultClusterAdminToken will make a call to the Vault service to generate an admin token for the Vault cluster that expires after 6 hours.

func CreateVaultSecretsApp added in v0.61.0

func CreateVaultSecretsApp(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName string, description string) (*secretmodels.Secrets20230613App, error)

CreateVaultSecretsApp will create a Vault Secrets application.

func CreateVaultSecretsAppSecret added in v0.61.0

func CreateVaultSecretsAppSecret(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName, secretName, secretValue string) (*secretmodels.Secrets20230613Secret, error)

CreateVaultSecretsAppSecret will create a Vault Secrets application secret.

func DeleteBoundaryCluster added in v0.43.0

DeleteBoundaryCluster will make a call to the Boundary service to initiate the delete Boundary cluster workflow.

func DeleteConsulCluster

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

func DeleteHVNRouteByID added in v0.7.0

DeleteSnapshotByID deletes an HVN route by its ID

func DeletePackerChannel added in v0.68.0

func DeletePackerChannel(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, bucketSlug, channelSlug string) (*packermodels.HashicorpCloudPackerChannel, error)

DeletePackerChannel deletes a channel from the named bucket.

func DeletePlugin added in v0.70.0

DeletePlugin will make a call to the Vault service to remove a plugin to a Vault cluster

func DeleteSnapshotByID

DeleteSnapshotByID deletes a Consul snapshot by its ID

func DeleteVaultCluster added in v0.4.0

DeleteVaultCluster will make a call to the Vault service to initiate the delete Vault cluster workflow.

func DeleteVaultPathsFilter added in v0.25.0

DeleteVaultPathsFilter will make a call to the Vault service to delete the paths filter for a secondary cluster

func DeleteVaultSecretsApp added in v0.61.0

func DeleteVaultSecretsApp(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName string) error

DeleteVaultSecretsApp will delete a Vault Secrets application.

func DeleteVaultSecretsAppSecret added in v0.61.0

func DeleteVaultSecretsAppSecret(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName, secretName string) error

DeleteVaultSecretsAppSecret will delete a Vault Secrets application secret.

func GetAvailableHCPConsulVersions

func GetAvailableHCPConsulVersions(ctx context.Context, client *Client) ([]*consulmodels.HashicorpCloudConsul20210204Version, error)

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

func GetAvailableHCPConsulVersionsForLocation added in v0.2.0

func GetAvailableHCPConsulVersionsForLocation(ctx context.Context, loc *sharedmodels.HashicorpCloudLocationLocation, client *Client) ([]*consulmodels.HashicorpCloudConsul20210204Version, error)

GetAvailableHCPConsulVersionsForLocation gets the list of available Consul versions that HCP supports for the provided location.

func GetBoundaryClusterByID added in v0.43.0

GetBoundaryClusterByID gets a Boundary cluster by its ID.

func GetBoundaryClusterMaintenanceWindow added in v0.58.0

GetBoundaryClusterMaintenanceWindow gets the maintenance window configuration for a Boundary cluster.

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 GetHVNRoute added in v0.7.0

GetHVNRoute returns specific HVN route by its ID

func GetHvnByID

GetHvnByID gets an HVN by its ID and location

func GetIterationFromFingerprint added in v0.60.0

func GetIterationFromFingerprint(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	bucketSlug string, iterationFingerprint string) (*packermodels.HashicorpCloudPackerIteration, error)

GetIterationFromFingerprint queries the HCP Packer registry for an existing bucket iteration using its fingerprint.

func GetIterationFromID added in v0.53.0

func GetIterationFromID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	bucketSlug string, iterationID string) (*packermodels.HashicorpCloudPackerIteration, error)

GetIterationFromID queries the HCP Packer registry for an existing bucket iteration using its ULID.

func GetIterationFromVersion added in v0.60.0

func GetIterationFromVersion(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	bucketSlug string, iterationIncrementalVersion int32) (*packermodels.HashicorpCloudPackerIteration, error)

GetIterationFromVersion queries the HCP Packer registry for an existing bucket iteration using its incremental version.

func GetPackerChannelBySlug added in v0.14.0

func GetPackerChannelBySlug(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	bucketName string, channelName string) (*packermodels.HashicorpCloudPackerChannel, error)

GetPackerChannelBySlug queries the HCP Packer registry for the channel associated with the given channel name.

func GetPackerChannelBySlugFromList added in v0.63.0

func GetPackerChannelBySlugFromList(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	bucketName string, channelName string) (*packermodels.HashicorpCloudPackerChannel, error)

GetPackerChannelBySlugFromList queries the HCP Packer registry for the channel associated with the given channel name, using ListBucketChannels

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 GetRunTask added in v0.66.0

GetRunTask queries the HCP Packer Registry for the API information needed to configure a run task

func GetSnapshotByID

GetSnapshotByID gets a Consul snapshot by its ID

func GetTGWAttachmentByID added in v0.2.0

GetTGWAttachmentByID gets a TGW attachment by its ID, hvnID, and location

func GetVaultClusterByID added in v0.4.0

GetVaultClusterByID gets an Vault cluster by its ID.

func GetVaultSecretsApp added in v0.71.0

GetVaultSecretsApp will read a Vault Secrets application

func IamPrincipalTypeToBindingType added in v0.77.0

IamPrincipalTypeToBindingType converts an IAM principal type to a resource manager binding member type.

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 ListBuckets added in v0.64.0

ListBuckets queries the HCP Packer registry for all associated buckets.

func ListConsulUpgradeVersions

ListConsulUpgradeVersions gets the list of available Consul versions that the supplied cluster can upgrade to.

func ListHVNRoutes added in v0.6.0

func ListHVNRoutes(ctx context.Context, client *Client, hvnID string,
	destination string, targetID string, targetType string,
	loc *sharedmodels.HashicorpCloudLocationLocation) ([]*networkmodels.HashicorpCloudNetwork20200907HVNRoute, error)

ListHVNRoutes lists the routes for an HVN.

func ListPackerChannels added in v0.68.0

ListPackerChannels queries the HCP Packer registry for channels associated to the specified bucket.

func ListPlugins added in v0.70.0

ListPlugins will make a call to the Vault service plugin status api to get all available plugins for the cluster.

func ListVaultSecretsAppSecrets added in v0.61.0

func ListVaultSecretsAppSecrets(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName string) ([]*secretmodels.Secrets20230613Secret, error)

ListVaultSecretsAppSecrets will retrieve all app secrets metadata for a Vault Secrets application.

func OpenVaultSecretsAppSecret added in v0.61.0

func OpenVaultSecretsAppSecret(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName, secretName string) (*secretmodels.Secrets20230613OpenSecret, error)

OpenVaultSecretsAppSecret will retrieve the latest secret for a Vault Secrets app, including it's value.

func RegenerateHMAC added in v0.66.0

RegenerateHMAC triggers the HCP Packer Registry's run task HMAC Key to be regenerated

func RenameSnapshotByID

RenameSnapshotByID renames a Consul snapshot by its ID

func RetryOrganizationServiceList added in v0.38.0

Wraps the OrganizationServiceList function in a loop that supports retrying the GET request

func RetryProjectServiceGet added in v0.57.0

func RetryProjectServiceGet(client *Client, params *project_service.ProjectServiceGetParams) (*project_service.ProjectServiceGetOK, error)

Wraps the ProjectServiceGet function in a loop that supports retrying the GET request

func RetryProjectServiceList added in v0.38.0

func RetryProjectServiceList(client *Client, params *project_service.ProjectServiceListParams) (*project_service.ProjectServiceListOK, error)

Wraps the ProjectServiceList function in a loop that supports retrying the GET request

func SetBoundaryClusterMaintenanceWindow added in v0.58.0

SetBoundaryClusterMaintenanceWindow updates the maintenance window configuration for a Boundary cluster.

func ShouldLog

func ShouldLog() bool

ShouldLog determines if TF_LOG is set to a valid level.

func UpdateConsulCluster

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

func UpdatePackerChannel added in v0.68.0

func UpdatePackerChannel(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, bucketSlug string, channelSlug string,
	restricted bool) (*packermodels.HashicorpCloudPackerChannel, error)

UpdatePackerChannel updates the named channel.

func UpdatePackerChannelAssignment added in v0.68.0

func UpdatePackerChannelAssignment(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, bucketSlug string, channelSlug string,
	iteration *packermodels.HashicorpCloudPackerIteration) (*packermodels.HashicorpCloudPackerChannel, error)

func UpdateVaultClusterConfig added in v0.31.0

UpdateVaultCluster will make a call to the Vault service to update the Vault cluster configuration.

func UpdateVaultClusterPublicIps added in v0.9.0

func UpdateVaultClusterPublicIps(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation,
	clusterID string, enablePublicIps bool) (*vaultmodels.HashicorpCloudVault20201125UpdatePublicIpsResponse, error)

UpdateVaultClusterPublicIps will make a call to the Vault service to enable or disable public IPs for the Vault cluster.

func UpdateVaultMajorVersionUpgradeConfig added in v0.43.0

UpdateVaultMajorVersionUpgradeConfig will make a call to the Vault service to update the major version upgrade config for the Vault cluster.

func UpdateVaultPathsFilter added in v0.25.0

UpdateVaultPathsFilter will make a call to the Vault service to update the paths filter for a secondary cluster

func UpdateVaultSecretsApp added in v0.71.0

func UpdateVaultSecretsApp(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName string, description string) (*secretmodels.Secrets20230613App, error)

UpdateVaultSecretsApp will update an app's description

func WaitForHVNRouteToBeActive added in v0.7.0

WaitForHVNRouteToBeActive will poll the GET HVN route endpoint until the state is ACTIVE, ctx is canceled, or an error occurs.

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 WaitForTGWAttachmentToBeActive added in v0.2.0

func WaitForTGWAttachmentToBeActive(ctx context.Context, client *Client, tgwAttachmentID string, hvnID string, loc *sharedmodels.HashicorpCloudLocationLocation, timeout time.Duration) (*networkmodels.HashicorpCloudNetwork20200907TGWAttachment, error)

WaitForTGWAttachmentToBeActive will poll the GET TGW attachment endpoint until the state is ACTIVE, ctx is canceled, or an error occurs.

func WaitForTGWAttachmentToBePendingAcceptance added in v0.2.0

func WaitForTGWAttachmentToBePendingAcceptance(ctx context.Context, client *Client, tgwAttachmentID string, hvnID string, loc *sharedmodels.HashicorpCloudLocationLocation, timeout time.Duration) (*networkmodels.HashicorpCloudNetwork20200907TGWAttachment, error)

WaitForTGWAttachmentToBePendingAcceptance will poll the GET TGW attachment endpoint until the state is PENDING_ACCEPTANCE, ctx is canceled, or an error occurs.

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

func (*Client) UpdateSourceChannel added in v0.18.0

func (cl *Client) UpdateSourceChannel(d *schema.ResourceData) (*Client, error)

updateSourceChannel updates the SourceChannel of the client

type ClientConfig

type ClientConfig struct {
	ClientID       string
	ClientSecret   string
	CredentialFile 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

type WaitFor added in v0.14.0

Directories

Path Synopsis
iampolicy is a helper package for creating Terraform resources that modify an HCP Resource's IAM Policy.
iampolicy is a helper package for creating Terraform resources that modify an HCP Resource's IAM Policy.

Jump to

Keyboard shortcuts

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