Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- func DoRequest(ctx context.Context, req *http.Request) (*http.Response, error)
- func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
- func SetBaseURL(bu string) func(*Client) error
- func SetDebugHTTP() func(*Client) error
- func SetGetLimiter(rps float64, burst int) func(*Client) error
- func SetPostLimiter(rps float64, burst int) func(*Client) error
- func SetSecretKey(sk string) func(*Client) error
- func SetUserAgent(ua string) func(*Client) error
- func SetUserKey(uk string) func(*Client) error
- type ArgError
- type Client
- type Domain
- type DomainsService
- type DomainsServiceOp
- type EmailAddress
- type ErrorResponse
- type PageOptions
- type RackspaceEmailAlias
- type RackspaceEmailAliasShow
- type RackspaceEmailAliasesService
- type RackspaceEmailAliasesServiceOp
- func (s *RackspaceEmailAliasesServiceOp) Add(ctx context.Context, domain, alias string, emailAddresses []string) (*Response, error)
- func (s *RackspaceEmailAliasesServiceOp) Delete(ctx context.Context, domain, alias string) (*Response, error)
- func (s RackspaceEmailAliasesServiceOp) Index(ctx context.Context, opt *PageOptions, domain string) ([]RackspaceEmailAlias, *Response, error)
- func (s *RackspaceEmailAliasesServiceOp) Show(ctx context.Context, domain, alias string) (*RackspaceEmailAliasShow, *Response, error)
- type Response
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. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func DoRequestWithClient ¶
func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
DoRequestWithClient submits an HTTP request using the specified client.
func SetBaseURL ¶
SetBaseURL is a client option for setting the base URL.
func SetDebugHTTP ¶
SetDebugHTTP is a client option for setting debugging for HTTP calls.
func SetGetLimiter ¶
SetGetLimiter is a client option for setting the ratelimiter for GET requests. rps is the requests per second and burst is the number of burst requests allowed.
func SetPostLimiter ¶
SetPostLimiter is a client option for setting the ratelimiter for POST requests. rps is the requests per second and burst is the number of burst requests allowed.
func SetSecretKey ¶
SetSecretKey is a client option for setting the secret key.
func SetUserAgent ¶
SetUserAgent is a client option for setting the user agent.
func SetUserKey ¶
SetUserKey is a client option for setting the user key.
Types ¶
type ArgError ¶
type ArgError struct {
// contains filtered or unexported fields
}
ArgError is an error that represents an error with an input to reago. It identifies the argument and the cause (if possible).
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent for client UserAgent string RackspaceEmailAliases RackspaceEmailAliasesService Domains DomainsService // contains filtered or unexported fields }
Client manages communication with Rackspace Email v1 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. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body map[string]string) (*http.Request, error)
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the map body is rendered as application/x-www-form-urlencoded.
type Domain ¶
type Domain struct { Name string `json:"name"` AccountNumber string `json:"accountNumber"` ServiceType string `json:"serviceType"` ActiveSyncLicenses int `json:"activeSyncLicenses"` ActiveSyncMobileServiceEnabled bool `json:"activeSyncMobileServiceEnabled"` ArchivingServiceEnabled bool `json:"archivingServiceEnabled"` BlackBerryLicenses int `json:"blackBerryLicenses"` BlackBerryMobileServiceEnabled bool `json:"blackBerryMobileServiceEnabled"` ExchangeExtraStorage int `json:"exchangeExtraStorage"` ExchangeMaxNumMailboxes int `json:"exchangeMaxNumMailboxes"` ExchangeUsedStorage int `json:"exchangeUsedStorage"` RSEmailBaseMailboxSize int `json:"rsEmailBaseMailboxSize"` RSEmailExtraStorage int `json:"rsEmailExtraStorage"` RSEmailMaxNumberMailboxes int `json:"rsEmailMaxNumberMailboxes"` RSEmailUsedStorage int `json:"rsEmailUsedStorage"` }
Domain represents a Rackspace Email API domain
type DomainsService ¶
type DomainsService interface { Index(context.Context, *PageOptions) ([]Domain, *Response, error) Show(context.Context, string) (*Domain, *Response, error) }
DomainsService is an interface for managing DNS with the Rackspace Email API.
See: http://api-wiki.apps.rackspace.com/api-wiki/index.php?title=Domain_(Rest_API)
type DomainsServiceOp ¶
type DomainsServiceOp struct {
// contains filtered or unexported fields
}
DomainsServiceOp handles communication with the domain related methods of the Rackspace Email API.
func (DomainsServiceOp) Index ¶
func (s DomainsServiceOp) Index(ctx context.Context, opt *PageOptions) ([]Domain, *Response, error)
Index lists all domains
type EmailAddress ¶
type EmailAddress struct {
Addresses []string `json:"emailAddress"`
}
EmailAddress represents an array of email addresses that iare tied to a Rackspace Email alias.
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string `json:"message"` // RequestID returned from the API, useful to contact support. RequestID string `json:"request_id"` }
ErrorResponse returns the information from an API error
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Error returns a string representation of an API error
type PageOptions ¶
PageOptions specifies the request pagination options
type RackspaceEmailAlias ¶
type RackspaceEmailAlias struct { Name string `json:"name"` NumberOfMembers int `json:"numberOfMembers"` }
RackspaceEmailAlias represents a Rackspace Email API alias from the Index method.
type RackspaceEmailAliasShow ¶
type RackspaceEmailAliasShow struct { Name string `json:"name"` EmailAddressList EmailAddress `json:"emailAddressList"` }
RackspaceEmailAliasShow represents the response from the Show method.
type RackspaceEmailAliasesService ¶
type RackspaceEmailAliasesService interface { Add(context.Context, string, string, []string) (*Response, error) Delete(context.Context, string, string) (*Response, error) Show(context.Context, string, string) (*RackspaceEmailAliasShow, *Response, error) Index(context.Context, *PageOptions, string) ([]RackspaceEmailAlias, *Response, error) }
RackspaceEmailAliasesService is an interface for managing Rackspace Email aliases with the Rackspace Email API.
See: http://api-wiki.apps.rackspace.com/api-wiki/index.php?title=Rackspace_Alias(Rest_API)
type RackspaceEmailAliasesServiceOp ¶
type RackspaceEmailAliasesServiceOp struct {
// contains filtered or unexported fields
}
RackspaceEmailAliasesServiceOp handles communication with the rackspace email alias related methods of the Rackspace Email API.
func (*RackspaceEmailAliasesServiceOp) Add ¶
func (s *RackspaceEmailAliasesServiceOp) Add(ctx context.Context, domain, alias string, emailAddresses []string) (*Response, error)
Add adds a new Rackspace Email alias and requires a non-empty domain name and a non-empty alias and a slice of email addresses.
func (*RackspaceEmailAliasesServiceOp) Delete ¶
func (s *RackspaceEmailAliasesServiceOp) Delete(ctx context.Context, domain, alias string) (*Response, error)
Delete removes a Rackspace Email alias and requires a non-empty domain name and a non-empty alias.
func (RackspaceEmailAliasesServiceOp) Index ¶
func (s RackspaceEmailAliasesServiceOp) Index(ctx context.Context, opt *PageOptions, domain string) ([]RackspaceEmailAlias, *Response, error)
Index lists all Rackspace Email aliases
func (*RackspaceEmailAliasesServiceOp) Show ¶
func (s *RackspaceEmailAliasesServiceOp) Show(ctx context.Context, domain, alias string) (*RackspaceEmailAliasShow, *Response, error)
Show gets details of a Rackspace Email alias and requires a non-empty domain name and a non-empty alias.