Documentation ¶
Overview ¶
Package azure is a generated GoMock package.
Index ¶
- func ProfilePath() (string, error)
- type AzureCredentialKind
- type Client
- type MockClient
- func (m *MockClient) CheckResourceGroupExistence(arg0 context.Context, arg1, arg2 string) (bool, error)
- func (m *MockClient) CreateOrUpdateResourceGroup(arg0 context.Context, arg1, arg2, arg3 string) error
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) Locations(arg0 context.Context, arg1 string) ([]armsubscriptions.Location, error)
- func (m *MockClient) ResourceGroups(arg0 context.Context, arg1 string) ([]armresources.ResourceGroup, error)
- func (m *MockClient) Subscriptions(arg0 context.Context) (*SubscriptionResult, error)
- type MockClientCheckResourceGroupExistenceCall
- func (c *MockClientCheckResourceGroupExistenceCall) Do(f func(context.Context, string, string) (bool, error)) *MockClientCheckResourceGroupExistenceCall
- func (c *MockClientCheckResourceGroupExistenceCall) DoAndReturn(f func(context.Context, string, string) (bool, error)) *MockClientCheckResourceGroupExistenceCall
- func (c *MockClientCheckResourceGroupExistenceCall) Return(arg0 bool, arg1 error) *MockClientCheckResourceGroupExistenceCall
- type MockClientCreateOrUpdateResourceGroupCall
- func (c *MockClientCreateOrUpdateResourceGroupCall) Do(f func(context.Context, string, string, string) error) *MockClientCreateOrUpdateResourceGroupCall
- func (c *MockClientCreateOrUpdateResourceGroupCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockClientCreateOrUpdateResourceGroupCall
- func (c *MockClientCreateOrUpdateResourceGroupCall) Return(arg0 error) *MockClientCreateOrUpdateResourceGroupCall
- type MockClientLocationsCall
- func (c *MockClientLocationsCall) Do(f func(context.Context, string) ([]armsubscriptions.Location, error)) *MockClientLocationsCall
- func (c *MockClientLocationsCall) DoAndReturn(f func(context.Context, string) ([]armsubscriptions.Location, error)) *MockClientLocationsCall
- func (c *MockClientLocationsCall) Return(arg0 []armsubscriptions.Location, arg1 error) *MockClientLocationsCall
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) CheckResourceGroupExistence(arg0, arg1, arg2 any) *MockClientCheckResourceGroupExistenceCall
- func (mr *MockClientMockRecorder) CreateOrUpdateResourceGroup(arg0, arg1, arg2, arg3 any) *MockClientCreateOrUpdateResourceGroupCall
- func (mr *MockClientMockRecorder) Locations(arg0, arg1 any) *MockClientLocationsCall
- func (mr *MockClientMockRecorder) ResourceGroups(arg0, arg1 any) *MockClientResourceGroupsCall
- func (mr *MockClientMockRecorder) Subscriptions(arg0 any) *MockClientSubscriptionsCall
- type MockClientResourceGroupsCall
- func (c *MockClientResourceGroupsCall) Do(f func(context.Context, string) ([]armresources.ResourceGroup, error)) *MockClientResourceGroupsCall
- func (c *MockClientResourceGroupsCall) DoAndReturn(f func(context.Context, string) ([]armresources.ResourceGroup, error)) *MockClientResourceGroupsCall
- func (c *MockClientResourceGroupsCall) Return(arg0 []armresources.ResourceGroup, arg1 error) *MockClientResourceGroupsCall
- type MockClientSubscriptionsCall
- func (c *MockClientSubscriptionsCall) Do(f func(context.Context) (*SubscriptionResult, error)) *MockClientSubscriptionsCall
- func (c *MockClientSubscriptionsCall) DoAndReturn(f func(context.Context) (*SubscriptionResult, error)) *MockClientSubscriptionsCall
- func (c *MockClientSubscriptionsCall) Return(arg0 *SubscriptionResult, arg1 error) *MockClientSubscriptionsCall
- type Profile
- type Provider
- type ServicePrincipalCredential
- type Subscription
- type SubscriptionResult
- type User
- type WorkloadIdentityCredential
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProfilePath ¶
ProfilePath() checks for the presence of a config directory and returns the path to the azureProfileJSON file in that directory, or if the config directory is not present, it returns the path to the azureProfileJSON file in the user's home directory. If an error occurs, an error is returned.
Types ¶
type AzureCredentialKind ¶ added in v0.35.0
type AzureCredentialKind string
AzureCredentialKind - Azure credential kinds supported.
const ( // ProviderDisplayName is the text used in display for Azure. ProviderDisplayName = "Azure" AzureCredentialKindWorkloadIdentity AzureCredentialKind = "WorkloadIdentity" AzureCredentialKindServicePrincipal AzureCredentialKind = "ServicePrincipal" )
type Client ¶
type Client interface { // Locations lists the locations available for a subscription. Locations(ctx context.Context, subscriptionID string) ([]armsubscriptions.Location, error) // Subscriptions lists the subscriptions available to the user. Subscriptions(ctx context.Context) (*SubscriptionResult, error) // ResourceGroups lists the existing resource groups in a subscription. ResourceGroups(ctx context.Context, subscriptionID string) ([]armresources.ResourceGroup, error) // CheckResourceGroupExistence checks if a resource group exists. CheckResourceGroupExistence(ctx context.Context, subscriptionID string, resourceGroupName string) (bool, error) // CreateOrUpdateResourceGroup creates or updates a resource group. CreateOrUpdateResourceGroup(ctx context.Context, subscriptionID string, resourceGroupName string, location string) error }
Client is an interface that abstracts `rad init`'s interactions with Azure. This is for testing purposes.
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) CheckResourceGroupExistence ¶
func (m *MockClient) CheckResourceGroupExistence(arg0 context.Context, arg1, arg2 string) (bool, error)
CheckResourceGroupExistence mocks base method.
func (*MockClient) CreateOrUpdateResourceGroup ¶
func (m *MockClient) CreateOrUpdateResourceGroup(arg0 context.Context, arg1, arg2, arg3 string) error
CreateOrUpdateResourceGroup mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) Locations ¶
func (m *MockClient) Locations(arg0 context.Context, arg1 string) ([]armsubscriptions.Location, error)
Locations mocks base method.
func (*MockClient) ResourceGroups ¶
func (m *MockClient) ResourceGroups(arg0 context.Context, arg1 string) ([]armresources.ResourceGroup, error)
ResourceGroups mocks base method.
func (*MockClient) Subscriptions ¶
func (m *MockClient) Subscriptions(arg0 context.Context) (*SubscriptionResult, error)
Subscriptions mocks base method.
type MockClientCheckResourceGroupExistenceCall ¶ added in v0.35.0
MockClientCheckResourceGroupExistenceCall wrap *gomock.Call
func (*MockClientCheckResourceGroupExistenceCall) Do ¶ added in v0.35.0
func (c *MockClientCheckResourceGroupExistenceCall) Do(f func(context.Context, string, string) (bool, error)) *MockClientCheckResourceGroupExistenceCall
Do rewrite *gomock.Call.Do
func (*MockClientCheckResourceGroupExistenceCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientCheckResourceGroupExistenceCall) DoAndReturn(f func(context.Context, string, string) (bool, error)) *MockClientCheckResourceGroupExistenceCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientCheckResourceGroupExistenceCall) Return ¶ added in v0.35.0
func (c *MockClientCheckResourceGroupExistenceCall) Return(arg0 bool, arg1 error) *MockClientCheckResourceGroupExistenceCall
Return rewrite *gomock.Call.Return
type MockClientCreateOrUpdateResourceGroupCall ¶ added in v0.35.0
MockClientCreateOrUpdateResourceGroupCall wrap *gomock.Call
func (*MockClientCreateOrUpdateResourceGroupCall) Do ¶ added in v0.35.0
func (c *MockClientCreateOrUpdateResourceGroupCall) Do(f func(context.Context, string, string, string) error) *MockClientCreateOrUpdateResourceGroupCall
Do rewrite *gomock.Call.Do
func (*MockClientCreateOrUpdateResourceGroupCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientCreateOrUpdateResourceGroupCall) DoAndReturn(f func(context.Context, string, string, string) error) *MockClientCreateOrUpdateResourceGroupCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientCreateOrUpdateResourceGroupCall) Return ¶ added in v0.35.0
func (c *MockClientCreateOrUpdateResourceGroupCall) Return(arg0 error) *MockClientCreateOrUpdateResourceGroupCall
Return rewrite *gomock.Call.Return
type MockClientLocationsCall ¶ added in v0.35.0
MockClientLocationsCall wrap *gomock.Call
func (*MockClientLocationsCall) Do ¶ added in v0.35.0
func (c *MockClientLocationsCall) Do(f func(context.Context, string) ([]armsubscriptions.Location, error)) *MockClientLocationsCall
Do rewrite *gomock.Call.Do
func (*MockClientLocationsCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientLocationsCall) DoAndReturn(f func(context.Context, string) ([]armsubscriptions.Location, error)) *MockClientLocationsCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientLocationsCall) Return ¶ added in v0.35.0
func (c *MockClientLocationsCall) Return(arg0 []armsubscriptions.Location, arg1 error) *MockClientLocationsCall
Return rewrite *gomock.Call.Return
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) CheckResourceGroupExistence ¶
func (mr *MockClientMockRecorder) CheckResourceGroupExistence(arg0, arg1, arg2 any) *MockClientCheckResourceGroupExistenceCall
CheckResourceGroupExistence indicates an expected call of CheckResourceGroupExistence.
func (*MockClientMockRecorder) CreateOrUpdateResourceGroup ¶
func (mr *MockClientMockRecorder) CreateOrUpdateResourceGroup(arg0, arg1, arg2, arg3 any) *MockClientCreateOrUpdateResourceGroupCall
CreateOrUpdateResourceGroup indicates an expected call of CreateOrUpdateResourceGroup.
func (*MockClientMockRecorder) Locations ¶
func (mr *MockClientMockRecorder) Locations(arg0, arg1 any) *MockClientLocationsCall
Locations indicates an expected call of Locations.
func (*MockClientMockRecorder) ResourceGroups ¶
func (mr *MockClientMockRecorder) ResourceGroups(arg0, arg1 any) *MockClientResourceGroupsCall
ResourceGroups indicates an expected call of ResourceGroups.
func (*MockClientMockRecorder) Subscriptions ¶
func (mr *MockClientMockRecorder) Subscriptions(arg0 any) *MockClientSubscriptionsCall
Subscriptions indicates an expected call of Subscriptions.
type MockClientResourceGroupsCall ¶ added in v0.35.0
MockClientResourceGroupsCall wrap *gomock.Call
func (*MockClientResourceGroupsCall) Do ¶ added in v0.35.0
func (c *MockClientResourceGroupsCall) Do(f func(context.Context, string) ([]armresources.ResourceGroup, error)) *MockClientResourceGroupsCall
Do rewrite *gomock.Call.Do
func (*MockClientResourceGroupsCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientResourceGroupsCall) DoAndReturn(f func(context.Context, string) ([]armresources.ResourceGroup, error)) *MockClientResourceGroupsCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientResourceGroupsCall) Return ¶ added in v0.35.0
func (c *MockClientResourceGroupsCall) Return(arg0 []armresources.ResourceGroup, arg1 error) *MockClientResourceGroupsCall
Return rewrite *gomock.Call.Return
type MockClientSubscriptionsCall ¶ added in v0.35.0
MockClientSubscriptionsCall wrap *gomock.Call
func (*MockClientSubscriptionsCall) Do ¶ added in v0.35.0
func (c *MockClientSubscriptionsCall) Do(f func(context.Context) (*SubscriptionResult, error)) *MockClientSubscriptionsCall
Do rewrite *gomock.Call.Do
func (*MockClientSubscriptionsCall) DoAndReturn ¶ added in v0.35.0
func (c *MockClientSubscriptionsCall) DoAndReturn(f func(context.Context) (*SubscriptionResult, error)) *MockClientSubscriptionsCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockClientSubscriptionsCall) Return ¶ added in v0.35.0
func (c *MockClientSubscriptionsCall) Return(arg0 *SubscriptionResult, arg1 error) *MockClientSubscriptionsCall
Return rewrite *gomock.Call.Return
type Profile ¶
type Profile struct { InstallationID string `json:"installationId"` Subscriptions []Subscription `json:"subscriptions"` }
Profile represents a Profile from the Azure CLI
func LoadProfile ¶
LoadProfile reads a file from the given path, decodes it into a Profile representation and returns the result, or an error if the file could not be read or decoded.
type Provider ¶
type Provider struct { SubscriptionID string ResourceGroup string CredentialKind AzureCredentialKind WorkloadIdentity *WorkloadIdentityCredential ServicePrincipal *ServicePrincipalCredential }
Provider specifies the properties required to configure Azure provider for cloud resources
type ServicePrincipalCredential ¶ added in v0.35.0
ServicePrincipal specifies the properties of an Azure service principal
type Subscription ¶
type Subscription struct { EnvironmentName string `json:"environmentName"` ID string `json:"id"` IsDefault bool `json:"isDefault"` Name string `json:"name"` State string `json:"state"` TenantID string `json:"tenantId"` User *User `json:"user"` }
Subscription represents a Subscription from the Azure CLI
type SubscriptionResult ¶
type SubscriptionResult struct { Default *Subscription Subscriptions []Subscription }
SubscriptionResult is the result of loading Azure subscriptions for the user.
func LoadSubscriptionsFromAzure ¶
func LoadSubscriptionsFromAzure(ctx context.Context, options clientv2.Options) (*SubscriptionResult, error)
LoadSubscriptionsFromAzure retrieves a list of subscriptions from Azure and returns them in a SubscriptionResult struct.
It returns an error if there is an issue retrieving the list.
func LoadSubscriptionsFromProfile ¶
func LoadSubscriptionsFromProfile() (*SubscriptionResult, error)
LoadSubscriptionsFromProfile() reads the profile from a file, filters out the enabled subscriptions and returns a SubscriptionResult object containing the enabled subscriptions and the default subscription. If an error occurs, an error is returned.
type WorkloadIdentityCredential ¶ added in v0.35.0
WorkloadIdentityCredential specifies the properties of an Azure service principal