azureauth

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AzureCloud        = "AzureCloud"
	AzureChinaCloud   = "AzureChinaCloud"
	AzureUSGovernment = "AzureUSGovernment"
)

Variables

This section is empty.

Functions

func DiscoverTenantID

func DiscoverTenantID(ctx context.Context, subscriptionID string, clientOpts arm.ClientOptions) (string, error)

DiscoverTenantID returns the tenent ID for the given subscription ID.

func MaybeJujuApplicationObjectID

func MaybeJujuApplicationObjectID(appID string) (string, error)

MaybeJujuApplicationObjectID returns the Juju Application Object ID if the passed in application ID is the Juju Enterprise App.

func ReportableError

func ReportableError(err error) error

ReportableError returns a wrapped error that exposes the underlying error code and message (if possible), or just the passed in error.

Types

type DataError

type DataError struct {
	*odataerrors.ODataError
}

DataError is a go error that wraps the odataerrors.ODataError response type.

func AsDataError

func AsDataError(err error) (*DataError, bool)

AsDataError returns a wrapped error that exposes the underlying error code and message (if possible).

func (*DataError) Code

func (e *DataError) Code() string

Code returns the code from the wrapped DataError.

func (*DataError) Error

func (e *DataError) Error() string

Error implements the error interface.

func (*DataError) Message

func (e *DataError) Message() string

Message returns the message from the wrapped DataError.

type ServicePrincipalCreator

type ServicePrincipalCreator struct {
	RequestAdaptor abstractions.RequestAdapter
	Sender         policy.Transporter

	Clock   clock.Clock
	NewUUID func() (uuid.UUID, error)
}

ServicePrincipalCreator creates a service principal for the Juju enterprise application.

func (*ServicePrincipalCreator) Create

func (c *ServicePrincipalCreator) Create(sdkCtx context.Context, params ServicePrincipalParams) (appid, spid, password string, err error)

Create creates a new service principal using the values specified in params.

func (*ServicePrincipalCreator) InteractiveCreate

func (c *ServicePrincipalCreator) InteractiveCreate(sdkCtx context.Context, stderr io.Writer, params ServicePrincipalParams) (appid, spid, password string, _ error)

InteractiveCreate creates a new ServicePrincipal by performing device code authentication with Azure AD and creating the service principal using the credentials that are obtained. Only GraphEndpoint, GraphResourceId, ResourceManagerEndpoint, ResourceManagerResourceId and SubscriptionId need to be specified in params, the other values will be derived.

type ServicePrincipalParams

type ServicePrincipalParams struct {
	CloudName string
	// Credential is the authorization needed to contact the
	// Azure graph API.
	Credential azcore.TokenCredential

	// SubscriptionId is the subscription ID of the account creating
	// the service principal.
	SubscriptionId string

	// TenantId is the tenant that the account creating the service
	// principal belongs to.
	TenantId string
}

ServicePrincipalParams are used when creating Juju service principal.

Jump to

Keyboard shortcuts

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