webhooks

package
v0.0.0-...-ff42b6a Latest Latest
Warning

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

Go to latest
Published: May 23, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package webhooks provides information and interaction with the webhook API resource in the Rackspace Auto Scale service.

Auto Scale uses webhooks to initiate scaling events. Webhooks are associated with scaling policies and provide capability URLs which can be accessed anonymously to trigger execution of those policies. The Auto Scale webhook architecture allows Auto Scale to be integrated with other systems, for example, monitoring systems.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoName     = errors.New("Webhook name cannot by empty.")
	ErrNoMetadata = errors.New("Webhook metadata cannot be nil.")
)

Validation errors returned by create or update operations.

Functions

func List

func List(client *gophercloud.ServiceClient, groupID, policyID string) pagination.Pager

List returns all webhooks for a scaling policy.

Types

type CreateOpt

type CreateOpt struct {
	// Name [required] is a name for the webhook.
	Name string

	// Metadata [optional] is user-provided key-value metadata.
	// Maximum length for keys and values is 256 characters.
	Metadata map[string]string
}

CreateOpt represents the options to create a webhook.

type CreateOpts

type CreateOpts []CreateOpt

CreateOpts is a slice of CreateOpt structs, that allow the user to create multiple webhooks in a single operation.

func (CreateOpts) ToWebhookCreateMap

func (opts CreateOpts) ToWebhookCreateMap() ([]map[string]interface{}, error)

ToWebhookCreateMap converts a slice of CreateOpt structs into a map for use in the request body of a Create operation.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToWebhookCreateMap() ([]map[string]interface{}, error)
}

CreateOptsBuilder is the interface responsible for generating the JSON for a Create operation.

type CreateResult

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

CreateResult represents the result of a create operation.

func Create

func Create(client *gophercloud.ServiceClient, groupID, policyID string, opts CreateOptsBuilder) CreateResult

Create requests a new webhook be created and associated with the given group and scaling policy.

func (CreateResult) Extract

func (res CreateResult) Extract() ([]Webhook, error)

Extract extracts a slice of Webhooks from a CreateResult. Multiple webhooks can be created in a single operation, so the result of a create is always a list of webhooks.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func Delete

func Delete(client *gophercloud.ServiceClient, groupID, policyID, webhookID string) DeleteResult

Delete requests the given webhook be permanently deleted.

type GetResult

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

GetResult temporarily contains the response from a Get call.

func Get

func Get(client *gophercloud.ServiceClient, groupID, policyID, webhookID string) GetResult

Get requests the details of a single webhook with the given ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Webhook, error)

Extract interprets any webhookResult as a Webhook, if possible.

type UpdateOpts

type UpdateOpts struct {
	// Name of the webhook.
	Name string `mapstructure:"name" json:"name"`

	// Metadata associated with the webhook.
	Metadata map[string]string `mapstructure:"metadata" json:"metadata"`
}

UpdateOpts represents the options for updating an existing webhook.

Update operations completely replace the configuration being updated. Empty values in the update are accepted and overwrite previously specified parameters.

func (UpdateOpts) ToWebhookUpdateMap

func (opts UpdateOpts) ToWebhookUpdateMap() (map[string]interface{}, error)

ToWebhookUpdateMap converts an UpdateOpts struct into a map for use as the request body in an Update request.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToWebhookUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder is the interface responsible for generating the map structure for producing JSON for an Update operation.

type UpdateResult

type UpdateResult struct {
	gophercloud.ErrResult
}

UpdateResult represents the result of an update operation.

func Update

func Update(client *gophercloud.ServiceClient, groupID, policyID, webhookID string, opts UpdateOptsBuilder) UpdateResult

Update requests the configuration of the given webhook be updated.

type Webhook

type Webhook struct {
	// UUID for the webhook.
	ID string `mapstructure:"id" json:"id"`

	// Name of the webhook.
	Name string `mapstructure:"name" json:"name"`

	// Links associated with the webhook, including the capability URL.
	Links []gophercloud.Link `mapstructure:"links" json:"links"`

	// Metadata associated with the webhook.
	Metadata map[string]string `mapstructure:"metadata" json:"metadata"`
}

Webhook represents a webhook associted with a scaling policy.

func ExtractWebhooks

func ExtractWebhooks(page pagination.Page) ([]Webhook, error)

ExtractWebhooks interprets the results of a single page from a List() call, producing a slice of Webhooks.

type WebhookPage

type WebhookPage struct {
	pagination.SinglePageBase
}

WebhookPage is the page returned by a pager when traversing over a collection of webhooks.

func (WebhookPage) IsEmpty

func (page WebhookPage) IsEmpty() (bool, error)

IsEmpty returns true if a page contains no Webhook results.

Jump to

Keyboard shortcuts

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