Browse Source

move ACI/ECS -specific const to related packages

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 4 years ago
parent
commit
88ba4599b2
3 changed files with 8 additions and 9 deletions
  1. 4 1
      aci/login/client.go
  2. 4 1
      ecs/sdk.go
  3. 0 7
      internal/variables.go

+ 4 - 1
aci/login/client.go

@@ -34,6 +34,9 @@ import (
 	"github.com/docker/compose-cli/pkg/api"
 )
 
+// UserAgentName is the default user agent used by the cli
+const UserAgentName = "docker-cli"
+
 // NewContainerGroupsClient get client toi manipulate containerGrouos
 func NewContainerGroupsClient(subscriptionID string) (containerinstance.ContainerGroupsClient, error) {
 	authorizer, mgmtURL, err := getClientSetupData()
@@ -52,7 +55,7 @@ func NewContainerGroupsClient(subscriptionID string) (containerinstance.Containe
 }
 
 func setupClient(aciClient *autorest.Client, auth autorest.Authorizer) {
-	aciClient.UserAgent = internal.UserAgentName + "/" + internal.Version
+	aciClient.UserAgent = UserAgentName + "/" + internal.Version
 	aciClient.Authorizer = auth
 }
 

+ 4 - 1
ecs/sdk.go

@@ -79,9 +79,12 @@ type sdk struct {
 // sdk implement API
 var _ API = sdk{}
 
+// UserAgentName is the ECS specific user agent used by the cli
+const UserAgentName = "Docker CLI"
+
 func newSDK(sess *session.Session) sdk {
 	sess.Handlers.Build.PushBack(func(r *request.Request) {
-		request.AddToUserAgent(r, internal.ECSUserAgentName+"/"+internal.Version)
+		request.AddToUserAgent(r, UserAgentName+"/"+internal.Version)
 	})
 	return sdk{
 		ECS:      ecs.New(sess),

+ 0 - 7
internal/variables.go

@@ -16,13 +16,6 @@
 
 package internal
 
-const (
-	// UserAgentName is the default user agent used by the cli
-	UserAgentName = "docker-cli"
-	// ECSUserAgentName is the ECS specific user agent used by the cli
-	ECSUserAgentName = "Docker CLI"
-)
-
 var (
 	// Version is the version of the CLI injected in compilation time
 	Version = "dev"