Documentation ¶
Index ¶
- type CheckResponse
- type EusaState
- type IssuedLicense
- type LoginError
- type LoginRequest
- type LoginResult
- type Metadata
- type Org
- type PaginatedMeta
- type PaginationParams
- type PricingComponents
- type RawLoginError
- type Subscription
- type SubscriptionCreationRequest
- type SubscriptionDetail
- type SubscriptionPricingComponent
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResponse ¶
type CheckResponse struct { Expiration time.Time `json:"expiration"` Token string `json:"token"` MaxEngines int `json:"maxEngines"` ScanningEnabled bool `json:"scanningEnabled"` Type string `json:"licenseType"` Tier string `json:"tier"` SubscriptionID string `json:"subscription_id,omitempty"` ProductID string `json:"product_id,omitempty"` RatePlanID string `json:"rate_plan_id,omitempty"` Version int `json:"version"` GraceDays int `json:"grace_days,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` PricingComponents PricingComponents `json:"pricing_components,omitempty"` }
A CheckResponse is the internal content of the PublicCheckResponse signed json blob.
type EusaState ¶
type EusaState struct { Accepted bool `json:"accepted"` AcceptedBy string `json:"accepted_by,omitempty"` AcceptedOn string `json:"accepted_on,omitempty"` }
EusaState encodes whether the subscription's EUSA has been accepted, and if so, by whom and when. See json marshal & unmarshal below.
type IssuedLicense ¶
type IssuedLicense struct { KeyID string `json:"key_id"` PrivateKey string `json:"private_key"` Authorization string `json:"authorization"` }
IssuedLicense represents an issued license
func (*IssuedLicense) Valid ¶
func (l *IssuedLicense) Valid() (bool, string)
Valid returns true if the License is syntactically valid, false otherwise
type LoginError ¶
type LoginError struct { *errors.HTTPError // Raw is the raw error from Accounts service Raw *RawLoginError }
LoginError wraps both the http error and raw hub login error
func (*LoginError) Error ¶
func (e *LoginError) Error() string
type LoginRequest ¶
LoginRequest holds a hub user's username and password
type LoginResult ¶
type LoginResult struct { // JWT associated with the authenticated user Token string `json:"token"` }
LoginResult holds the response of the login endpoint
type Metadata ¶
type Metadata struct { Username string `json:"username,omitempty"` Company string `json:"company,omitempty"` }
Metadata holds non-essential license information, that is, anything that is not required by clients to ensure the license is valid
type Org ¶
type Org struct { ID string `json:"id"` Orgname string `json:"orgname"` DateJoined time.Time `json:"date_joined"` Type string `json:"type"` FullName string `json:"full_name,omitempty"` Location string `json:"location,omitempty"` Company string `json:"company,omitempty"` ProfileURL string `json:"profile_url,omitempty"` GravatarURL string `json:"gravatar_url,omitempty"` }
Org details a Docker organization
type PaginatedMeta ¶
type PaginatedMeta struct { Count int `json:"count"` PageSize int `json:"page_size,omitempty"` Next *string `json:"next,omitempty"` Previous *string `json:"previous,omitempty"` }
PaginatedMeta describes fields contained in a paginated response body
type PaginationParams ¶
PaginationParams is used for specifying pagination in requests to accounts
type PricingComponents ¶
type PricingComponents []*SubscriptionPricingComponent
PricingComponents represents a collection of pricing components
func (PricingComponents) Len ¶
func (comps PricingComponents) Len() int
func (PricingComponents) Less ¶
func (comps PricingComponents) Less(i, j int) bool
always sorting by name
func (PricingComponents) Swap ¶
func (comps PricingComponents) Swap(i, j int)
type RawLoginError ¶
type RawLoginError struct { Detail string `json:"detail,omitempty"` // These fields wil be populated if it's a validation error Username []string `json:"username,omitempty"` Password []string `json:"password,omitempty"` }
RawLoginError is the raw format of errors returned from the Accounts service.
type Subscription ¶
type Subscription struct { Name string `json:"name"` ID string `json:"subscription_id"` DockerID string `json:"docker_id"` ProductID string `json:"product_id"` ProductRatePlan string `json:"product_rate_plan"` ProductRatePlanID string `json:"product_rate_plan_id"` Start *time.Time `json:"current_period_start,omitempty"` Expires *time.Time `json:"current_period_end,omitempty"` State string `json:"state"` Eusa *EusaState `json:"eusa,omitempty"` PricingComponents PricingComponents `json:"pricing_components"` GraceDays int `json:"grace_days"` }
Subscription includes the base fields that will be meaningful to most of the clients consuming this api
func (*Subscription) GetFeatureValue ¶
func (s *Subscription) GetFeatureValue(featureName string) (int, bool)
GetFeatureValue returns true if a given feature is among a subscription's pricing component entitlements along with it's corresponding value and false if it is not found
func (*Subscription) String ¶
func (s *Subscription) String() string
type SubscriptionCreationRequest ¶
type SubscriptionCreationRequest struct { Name string `json:"name"` DockerID string `json:"docker_id"` ProductID string `json:"product_id"` ProductRatePlan string `json:"product_rate_plan"` Eusa *EusaState `json:"eusa,omitempty"` Origin string `json:"origin,omitempty"` OrderID string `json:"order_id,omitempty"` OrderItemID string `json:"order_item_id,omitempty"` End *time.Time `json:"end,omitempty"` Start *time.Time `json:"start,omitempty"` CouponCodes []string `json:"coupon_codes"` PricingComponents PricingComponents `json:"pricing_components"` // If true, the product for this subscription uses product keys. To // obtain the keys, the frontend or billing client will need to // make additional calls to the fulfillment service. UsesProductKeys bool `json:"uses_product_keys,omitempty"` // Should be non-empty only if creating a managed subscription that will // be controlled by a partner or publisher. This identifier matches // whatever the fulfillment service uses as guid's for partners. ManagingPartnerID string `json:"managing_partner_id,omitempty"` // Should be non-empty only if creating a managed subscription on behalf // of a partner, and this ID represent's a partner's user's account id. PartnerAccountID string `json:"partner_account_id,omitempty"` // Marketing opt-in for the subscription. This means customer agrees to receive additional marketing emails MarketingOptIn bool `json:"marketing_opt_in"` }
SubscriptionCreationRequest represents a subscription creation request
func (*SubscriptionCreationRequest) Validate ¶
func (s *SubscriptionCreationRequest) Validate() (bool, validation.Errors)
Validate returns true if the subscription request is valid, false otherwise. If invalid, one or more validation Errors will be returned.
type SubscriptionDetail ¶
type SubscriptionDetail struct { Subscription Origin string `json:"origin,omitempty"` OrderID string `json:"order_id,omitempty"` OrderItemID string `json:"order_item_id,omitempty"` InitialPeriodStart time.Time `json:"initial_period_start"` CreatedByID string `json:"created_by_docker_id"` // If true, the product for this subscription uses product keys. To // obtain the keys, the frontend or billing client will need to // make additional calls to the fulfillment service. UsesProductKeys bool `json:"uses_product_keys,omitempty"` // If non-empty, this is a managed subscription, and this identifier is // known to the fulfillment service as a means to uniquely identify the // partner that manages this subscription. // // Different permissions checking will be used to authorize changes and // cancellation; the entity entitled to this subscription (represented // by DockerID) may not change or cancel it directly. ManagingPartnerID string `json:"managing_partner_id,omitempty"` // If non-empty, this is a managed subscription, and this ID belongs to the // account of a user within a partner's account system. PartnerAccountID string `json:"partner_account_id,omitempty"` // Marketing opt-in for the subscription. This means customer agrees to receive additional marketing emails MarketingOptIn bool `json:"marketing_opt_in"` }
SubscriptionDetail presents Subscription information to billing service clients.
type SubscriptionPricingComponent ¶
SubscriptionPricingComponent captures pricing component values that have been selected by the user.
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` DateJoined time.Time `json:"date_joined"` // The user type. Is either 'User' or 'Organization' Type string `json:"type"` FullName string `json:"full_name,omitempty"` Location string `json:"location,omitempty"` Company string `json:"company,omitempty"` ProfileURL string `json:"profile_url,omitempty"` GravatarURL string `json:"gravatar_url,omitempty"` }
User details a Docker user