notifications

package
v0.0.0-...-cd80d89 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List retrieves a list notification.

Types

type CreateOpts

type CreateOpts struct {

	// Type of notification, can be either PROCESS, COMPUTE_HOST or VM.
	Type string `json:"type" required:"true"`

	// GeneratedTime The date and time when the notification was created
	GeneratedTime string `json:"generated_time,omitempty"`

	// Payload for notification. This is a JSON string.
	Payload string `json:"payload" required:"true"`

	// HostName A name of host for which notification is created.
	HostName string `json:"host_name" required:"true"`
}

CreateOpts provides options used to add a notification.

func (CreateOpts) ToContainerCreateMap

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

ToContainerCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult is the response from a Create operation. Call its Extract method to interpret it as a Segment.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create creates a new segment.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Notification, error)

Extract interprets any commonResult as a Segment.

type GetResult

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

GetResult is the response from a Get operation. Call its Extract method to interpret it as a Segment.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves details of a notification.

func (GetResult) Extract

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

Extract interprets any commonResult as a Segment.

type ListOpts

type ListOpts struct {
	// Limit is the amount of containers to retrieve.
	Limit int `q:"limit"`

	// Marker The ID of the last-seen item. Use the limit parameter to make an initial limited request and use the
	// ID of the last-seen item from the response as the marker parameter value in a subsequent limited request.
	Marker string `q:"marker"`

	// SortDir Sort direction. A valid value is asc (ascending) or desc (descending). Default is desc.
	// You can specify multiple pairs of sort key and sort direction query parameters.
	// If you omit the sort direction in a pair, the API uses the natural sorting direction of the direction of the segment sort_key attribute.
	SortDir string `q:"sort_dir"`

	// SortKey Sorts by a notification attribute. Default attribute is created_at.
	// You can specify multiple pairs of sort key and sort direction query parameters.
	// If you omit the sort direction in a pair, the API uses the natural sorting direction of the segment sort_key attribute.
	// The sort keys are limited to: created_at,type,generated_time,updated_at,uuid,payload,status,source_host_uuid
	SortKey string `q:"sort_key"`

	// GeneratedSince Filter the notifications list result by notification generated time.
	GeneratedSince string `json:"generated_since"`

	// SourceHostUUID Filter the notifications list result by source_host_uuid.
	SourceHostUUID string `json:"source_host_uuid"`

	// Type Filter the notifications list result by notification type.
	Type string `json:"type"`
}

ListOpts provides options to filter the List results.

func (ListOpts) ToContainerListQuery

func (opts ListOpts) ToContainerListQuery() (string, error)

ToContainerListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToContainerListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request

type Notification

type Notification struct {
	// ID of notification.
	ID int `json:"id"`

	// NotificationUUID The UUID of the notification.
	NotificationUUID string `json:"notification_uuid"`

	// CreatedAt The date and time stamp when the segment was created.
	CreatedAt string `json:"created_at"`

	// UpdatedAt The date and time stamp when the segment was updated.
	UpdatedAt string `json:"updated_at"`

	// Delete A boolean indicates whether this resource is deleted or not, if it has not been deleted, false will appear.
	Delete bool `json:"delete"`

	// Status of notification.
	Status string `json:"status"`

	// UUID The UUID of the notification.
	UUID string `json:"uuid"`

	// SourceHostUUID The UUID of host for which notification is generated.
	SourceHostUUID string `json:"source_host_uuid"`

	// GeneratedTime The date and time stamp when the notification was created.
	GeneratedTime string `json:"generated_time"`

	// Type of notification. can be either PROCESS, COMPUTE_HOST or VM.
	Type string `json:"type"`

	// Payload of notification.
	Payload interface{} `json:"payload"`
}

func ExtractNotifications

func ExtractNotifications(r pagination.Page) ([]Notification, error)

ExtractNotifications returns a slice of Notification in a single page of results.

type NotificationPage

type NotificationPage struct {
	pagination.LinkedPageBase
}

NotificationPage is a single page of notification results.

func (NotificationPage) IsEmpty

func (r NotificationPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of Container contains any results.

func (NotificationPage) NextPageURL

func (r NotificationPage) NextPageURL() (string, error)

NextPageURL extracts the "next" link from the links section of the result.

Jump to

Keyboard shortcuts

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