index

package
v0.0.0-...-85536c8 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EuropaURL = "http://rnd-dockerhub.huawei.com:9999"
)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(resp *http.Response) error

CheckResponse check the API response for errors A response is considered an error if it has astatus code outside the 200 range

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a ressonable string representation of types in the rnd-dockerhub libirary. It does things like resolve pointers to their values and omits struct fields with nil values.

Types

type BasicAuthTransport

type BasicAuthTransport struct {
	Username string
	Password string

	// Transport is the underlying HTTP transport to use when making requests.
	//It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.

func (*BasicAuthTransport) Client

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes request that are authenticated using HTTP Basic Authentication

func (*BasicAuthTransport) RoundTrip

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type Client

type Client struct {

	// Bse URL for API request.
	BaseURL *url.URL
	// User agent used when communicating with the API
	UserAgent string

	// Servcie used for talking to different parts of the rnd-dockerhub API
	Repositories  *RepositoriesService
	Organizations *OrganizationsService
	Search        *SearchService
	Status        *StatusService
	UserInfo      *UserInfoService
	Users         *UsersService
	// contains filtered or unexported fields
}

A Client manages communication with the rnd-dockerhub API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new rnd-dockerhub API client. if a nil httpclient is provided, http.DefaultClient will be used.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client

type Image

type Image struct {
	Tag  *string `json:"tag,omitempty"`
	Size *int    `json:"size,omitempty"`
}

func (Image) String

func (i Image) String() string

type OrganizationsService

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

OrganizationsService provides access to the organization related functions in the rnd-dockerhub API

type Property

type Property struct {
	NumberDL    *int    `json:"download_num,omitempty"`
	ImageList   []Image `json:"image_list,omitempty"`
	NumberImage *int    `json:"image_num,omitempty"`
	Property    *string `json:"property,omitempty"`
	RepoName    *string `json:"repo,omitempty"`
	Size        *int    `json:"size,omitempty"`
}

Property represents a rund-dockerhub repo's property

type RepoDesc

type RepoDesc struct {
	Description *string `json:"description,omitempty"`
}

type RepositoriesSearchResult

type RepositoriesSearchResult struct {
	NumberResults *int         `json:"num_results,omitempty"`
	QueryString   *string      `json:"query,omitempty"`
	Repositories  []Repository `json:"results,omitempty"`
}

RepositoriesSearchResult represents the result of a repositories search

type RepositoriesService

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

RepositoriesService handles communication with the repository related methods of the rnd-dockerhub API

func (*RepositoriesService) DeleteRepo

func (s *RepositoriesService) DeleteRepo(repo string) (string, *Response, error)

func (*RepositoriesService) DeleteTag

func (s *RepositoriesService) DeleteTag(repo string, tag string) (string, *Response, error)

func (*RepositoriesService) Get

func (s *RepositoriesService) Get(repo string) (*Property, *Response, error)

func (*RepositoriesService) GetRepoDesc

func (s *RepositoriesService) GetRepoDesc(repo string) (*RepoDesc, *Response, error)

func (*RepositoriesService) GetUserRepo

func (s *RepositoriesService) GetUserRepo() (*UserRepoResult, *Response, error)

func (*RepositoriesService) Set

func (s *RepositoriesService) Set(repo string, property *Property) (string, *Response, error)

func (*RepositoriesService) SetRepoDesc

func (s *RepositoriesService) SetRepoDesc(repo string, repoDesc *RepoDesc) (string, *Response, error)

type Repository

type Repository struct {
	Description *string `json:"description,omitempty"`
	IsOfficial  *bool   `json:"is_official,omitempty"`
	IsTrusted   *bool   `json:"is_trusted,omitempty"`
	Name        *string `json:"name,omitempty"`
	StarCount   *int    `json:"star_count,omitempty"`
}

Repository represents a rmd-dockerhub repository

func (Repository) String

func (r Repository) String() string

type Response

type Response struct {
	*http.Response
}

Response is a rnd-dockerhub API response. This wraps the standard http.Response returnef from rnd-dockerhub.

type SearchOptions

type SearchOptions struct {
	// How to sort the search results.
	Sort string `url:"sort,omitempty"`
	// Sort order if sort parameter is provided. Possible values are asc, desc
	// Default is desc
	Order string `url:"order,omitempty"`
}

SearchOptions specties optional parameters to the SearchService methods

type SearchService

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

SearchService provides access to the search related functions in the rnd-dockerhub API.

rnd-dockerhub API docks: http://code.huawei.com/docker-incubator/index/blob/master/docs/api.md

func (*SearchService) Repositories

func (s *SearchService) Repositories(query string, opt *SearchOptions) (*RepositoriesSearchResult, *Response, error)

Repositories searches repositories via various criteria.

type StatusService

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

func (*StatusService) Get

func (s *StatusService) Get() (string, *Response, error)

Get get the status info of the rnd-dockerhub

type User

type User struct {
	Username    *string `json:"name,omitempty"`
	Password    *string `json:"pwd,omitempty"`
	NewPassword *string `json:"pwdnew,omitempty"`
	Email       *string `json:"email,omitempty"`
	Phone       *string `json:"phone,omitempty"`
}

func (User) String

func (u User) String() string

type UserInfo

type UserInfo struct {
	NumberImage        *int    `json:"image_num,omitempty"`
	NumberImagePrivate *int    `json:"private_image_num,omitempty"`
	NumberImageProtect *int    `json:"protect_image_num,omitempty"`
	NumberImagePublic  *int    `json:"public_image_num,omitempty"`
	Namespace          *string `json:"namespace,omitempty"`
	Product            *string `json:"product,omitempty"`
	Quote              *int64  `json:"quota,omitempty"`
	UsedSpace          *int64  `json:"used_space,omitempty"`
	Username           *string `json:"username,omitempty"`
}

UserInfo represents a rnd-dockerhub userinfo

type UserInfoService

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

func (*UserInfoService) Get

func (s *UserInfoService) Get() (*UserInfo, *Response, error)

Get fetch the current user infomation

type UserRepo

type UserRepo struct {
	NumberDL    *int    `json:"download_num,omitempty"`
	NumberImage *int    `json:"image_num,omitempty"`
	Property    *string `json:"property,omitempty"`
	RepoName    *string `json:"repo,omitempty"`
	Size        *int    `json:"size,omitempty"`
}

func (UserRepo) String

func (u UserRepo) String() string

type UserRepoResult

type UserRepoResult struct {
	RepoList []UserRepo `json:"repo_list,omitempty"`
}

func (UserRepoResult) String

func (u UserRepoResult) String() string

type UsersService

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

UsersService handles communication with the user related method of the Rnd-dockerhub API

API docs: http://code.huawei.com/h00283522/europa/blob/master/docs/api.md

func (*UsersService) Create

func (s *UsersService) Create(user *User) (string, *Response, error)

Create create user via user's credential,

func (*UsersService) Update

func (s *UsersService) Update(user *User) (string, *Response, error)

Update update user via user's credential,

Jump to

Keyboard shortcuts

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