sdk

package
v0.0.0-...-c5a5fda Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorDlgDetailsInputs      = errors.New("dlgDetails: downloadGroup or productId invalid")
	ErrorNoMatchingFiles       = errors.New("dlgDetails: no files match provided glob")
	ErrorMultipleMatchingFiles = errors.New("dlgDetails: more than 1 file matches glob")
	ErrorEulaUnaccepted        = errors.New("dlgDetails: EULA needs to be accepted for this version")
	ErrorNotEntitled           = errors.New("dlgDetails: user is not entitled to download this file")
)
View Source
var ErrorAuthenticationFailure = errors.New("login: authentication failure")
View Source
var ErrorConnectionFailure = errors.New("login: server did not return 200 ok")
View Source
var ErrorDlgHeader = errors.New("dlgHeader: downloadGroup or productId invalid")
View Source
var ErrorEulaInputs = errors.New("eula: downloadGroup or productId invalid")
View Source
var ErrorInvalidCategory = errors.New("api: category is not valid")
View Source
var ErrorInvalidDownloadPayload = errors.New("download: invalid download payload")
View Source
var ErrorInvalidMajorVersion = errors.New("major version not found")
View Source
var ErrorInvalidSlug = errors.New("api: slug is not valid")
View Source
var ErrorInvalidSubProduct = errors.New("subproduct: invalid subproduct requested")
View Source
var ErrorInvalidSubProductMajorVersion = errors.New("subproduct: invalid major version requested")
View Source
var ErrorInvalidVersion = errors.New("api: version is not valid")
View Source
var ErrorMultipleVersionGlob = errors.New("versions: invalid glob. a single version glob must be used")
View Source
var ErrorNoMatchingVersions = errors.New("versions: invalid glob. no versions found")
View Source
var ErrorNoVersinGlob = errors.New("versions: invalid glob. glob my be provided")
View Source
var ErrorNon200Response = errors.New("account: server did not respond with 200 ok")
View Source
var ErrorNotAuthenticated = errors.New("generic: returned http 401 not authenticated")
View Source
var ErrorNotAuthorized = errors.New("account: you are not authenticated")
View Source
var ErrorServerError = errors.New("api: server down. 500 error received")
View Source
var ErrorXsrfFailure = errors.New("login: server did not return XSRF token")
View Source
var ProductDetailMap map[string]ProductDetails

Functions

func CheckConnectivity

func CheckConnectivity() (err error)

Types

type APIVersions

type APIVersions struct {
	Code         string
	MajorVersion string
	MinorVersion string
}

type AccntList

type AccntList struct {
	EaNumber  string `json:"eaNumber"`
	EaName    string `json:"eaName"`
	IsDefault string `json:"isDefault"`
}

type AccountInfo

type AccountInfo struct {
	UserType    string      `json:"userType"`
	AccountList []AccntList `json:"accntList"`
}

type AuthorizedDownload

type AuthorizedDownload struct {
	DownloadURL string `json:"downloadURL"`
	FileName    string `json:"fileName"`
}

type Client

type Client struct {
	HttpClient *http.Client
	XsrfToken  string
}

func Login

func Login(username, password string, jar *cookiejar.Jar) (client *Client, err error)

func (*Client) AcceptEula

func (c *Client) AcceptEula(downloadGroup, productId string) (err error)

func (*Client) AccountInfo

func (c *Client) AccountInfo() (data AccountInfo, err error)

func (*Client) CheckLoggedIn

func (c *Client) CheckLoggedIn() (err error)

func (*Client) CurrentUser

func (c *Client) CurrentUser() (data CurrentUser, err error)

func (*Client) EnsureProductDetailMap

func (c *Client) EnsureProductDetailMap() (err error)
func (c *Client) FetchDownloadLink(downloadPayload DownloadPayload) (data AuthorizedDownload, err error)

func (*Client) FetchEulaUrl

func (c *Client) FetchEulaUrl(downloadGroup, productId string) (url string, err error)

func (*Client) FindDlgDetails

func (c *Client) FindDlgDetails(downloadGroup, productId, fileName string) (data FoundDownload, err error)

func (*Client) FindVersion

func (c *Client) FindVersion(slug, subProduct, version, dlgType string) (data APIVersions, err error)

func (*Client) FindVersionFromGlob

func (c *Client) FindVersionFromGlob(versionGlob string, versionMap map[string]APIVersions) (version string, err error)

