clients

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeaderCorrelationRequestID is the Azure extension header to set a user-specified correlation request ID.
	HeaderCorrelationRequestID = "x-ms-correlation-request-id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureResourceManagerAccount

type AzureResourceManagerAccount struct {
	// AuthenticatedAsAServicePrincipal denotes whether the current Azure AD user is authenticated using a SP.
	AuthenticatedAsAServicePrincipal bool
	// ClientId is the client id of the Azure AD account.
	ClientId string
	// Environment represents a set of endpoints for each of Azure's Clouds.
	Environment azure.Environment
	// ObjectId is the id of the Azure AD account.
	ObjectId string
	// SubscriptionId is the id of the Azure subscription.
	SubscriptionId string
	// TenantId is the id of the Azure tenant.
	TenantId string
}

AzureResourceManagerAccount contains Azure AD account information.

func NewAzureResourceManagerAccount

func NewAzureResourceManagerAccount(ctx context.Context, config authentication.Config, env azure.Environment) (*AzureResourceManagerAccount, error)

NewAzureResourceManagerAccount constructs an AzureResourceManagerAccount from the given auth config and Azure env.

type Client

type Client struct {
	// Account contains Azure RM account information.
	Account *AzureResourceManagerAccount

	// ManagedApplication is the client used for Azure Managed Application CRUD.
	ManagedApplication *managedapplications.ApplicationsClient

	// ResourceGroup is the client used for Azure Resource Group CRUD
	ResourceGroup *resources.GroupsClient

	// CustomResourceProvider is the client used for HCS Custom Resource Provider actions.
	CustomResourceProvider *CustomResourceProviderClient

	// ManagedClusters is the client used for Azure Container services managed clusters CRUD.
	ManagedClusters *containerservice.ManagedClustersClient

	// VNet is the client used for Azure Virtual Networks CRUD
	VNet *network.VirtualNetworksClient

	// Config is the provider config which contains HCS specific configuration values.
	Config Config

	// CorrelationRequestID is the correlation id for all Azure requests made by an instance of this client.
	CorrelationRequestID string
}

Client is used by the provider to make authenticated HTTP requests to Azure.

func Build

func Build(ctx context.Context, options Options) (*Client, error)

Build constructs a Client which is used by the provider to make authenticated HTTP requests to Azure. Adapted from the azurerm provider's clients.Build https://github.com/terraform-providers/terraform-provider-azurerm/blob/8f32ad645888ee00a24ad7c739a8703222e13913/azurerm/internal/clients/builder.go#L38

type Config

