More renaming

This commit is contained in:
Guillaume Tardif 2020-08-14 17:07:33 +02:00
parent 274dc8283f
commit 4ee5aa6267
5 changed files with 26 additions and 26 deletions

View File

@ -42,7 +42,7 @@ import (
)
func createACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) error {
containerGroupsClient, err := login.GetContainerGroupsClient(aciContext.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(aciContext.SubscriptionID)
if err != nil {
return errors.Wrapf(err, "cannot get container group client")
}
@ -66,7 +66,7 @@ func createACIContainers(ctx context.Context, aciContext store.AciContext, group
func createOrUpdateACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) error {
w := progress.ContextWriter(ctx)
containerGroupsClient, err := login.GetContainerGroupsClient(aciContext.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(aciContext.SubscriptionID)
if err != nil {
return errors.Wrapf(err, "cannot get container group client")
}
@ -121,7 +121,7 @@ func createOrUpdateACIContainers(ctx context.Context, aciContext store.AciContex
}
func getACIContainerGroup(ctx context.Context, aciContext store.AciContext, containerGroupName string) (containerinstance.ContainerGroup, error) {
containerGroupsClient, err := login.GetContainerGroupsClient(aciContext.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(aciContext.SubscriptionID)
if err != nil {
return containerinstance.ContainerGroup{}, fmt.Errorf("cannot get container group client: %v", err)
}
@ -130,7 +130,7 @@ func getACIContainerGroup(ctx context.Context, aciContext store.AciContext, cont
}
func deleteACIContainerGroup(ctx context.Context, aciContext store.AciContext, containerGroupName string) (containerinstance.ContainerGroup, error) {
containerGroupsClient, err := login.GetContainerGroupsClient(aciContext.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(aciContext.SubscriptionID)
if err != nil {
return containerinstance.ContainerGroup{}, fmt.Errorf("cannot get container group client: %v", err)
}
@ -139,7 +139,7 @@ func deleteACIContainerGroup(ctx context.Context, aciContext store.AciContext, c
}
func stopACIContainerGroup(ctx context.Context, aciContext store.AciContext, containerGroupName string) error {
containerGroupsClient, err := login.GetContainerGroupsClient(aciContext.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(aciContext.SubscriptionID)
if err != nil {
return fmt.Errorf("cannot get container group client: %v", err)
}
@ -152,7 +152,7 @@ func stopACIContainerGroup(ctx context.Context, aciContext store.AciContext, con
}
func execACIContainer(ctx context.Context, aciContext store.AciContext, command, containerGroup string, containerName string) (c containerinstance.ContainerExecResponse, err error) {
containerClient, err := login.GetContainerClient(aciContext.SubscriptionID)
containerClient, err := login.NewContainerClient(aciContext.SubscriptionID)
if err != nil {
return c, errors.Wrapf(err, "cannot get container client")
}
@ -245,7 +245,7 @@ func exec(ctx context.Context, address string, password string, request containe
}
func getACIContainerLogs(ctx context.Context, aciContext store.AciContext, containerGroupName, containerName string, tail *int32) (string, error) {
containerClient, err := login.GetContainerClient(aciContext.SubscriptionID)
containerClient, err := login.NewContainerClient(aciContext.SubscriptionID)
if err != nil {
return "", errors.Wrapf(err, "cannot get container client")
}

View File

@ -133,7 +133,7 @@ type aciContainerService struct {
}
func (cs *aciContainerService) List(ctx context.Context, all bool) ([]containers.Container, error) {
groupsClient, err := login.GetContainerGroupsClient(cs.ctx.SubscriptionID)
groupsClient, err := login.NewContainerGroupsClient(cs.ctx.SubscriptionID)
if err != nil {
return nil, err
}
@ -232,7 +232,7 @@ func (cs *aciContainerService) Start(ctx context.Context, containerID string) er
return errors.New(fmt.Sprintf(msg, containerName, groupName, groupName))
}
containerGroupsClient, err := login.GetContainerGroupsClient(cs.ctx.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(cs.ctx.SubscriptionID)
if err != nil {
return err
}
@ -336,7 +336,7 @@ func (cs *aciContainerService) Delete(ctx context.Context, containerID string, r
}
if !request.Force {
containerGroupsClient, err := login.GetContainerGroupsClient(cs.ctx.SubscriptionID)
containerGroupsClient, err := login.NewContainerGroupsClient(cs.ctx.SubscriptionID)
if err != nil {
return err
}

View File

@ -15,8 +15,8 @@ import (
const userAgent = "docker-cli"
// GetContainerGroupsClient get client toi manipulate containerGrouos
func GetContainerGroupsClient(subscriptionID string) (containerinstance.ContainerGroupsClient, error) {
// NewContainerGroupsClient get client toi manipulate containerGrouos
func NewContainerGroupsClient(subscriptionID string) (containerinstance.ContainerGroupsClient, error) {
containerGroupsClient := containerinstance.NewContainerGroupsClient(subscriptionID)
err := setupClient(&containerGroupsClient.Client)
if err != nil {
@ -38,8 +38,8 @@ func setupClient(aciClient *autorest.Client) error {
return nil
}
// GetStorageAccountsClient get client to manipulate storage accounts
func GetStorageAccountsClient(subscriptionID string) (storage.AccountsClient, error) {
// NewStorageAccountsClient get client to manipulate storage accounts
func NewStorageAccountsClient(subscriptionID string) (storage.AccountsClient, error) {
containerGroupsClient := storage.NewAccountsClient(subscriptionID)
err := setupClient(&containerGroupsClient.Client)
if err != nil {
@ -51,8 +51,8 @@ func GetStorageAccountsClient(subscriptionID string) (storage.AccountsClient, er
return containerGroupsClient, nil
}
// GetSubscriptionsClient get subscription client
func GetSubscriptionsClient() (subscription.SubscriptionsClient, error) {
// NewSubscriptionsClient get subscription client
func NewSubscriptionsClient() (subscription.SubscriptionsClient, error) {
subc := subscription.NewSubscriptionsClient()
err := setupClient(&subc.Client)
if err != nil {
@ -61,8 +61,8 @@ func GetSubscriptionsClient() (subscription.SubscriptionsClient, error) {
return subc, nil
}
// GetGroupsClient get client to manipulate groups
func GetGroupsClient(subscriptionID string) (resources.GroupsClient, error) {
// NewGroupsClient get client to manipulate groups
func NewGroupsClient(subscriptionID string) (resources.GroupsClient, error) {
groupsClient := resources.NewGroupsClient(subscriptionID)
err := setupClient(&groupsClient.Client)
if err != nil {
@ -71,8 +71,8 @@ func GetGroupsClient(subscriptionID string) (resources.GroupsClient, error) {
return groupsClient, nil
}
// GetContainerClient get client to manipulate containers
func GetContainerClient(subscriptionID string) (containerinstance.ContainerClient, error) {
// NewContainerClient get client to manipulate containers
func NewContainerClient(subscriptionID string) (containerinstance.ContainerClient, error) {
containerClient := containerinstance.NewContainerClient(subscriptionID)
err := setupClient(&containerClient.Client)
if err != nil {

View File

@ -17,7 +17,7 @@ type StorageAccountHelper struct {
// GetAzureStorageAccountKey retrieves the storage account ket from the current azure login
func (helper StorageAccountHelper) GetAzureStorageAccountKey(ctx context.Context, accountName string) (string, error) {
client, err := GetStorageAccountsClient(helper.AciContext.SubscriptionID)
client, err := NewStorageAccountsClient(helper.AciContext.SubscriptionID)
if err != nil {
return "", err
}

View File

@ -45,7 +45,7 @@ func NewACIResourceGroupHelper() ResourceGroupHelper {
// GetGroup get a resource group from its name
func (mgt aciResourceGroupHelperImpl) GetGroup(ctx context.Context, subscriptionID string, groupName string) (resources.Group, error) {
gc, err := login.GetGroupsClient(subscriptionID)
gc, err := login.NewGroupsClient(subscriptionID)
if err != nil {
return resources.Group{}, err
}
@ -54,7 +54,7 @@ func (mgt aciResourceGroupHelperImpl) GetGroup(ctx context.Context, subscription
// ListGroups list resource groups
func (mgt aciResourceGroupHelperImpl) ListGroups(ctx context.Context, subscriptionID string) ([]resources.Group, error) {
gc, err := login.GetGroupsClient(subscriptionID)
gc, err := login.NewGroupsClient(subscriptionID)
if err != nil {
return nil, err
}
@ -80,7 +80,7 @@ func (mgt aciResourceGroupHelperImpl) ListGroups(ctx context.Context, subscripti
// CreateOrUpdate create or update a resource group
func (mgt aciResourceGroupHelperImpl) CreateOrUpdate(ctx context.Context, subscriptionID string, resourceGroupName string, parameters resources.Group) (result resources.Group, err error) {
gc, err := login.GetGroupsClient(subscriptionID)
gc, err := login.NewGroupsClient(subscriptionID)
if err != nil {
return resources.Group{}, err
}
@ -89,7 +89,7 @@ func (mgt aciResourceGroupHelperImpl) CreateOrUpdate(ctx context.Context, subscr
// DeleteAsync deletes a resource group. Does not wait for full deletion to return (long operation)
func (mgt aciResourceGroupHelperImpl) DeleteAsync(ctx context.Context, subscriptionID string, resourceGroupName string) (err error) {
gc, err := login.GetGroupsClient(subscriptionID)
gc, err := login.NewGroupsClient(subscriptionID)
if err != nil {
return err
}
@ -100,7 +100,7 @@ func (mgt aciResourceGroupHelperImpl) DeleteAsync(ctx context.Context, subscript
// GetSubscriptionIDs Return available subscription IDs based on azure login
func (mgt aciResourceGroupHelperImpl) GetSubscriptionIDs(ctx context.Context) ([]subscription.Model, error) {
c, err := login.GetSubscriptionsClient()
c, err := login.NewSubscriptionsClient()
if err != nil {
return nil, err
}