Documentation ¶
Overview ¶
Package client manages the creation of API clients. API user first creates a pointer of type OpsGenieClient. Following that he/she can set some configurations for HTTP communication layer by setting a proxy definition and/or transport layer options. Introduction The most fundamental and general use case is being able to access the OpsGenie Web API by coding a Go program. The program -by mean of a client application- can send OpsGenie Web API the requests using the 'client' package in a higher level. For the programmer of the client application, that reduces the number of LoCs. Besides it will result a less error-prone application and reduce the complexity by hiding the low-level networking, error-handling and byte-processing calls. Package client has ports for all entry points to the Web API. The OpsGenie Web API is structured in JSON-bodied calls (except the file attachment).
Copyright 2015 OpsGenie. All rights reserved. Use of this source code is governed by an Apache Software license that can be found in the LICENSE file.
Index ¶
- Constants
- type ClientProxyConfiguration
- type HttpTransportSettings
- type OpsGenieAlertClient
- func (cli *OpsGenieAlertClient) Acknowledge(req alerts.AcknowledgeAlertRequest) (*alerts.AcknowledgeAlertResponse, error)
- func (cli *OpsGenieAlertClient) AddNote(req alerts.AddNoteAlertRequest) (*alerts.AddNoteAlertResponse, error)
- func (cli *OpsGenieAlertClient) AddRecipient(req alerts.AddRecipientAlertRequest) (*alerts.AddRecipientAlertResponse, error)
- func (cli *OpsGenieAlertClient) AddTeam(req alerts.AddTeamAlertRequest) (*alerts.AddTeamAlertResponse, error)
- func (cli *OpsGenieAlertClient) AssignOwner(req alerts.AssignOwnerAlertRequest) (*alerts.AssignOwnerAlertResponse, error)
- func (cli *OpsGenieAlertClient) AttachFile(req alerts.AttachFileAlertRequest) (*alerts.AttachFileAlertResponse, error)
- func (cli *OpsGenieAlertClient) Close(req alerts.CloseAlertRequest) (*alerts.CloseAlertResponse, error)
- func (cli *OpsGenieAlertClient) Create(req alerts.CreateAlertRequest) (*alerts.CreateAlertResponse, error)
- func (cli *OpsGenieAlertClient) Delete(req alerts.DeleteAlertRequest) (*alerts.DeleteAlertResponse, error)
- func (cli *OpsGenieAlertClient) ExecuteAction(req alerts.ExecuteActionAlertRequest) (*alerts.ExecuteActionAlertResponse, error)
- func (cli *OpsGenieAlertClient) Get(req alerts.GetAlertRequest) (*alerts.GetAlertResponse, error)
- func (cli *OpsGenieAlertClient) List(req alerts.ListAlertsRequest) (*alerts.ListAlertsResponse, error)
- func (cli *OpsGenieAlertClient) ListLogs(req alerts.ListAlertLogsRequest) (*alerts.ListAlertLogsResponse, error)
- func (cli *OpsGenieAlertClient) ListNotes(req alerts.ListAlertNotesRequest) (*alerts.ListAlertNotesResponse, error)
- func (cli *OpsGenieAlertClient) ListRecipients(req alerts.ListAlertRecipientsRequest) (*alerts.ListAlertRecipientsResponse, error)
- func (cli *OpsGenieAlertClient) Renotify(req alerts.RenotifyAlertRequest) (*alerts.RenotifyAlertResponse, error)
- func (cli *OpsGenieAlertClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
- func (cli *OpsGenieAlertClient) SetMaxRetryAttempts(retries int)
- func (cli *OpsGenieAlertClient) TakeOwnership(req alerts.TakeOwnershipAlertRequest) (*alerts.TakeOwnershipAlertResponse, error)
- type OpsGenieClient
- func (cli *OpsGenieClient) Alert() (*OpsGenieAlertClient, error)
- func (cli *OpsGenieClient) Heartbeat() (*OpsGenieHeartbeatClient, error)
- func (cli *OpsGenieClient) Integration() (*OpsGenieIntegrationClient, error)
- func (cli *OpsGenieClient) Policy() (*OpsGeniePolicyClient, error)
- func (cli *OpsGenieClient) SetApiKey(key string) error
- func (cli *OpsGenieClient) SetClientProxyConfiguration(conf *ClientProxyConfiguration)
- func (cli *OpsGenieClient) SetHttpTransportSettings(settings *HttpTransportSettings)
- type OpsGenieHeartbeatClient
- func (cli *OpsGenieHeartbeatClient) Add(req heartbeat.AddHeartbeatRequest) (*heartbeat.AddHeartbeatResponse, error)
- func (cli *OpsGenieHeartbeatClient) Delete(req heartbeat.DeleteHeartbeatRequest) (*heartbeat.DeleteHeartbeatResponse, error)
- func (cli *OpsGenieHeartbeatClient) Disable(req heartbeat.DisableHeartbeatRequest) (*heartbeat.DisableHeartbeatResponse, error)
- func (cli *OpsGenieHeartbeatClient) Enable(req heartbeat.EnableHeartbeatRequest) (*heartbeat.EnableHeartbeatResponse, error)
- func (cli *OpsGenieHeartbeatClient) Get(req heartbeat.GetHeartbeatRequest) (*heartbeat.GetHeartbeatResponse, error)
- func (cli *OpsGenieHeartbeatClient) List(req heartbeat.ListHeartbeatsRequest) (*heartbeat.ListHeartbeatsResponse, error)
- func (cli *OpsGenieHeartbeatClient) Send(req heartbeat.SendHeartbeatRequest) (*heartbeat.SendHeartbeatResponse, error)
- func (cli *OpsGenieHeartbeatClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
- func (cli *OpsGenieHeartbeatClient) SetMaxRetryAttempts(retries int)
- func (cli *OpsGenieHeartbeatClient) Update(req heartbeat.UpdateHeartbeatRequest) (*heartbeat.UpdateHeartbeatResponse, error)
- type OpsGenieIntegrationClient
- func (cli *OpsGenieIntegrationClient) Disable(req integration.DisableIntegrationRequest) (*integration.DisableIntegrationResponse, error)
- func (cli *OpsGenieIntegrationClient) Enable(req integration.EnableIntegrationRequest) (*integration.EnableIntegrationResponse, error)
- func (cli *OpsGenieIntegrationClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
- func (cli *OpsGenieIntegrationClient) SetMaxRetryAttempts(retries int)
- type OpsGeniePolicyClient
- func (cli *OpsGeniePolicyClient) Disable(req policy.DisablePolicyRequest) (*policy.DisablePolicyResponse, error)
- func (cli *OpsGeniePolicyClient) Enable(req policy.EnablePolicyRequest) (*policy.EnablePolicyResponse, error)
- func (cli *OpsGeniePolicyClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
- func (cli *OpsGeniePolicyClient) SetMaxRetryAttempts(retries int)
- type RequestHeaderUserAgent
Constants ¶
const ( CREATE_ALERT_URL = ENDPOINT_URL + "/v1/json/alert" CLOSE_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/close" DELETE_ALERT_URL = ENDPOINT_URL + "/v1/json/alert" GET_ALERT_URL = ENDPOINT_URL + "/v1/json/alert" LIST_ALERTS_URL = ENDPOINT_URL + "/v1/json/alert" LIST_ALERT_NOTES_URL = ENDPOINT_URL + "/v1/json/alert/note" LIST_ALERT_LOGS_URL = ENDPOINT_URL + "/v1/json/alert/log" LIST_ALERT_RECIPIENTS_URL = ENDPOINT_URL + "/v1/json/alert/recipient" ACKNOWLEDGE_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/acknowledge" RENOTIFY_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/renotify" TAKE_OWNERSHIP_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/takeOwnership" ASSIGN_OWNERSHIP_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/assign" ADD_TEAM_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/team" ADD_RECIPIENT_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/recipient" ADD_NOTE_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/note" EXECUTE_ACTION_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/executeAction" ATTACH_FILE_ALERT_URL = ENDPOINT_URL + "/v1/json/alert/attach" )
const ( ADD_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat" UPDATE_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat" ENABLE_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat/enable" DISABLE_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat/disable" DELETE_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat" GET_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat" LIST_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat" SEND_HEARTBEAT_URL = ENDPOINT_URL + "/v1/json/heartbeat/send" )
const ( ENABLE_INTEGRATION_URL = ENDPOINT_URL + "/v1/json/integration/enable" DISABLE_INTEGRATION_URL = ENDPOINT_URL + "/v1/json/integration/disable" )
const ( ENABLE_POLICY_URL = ENDPOINT_URL + "/v1/json/policy/enable" DISABLE_POLICY_URL = ENDPOINT_URL + "/v1/json/policy/disable" )
const DEFAULT_CONNECTION_TIMEOUT_IN_SECONDS time.Duration = 1
const DEFAULT_MAX_RETRY_ATTEMPTS int = 1
const ENDPOINT_URL string = "https://api.opsgenie.com"
OpsGenie Go SDK performs HTTP calls to the Web API. The Web API is designated by a URL so called an endpoint
const TIME_SLEEP_BETWEEN_REQUESTS time.Duration = 500 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientProxyConfiguration ¶
type ClientProxyConfiguration struct { Host string Port int Username string Password string ProxyUri string Secured bool }
func (*ClientProxyConfiguration) ToString ¶
func (proxy *ClientProxyConfiguration) ToString() string
type HttpTransportSettings ¶
type OpsGenieAlertClient ¶
type OpsGenieAlertClient struct {
// contains filtered or unexported fields
}
func (*OpsGenieAlertClient) Acknowledge ¶
func (cli *OpsGenieAlertClient) Acknowledge(req alerts.AcknowledgeAlertRequest) (*alerts.AcknowledgeAlertResponse, error)
func (*OpsGenieAlertClient) AddNote ¶
func (cli *OpsGenieAlertClient) AddNote(req alerts.AddNoteAlertRequest) (*alerts.AddNoteAlertResponse, error)
func (*OpsGenieAlertClient) AddRecipient ¶
func (cli *OpsGenieAlertClient) AddRecipient(req alerts.AddRecipientAlertRequest) (*alerts.AddRecipientAlertResponse, error)
func (*OpsGenieAlertClient) AddTeam ¶
func (cli *OpsGenieAlertClient) AddTeam(req alerts.AddTeamAlertRequest) (*alerts.AddTeamAlertResponse, error)
func (*OpsGenieAlertClient) AssignOwner ¶
func (cli *OpsGenieAlertClient) AssignOwner(req alerts.AssignOwnerAlertRequest) (*alerts.AssignOwnerAlertResponse, error)
func (*OpsGenieAlertClient) AttachFile ¶
func (cli *OpsGenieAlertClient) AttachFile(req alerts.AttachFileAlertRequest) (*alerts.AttachFileAlertResponse, error)
func (*OpsGenieAlertClient) Close ¶
func (cli *OpsGenieAlertClient) Close(req alerts.CloseAlertRequest) (*alerts.CloseAlertResponse, error)
func (*OpsGenieAlertClient) Create ¶
func (cli *OpsGenieAlertClient) Create(req alerts.CreateAlertRequest) (*alerts.CreateAlertResponse, error)
func (*OpsGenieAlertClient) Delete ¶
func (cli *OpsGenieAlertClient) Delete(req alerts.DeleteAlertRequest) (*alerts.DeleteAlertResponse, error)
func (*OpsGenieAlertClient) ExecuteAction ¶
func (cli *OpsGenieAlertClient) ExecuteAction(req alerts.ExecuteActionAlertRequest) (*alerts.ExecuteActionAlertResponse, error)
func (*OpsGenieAlertClient) Get ¶
func (cli *OpsGenieAlertClient) Get(req alerts.GetAlertRequest) (*alerts.GetAlertResponse, error)
func (*OpsGenieAlertClient) List ¶
func (cli *OpsGenieAlertClient) List(req alerts.ListAlertsRequest) (*alerts.ListAlertsResponse, error)
func (*OpsGenieAlertClient) ListLogs ¶
func (cli *OpsGenieAlertClient) ListLogs(req alerts.ListAlertLogsRequest) (*alerts.ListAlertLogsResponse, error)
func (*OpsGenieAlertClient) ListNotes ¶
func (cli *OpsGenieAlertClient) ListNotes(req alerts.ListAlertNotesRequest) (*alerts.ListAlertNotesResponse, error)
func (*OpsGenieAlertClient) ListRecipients ¶
func (cli *OpsGenieAlertClient) ListRecipients(req alerts.ListAlertRecipientsRequest) (*alerts.ListAlertRecipientsResponse, error)
func (*OpsGenieAlertClient) Renotify ¶
func (cli *OpsGenieAlertClient) Renotify(req alerts.RenotifyAlertRequest) (*alerts.RenotifyAlertResponse, error)
func (*OpsGenieAlertClient) SetConnectionTimeout ¶
func (cli *OpsGenieAlertClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
func (*OpsGenieAlertClient) SetMaxRetryAttempts ¶
func (cli *OpsGenieAlertClient) SetMaxRetryAttempts(retries int)
func (*OpsGenieAlertClient) TakeOwnership ¶
func (cli *OpsGenieAlertClient) TakeOwnership(req alerts.TakeOwnershipAlertRequest) (*alerts.TakeOwnershipAlertResponse, error)
type OpsGenieClient ¶
type OpsGenieClient struct {
// contains filtered or unexported fields
}
OpsGenieClient is a general data type used for:
- authenticating callers through their api keys and
- instanciating "alert" and "heartbeat" clients
- setting HTTP transport layer configurations
func (*OpsGenieClient) Alert ¶
func (cli *OpsGenieClient) Alert() (*OpsGenieAlertClient, error)
Instanciates a new OpsGenieAlertClient and sets the api key to be used alongside the execution.
func (*OpsGenieClient) Heartbeat ¶
func (cli *OpsGenieClient) Heartbeat() (*OpsGenieHeartbeatClient, error)
Instanciates a new OpsGenieHeartbeatClient and sets the api key to be used alongside the execution.
func (*OpsGenieClient) Integration ¶
func (cli *OpsGenieClient) Integration() (*OpsGenieIntegrationClient, error)
Instanciates a new OpsGenieIntegrationClient and sets the api key to be used alongside the execution.
func (*OpsGenieClient) Policy ¶
func (cli *OpsGenieClient) Policy() (*OpsGeniePolicyClient, error)
Instanciates a new OpsGeniePolicyClient and sets the api key to be used alongside the execution.
func (*OpsGenieClient) SetApiKey ¶
func (cli *OpsGenieClient) SetApiKey(key string) error
func (*OpsGenieClient) SetClientProxyConfiguration ¶
func (cli *OpsGenieClient) SetClientProxyConfiguration(conf *ClientProxyConfiguration)
Setters:
- proxy
- http transport layer conf
- api key
func (*OpsGenieClient) SetHttpTransportSettings ¶
func (cli *OpsGenieClient) SetHttpTransportSettings(settings *HttpTransportSettings)
type OpsGenieHeartbeatClient ¶
type OpsGenieHeartbeatClient struct {
// contains filtered or unexported fields
}
func (*OpsGenieHeartbeatClient) Add ¶
func (cli *OpsGenieHeartbeatClient) Add(req heartbeat.AddHeartbeatRequest) (*heartbeat.AddHeartbeatResponse, error)
func (*OpsGenieHeartbeatClient) Delete ¶
func (cli *OpsGenieHeartbeatClient) Delete(req heartbeat.DeleteHeartbeatRequest) (*heartbeat.DeleteHeartbeatResponse, error)
func (*OpsGenieHeartbeatClient) Disable ¶
func (cli *OpsGenieHeartbeatClient) Disable(req heartbeat.DisableHeartbeatRequest) (*heartbeat.DisableHeartbeatResponse, error)
func (*OpsGenieHeartbeatClient) Enable ¶
func (cli *OpsGenieHeartbeatClient) Enable(req heartbeat.EnableHeartbeatRequest) (*heartbeat.EnableHeartbeatResponse, error)
func (*OpsGenieHeartbeatClient) Get ¶
func (cli *OpsGenieHeartbeatClient) Get(req heartbeat.GetHeartbeatRequest) (*heartbeat.GetHeartbeatResponse, error)
func (*OpsGenieHeartbeatClient) List ¶
func (cli *OpsGenieHeartbeatClient) List(req heartbeat.ListHeartbeatsRequest) (*heartbeat.ListHeartbeatsResponse, error)
func (*OpsGenieHeartbeatClient) Send ¶
func (cli *OpsGenieHeartbeatClient) Send(req heartbeat.SendHeartbeatRequest) (*heartbeat.SendHeartbeatResponse, error)
func (*OpsGenieHeartbeatClient) SetConnectionTimeout ¶
func (cli *OpsGenieHeartbeatClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
func (*OpsGenieHeartbeatClient) SetMaxRetryAttempts ¶
func (cli *OpsGenieHeartbeatClient) SetMaxRetryAttempts(retries int)
func (*OpsGenieHeartbeatClient) Update ¶
func (cli *OpsGenieHeartbeatClient) Update(req heartbeat.UpdateHeartbeatRequest) (*heartbeat.UpdateHeartbeatResponse, error)
Update Heartbeat is used to change configuration of existing heartbeats. Mandatory Parameters:
- id: Id of the heartbeat
- apiKey: API key is used for authenticating API requests
Optional Parameters
- name: Name of the heartbeat
- interval: Specifies how often a heartbeat message should be expected.
- intervalUnit: interval specified as minutes, hours or days
- description: An optional description of the heartbeat
- enabled: Enable/disable heartbeat monitoring
type OpsGenieIntegrationClient ¶
type OpsGenieIntegrationClient struct {
// contains filtered or unexported fields
}
func (*OpsGenieIntegrationClient) Disable ¶
func (cli *OpsGenieIntegrationClient) Disable(req integration.DisableIntegrationRequest) (*integration.DisableIntegrationResponse, error)
func (*OpsGenieIntegrationClient) Enable ¶
func (cli *OpsGenieIntegrationClient) Enable(req integration.EnableIntegrationRequest) (*integration.EnableIntegrationResponse, error)
func (*OpsGenieIntegrationClient) SetConnectionTimeout ¶
func (cli *OpsGenieIntegrationClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
func (*OpsGenieIntegrationClient) SetMaxRetryAttempts ¶
func (cli *OpsGenieIntegrationClient) SetMaxRetryAttempts(retries int)
type OpsGeniePolicyClient ¶
type OpsGeniePolicyClient struct {
// contains filtered or unexported fields
}
func (*OpsGeniePolicyClient) Disable ¶
func (cli *OpsGeniePolicyClient) Disable(req policy.DisablePolicyRequest) (*policy.DisablePolicyResponse, error)
func (*OpsGeniePolicyClient) Enable ¶
func (cli *OpsGeniePolicyClient) Enable(req policy.EnablePolicyRequest) (*policy.EnablePolicyResponse, error)
func (*OpsGeniePolicyClient) SetConnectionTimeout ¶
func (cli *OpsGeniePolicyClient) SetConnectionTimeout(timeoutInSeconds time.Duration)
func (*OpsGeniePolicyClient) SetMaxRetryAttempts ¶
func (cli *OpsGeniePolicyClient) SetMaxRetryAttempts(retries int)
type RequestHeaderUserAgent ¶
type RequestHeaderUserAgent struct {
// contains filtered or unexported fields
}
User-Agent values tool/version (OS;GO_Version;language)
func (RequestHeaderUserAgent) ToString ¶
func (p RequestHeaderUserAgent) ToString() string