Documentation ¶
Index ¶
- Constants
- Variables
- func CreateConsulCluster(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204CreateResponse, error)
- func CreateCustomerRootACLToken(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse, ...)
- func CreateHVNRoute(ctx context.Context, client *Client, id string, ...) (*networkmodels.HashicorpCloudNetwork20200907CreateHVNRouteResponse, error)
- func CreateSnapshot(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204CreateSnapshotResponse, error)
- func CreateVaultCluster(ctx context.Context, client *Client, ...) (*vaultmodels.HashicorpCloudVault20201125CreateResponse, error)
- func CreateVaultClusterAdminToken(ctx context.Context, client *Client, ...) (*vaultmodels.HashicorpCloudVault20201125GetAdminTokenResponse, error)
- func DeleteConsulCluster(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204DeleteResponse, error)
- func DeleteHVNRouteByID(ctx context.Context, client *Client, hvnID string, hvnRouteID string, ...) (*networkmodels.HashicorpCloudNetwork20200907DeleteHVNRouteResponse, error)
- func DeleteSnapshotByID(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204DeleteSnapshotResponse, error)
- func DeleteVaultCluster(ctx context.Context, client *Client, ...) (*vaultmodels.HashicorpCloudVault20201125DeleteResponse, error)
- func GetAvailableHCPConsulVersions(ctx context.Context, client *Client) ([]*consulmodels.HashicorpCloudConsul20210204Version, error)
- func GetAvailableHCPConsulVersionsForLocation(ctx context.Context, loc *sharedmodels.HashicorpCloudLocationLocation, ...) ([]*consulmodels.HashicorpCloudConsul20210204Version, error)
- func GetConsulClientConfigFiles(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204GetClientConfigResponse, error)
- func GetConsulClusterByID(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204Cluster, error)
- func GetHVNRoute(ctx context.Context, client *Client, hvnID, routeID string, ...) (*networkmodels.HashicorpCloudNetwork20200907HVNRoute, error)
- func GetHvnByID(ctx context.Context, client *Client, ...) (*networkmodels.HashicorpCloudNetwork20200907Network, error)
- func GetPackerChannelBySlug(ctx context.Context, client *Client, ...) (*packermodels.HashicorpCloudPackerChannel, error)
- func GetParentOrganizationIDByProjectID(ctx context.Context, client *Client, projectID string) (string, error)
- func GetPeeringByID(ctx context.Context, client *Client, peeringID string, hvnID string, ...) (*networkmodels.HashicorpCloudNetwork20200907Peering, error)
- func GetProjectByID(ctx context.Context, client *Client, projectID string) (*resourcemodels.HashicorpCloudResourcemanagerProject, error)
- func GetSnapshotByID(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204GetSnapshotResponse, error)
- func GetTGWAttachmentByID(ctx context.Context, client *Client, tgwAttachmentID string, hvnID string, ...) (*networkmodels.HashicorpCloudNetwork20200907TGWAttachment, error)
- func GetVaultClusterByID(ctx context.Context, client *Client, ...) (*vaultmodels.HashicorpCloudVault20201125Cluster, error)
- func IsResponseCodeNotFound(err error) bool
- func ListConsulUpgradeVersions(ctx context.Context, client *Client, ...) ([]*consulmodels.HashicorpCloudConsul20210204Version, error)
- func ListHVNRoutes(ctx context.Context, client *Client, hvnID string, destination string, ...) ([]*networkmodels.HashicorpCloudNetwork20200907HVNRoute, error)
- func RenameSnapshotByID(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204UpdateSnapshotResponse, error)
- func ShouldLog() bool
- func UpdateConsulCluster(ctx context.Context, client *Client, ...) (*consulmodels.HashicorpCloudConsul20210204UpdateResponse, error)
- func UpdateVaultClusterPublicIps(ctx context.Context, client *Client, ...) (*vaultmodels.HashicorpCloudVault20201125UpdatePublicIpsResponse, error)
- func WaitForHVNRouteToBeActive(ctx context.Context, client *Client, hvnID string, routeID string, ...) (*networkmodels.HashicorpCloudNetwork20200907HVNRoute, error)
- func WaitForOperation(ctx context.Context, client *Client, operationName string, ...) error
- func WaitForTGWAttachmentToBeActive(ctx context.Context, client *Client, tgwAttachmentID string, hvnID string, ...) (*networkmodels.HashicorpCloudNetwork20200907TGWAttachment, error)
- func WaitForTGWAttachmentToBePendingAcceptance(ctx context.Context, client *Client, tgwAttachmentID string, hvnID string, ...) (*networkmodels.HashicorpCloudNetwork20200907TGWAttachment, error)
- type Client
- type ClientConfig
- type WaitFor
Constants ¶
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) )
const ( // PeeringStateCreating is the CREATING state of a network peering PeeringStateCreating = string(networkmodels.HashicorpCloudNetwork20200907PeeringStateCREATING) // PeeringStatePendingAcceptance is the PENDING_ACCEPTANCE state of a network peering PeeringStatePendingAcceptance = string(networkmodels.HashicorpCloudNetwork20200907PeeringStatePENDINGACCEPTANCE) // PeeringStateAccepted is the ACCEPTED state of a network peering PeeringStateAccepted = string(networkmodels.HashicorpCloudNetwork20200907PeeringStateACCEPTED) )
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 ¶
var WaitForPeeringToBeAccepted = waitForPeeringToBe(PeeringStateAccepted)
WaitForPeeringToBeAccepted will poll the GET peering endpoint until the state is ACCEPTED, ctx in canceled, or an error occurs.
var WaitForPeeringToBePendingAcceptance = waitForPeeringToBe(PeeringStatePendingAcceptance)
WaitForPeeringToBePendingAcceptance will poll the GET peering endpoint until the state is PENDING_ACCEPTANCE, ctx is canceled, or an error occurs.
Functions ¶
func CreateConsulCluster ¶
func CreateConsulCluster(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, consulCluster *consulmodels.HashicorpCloudConsul20210204Cluster) (*consulmodels.HashicorpCloudConsul20210204CreateResponse, error)
CreateConsulCluster will make a call to the Consul service to initiate the create Consul cluster workflow.
func CreateCustomerRootACLToken ¶
func CreateCustomerRootACLToken(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, consulClusterID string) (*consulmodels.HashicorpCloudConsul20210204CreateCustomerMasterACLTokenResponse, error)
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 CreateHVNRoute ¶ added in v0.7.0
func CreateHVNRoute(ctx context.Context, client *Client, id string, hvn *sharedmodels.HashicorpCloudLocationLink, destination string, target *sharedmodels.HashicorpCloudLocationLink, location *sharedmodels.HashicorpCloudLocationLocation) (*networkmodels.HashicorpCloudNetwork20200907CreateHVNRouteResponse, error)
CreateHVNRoute creates a new HVN route
func CreateSnapshot ¶
func CreateSnapshot(ctx context.Context, client *Client, res *sharedmodels.HashicorpCloudLocationLink, snapshotName string) (*consulmodels.HashicorpCloudConsul20210204CreateSnapshotResponse, error)
CreateSnapshot will make a call to the Consul service to initiate the create Consul snapshot workflow.
func CreateVaultCluster ¶ added in v0.4.0
func CreateVaultCluster(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, vaultCluster *vaultmodels.HashicorpCloudVault20201125InputCluster) (*vaultmodels.HashicorpCloudVault20201125CreateResponse, error)
CreateVaultCluster will make a call to the Consul service to initiate the create Consul cluster workflow.
func CreateVaultClusterAdminToken ¶ added in v0.4.0
func CreateVaultClusterAdminToken(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, vaultClusterID string) (*vaultmodels.HashicorpCloudVault20201125GetAdminTokenResponse, error)
CreateVaultClusterAdminToken will make a call to the Vault service to generate an admin token for the Vault cluster that expires after 6 hours.
func DeleteConsulCluster ¶
func DeleteConsulCluster(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, clusterID string) (*consulmodels.HashicorpCloudConsul20210204DeleteResponse, error)
DeleteConsulCluster will make a call to the Consul service to initiate the delete Consul cluster workflow.
func DeleteHVNRouteByID ¶ added in v0.7.0
func DeleteHVNRouteByID(ctx context.Context, client *Client, hvnID string, hvnRouteID string, loc *sharedmodels.HashicorpCloudLocationLocation) (*networkmodels.HashicorpCloudNetwork20200907DeleteHVNRouteResponse, error)
DeleteSnapshotByID deletes an HVN route by its ID
func DeleteSnapshotByID ¶
func DeleteSnapshotByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, snapshotID string) (*consulmodels.HashicorpCloudConsul20210204DeleteSnapshotResponse, error)
DeleteSnapshotByID deletes a Consul snapshot by its ID
func DeleteVaultCluster ¶ added in v0.4.0
func DeleteVaultCluster(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, clusterID string) (*vaultmodels.HashicorpCloudVault20201125DeleteResponse, error)
DeleteVaultCluster will make a call to the Vault service to initiate the delete Vault cluster workflow.
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 GetConsulClientConfigFiles ¶
func GetConsulClientConfigFiles(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, consulClusterID string) (*consulmodels.HashicorpCloudConsul20210204GetClientConfigResponse, error)
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 ¶
func GetConsulClusterByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, consulClusterID string) (*consulmodels.HashicorpCloudConsul20210204Cluster, error)
GetConsulClusterByID gets an Consul cluster by its ID
func GetHVNRoute ¶ added in v0.7.0
func GetHVNRoute(ctx context.Context, client *Client, hvnID, routeID string, loc *sharedmodels.HashicorpCloudLocationLocation) (*networkmodels.HashicorpCloudNetwork20200907HVNRoute, error)
GetHVNRoute returns specific HVN route by its ID
func GetHvnByID ¶
func GetHvnByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, hvnID string) (*networkmodels.HashicorpCloudNetwork20200907Network, error)
GetHvnByID gets an HVN by its ID and location
func GetPackerChannelBySlug ¶ added in v0.14.0
func GetPackerChannelBySlug(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, bucketName string, channel string) (*packermodels.HashicorpCloudPackerChannel, error)
func GetParentOrganizationIDByProjectID ¶
func GetParentOrganizationIDByProjectID(ctx context.Context, client *Client, projectID string) (string, error)
GetParentOrganizationIDByProjectID gets the parent organization ID of a project
func GetPeeringByID ¶
func GetPeeringByID(ctx context.Context, client *Client, peeringID string, hvnID string, loc *sharedmodels.HashicorpCloudLocationLocation) (*networkmodels.HashicorpCloudNetwork20200907Peering, error)
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 ¶
func GetSnapshotByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, snapshotID string) (*consulmodels.HashicorpCloudConsul20210204GetSnapshotResponse, error)
GetSnapshotByID gets a Consul snapshot by its ID
func GetTGWAttachmentByID ¶ added in v0.2.0
func GetTGWAttachmentByID(ctx context.Context, client *Client, tgwAttachmentID string, hvnID string, loc *sharedmodels.HashicorpCloudLocationLocation) (*networkmodels.HashicorpCloudNetwork20200907TGWAttachment, error)
GetTGWAttachmentByID gets a TGW attachment by its ID, hvnID, and location
func GetVaultClusterByID ¶ added in v0.4.0
func GetVaultClusterByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, vaultClusterID string) (*vaultmodels.HashicorpCloudVault20201125Cluster, error)
GetVaultClusterByID gets an Vault cluster by its ID.
func IsResponseCodeNotFound ¶
IsResponseCodeNotFound takes an error returned from a client service request, and returns true if the response code was 404 not found
func ListConsulUpgradeVersions ¶
func ListConsulUpgradeVersions(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, clusterID string) ([]*consulmodels.HashicorpCloudConsul20210204Version, error)
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 RenameSnapshotByID ¶
func RenameSnapshotByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, snapshotID string, snapshotName string) (*consulmodels.HashicorpCloudConsul20210204UpdateSnapshotResponse, error)
RenameSnapshotByID renames a Consul snapshot by its ID
func UpdateConsulCluster ¶
func UpdateConsulCluster(ctx context.Context, client *Client, newCluster *consulmodels.HashicorpCloudConsul20210204Cluster) (*consulmodels.HashicorpCloudConsul20210204UpdateResponse, error)
UpdateConsulCluster will make a call to the Consul service to initiate the update Consul cluster workflow.
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 WaitForHVNRouteToBeActive ¶ added in v0.7.0
func WaitForHVNRouteToBeActive(ctx context.Context, client *Client, hvnID string, routeID string, loc *sharedmodels.HashicorpCloudLocationLocation, timeout time.Duration) (*networkmodels.HashicorpCloudNetwork20200907HVNRoute, error)
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 ¶
type Client struct { Config ClientConfig Network network_service.ClientService Operation operation_service.ClientService Project project_service.ClientService Organization organization_service.ClientService Consul consul_service.ClientService Vault vault_service.ClientService Packer packer_service.ClientService }
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
type WaitFor ¶ added in v0.14.0
type WaitFor = func(ctx context.Context, client *Client, peeringID string, hvnID string, loc *sharedmodels.HashicorpCloudLocationLocation, timeout time.Duration) (*networkmodels.HashicorpCloudNetwork20200907Peering, error)