Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. The caller is responsible to analyze the response body. The body can contain JSON (if the error is intended) or xml (sometimes JIRA just failes).
Types ¶
type Asset ¶
type Asset struct { Id string `json:"id"` OrgId string `json:"org_id"` Ip string `json:"ip"` Hostname string `json:"hostname"` Protocol string `json:"protocol"` Port int `json:"port"` Platform string `json:"platform"` IsActive bool `json:"is_active"` PublicIp string `json:"public_ip"` Number string `json:"number"` Vendor string `json:"vendor"` Model string `json:"model"` Sn string `json:"sn"` CpuModel string `json:"cpu_model"` CpuCount string `json:"cpu_count"` CpuCores string `json:"cpu_cores"` CpuVcpus string `json:"cpu_vcpus"` Memory string `json:"memory"` DiskTotal string `json:"disk_total"` DiskInfo string `json:"disk_info"` Os string `json:"os"` OsVersion string `json:"os_version"` OsArch string `json:"os_arch"` HostnameRaw string `json:"hostname_raw"` CreatedBy string `json:"created_by"` DateCreated string `json:"date_created"` Comment string `json:"comment"` Domain string `json:"domain"` AdminUser string `json:"admin_user"` Nodes []string `json:"nodes"` Labels []string `json:"labels"` HardwareInfo string `json:"hardware_info"` Connectivity int `json:"connectivity"` OrgName string `json:"org_name"` }
User represents a GitHub user.
type AssetsService ¶
type AssetsService struct {
// contains filtered or unexported fields
}
UsersService handles communication with the user related methods of the GitHub API.
GitHub API docs: https://developer.github.com/v3/users/
type AuthenticateInfo ¶
type BasicAuthTransport ¶
type BasicAuthTransport struct { Username string // GitHub username Password string // GitHub password OTP string // one-time password for users with two-factor auth enabled // 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. It additionally supports users who have two-factor authentication enabled on their GitHub account.
func (*BasicAuthTransport) Client ¶
func (t *BasicAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.
type Client ¶
type Client struct { // Services used for talking to different parts of the JIRA API. Users *UsersService Assets *AssetsService // contains filtered or unexported fields }
A Client manages communication with the JIRA API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) GetBaseURL ¶
GetBaseURL will return you the Base URL. This is the same URL as in the NewClient constructor
func (*Client) NewRequest ¶
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. If specified, the value pointed to by body is JSON encoded and included as the request body.
type Response ¶
type Response struct { *http.Response StartAt int MaxResults int Total int NextPage int PrevPage int FirstPage int LastPage int }
Response represents JIRA API response. It wraps http.Response returned from API and provides information about paging.
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. This is necessary for some fields since the GitHub API is inconsistent in how it represents times. All exported methods of time.Time can be called on Timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.
type TokenAuthTransport ¶
type TokenAuthTransport struct { Username string // JumpServer username Password string // JumpServer password AuthURL string // JumpServer auth url Token string OTP string // one-time password for users with two-factor auth enabled // 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. It additionally supports users who have two-factor authentication enabled on their GitHub account.
func (*TokenAuthTransport) Client ¶
func (t *TokenAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.
type User ¶
type User struct { Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Groups *[]string `json:"groups,omitempty"` GroupsDisplay string `json:"groups_display,omitempty"` Role string `json:"role,omitempty"` RoleDisplay string `json:"role_display,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` Wechat string `json:"wechat,omitempty"` Phone string `json:"phone,omitempty"` OtpLevel *int `json:"otp_level,omitempty"` Comment string `json:"comment,omitempty"` Source string `json:"source,omitempty"` SourceDisplay string `json:"source_display,omitempty"` IsValid *bool `json:"is_valid,omitempty"` IsExpired *bool `json:"is_expired,omitempty"` IsActive *bool `json:"is_active,omitempty"` CreatedBy string `json:"created_by,omitempty"` IsFirstLogin *bool `json:"is_first_login,omitempty"` DatePasswordLastUpdated string `json:"date_password_last_updated,omitempty"` DateExpired string `json:"date_expired,omitempty"` // API URLs URL string `json:"url,omitempty"` EventsURL string `json:"events_url,omitempty"` FollowingURL string `json:"following_url,omitempty"` FollowersURL string `json:"followers_url,omitempty"` GistsURL string `json:"gists_url,omitempty"` OrganizationsURL string `json:"organizations_url,omitempty"` ReceivedEventsURL string `json:"received_events_url,omitempty"` ReposURL string `json:"repos_url,omitempty"` StarredURL string `json:"starred_url,omitempty"` SubscriptionsURL string `json:"subscriptions_url,omitempty"` // Permissions identifies the permissions that a user has on a given // repository. This is only populated when calling Repositories.ListCollaborators. Permissions *map[string]bool `json:"permissions,omitempty"` }
User represents a GitHub user.
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService handles communication with the user related methods of the GitHub API.
GitHub API docs: https://developer.github.com/v3/users/