func (*Client) GenerateDownloadPayload

func (c *Client) GenerateDownloadPayload(slug, subProduct, version, fileName, dlgType string, acceptEula bool) (data []DownloadPayload, err error)

func (*Client) GetCategory

func (c *Client) GetCategory(slug string) (data string, err error)

func (*Client) GetDlgDetails

func (c *Client) GetDlgDetails(downloadGroup, productId string) (data DlgDetails, err error)

curl "https://my.vmware.com/channel/public/api/v1.0/dlg/details?downloadGroup=VMTOOLS1130&productId=1073" |jq

func (*Client) GetDlgEditionsList

func (c *Client) GetDlgEditionsList(slug, majorVersion, dlgType string) (data []DlgEditionsLists, err error)

curl "https://my.vmware.com/channel/public/api/v1.0/products/getRelatedDLGList?category= &product=vmware_vsan&version=7_0&dlgType=PRODUCT_BINARY" |jq

func (*Client) GetDlgProduct

func (c *Client) GetDlgProduct(slug, subProduct, version, dlgType string) (productID string, apiVersions APIVersions, err error)

func (*Client) GetFileArray

func (c *Client) GetFileArray(slug, subProduct, version, dlgType string) (data []string, err error)

func (*Client) GetProductsMap

func (c *Client) GetProductsMap() (productMap map[string]ProductDetails, err error)

returned map is used to look up products by their slig

func (*Client) GetProductsSlice

func (c *Client) GetProductsSlice() (data []MajorProducts, err error)

func (*Client) GetSubProduct

func (c *Client) GetSubProduct(slug, subProduct, dlgType string) (data SubProductDetails, err error)

func (*Client) GetSubProductDetails

func (c *Client) GetSubProductDetails(slug, subProduct, majorVersion, dlgType string) (data DlgList, err error)

func (*Client) GetSubProductsMap

func (c *Client) GetSubProductsMap(slug, dlgType, requestedMajorVersion string) (subProductMap map[string]SubProductDetails, err error)

func (*Client) GetSubProductsSlice

func (c *Client) GetSubProductsSlice(slug, dlgType, majorVersion string) (data []SubProductDetails, err error)

func (*Client) GetVersionMap

func (c *Client) GetVersionMap(slug, subProductName, dlgType string) (data map[string]APIVersions, err error)

func (*Client) GetVersionSlice

func (c *Client) GetVersionSlice(slug, subProductName, dlgType string) (data []string, err error)

type CurrentUser

type CurrentUser struct {
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
}

type Dlg

type Dlg struct {
	Name           string `json:"name"`
	ReleaseDate    string `json:"releaseDate"`
	Type           string `json:"type"`
	Code           string `json:"code"`
	Documentation  string `json:"documentation"`
	InternalType   string `json:"internalType"`
	IsFreeProduct  bool   `json:"isFreeProduct"`
	IsThirdParty   bool   `json:"isThirdParty"`
	IsMassMarket   bool   `json:"isMassMarket"`
	TagID          int    `json:"tagId"`
	Notes          string `json:"notes"`
	Description    string `json:"description"`
	CompatibleWith string `json:"compatibleWith"`
}

type DlgDetails

type DlgDetails struct {
	DownloadDetails     []DownloadDetails   `json:"downloadFiles"`
	EligibilityResponse EligibilityResponse `json:"eligibilityResponse"`
	EulaResponse        EulaResponse        `json:"eulaResponse"`
}

type DlgEditions

type DlgEditions struct {
	DlgEditionsLists []DlgEditionsLists `json:"dlgEditionsLists"`
}

dlg list

type DlgEditionsLists

type DlgEditionsLists struct {
	Name    string    `json:"name"`
	DlgList []DlgList `json:"dlgList"`
	OrderID int       `json:"orderId"`
}

type DlgHeader

type DlgHeader struct {
	Versions  []Versions    `json:"versions"`
	Product   Product       `json:"product"`
	Dlg       Dlg           `json:"dlg"`
	Resources []interface{} `json:"resources"`
}

type DlgList

type DlgList struct {
	Name             string `json:"name"`
	Code             string `json:"code"`
	ProductID        string `json:"productId"`
	ReleaseDate      string `json:"releaseDate"`
	ReleasePackageID string `json:"releasePackageId"`
}

