Documentation ¶
Overview ¶
Copyright 2022 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func ConvertResponseError(err error) error
- func ConvertTags(tags map[string]*string) map[string]string
- func StringVal[T ~string](s *T) string
- type AKSAuthMethod
- type AKSClient
- type AKSCluster
- type AKSClusterProperties
- type ARMAKS
- type ARMComputeMock
- type ARMKubernetesMock
- func (m *ARMKubernetesMock) BeginRunCommand(ctx context.Context, resourceGroupName string, resourceName string, ...) (*runtime.Poller[armcontainerservice.ManagedClustersClientRunCommandResponse], ...)
- func (m *ARMKubernetesMock) Get(_ context.Context, group, name string, ...) (armcontainerservice.ManagedClustersClientGetResponse, error)
- func (m *ARMKubernetesMock) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, ...) (armcontainerservice.ManagedClustersClientGetCommandResultResponse, error)
- func (m *ARMKubernetesMock) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, ...) (armcontainerservice.ManagedClustersClientListClusterAdminCredentialsResponse, ...)
- func (m *ARMKubernetesMock) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, ...) (armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse, ...)
- func (m *ARMKubernetesMock) NewListByResourceGroupPager(group string, ...) ...
- func (m *ARMKubernetesMock) NewListPager(_ *armcontainerservice.ManagedClustersClientListOptions) *runtime.Pager[armcontainerservice.ManagedClustersClientListResponse]
- type ARMMySQL
- type ARMMySQLMock
- func (m *ARMMySQLMock) Get(_ context.Context, group, name string, _ *armmysql.ServersClientGetOptions) (armmysql.ServersClientGetResponse, error)
- func (m *ARMMySQLMock) NewListByResourceGroupPager(group string, _ *armmysql.ServersClientListByResourceGroupOptions) *runtime.Pager[armmysql.ServersClientListByResourceGroupResponse]
- func (m *ARMMySQLMock) NewListPager(_ *armmysql.ServersClientListOptions) *runtime.Pager[armmysql.ServersClientListResponse]
- type ARMPostgres
- type ARMPostgresMock
- func (m *ARMPostgresMock) Get(_ context.Context, group, name string, ...) (armpostgresql.ServersClientGetResponse, error)
- func (m *ARMPostgresMock) NewListByResourceGroupPager(group string, _ *armpostgresql.ServersClientListByResourceGroupOptions) *runtime.Pager[armpostgresql.ServersClientListByResourceGroupResponse]
- func (m *ARMPostgresMock) NewListPager(_ *armpostgresql.ServersClientListOptions) *runtime.Pager[armpostgresql.ServersClientListResponse]
- type ARMRedisEnterpriseClusterMock
- func (m *ARMRedisEnterpriseClusterMock) NewListByResourceGroupPager(resourceGroupName string, ...) *runtime.Pager[armredisenterprise.ClientListByResourceGroupResponse]
- func (m *ARMRedisEnterpriseClusterMock) NewListPager(options *armredisenterprise.ClientListOptions) *runtime.Pager[armredisenterprise.ClientListResponse]
- type ARMRedisEnterpriseDatabaseMock
- func (m *ARMRedisEnterpriseDatabaseMock) ListKeys(ctx context.Context, resourceGroupName string, clusterName string, ...) (armredisenterprise.DatabasesClientListKeysResponse, error)
- func (m *ARMRedisEnterpriseDatabaseMock) NewListByClusterPager(resourceGroupName string, clusterName string, ...) *runtime.Pager[armredisenterprise.DatabasesClientListByClusterResponse]
- type ARMRedisMock
- func (m *ARMRedisMock) ListKeys(ctx context.Context, resourceGroupName string, name string, ...) (armredis.ClientListKeysResponse, error)
- func (m *ARMRedisMock) NewListByResourceGroupPager(resourceGroupName string, options *armredis.ClientListByResourceGroupOptions) *runtime.Pager[armredis.ClientListByResourceGroupResponse]
- func (m *ARMRedisMock) NewListBySubscriptionPager(options *armredis.ClientListBySubscriptionOptions) *runtime.Pager[armredis.ClientListBySubscriptionResponse]
- type ARMSQLManagedServerMock
- func (m *ARMSQLManagedServerMock) NewListByResourceGroupPager(resourceGroupName string, ...) *runtime.Pager[armsql.ManagedInstancesClientListByResourceGroupResponse]
- func (m *ARMSQLManagedServerMock) NewListPager(options *armsql.ManagedInstancesClientListOptions) *runtime.Pager[armsql.ManagedInstancesClientListResponse]
- type ARMSQLServerMock
- type ARMSubscriptions
- type ARMSubscriptionsMock
- type CacheForRedisClient
- type ClientConfig
- type ClientMap
- type ClusterCredentialsConfig
- type DBServer
- type DBServersClient
- type GetToken
- type Identity
- type ImpersonationPermissionsChecker
- type InstanceMetadataClient
- func (client *InstanceMetadataClient) GetAPIVersion() string
- func (client *InstanceMetadataClient) GetHostname(ctx context.Context) (string, error)
- func (client *InstanceMetadataClient) GetID(ctx context.Context) (string, error)
- func (client *InstanceMetadataClient) GetTags(ctx context.Context) (map[string]string, error)
- func (client *InstanceMetadataClient) GetType() types.InstanceMetadataType
- func (client *InstanceMetadataClient) IsAvailable(ctx context.Context) bool
- type InstanceMetadataClientOption
- type ManagedSQLServerClient
- type RedisClient
- type RedisEnterpriseClient
- type RedisEnterpriseDatabase
- type SQLServerClient
- type ServerProperties
- type SubscriptionClient
- type VirtualMachine
- type VirtualMachinesClient
Constants ¶
const ( // MySQLPort is the Azure managed MySQL server port // https://docs.microsoft.com/en-us/azure/mysql/single-server/concepts-connectivity-architecture MySQLPort = "3306" // PostgresPort is the Azure managed PostgreSQL server port // https://docs.microsoft.com/en-us/azure/postgresql/single-server/concepts-connectivity-architecture PostgresPort = "5432" )
const ( // RedisEnterpriseClusterDefaultDatabase is the default database name for a // Redis Enterprise cluster. RedisEnterpriseClusterDefaultDatabase = "default" // RedisEnterpriseClusterPolicyOSS indicates the Redis Enterprise cluster // is running in OSS mode. RedisEnterpriseClusterPolicyOSS = string(armredisenterprise.ClusteringPolicyOSSCluster) )
Variables ¶
This section is empty.
Functions ¶
func ConvertResponseError ¶
ConvertResponseError converts `error` into Azure Response error. to trace error. If the provided error is not a `ResponseError` it returns. the error without modifying it.
func ConvertTags ¶
ConvertTags converts map of string pointers to map of strings.
Types ¶
type AKSAuthMethod ¶
type AKSAuthMethod uint8
AKSAuthMethod defines the authentication method for AKS cluster.
const ( // AzureRBAC indicates that the Azure AD is enabled and authorization is handled by Azure RBAC. AzureRBAC AKSAuthMethod = iota // AzureAD indicates that the Azure AD is enabled but authorization is handled by Kubernetes RBAC. AzureAD // LocalAccounts indicates that the cluster access happens through Local accounts created // during provisioning phase. LocalAccounts )
type AKSClient ¶
type AKSClient interface { // ListAll returns all AKSClusters the user has access to. ListAll(ctx context.Context) ([]*AKSCluster, error) // ListAll returns all AKSClusters the user has access to within the resource group. ListWithinGroup(ctx context.Context, group string) ([]*AKSCluster, error) // ClusterCredentials returns the credentials for accessing the desired AKS cluster. // If agent access has not yet been configured, this function will attempt to configure it // using administrator credentials `ListClusterAdminCredentials“ or by running a command `BeginRunCommand`. // If the access setup is not successful, then an error is returned. ClusterCredentials(ctx context.Context, cfg ClusterCredentialsConfig) (*rest.Config, time.Time, error) }
AKSClient is the Azure client to interact with AKS.
func NewAKSClustersClient ¶
NewAKSClustersClient returns a client for Azure AKS clusters.
type AKSCluster ¶
type AKSCluster struct { // Name is the name of the cluster. Name string // GroupName is the resource group name. GroupName string // TenantID is the cluster TenantID. TenantID string // Location is the cluster region. Location string // SubscriptionID is the cluster subscription id. SubscriptionID string // Tags are the cluster tags. Tags map[string]string // Properties are the cluster authentication and authorization properties. Properties AKSClusterProperties }
AKSCluster represents an AKS cluster.
func AKSClusterFromManagedCluster ¶
func AKSClusterFromManagedCluster(cluster *armcontainerservice.ManagedCluster) (*AKSCluster, error)
AKSClusterFromManagedCluster converts an Azure armcontainerservice.ManagedCluster into AKSCluster.
type AKSClusterProperties ¶
type AKSClusterProperties struct { // AccessConfig indicates the authentication & authorization config to use with the cluster. AccessConfig AKSAuthMethod // LocalAccounts indicates if the cluster has local accounts. LocalAccounts bool }
AKSClusterProperties holds the AZ cluster authentication properties.
type ARMAKS ¶
type ARMAKS interface { BeginRunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload armcontainerservice.RunCommandRequest, options *armcontainerservice.ManagedClustersClientBeginRunCommandOptions) (*runtime.Poller[armcontainerservice.ManagedClustersClientRunCommandResponse], error) Get(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (armcontainerservice.ManagedClustersClientGetResponse, error) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string, options *armcontainerservice.ManagedClustersClientGetCommandResultOptions) (armcontainerservice.ManagedClustersClientGetCommandResultResponse, error) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterAdminCredentialsOptions) (armcontainerservice.ManagedClustersClientListClusterAdminCredentialsResponse, error) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions) (armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse, error) NewListByResourceGroupPager(resourceGroupName string, options *armcontainerservice.ManagedClustersClientListByResourceGroupOptions) *runtime.Pager[armcontainerservice.ManagedClustersClientListByResourceGroupResponse] NewListPager(options *armcontainerservice.ManagedClustersClientListOptions) *runtime.Pager[armcontainerservice.ManagedClustersClientListResponse] }
ARMAKS is an interface for armcontainerservice.ManagedClustersClient.
type ARMComputeMock ¶
type ARMComputeMock struct { VirtualMachines map[string][]*armcompute.VirtualMachine GetResult armcompute.VirtualMachine GetErr error }
ARMComputeMock mocks armcompute.VirtualMachinesClient.
func (*ARMComputeMock) NewListPager ¶
func (m *ARMComputeMock) NewListPager(resourceGroup string, _ *armcompute.VirtualMachinesClientListOptions) *runtime.Pager[armcompute.VirtualMachinesClientListResponse]
type ARMKubernetesMock ¶
type ARMKubernetesMock struct { KubeServers []*armcontainerservice.ManagedCluster ClusterAdminCreds *armcontainerservice.CredentialResult ClusterUserCreds *armcontainerservice.CredentialResult NoAuth bool }
ARMKubernetesMock mocks Azure armmanagedclusters API.
func (*ARMKubernetesMock) BeginRunCommand ¶
func (m *ARMKubernetesMock) BeginRunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload armcontainerservice.RunCommandRequest, options *armcontainerservice.ManagedClustersClientBeginRunCommandOptions) (*runtime.Poller[armcontainerservice.ManagedClustersClientRunCommandResponse], error)
func (*ARMKubernetesMock) Get ¶
func (m *ARMKubernetesMock) Get(_ context.Context, group, name string, _ *armcontainerservice.ManagedClustersClientGetOptions) (armcontainerservice.ManagedClustersClientGetResponse, error)
func (*ARMKubernetesMock) GetCommandResult ¶
func (*ARMKubernetesMock) ListClusterAdminCredentials ¶
func (*ARMKubernetesMock) ListClusterUserCredentials ¶
func (*ARMKubernetesMock) NewListByResourceGroupPager ¶
func (m *ARMKubernetesMock) NewListByResourceGroupPager(group string, _ *armcontainerservice.ManagedClustersClientListByResourceGroupOptions) *runtime.Pager[armcontainerservice.ManagedClustersClientListByResourceGroupResponse]
func (*ARMKubernetesMock) NewListPager ¶
func (m *ARMKubernetesMock) NewListPager(_ *armcontainerservice.ManagedClustersClientListOptions) *runtime.Pager[armcontainerservice.ManagedClustersClientListResponse]
type ARMMySQL ¶
type ARMMySQL interface { // Get - gets information about an Azure DB server. Get(ctx context.Context, group, name string, opts *armmysql.ServersClientGetOptions) (armmysql.ServersClientGetResponse, error) // NewListPager - List all the servers in a given subscription. NewListPager(opts *armmysql.ServersClientListOptions) *runtime.Pager[armmysql.ServersClientListResponse] // NewListByResourceGroupPager - List all the servers in a given resource group. NewListByResourceGroupPager(group string, opts *armmysql.ServersClientListByResourceGroupOptions) *runtime.Pager[armmysql.ServersClientListByResourceGroupResponse] }
ARMMySQL is an interface for armmysql.ServersClient. It exists so that the client can be mocked.
type ARMMySQLMock ¶
ARMMySQLMock mocks Azure armmysql API.
func (*ARMMySQLMock) Get ¶
func (m *ARMMySQLMock) Get(_ context.Context, group, name string, _ *armmysql.ServersClientGetOptions) (armmysql.ServersClientGetResponse, error)
func (*ARMMySQLMock) NewListByResourceGroupPager ¶
func (m *ARMMySQLMock) NewListByResourceGroupPager(group string, _ *armmysql.ServersClientListByResourceGroupOptions) *runtime.Pager[armmysql.ServersClientListByResourceGroupResponse]
func (*ARMMySQLMock) NewListPager ¶
func (m *ARMMySQLMock) NewListPager(_ *armmysql.ServersClientListOptions) *runtime.Pager[armmysql.ServersClientListResponse]
type ARMPostgres ¶
type ARMPostgres interface { // Get - gets information about an Azure DB server. Get(ctx context.Context, group, name string, opts *armpostgresql.ServersClientGetOptions) (armpostgresql.ServersClientGetResponse, error) // NewListPager - List all the servers in a given subscription. NewListPager(opts *armpostgresql.ServersClientListOptions) *runtime.Pager[armpostgresql.ServersClientListResponse] // NewListByResourceGroupPager - List all the servers in a given resource group. NewListByResourceGroupPager(group string, opts *armpostgresql.ServersClientListByResourceGroupOptions) *runtime.Pager[armpostgresql.ServersClientListByResourceGroupResponse] }
ARMPostgres is an interface for armpostgresql.ServersClient. It exists so that the client can be mocked.
type ARMPostgresMock ¶
type ARMPostgresMock struct { DBServers []*armpostgresql.Server NoAuth bool }
ARMPostgresMock mocks Azure armpostgresql API.
func (*ARMPostgresMock) Get ¶
func (m *ARMPostgresMock) Get(_ context.Context, group, name string, _ *armpostgresql.ServersClientGetOptions) (armpostgresql.ServersClientGetResponse, error)
func (*ARMPostgresMock) NewListByResourceGroupPager ¶
func (m *ARMPostgresMock) NewListByResourceGroupPager(group string, _ *armpostgresql.ServersClientListByResourceGroupOptions) *runtime.Pager[armpostgresql.ServersClientListByResourceGroupResponse]
func (*ARMPostgresMock) NewListPager ¶
func (m *ARMPostgresMock) NewListPager(_ *armpostgresql.ServersClientListOptions) *runtime.Pager[armpostgresql.ServersClientListResponse]
type ARMRedisEnterpriseClusterMock ¶
type ARMRedisEnterpriseClusterMock struct { NoAuth bool Clusters []*armredisenterprise.Cluster }
ARMRedisEnterpriseClusterMock mocks armRedisEnterpriseClusterClient.
func (*ARMRedisEnterpriseClusterMock) NewListByResourceGroupPager ¶
func (m *ARMRedisEnterpriseClusterMock) NewListByResourceGroupPager(resourceGroupName string, options *armredisenterprise.ClientListByResourceGroupOptions) *runtime.Pager[armredisenterprise.ClientListByResourceGroupResponse]
func (*ARMRedisEnterpriseClusterMock) NewListPager ¶
func (m *ARMRedisEnterpriseClusterMock) NewListPager(options *armredisenterprise.ClientListOptions) *runtime.Pager[armredisenterprise.ClientListResponse]
type ARMRedisEnterpriseDatabaseMock ¶
type ARMRedisEnterpriseDatabaseMock struct { Token string TokensByDatabaseName map[string]string NoAuth bool Databases []*armredisenterprise.Database }
ARMRedisEnterpriseDatabaseMock mocks armRedisEnterpriseDatabaseClient.
func (*ARMRedisEnterpriseDatabaseMock) ListKeys ¶
func (m *ARMRedisEnterpriseDatabaseMock) ListKeys(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *armredisenterprise.DatabasesClientListKeysOptions) (armredisenterprise.DatabasesClientListKeysResponse, error)
func (*ARMRedisEnterpriseDatabaseMock) NewListByClusterPager ¶
func (m *ARMRedisEnterpriseDatabaseMock) NewListByClusterPager(resourceGroupName string, clusterName string, options *armredisenterprise.DatabasesClientListByClusterOptions) *runtime.Pager[armredisenterprise.DatabasesClientListByClusterResponse]
type ARMRedisMock ¶
ARMRedisMock mocks armRedisClient.
func (*ARMRedisMock) NewListByResourceGroupPager ¶
func (m *ARMRedisMock) NewListByResourceGroupPager(resourceGroupName string, options *armredis.ClientListByResourceGroupOptions) *runtime.Pager[armredis.ClientListByResourceGroupResponse]
func (*ARMRedisMock) NewListBySubscriptionPager ¶
func (m *ARMRedisMock) NewListBySubscriptionPager(options *armredis.ClientListBySubscriptionOptions) *runtime.Pager[armredis.ClientListBySubscriptionResponse]
type ARMSQLManagedServerMock ¶
type ARMSQLManagedServerMock struct { NoAuth bool AllServers []*armsql.ManagedInstance ResourceGroupServers []*armsql.ManagedInstance }
ARMSQLManagedServerMock mocks armSQLServerClient
func (*ARMSQLManagedServerMock) NewListByResourceGroupPager ¶
func (m *ARMSQLManagedServerMock) NewListByResourceGroupPager(resourceGroupName string, options *armsql.ManagedInstancesClientListByResourceGroupOptions) *runtime.Pager[armsql.ManagedInstancesClientListByResourceGroupResponse]
func (*ARMSQLManagedServerMock) NewListPager ¶
func (m *ARMSQLManagedServerMock) NewListPager(options *armsql.ManagedInstancesClientListOptions) *runtime.Pager[armsql.ManagedInstancesClientListResponse]
type ARMSQLServerMock ¶
type ARMSQLServerMock struct { NoAuth bool AllServers []*armsql.Server ResourceGroupServers []*armsql.Server }
ARMSQLServerMock mocks armSQLServerClient
func (*ARMSQLServerMock) NewListByResourceGroupPager ¶
func (m *ARMSQLServerMock) NewListByResourceGroupPager(resourceGroupName string, options *armsql.ServersClientListByResourceGroupOptions) *runtime.Pager[armsql.ServersClientListByResourceGroupResponse]
func (*ARMSQLServerMock) NewListPager ¶
func (m *ARMSQLServerMock) NewListPager(options *armsql.ServersClientListOptions) *runtime.Pager[armsql.ServersClientListResponse]
type ARMSubscriptions ¶
type ARMSubscriptions interface {
NewListPager(opts *armsubscription.SubscriptionsClientListOptions) *runtime.Pager[armsubscription.SubscriptionsClientListResponse]
}
ARMSubscriptions provides an interface for armsubscription.SubscriptionsClient. It is provided so that the client can be mocked.
type ARMSubscriptionsMock ¶
type ARMSubscriptionsMock struct { Subscriptions []*armsubscription.Subscription NoAuth bool }
func (*ARMSubscriptionsMock) NewListPager ¶
func (m *ARMSubscriptionsMock) NewListPager(_ *armsubscription.SubscriptionsClientListOptions) *runtime.Pager[armsubscription.SubscriptionsClientListResponse]
type CacheForRedisClient ¶
type CacheForRedisClient interface { // GetToken retrieves the auth token for provided resource ID. GetToken(ctx context.Context, resourceID string) (string, error) }
CacheForRedisClient provides an interface for an Azure Redis For Cache client.
type ClientConfig ¶
type ClientMap ¶
type ClientMap[ClientType any] struct { // contains filtered or unexported fields }
ClientMap is a generic map that caches a collection of Azure clients by subscriptions.
func NewClientMap ¶
func NewClientMap[ClientType any](newClient func(string, azcore.TokenCredential, *arm.ClientOptions) (ClientType, error)) ClientMap[ClientType]
NewClientMap creates a new ClientMap.
type ClusterCredentialsConfig ¶
type ClusterCredentialsConfig struct { // ResourceGroup is the AKS cluster resource group. ResourceGroup string // ResourceName is the AKS cluster name. ResourceName string // TenantID is the AKS cluster tenant id. TenantID string // ImpersonationPermissionsChecker is checker function that validates if access // was granted. ImpersonationPermissionsChecker ImpersonationPermissionsChecker }
ClusterCredentialsConfig are the required parameters for generating cluster credentials.
func (ClusterCredentialsConfig) CheckAndSetDefaults ¶
func (c ClusterCredentialsConfig) CheckAndSetDefaults() error
CheckAndSetDefaults checks for required parameters.
type DBServer ¶
type DBServer struct { // ID is the fully qualified resource ID for this resource. ID string // Location is the geo-location where the resource lives. Location string // Name is the name of the resource. Name string // Port is the port used to connect to this resource. Port string // Properties contains properties for an DB Server. Properties ServerProperties // Protocol is the DB protocol used for this DB Server. Protocol string // Tags are the resource tags associated with this resource. Tags map[string]string }
DBServer represents an Azure DB Server. It exists to reduce code duplication, since Azure MySQL and PostgreSQL server fields are identical in all but type. TODO(gavin): Remove this in favor of generics when Go supports structural constraints on generic types.
func ServerFromMySQLServer ¶
ServerFromMySQLServer converts an Azure armmysql.Server into DBServer.
func ServerFromPostgresServer ¶
func ServerFromPostgresServer(server *armpostgresql.Server) *DBServer
ServerFromPostgresServer converts an Azure armpostgresql.Server into DBServer.
func (*DBServer) IsAvailable ¶
IsAvailable returns whether the Azure DBServer is available.
func (*DBServer) IsSupported ¶
IsSupported returns true if database supports AAD authentication. Only available for MySQL 5.7 and newer. All Azure managed PostgreSQL single-server instances support AAD auth.
type DBServersClient ¶
type DBServersClient interface { // ListAll returns all Azure DB servers within an Azure subscription. ListAll(ctx context.Context) ([]*DBServer, error) // ListWithinGroup returns all Azure DB servers within an Azure resource group. ListWithinGroup(ctx context.Context, group string) ([]*DBServer, error) // Get returns a DBServer within an Azure subscription, queried by group and name Get(ctx context.Context, group, name string) (*DBServer, error) }
DBServersClient provides an interface for fetching Azure DB Servers.
func NewMySQLServersClient ¶
func NewMySQLServersClient(api ARMMySQL) DBServersClient
NewMySQLServersClient returns a DBServersClient for Azure MySQL servers.
func NewPostgresServerClient ¶
func NewPostgresServerClient(api ARMPostgres) DBServersClient
NewPostgresServerClient returns a DBServersClient for Azure PostgreSQL servers.
type GetToken ¶
type GetToken interface { // GetToken returns an azure token. GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) }
GetToken is an interface for generating tokens from credentials.
type Identity ¶
type Identity struct { // ResourceID the identity resource ID. ResourceID string }
Identitiy represents an Azure Virtual Machine identity.
type ImpersonationPermissionsChecker ¶
type ImpersonationPermissionsChecker func(ctx context.Context, clusterName string, sarClient authztypes.SelfSubjectAccessReviewInterface) error
ImpersonationPermissionsChecker describes a function that can be used to check for the required impersonation permissions on a Kubernetes cluster. Return nil to indicate success.
type InstanceMetadataClient ¶
type InstanceMetadataClient struct {
// contains filtered or unexported fields
}
InstanceMetadataClient is a client for Azure instance metadata.
func NewInstanceMetadataClient ¶
func NewInstanceMetadataClient(opts ...InstanceMetadataClientOption) *InstanceMetadataClient
NewInstanceMetadataClient creates a new instance metadata client.
func (*InstanceMetadataClient) GetAPIVersion ¶
func (client *InstanceMetadataClient) GetAPIVersion() string
GetAPIVersion gets the Azure instance metadata API version this client is using.
func (*InstanceMetadataClient) GetHostname ¶
func (client *InstanceMetadataClient) GetHostname(ctx context.Context) (string, error)
GetHostname gets the hostname set by the cloud instance that Teleport should use, if any.
func (*InstanceMetadataClient) GetID ¶
func (client *InstanceMetadataClient) GetID(ctx context.Context) (string, error)
GetID gets the Azure resource ID of the cloud instance.
func (*InstanceMetadataClient) GetType ¶
func (client *InstanceMetadataClient) GetType() types.InstanceMetadataType
GetType gets the cloud instance type.
func (*InstanceMetadataClient) IsAvailable ¶
func (client *InstanceMetadataClient) IsAvailable(ctx context.Context) bool
IsAvailable checks if instance metadata is available.
type InstanceMetadataClientOption ¶
type InstanceMetadataClientOption func(client *InstanceMetadataClient)
InstanceMetadataClientOption allows setting options as functional arguments to an InstanceMetadataClient.
func WithBaseURL ¶
func WithBaseURL(url string) InstanceMetadataClientOption
WithBaseURL sets the base URL for the metadata client. Used in tests.
type ManagedSQLServerClient ¶
type ManagedSQLServerClient interface { // ListAll returns all Azure Managed SQL servers within an Azure subscription. ListAll(ctx context.Context) ([]*armsql.ManagedInstance, error) // ListWithinGroup returns all Azure Managed SQL servers within an Azure resource group. ListWithinGroup(ctx context.Context, group string) ([]*armsql.ManagedInstance, error) }
ManagedSQLServerClient is an interface for a Managed SQL Server client.
func NewManagedSQLClient ¶
func NewManagedSQLClient(subscription string, cred azcore.TokenCredential, options *arm.ClientOptions) (ManagedSQLServerClient, error)
NewSQLClient creates a new Azure SQL Server client by subscription and credentials.
func NewManagedSQLClientByAPI ¶
func NewManagedSQLClientByAPI(api armSQLManagedInstancesClient) ManagedSQLServerClient
NewSQLClientByAPI creates a new Azure SQL Serverclient by ARM API client.
type RedisClient ¶
type RedisClient interface { CacheForRedisClient // ListAll returns all Azure Redis servers within an Azure subscription. ListAll(ctx context.Context) ([]*armredis.ResourceInfo, error) // ListWithinGroup returns all Azure Redis servers within an Azure resource group. ListWithinGroup(ctx context.Context, group string) ([]*armredis.ResourceInfo, error) }
RedisClient is an interface for a Redis client.
func NewRedisClient ¶
func NewRedisClient(subscription string, cred azcore.TokenCredential, options *arm.ClientOptions) (RedisClient, error)
NewRedisClient creates a new Azure Redis client by subscription and credentials.
func NewRedisClientByAPI ¶
func NewRedisClientByAPI(api armRedisClient) RedisClient
NewRedisClientByAPI creates a new Azure Redis client by ARM API client.
type RedisEnterpriseClient ¶
type RedisEnterpriseClient interface { CacheForRedisClient // ListAll returns all Azure Redis Enterprise databases within an Azure subscription. ListAll(ctx context.Context) ([]*RedisEnterpriseDatabase, error) // ListWithinGroup returns all Azure Redis Enterprise databases within an Azure resource group. ListWithinGroup(ctx context.Context, group string) ([]*RedisEnterpriseDatabase, error) }
RedisEnterpriseClient is an interface for a Redis Enterprise client.
func NewRedisEnterpriseClient ¶
func NewRedisEnterpriseClient(subscription string, cred azcore.TokenCredential, options *arm.ClientOptions) (RedisEnterpriseClient, error)
NewRedisEnterpriseClient creates a new Azure Redis Enterprise client by subscription and credentials.
func NewRedisEnterpriseClientByAPI ¶
func NewRedisEnterpriseClientByAPI(clusterAPI armRedisEnterpriseClusterClient, databaseAPI armRedisEnterpriseDatabaseClient) RedisEnterpriseClient
NewRedisEnterpriseClientByAPI creates a new Azure Redis Enterprise client by ARM API client(s).
type RedisEnterpriseDatabase ¶
type RedisEnterpriseDatabase struct { *armredisenterprise.Database // Cluster is the parent cluster. Cluster *armredisenterprise.Cluster }
RedisEnterpriseDatabase is a wrapper of a armredisenterprise.Database and its parent cluster.
func (*RedisEnterpriseDatabase) String ¶
func (d *RedisEnterpriseDatabase) String() string
String returns the description of the database.
type SQLServerClient ¶
type SQLServerClient interface { // ListAll returns all Azure SQL servers within an Azure subscription. ListAll(ctx context.Context) ([]*armsql.Server, error) // ListWithinGroup returns all Azure SQL servers databases within an Azure resource group. ListWithinGroup(ctx context.Context, group string) ([]*armsql.Server, error) }
SQLServerClient is an interface for a SQL Server client.
func NewSQLClient ¶
func NewSQLClient(subscription string, cred azcore.TokenCredential, options *arm.ClientOptions) (SQLServerClient, error)
NewSQLClient creates a new Azure SQL Server client by subscription and credentials.
func NewSQLClientByAPI ¶
func NewSQLClientByAPI(api armSQLServerClient) SQLServerClient
NewSQLClientByAPI creates a new Azure SQL Serverclient by ARM API client.
type ServerProperties ¶
type ServerProperties struct { // FullyQualifiedDomainName is the fully qualified domain name which resolves to the DB Server address. FullyQualifiedDomainName string // UserVisibleState is the state of the DB Server that is visible to a user. UserVisibleState string // Version is the version of the Azure gateway which redirects traffic to the database servers. Version string }
ServerProperties contains properties for an DB Server.
type SubscriptionClient ¶
type SubscriptionClient struct {
// contains filtered or unexported fields
}
SubscriptionClient wraps the Azure SubscriptionsAPI to fetch subscription IDs.
func NewSubscriptionClient ¶
func NewSubscriptionClient(api ARMSubscriptions) *SubscriptionClient
NewSubscriptionClient returns a SubscriptionsClient.
func (*SubscriptionClient) ListSubscriptionIDs ¶
func (c *SubscriptionClient) ListSubscriptionIDs(ctx context.Context) ([]string, error)
ListSubscriptionIDs lists all subscription IDs using the Azure Subscription API.
type VirtualMachine ¶
type VirtualMachine struct { // ID resource ID. ID string `json:"id,omitempty"` // Name resource name. Name string `json:"name,omitempty"` // Identities are the identities associated with the resource. Identities []Identity }
VirtualMachine represents an Azure Virtual Machine.
type VirtualMachinesClient ¶
type VirtualMachinesClient interface { // Get returns the Virtual Machine for the given resource ID. Get(ctx context.Context, resourceID string) (*VirtualMachine, error) // ListVirtualMachines gets all of the virtual machines in the given resource group. ListVirtualMachines(ctx context.Context, resourceGroup string) ([]*armcompute.VirtualMachine, error) }
VirtualMachinesClient is a client for Azure Virtual Machines.
func NewVirtualMachinesClient ¶
func NewVirtualMachinesClient(subscription string, cred azcore.TokenCredential, options *arm.ClientOptions) (VirtualMachinesClient, error)
NewVirtualMachinesClient creates a new Azure Virtual Machines client by subscription and credentials.
func NewVirtualMachinesClientByAPI ¶
func NewVirtualMachinesClientByAPI(api armCompute) VirtualMachinesClient
NewVirtualMachinesClientByAPI creates a new Azure Virtual Machines client by ARM API client.