Documentation ¶
Overview ¶
Package azure is a generated GoMock package.
Index ¶
- Constants
- func ProfilePath() (string, error)
- 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 MockClientMockRecorder
- func (mr *MockClientMockRecorder) CheckResourceGroupExistence(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) CreateOrUpdateResourceGroup(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Locations(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) ResourceGroups(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) Subscriptions(arg0 interface{}) *gomock.Call
- type Profile
- type Provider
- type ServicePrincipal
- type Subscription
- type SubscriptionResult
- type User
Constants ¶
const (
// ProviderDisplayName is the text used in display for Azure.
ProviderDisplayName = "Azure"
)
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 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 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 interface{}) *gomock.Call
CheckResourceGroupExistence indicates an expected call of CheckResourceGroupExistence.
func (*MockClientMockRecorder) CreateOrUpdateResourceGroup ¶
func (mr *MockClientMockRecorder) CreateOrUpdateResourceGroup(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
CreateOrUpdateResourceGroup indicates an expected call of CreateOrUpdateResourceGroup.
func (*MockClientMockRecorder) Locations ¶
func (mr *MockClientMockRecorder) Locations(arg0, arg1 interface{}) *gomock.Call
Locations indicates an expected call of Locations.
func (*MockClientMockRecorder) ResourceGroups ¶
func (mr *MockClientMockRecorder) ResourceGroups(arg0, arg1 interface{}) *gomock.Call
ResourceGroups indicates an expected call of ResourceGroups.
func (*MockClientMockRecorder) Subscriptions ¶
func (mr *MockClientMockRecorder) Subscriptions(arg0 interface{}) *gomock.Call
Subscriptions indicates an expected call of Subscriptions.
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 ServicePrincipal *ServicePrincipal }
Provider specifies the properties required to configure Azure provider for cloud resources
type ServicePrincipal ¶
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.