type DownloadDetails

type DownloadDetails struct {
	FileName       string `json:"fileName"`
	Sha1Checksum   string `json:"sha1checksum"`
	Sha256Checksum string `json:"sha256checksum"`
	Md5Checksum    string `json:"md5checksum"`
	Build          string `json:"build"`
	ReleaseDate    string `json:"releaseDate"`
	FileType       string `json:"fileType"`
	Description    string `json:"description"`
	FileSize       string `json:"fileSize"`
	Title          string `json:"title"`
	Version        string `json:"version"`
	Status         string `json:"status"`
	UUID           string `json:"uuid"`
	Header         bool   `json:"header"`
	DisplayOrder   int    `json:"displayOrder"`
	Relink         bool   `json:"relink"`
	Rsync          bool   `json:"rsync"`
}

type DownloadPayload

type DownloadPayload struct {
	Locale        string `json:"locale"`        // en_US
	DownloadGroup string `json:"downloadGroup"` // Versions versionMap[version].Code
	ProductId     string `json:"productId"`     // DlgList ProductID
	Md5checksum   string `json:"md5checksum"`   // dlgDetails  Md5Checksum
	TagId         int    `json:"tagId"`         // dlgHeader Dlg.TagID
	UUId          string `json:"uUId"`          // dlgDetails UUID
	DlgType       string `json:"dlgType"`       // dlgHeader Dlg.Type replace(/&/g, '&')
	ProductFamily string `json:"productFamily"` // dlgHeader Product.Name
	ReleaseDate   string `json:"releaseDate"`   // dlgDetails ReleaseDate
	DlgVersion    string `json:"dlgVersion"`    // dlgDetails Version
	IsBetaFlow    bool   `json:"isBetaFlow"`    // false
}

type EligibilityResponse

type EligibilityResponse struct {
	EligibleToDownload bool `json:"eligibleToDownload"`
}

type EulaResponse

type EulaResponse struct {
	EulaAccepted bool   `json:"eulaAccepted"`
	EulaURL      string `json:"eulaURL"`
}

type FoundDownload

type FoundDownload struct {
	DownloadDetails    []DownloadDetails
	EulaAccepted       bool
	EligibleToDownload bool
}

type MajorProductEntities

type MajorProductEntities struct {
	Linkname string `json:"linkname"`
	OrderID  int    `json:"orderId"`
	Target   string `json:"target"`
}

type MajorProducts

type MajorProducts struct {
	MajorProductEntities []MajorProductEntities `json:"actions"`
	Name                 string                 `json:"name"`
}

type MajorVersions

type MajorVersions struct {
	ID string `json:"id"`
}

type Product

type Product struct {
	ID               string `json:"id"`
	ReleasePackageID string `json:"releasePackageId"`
	Categorymap      string `json:"categorymap"`
	Productmap       string `json:"productmap"`
	Versionmap       string `json:"versionmap"`
	Name             string `json:"name"`
	Version          string `json:"version"`
}

type ProductCategoryList

type ProductCategoryList struct {
	ID            string          `json:"id"`
	Name          string          `json:"name"`
	MajorProducts []MajorProducts `json:"productList"`
}

type ProductDetails

type ProductDetails struct {
	Category           string
	DisplayName        string
	LatestMajorVersion string
}

type ProductResponse

type ProductResponse struct {
	ProductCategoryList []ProductCategoryList `json:"productCategoryList"`
}

type ProductVersions

type ProductVersions struct {
	MajorVersions []MajorVersions `json:"versions"`
	Resources     []interface{}   `json:"resources"`
}

type SubProductDetails

type SubProductDetails struct {
	ProductName      string
	ProductCode      string
	DlgListByVersion map[string]DlgList
}

type SubProductSliceElement

type SubProductSliceElement struct {
	Name        string
	Description string
}

type TokenValidation

type TokenValidation struct {
	IsAccessTokenValid    string `json:"isAccessTokenValid"`
	IsRefreshTokenPresent string `json:"isRefreshTokenPresent"`
	Cn                    string `json:"cn"`
	Email                 string `json:"email"`
	Firstname             string `json:"firstname"`
	Lastname              string `json:"lastname"`
	UserType              string `json:"userType"`
}

type Versions

type Versions struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	IsSelected bool   `json:"isSelected"`
}

Jump to

Keyboard shortcuts

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