diff --git a/vendor.conf b/vendor.conf index 9a6d2aba98..73e1fe0bad 100755 --- a/vendor.conf +++ b/vendor.conf @@ -24,7 +24,7 @@ github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 github.com/docker/go-metrics d466d4f6fd960e01820085bd7e1a24426ee7ef18 github.com/docker/go-units 47565b4f722fb6ceae66b95f853feed578a4a51c # v0.3.3 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a -github.com/docker/licensing f2eae57157a06681b024f1690923d03e414179a0 +github.com/docker/licensing 1c117a1720cb413dd6a101d36a6c567b1ccb90fe github.com/docker/swarmkit 8af8c420f491f006ab1730e08d446a795b1667d7 github.com/flynn-archive/go-shlex 3f9db97f856818214da2e1057f8ad84803971cff github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 # v1.0.0 diff --git a/vendor/github.com/docker/licensing/accounts.go b/vendor/github.com/docker/licensing/accounts.go deleted file mode 100644 index 312faff143..0000000000 --- a/vendor/github.com/docker/licensing/accounts.go +++ /dev/null @@ -1,32 +0,0 @@ -package licensing - -import ( - "context" - - "github.com/docker/licensing/lib/go-clientlib" - "github.com/docker/licensing/model" -) - -func (c *client) createAccount(ctx context.Context, dockerID string, request *model.AccountCreationRequest) (*model.Account, error) { - url := c.baseURI - url.Path += "/api/billing/v4/accounts/" + dockerID - - response := new(model.Account) - if _, _, err := c.doReq(ctx, "PUT", &url, clientlib.SendJSON(request), clientlib.RecvJSON(response)); err != nil { - return nil, err - } - - return response, nil -} - -func (c *client) getAccount(ctx context.Context, dockerID string) (*model.Account, error) { - url := c.baseURI - url.Path += "/api/billing/v4/accounts/" + dockerID - - response := new(model.Account) - if _, _, err := c.doReq(ctx, "GET", &url, clientlib.RecvJSON(response)); err != nil { - return nil, err - } - - return response, nil -} diff --git a/vendor/github.com/docker/licensing/client.go b/vendor/github.com/docker/licensing/client.go index 62a2cd524d..1ad0d87fbd 100644 --- a/vendor/github.com/docker/licensing/client.go +++ b/vendor/github.com/docker/licensing/client.go @@ -28,7 +28,7 @@ type Client interface { GetHubUserOrgs(ctx context.Context, authToken string) (orgs []model.Org, err error) GetHubUserByName(ctx context.Context, username string) (user *model.User, err error) VerifyLicense(ctx context.Context, license model.IssuedLicense) (res *model.CheckResponse, err error) - GenerateNewTrialSubscription(ctx context.Context, authToken, dockerID, email string) (subscriptionID string, err error) + GenerateNewTrialSubscription(ctx context.Context, authToken, dockerID string) (subscriptionID string, err error) ListSubscriptions(ctx context.Context, authToken, dockerID string) (response []*model.Subscription, err error) ListSubscriptionsDetails(ctx context.Context, authToken, dockerID string) (response []*model.SubscriptionDetail, err error) DownloadLicenseFromHub(ctx context.Context, authToken, subscriptionID string) (license *model.IssuedLicense, err error) @@ -80,31 +80,9 @@ func (c *client) VerifyLicense(ctx context.Context, license model.IssuedLicense) return res, nil } -func (c *client) GenerateNewTrialSubscription(ctx context.Context, authToken, dockerID, email string) (string, error) { +func (c *client) GenerateNewTrialSubscription(ctx context.Context, authToken, dockerID string) (string, error) { ctx = jwt.NewContext(ctx, authToken) - if _, err := c.getAccount(ctx, dockerID); err != nil { - code, ok := errors.HTTPStatus(err) - // create billing account if one is not found - if ok && code == http.StatusNotFound { - _, err = c.createAccount(ctx, dockerID, &model.AccountCreationRequest{ - Profile: model.Profile{ - Email: email, - }, - }) - if err != nil { - return "", errors.Wrap(err, errors.Fields{ - "dockerID": dockerID, - "email": email, - }) - } - } else { - return "", errors.Wrap(err, errors.Fields{ - "dockerID": dockerID, - }) - } - } - sub, err := c.createSubscription(ctx, &model.SubscriptionCreationRequest{ Name: "Docker Enterprise Free Trial", DockerID: dockerID, @@ -116,8 +94,7 @@ func (c *client) GenerateNewTrialSubscription(ctx context.Context, authToken, do }) if err != nil { return "", errors.Wrap(err, errors.Fields{ - "dockerID": dockerID, - "email": email, + "docker_id": dockerID, }) } @@ -131,7 +108,7 @@ func (c *client) ListSubscriptions(ctx context.Context, authToken, dockerID stri subs, err := c.listSubscriptions(ctx, map[string]string{"docker_id": dockerID}) if err != nil { return nil, errors.Wrap(err, errors.Fields{ - "dockerID": dockerID, + "docker_id": dockerID, }) } @@ -155,7 +132,7 @@ func (c *client) ListSubscriptionsDetails(ctx context.Context, authToken, docker subs, err := c.listSubscriptionsDetails(ctx, map[string]string{"docker_id": dockerID}) if err != nil { return nil, errors.Wrap(err, errors.Fields{ - "dockerID": dockerID, + "docker_id": dockerID, }) } diff --git a/vendor/github.com/docker/licensing/model/accounts.go b/vendor/github.com/docker/licensing/model/accounts.go deleted file mode 100644 index a646ecd9fb..0000000000 --- a/vendor/github.com/docker/licensing/model/accounts.go +++ /dev/null @@ -1,61 +0,0 @@ -package model - -import ( - "github.com/docker/licensing/lib/go-validation" -) - -// Profile represents an Account profile -type Profile struct { - Email string `json:"email"` - FirstName string `json:"first_name"` - LastName string `json:"last_name"` - - Addresses []*Address `json:"addresses,omitempty"` - CompanyName string `json:"company_name,omitempty"` - PhonePrimary string `json:"phone_primary,omitempty"` - JobFunction string `json:"job_function,omitempty"` - VatID string `json:"vat_id,omitempty"` -} - -// Address represents a Profile address -type Address struct { - AddressLine1 string `json:"address_line_1,omitempty"` - AddressLine2 string `json:"address_line_2,omitempty"` - AddressLine3 string `json:"address_line_3,omitempty"` - City string `json:"city,omitempty"` - Province string `json:"province,omitempty"` - Country string `json:"country,omitempty"` - Postcode string `json:"post_code,omitempty"` - PrimaryAddress bool `json:"primary_address,omitempty"` -} - -// Account represents a billing profile -type Account struct { - DockerID string `json:"docker_id"` - - Profile Profile `json:"profile"` -} - -// AccountCreationRequest represents an Account creation request -type AccountCreationRequest struct { - Profile Profile `json:"profile"` -} - -// Validate returns true if the account request is valid, false otherwise. -// If invalid, one or more validation Errors will be returned. -func (a *AccountCreationRequest) Validate() (bool, validation.Errors) { - profile := a.Profile - - var errs validation.Errors - - if validation.IsEmpty(profile.Email) { - errs = append(errs, validation.InvalidEmpty("email")) - } - - if !validation.IsEmpty(profile.Email) && !validation.IsEmail(profile.Email) { - errs = append(errs, validation.InvalidEmail("email", profile.Email)) - } - - valid := len(errs) == 0 - return valid, errs -} diff --git a/vendor/github.com/docker/licensing/model/users.go b/vendor/github.com/docker/licensing/model/users.go index c61389da14..24da8c2793 100644 --- a/vendor/github.com/docker/licensing/model/users.go +++ b/vendor/github.com/docker/licensing/model/users.go @@ -21,10 +21,6 @@ type User struct { Company string `json:"company,omitempty"` ProfileURL string `json:"profile_url,omitempty"` GravatarURL string `json:"gravatar_url,omitempty"` - - Email string `json:"email"` - Primary bool `json:"primary"` - Verified bool `json:"verified"` } // Org details a Docker organization