type Config struct {
	// HCPApiDomain is the domain of the HashiCorp Cloud Platform API.
	HCPApiDomain string

	// MarketPlaceProductName is the HCS product name on the Azure marketplace.
	MarketPlaceProductName string

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

type ConsulConfig

type ConsulConfig struct {
	GossipKey  string   `json:"encrypt"`
	Datacenter string   `json:"datacenter"`
	RetryJoin  []string `json:"retry_join"`
	CaFile     string
}

ConsulConfig represents the Consul config returned on the GetConfig response.

type CustomResourceProviderClient

type CustomResourceProviderClient struct {
	// Client is the Autorest client responsible for making HTTP requests to Azure.
	autorest.Client
	// BaseURI is the base URI for the Azure Management API.
	BaseURI string
	// SubscriptionID is the Azure subscription id for the current authenticated user.
	SubscriptionID string
	// SourceChannel denotes the client (channel) that originated the HCS cluster request.
	// This is synonymous to a user-agent.
	SourceChannel string
}

CustomResourceProviderClient is used to make authenticated requests to the HCS Azure Custom Resource Provider.

func NewCustomResourceProviderClientWithBaseURI

func NewCustomResourceProviderClientWithBaseURI(baseURI string, subscriptionID string, sourceChannel string) CustomResourceProviderClient

NewCustomResourceProviderClientWithBaseURI constructs a CustomResourceProviderClient using the provided base URI and subscription id.

func (CustomResourceProviderClient) CreateFederationToken

func (client CustomResourceProviderClient) CreateFederationToken(ctx context.Context, managedResourceGroupID string, resourceGroupName string) (models.HashicorpCloudConsulamaAmaCreateFederationTokenResponse, error)

CreateFederationToken invokes the createFederationToken Custom Resource Provider Action

func (CustomResourceProviderClient) CreateRootToken

func (client CustomResourceProviderClient) CreateRootToken(ctx context.Context, managedResourceGroupId string) (models.HashicorpCloudConsulamaAmaCreateTokenResponse, error)

CreateRootToken invokes the createToken Custom Resource Provider Action.

func (CustomResourceProviderClient) CreateSnapshot

func (client CustomResourceProviderClient) CreateSnapshot(ctx context.Context, managedResourceGroupID,
	resourceGroupName, snapshotName string) (models.HashicorpCloudConsulamaAmaCreateSnapshotResponse, error)

CreateSnapshot invokes the createSnapshot Custom Resource Provider Action

func (CustomResourceProviderClient) DeleteSnapshot

func (client CustomResourceProviderClient) DeleteSnapshot(ctx context.Context, managedResourceGroupID, resourceGroupName,
	snapshotID string) (models.HashicorpCloudConsulamaAmaDeleteSnapshotResponse, error)

DeleteSnapshot invokes the deleteSnapshot Custom Resource Provider Action

func (CustomResourceProviderClient) FetchConsulCluster

func (client CustomResourceProviderClient) FetchConsulCluster(ctx context.Context, managedResourceGroupId string, clusterName string) (models.HashicorpCloudConsulamaAmaClusterResponse, error)

FetchConsulCluster invokes the consulCluster Custom Resource Action.

func (CustomResourceProviderClient) GetConsulConfig

func (client CustomResourceProviderClient) GetConsulConfig(ctx context.Context, managedResourceGroupID string, resourceGroupName string) (*ConsulConfig, error)

GetConsulConfig invokes the config Custom Resource Provider Action

func (CustomResourceProviderClient) GetFederation

func (client CustomResourceProviderClient) GetFederation(ctx context.Context, managedResourceGroupID string, resourceGroupName string) (models.HashicorpCloudConsulamaAmaGetFederationResponse, error)

GetFederation invokes the getFederation Custom Resource Provider Action

func (CustomResourceProviderClient) GetOperation

func (client CustomResourceProviderClient) GetOperation(ctx context.Context, managedResourceGroupID,
	resourceGroupName, operationID string) (models.HashicorpCloudConsulamaAmaGetOperationResponse, error)

GetOperation invokes the operation Custom Resource Provider Action

func (CustomResourceProviderClient) GetSnapshot

func (client CustomResourceProviderClient) GetSnapshot(ctx context.Context, managedResourceGroupID, resourceGroupName,
	snapshotID string) (models.HashicorpCloudConsulamaAmaGetSnapshotResponse, error)

GetSnapshot invokes the getSnapshot Custom Resource Provider Action

func (CustomResourceProviderClient) IsCRPErrorAzureNotFound

func (_ CustomResourceProviderClient) IsCRPErrorAzureNotFound(err error) bool

IsCRPErrorAzureNotFound determines if the the error returned from a Custom Resource Provider Action was a 404 not found.

func (CustomResourceProviderClient) ListUpgradeVersions

ListUpgradeVersions invokes the listConsulUpgradeVersions Custom Resource Provider Action.

func (CustomResourceProviderClient) PollOperation

func (client CustomResourceProviderClient) PollOperation(ctx context.Context, operationID, managedResourceGroupID, managedAppName string,
	pollInterval int) error

PollOperation will poll the operation Custom Resource Provider Action endpoint every pollInterval seconds until the operation state is DONE or the context cancels the request.

func (CustomResourceProviderClient) RenameSnapshot

func (client CustomResourceProviderClient) RenameSnapshot(ctx context.Context, managedResourceGroupID, resourceGroupName,
	snapshotID, snapshotName string) (models.HashicorpCloudConsulamaAmaRenameSnapshotResponse, error)

RenameSnapshot invokes the renameSnapshot Custom Resource Provider Action

func (CustomResourceProviderClient) UpdateCluster

UpdateCluster invokes the update Custom Resource Provider Action.

type Options

type Options struct {
	// ProviderUserAgent is the User Agent used for HTTP requests which contains the provider name and version.
	ProviderUserAgent string

	// AzureAuthConfig is the configuration used to create an authenticated Azure client.
	AzureAuthConfig *authentication.Config

	// Config is the provider config which contains HCS specific configuration values.
	Config Config
}

Options are the options passed to the client.

Directories

Path Synopsis
hcs-ama-api-spec

Jump to

Keyboard shortcuts

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