store

package
v0.0.0-...-d275bc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SNAP_STORE_ENDPOINTS = StoreEndpoints{
	BaseURL:    "https://dashboard.snapcraft.io",
	StorageURL: "https://upload.apps.staging.ubuntu.com",
}

SNAP_STORE_ENDPOINTS represents the set of endpoints used when interacting with the production Snap store.

View Source
var UBUNTU_ONE_SNAP_STORE_AUTH_ENDPOINTS = StoreAuthEndpoints{
	AuthURL:           "https://login.ubuntu.com",
	Namespace:         "snap",
	Whoami:            "/api/v2/tokens/whoami",
	Tokens:            "/dev/api/acl/",
	TokensExchange:    "/api/v2/tokens/discharge",
	TokensRefresh:     "/api/v2/tokens/refresh",
	ValidPackageTypes: []string{"snap"},
}

UBUNTU_ONE_SNAP_STORE_AUTH_ENDPOINTS represents the set of endpoints used to authenticate against the Snap Store using Ubuntu One credentials.

Functions

This section is empty.

Types

type Package

type Package struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Package is a generic representation of a package in a Canonical store. This could be a snap, a charm, a rock, etc.

func NewSnapPackage

func NewSnapPackage(name string) Package

NewSnapPackage constructs and returns a new package of type "snap".

type StoreAuthEndpoints

type StoreAuthEndpoints struct {
	AuthURL           string
	Namespace         string
	Whoami            string
	Tokens            string
	TokensExchange    string
	TokensRefresh     string
	ValidPackageTypes []string
}

StoreAuthEndpoints represents the authn/authz endpoints to use for a given environment/store.

type StoreClient

type StoreClient struct {
	// contains filtered or unexported fields
}

StoreClient is a wrapper around http.Client for logging into a Canonical store.

func NewSnapStoreClient

func NewSnapStoreClient(credentials config.LoginCredentials) *StoreClient

NewSnapStoreClient constructs a new StoreClient for interacting with the snap store.

func (*StoreClient) GenerateStoreToken

func (sc *StoreClient) GenerateStoreToken(snap, track, channel string) (string, error)

GenerateStoreToken takes a snap, track and channel and returns a token with a TTL of 1 year, with default permissions for the given channel.

type StoreEndpoints

type StoreEndpoints struct {
	BaseURL    string
	StorageURL string
}

StoreEndpoints represents the the base and storage URLs for a given environment/store.

type UbuntuOneToken

type UbuntuOneToken struct {
	TokenType          string             `json:"t"`
	UbuntuOneMacaroons ubuntuOneMacaroons `json:"v"`
}

UbuntuOneToken represents the top-level token object that is returned to the client encoded in base64 for use with CLI tools.

func NewUbuntuOneToken

func NewUbuntuOneToken(rootMacaroon *macaroon.Macaroon, dischargedMacaroon *macaroon.Macaroon) (*UbuntuOneToken, error)

NewUbuntuOneToken constructs a valid UbuntuOneToken given a input root token, and discharged token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL