client

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2017 License: GPL-2.0 Imports: 16 Imported by: 0

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

View Source
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"
)
View Source
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"
)
View Source
const (
	ENABLE_INTEGRATION_URL  = ENDPOINT_URL + "/v1/json/integration/enable"
	DISABLE_INTEGRATION_URL = ENDPOINT_URL + "/v1/json/integration/disable"
)
View Source
const (
	ENABLE_POLICY_URL  = ENDPOINT_URL + "/v1/json/policy/enable"
	DISABLE_POLICY_URL = ENDPOINT_URL + "/v1/json/policy/disable"
)
View Source
const DEFAULT_CONNECTION_TIMEOUT_IN_SECONDS time.Duration = 1
View Source
const DEFAULT_MAX_RETRY_ATTEMPTS int = 1
View Source
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

View Source
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 HttpTransportSettings struct {
	ConnectionTimeout time.Duration
	MaxRetryAttempts  int
}

type OpsGenieAlertClient

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

func (*OpsGenieAlertClient) Acknowledge

func (*OpsGenieAlertClient) AddNote

func (*OpsGenieAlertClient) AddRecipient

func (*OpsGenieAlertClient) AddTeam

func (*OpsGenieAlertClient) AssignOwner

func (*OpsGenieAlertClient) AttachFile

func (*OpsGenieAlertClient) Close

func (*OpsGenieAlertClient) Create

func (*OpsGenieAlertClient) Delete

func (*OpsGenieAlertClient) ExecuteAction

func (*OpsGenieAlertClient) Get

func (*OpsGenieAlertClient) List

func (*OpsGenieAlertClient) ListLogs

func (*OpsGenieAlertClient) ListNotes

func (*OpsGenieAlertClient) ListRecipients

func (*OpsGenieAlertClient) Renotify

func (*OpsGenieAlertClient) SetConnectionTimeout

func (cli *OpsGenieAlertClient) SetConnectionTimeout(timeoutInSeconds time.Duration)

func (*OpsGenieAlertClient) SetMaxRetryAttempts

func (cli *OpsGenieAlertClient) SetMaxRetryAttempts(retries int)

func (*OpsGenieAlertClient) TakeOwnership

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 (*OpsGenieHeartbeatClient) Delete

func (*OpsGenieHeartbeatClient) Disable

func (*OpsGenieHeartbeatClient) Enable

func (*OpsGenieHeartbeatClient) Get

func (*OpsGenieHeartbeatClient) List

func (*OpsGenieHeartbeatClient) Send

func (*OpsGenieHeartbeatClient) SetConnectionTimeout

func (cli *OpsGenieHeartbeatClient) SetConnectionTimeout(timeoutInSeconds time.Duration)

func (*OpsGenieHeartbeatClient) SetMaxRetryAttempts

func (cli *OpsGenieHeartbeatClient) SetMaxRetryAttempts(retries int)

func (*OpsGenieHeartbeatClient) Update

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) 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 (*OpsGeniePolicyClient) Enable

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

Jump to

Keyboard shortcuts

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