Documentation ¶
Index ¶
- Constants
- Variables
- func DiscoverTenantID(ctx context.Context, subscriptionID string, clientOpts arm.ClientOptions) (string, error)
- func MaybeJujuApplicationObjectID(appID string) (string, error)
- func ReportableError(err error) error
- type DataError
- type ServicePrincipalCreator
- func (c *ServicePrincipalCreator) Create(sdkCtx context.Context, params ServicePrincipalParams) (appid, spid, password string, err error)
- func (c *ServicePrincipalCreator) InteractiveCreate(sdkCtx context.Context, stderr io.Writer, params ServicePrincipalParams) (appid, spid, password string, _ error)
- type ServicePrincipalParams
Constants ¶
const ( AzureCloud = "AzureCloud" AzureChinaCloud = "AzureChinaCloud" AzureUSGovernment = "AzureUSGovernment" )
Variables ¶
var JujuActions = []string{
"Microsoft.Compute/*",
"Microsoft.KeyVault/*",
"Microsoft.Network/*",
"Microsoft.Resources/*",
"Microsoft.Storage/*",
"Microsoft.ManagedIdentity/userAssignedIdentities/*",
}
JujuActions contains the allowed actions needed by a Juju controller.
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 ¶
MaybeJujuApplicationObjectID returns the Juju Application Object ID if the passed in application ID is the Juju Enterprise App. This is only needed for very old credentials. At some point we should be able to delete it.
func ReportableError ¶
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 ¶
AsDataError returns a wrapped error that exposes the underlying error code and message (if possible).
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 // ApplicationName is the name of the enterprise app with which // the service principal is associated. ApplicationName string // RoleDefinitionName is the name of the role definition holding // the allowed actions for a Juju controller. RoleDefinitionName string }
ServicePrincipalParams are used when creating Juju service principal.