move ACI/ECS -specific const to related packages

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-08-31 16:05:32 +02:00
parent fcb91096b8
commit 88ba4599b2
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
3 changed files with 8 additions and 9 deletions

View File

@ -34,6 +34,9 @@ import (
"github.com/docker/compose-cli/pkg/api" "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 // NewContainerGroupsClient get client toi manipulate containerGrouos
func NewContainerGroupsClient(subscriptionID string) (containerinstance.ContainerGroupsClient, error) { func NewContainerGroupsClient(subscriptionID string) (containerinstance.ContainerGroupsClient, error) {
authorizer, mgmtURL, err := getClientSetupData() authorizer, mgmtURL, err := getClientSetupData()
@ -52,7 +55,7 @@ func NewContainerGroupsClient(subscriptionID string) (containerinstance.Containe
} }
func setupClient(aciClient *autorest.Client, auth autorest.Authorizer) { func setupClient(aciClient *autorest.Client, auth autorest.Authorizer) {
aciClient.UserAgent = internal.UserAgentName + "/" + internal.Version aciClient.UserAgent = UserAgentName + "/" + internal.Version
aciClient.Authorizer = auth aciClient.Authorizer = auth
} }

View File

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

View File

@ -16,13 +16,6 @@
package internal 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 ( var (
// Version is the version of the CLI injected in compilation time // Version is the version of the CLI injected in compilation time
Version = "dev" Version = "dev"