azurex

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserAgent is the user agent addition that identifies the Azure client
	UserAgent = "identity-manager-azure-client"
)

Variables

View Source
var DefaultConfigMap = map[string]string{
	"environment":                    azure.PublicCloud.Name,
	"activeDirectoryEndpointUrl":     azure.PublicCloud.ActiveDirectoryEndpoint,
	"resourceManagerEndpointUrl":     azure.PublicCloud.ResourceManagerEndpoint,
	"activeDirectoryGraphResourceId": azure.PublicCloud.ActiveDirectoryEndpoint,
	"galleryEndpointUrl":             azure.PublicCloud.GalleryEndpoint,
	"managementEndpointUrl":          azure.PublicCloud.ServiceManagementEndpoint,
}

DefaultConfigMap is the config map with default settings

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a value indicating whether the given error represents that the resource was not found.

func ToString

func ToString(s *string) string

ToString returns underlying string of s It returns "" if s is nil

func ToStringPtr

func ToStringPtr(s string) *string

ToStringPtr returns pointer to s

func ToUUIDString

func ToUUIDString(u *uuid.UUID) string

ToUUIDString expects uuid and returns string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the definition of the Client object

func New

func New(opts ...Option) (*Client, error)

New initializes Client with multiple Option

func (*Client) GetAuthorizer

func (x *Client) GetAuthorizer() autorest.Authorizer

GetAuthorizer returns client's authorizer

func (*Client) GetConfig

func (x *Client) GetConfig() *Config

GetConfig returns client's config

type Config

type Config struct {
	// AzureEnv
	Environment string `json:"environment" yaml:"environment"`
	// IDs
	TenantID       string `json:"tenantId" yaml:"tenantId"`
	SubscriptionID string `json:"subscriptionId" yaml:"subscriptionId"`
	// Auth1
	ClientID     string `json:"clientId" yaml:"clientId"`
	ClientSecret string `json:"clientSecret" yaml:"clientSecret"`
	// Auth2
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
	// Auth3
	Certificate         string `json:"certificate" yaml:"certificate"`
	CertificatePath     string `json:"certificatePath" yaml:"certificatePath"`
	CertificatePassword string `json:"certificatePassword" yaml:"certificatePassword"`
	// Defaults
	ResourceGroup string `json:"resourceGroup" yaml:"resourceGroup"`
	Location      string `json:"location" yaml:"location"`
	// ???
	ADResource string `json:"adResource" yaml:"adResource"`
	// ???
	UseManagedIdentityExtension bool   `json:"useManagedIdentityExtension" yaml:"useManagedIdentityExtension"`
	UserAssignedIdentityID      string `json:"userAssignedIdentityID" yaml:"userAssignedIdentityID"`
	UseDeviceFlow               bool   `json:"useDeviceFlow" yaml:"useDeviceFlow"`
	// URLs
	ActiveDirectoryEndpointURL     string `json:"activeDirectoryEndpointUrl" yaml:"activeDirectoryEndpointUrl"`
	ResourceManagerEndpointURL     string `json:"resourceManagerEndpointUrl" yaml:"resourceManagerEndpointUrl"`
	ActiveDirectoryGraphResourceID string `json:"activeDirectoryGraphResourceId" yaml:"activeDirectoryGraphResourceId"`
	SQLManagementEndpointURL       string `json:"sqlManagementEndpointUrl,omitempty" yaml:"sqlManagementEndpointUrl,omitempty"`
	GalleryEndpointURL             string `json:"galleryEndpointUrl,omitempty" yaml:"galleryEndpointUrl,omitempty"`
	ManagementEndpointURL          string `json:"managementEndpointUrl,omitempty" yaml:"managementEndpointUrl,omitempty"`
}

Config - simple aws session config

func (*Config) GetAuthorizer

func (c *Config) GetAuthorizer() (autorest.Authorizer, error)

GetAuthorizer returns the autorest.Authorizer based on the available settings

func (*Config) GetClientCertificate

func (c *Config) GetClientCertificate() (*auth.ClientCertificateConfig, error)

GetClientCertificate creates a config object from the available certificate credentials. An error is returned if no certificate credentials are available.

func (*Config) GetClientCredentials

func (c *Config) GetClientCredentials() (*auth.ClientCredentialsConfig, error)

GetClientCredentials creates a config object from the available client credentials. An error is returned if no client credentials are available.

func (*Config) GetDeviceFlow

func (c *Config) GetDeviceFlow() *auth.DeviceFlowConfig

GetDeviceFlow creates a device-flow config object from the available client and tenant IDs.

func (*Config) GetEnvironment

func (c *Config) GetEnvironment() (azure.Environment, error)

GetEnvironment returns azure.Environment based on Config's Environment

func (*Config) GetMSI

func (c *Config) GetMSI() *auth.MSIConfig

GetMSI creates a MSI config object from the available client ID.

func (*Config) GetUsernamePassword

func (c *Config) GetUsernamePassword() (*auth.UsernamePasswordConfig, error)

GetUsernamePassword creates a config object from the available username/password credentials. An error is returned if no username/password credentials are available.

type Option

type Option func(*Client) error

Option is the function syntax definition that is used as a generic return type for config options

func WithConfig

func WithConfig(c *Config) Option

WithConfig expects Config and returns Option

func WithConfigData

func WithConfigData(data []byte) Option

WithConfigData expects data and returns Option with a populated map

func WithConfigMap

func WithConfigMap(m map[string]any) Option

WithConfigMap expects map[string]interface and returns Option

func WithConfigMapFunc

func WithConfigMapFunc(fn func() (map[string]any, error)) Option

WithConfigMapFunc executes fn and returns Option with fn's returned map value

func WithEnv

func WithEnv() Option

WithEnv populates env data to Client and returns Option

Directories

Path Synopsis
clients
msi

Jump to

Keyboard shortcuts

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