notification

package
v0.85.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Overview

Package notification provides support for interacting with HSDP Notification services

Index

Constants

View Source
const (
	APIVersion = "2"
)

Variables

View Source
var (
	ErrNotificationURLCannotBeEmpty = errors.New("base Notification URL cannot be empty")
	ErrEmptyResult                  = errors.New("empty result")
)

Errors

Functions

This section is empty.

Types

type Client

type Client struct {

	// User agent used when communicating with the HSDP Notification API
	UserAgent string

	Producer     *ProducerService
	Subscription *SubscriptionService
	Subscriber   *SubscriberService
	Topic        *TopicService
	// contains filtered or unexported fields
}

A Client manages communication with HSDP Notification API

func NewClient

func NewClient(iamClient *iam.Client, config *Config) (*Client, error)

NewClient returns a new HSDP Notification API client. A configured IAM client must be provided as the underlying API requires an IAM token

func (*Client) Close

func (c *Client) Close()

Close releases allocated resources of clients

func (*Client) Publish

func (c *Client) Publish(request PublishRequest) (*PublishResponse, *Response, error)

Publish publishes a message to a topic

func (*Client) SetNotificationURL

func (c *Client) SetNotificationURL(urlStr string) error

SetNotificationURL sets the Notification URL for API requests

func (*Client) TokenRefresh

func (c *Client) TokenRefresh() error

TokenRefresh forces a refresh of the IAM access token

type Config

type Config struct {
	Region          string
	Environment     string
	OrganizationID  string
	NotificationURL string
	Type            string
	TimeZone        string
	DebugLog        io.Writer
	Retry           int
}

Config contains the configuration of a client

type ConfirmRequest

type ConfirmRequest struct {
	AuthenticateOnUnsubscribe string `json:"authenticateOnUnsubscribe,omitempty"`
	Token                     string `json:"token" validate:"required"`
	TopicARN                  string `json:"topicArn" validate:"required"`
	Endpoint                  string `json:"endpoint" validate:"required"`
}

type Event added in v0.39.1

type Event struct {
	Type             string    `json:"Type"`
	MessageID        string    `json:"MessageId"`
	Token            string    `json:"Token"`
	TopicARN         string    `json:"TopicArn"`
	Message          string    `json:"Message"`
	Subject          string    `json:"Subject,omitempty"`
	SubscribeURL     string    `json:"SubscribeURL,omitempty"`
	Timestamp        time.Time `json:"Timestamp"`
	SignatureVersion string    `json:"SignatureVersion"`
	Signature        string    `json:"Signature"`
	SigningCertURL   string    `json:"SigningCertURL"`
}

Event is an Amazon SNS HTTP message on which HSDP Notification is currently based on

type GetOptions

type GetOptions struct {
	ID                    *string `url:"_id,omitempty"`
	ManagedOrganizationID *string `url:"managedOrganizationId,omitempty"`
	ManagedOrganization   *string `url:"managedOrganization,omitempty"`
	ProducerProductName   *string `url:"producerProductName,omitempty"`
	ProducerServiceName   *string `url:"producerServiceName,omitempty"`
	Scope                 *string `url:"scope,omitempty"`
	Name                  *string `url:"name,omitempty"`
	ProducerID            *string `url:"producerId,omitempty"`
}

GetOptions describes the fields on which you can search for producers

type OptionFunc

type OptionFunc func(*http.Request) error

OptionFunc is the function signature function for options

type Producer

type Producer struct {
	ID                          string `json:"_id,omitempty"`
	ResourceType                string `json:"resourceType,omitempty"`
	ManagingOrganizationID      string `json:"managingOrganizationId" validate:"required"`
	ManagingOrganization        string `json:"managingOrganization,omitempty"`
	ProducerProductName         string `json:"producerProductName" validate:"required"`
	ProducerServiceName         string `json:"producerServiceName" validate:"required"`
	ProducerServiceInstanceName string `json:"producerServiceInstanceName,omitempty" validate:"required"`
	ProducerServiceBaseURL      string `json:"producerServiceBaseUrl" validate:"required"`
	ProducerServicePathURL      string `json:"producerServicePathUrl" validate:"required"`
	Description                 string `json:"description,omitempty"`
}

type ProducerService

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

func (*ProducerService) CreateProducer

func (p *ProducerService) CreateProducer(producer Producer) (*Producer, *Response, error)

func (*ProducerService) DeleteProducer

func (p *ProducerService) DeleteProducer(producer Producer) (bool, *Response, error)

func (*ProducerService) GetProducer

func (p *ProducerService) GetProducer(id string) (*Producer, *Response, error)

func (*ProducerService) GetProducers

func (p *ProducerService) GetProducers(opt *GetOptions, options ...OptionFunc) ([]Producer, *Response, error)

type PublishRequest

type PublishRequest struct {
	TopicID string `json:"topicId"`
	Message string `json:"message"`
}

type PublishResponse

type PublishResponse struct {
	ID           string `json:"_id,omitempty"`
	ResourceType string `json:"resourceType,omitempty"`
	TopicID      string `json:"topicId"`
}

type Response

type Response struct {
	*http.Response
}

Response is a HSDP IAM API response. This wraps the standard http.Response returned from HSDP IAM and provides convenient access to things like errors

type Subscriber

type Subscriber struct {
	ID                            string `json:"_id,omitempty"`
	ResourceType                  string `json:"resourceType,omitempty"`
	ManagingOrganizationID        string `json:"managingOrganizationId" validate:"required"`
	ManagingOrganization          string `json:"managingOrganization,omitempty"`
	SubscriberProductName         string `json:"subscriberProductName" validate:"required"`
	SubscriberServicename         string `json:"subscriberServiceName" validate:"required"`
	SubscriberServiceinstanceName string `json:"subscriberServiceInstanceName,omitempty"`
	SubscriberServiceBaseURL      string `json:"subscriberServiceBaseUrl" validate:"required"`
	SubscriberServicePathURL      string `json:"subscriberServicePathUrl" validate:"required"`
	Description                   string `json:"description,omitempty"`
}

type SubscriberService

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

func (*SubscriberService) CreateSubscriber

func (p *SubscriberService) CreateSubscriber(subscriber Subscriber) (*Subscriber, *Response, error)

func (*SubscriberService) DeleteSubscriber

func (p *SubscriberService) DeleteSubscriber(subscriber Subscriber) (bool, *Response, error)

func (*SubscriberService) GetSubscriber

func (p *SubscriberService) GetSubscriber(id string) (*Subscriber, *Response, error)

func (*SubscriberService) GetSubscribers

func (p *SubscriberService) GetSubscribers(opt *GetOptions, options ...OptionFunc) ([]Subscriber, *Response, error)

type Subscription

type Subscription struct {
	ID                   string `json:"_id,omitempty"`
	ResourceType         string `json:"resourceType,omitempty"`
	TopicID              string `json:"topicId" validate:"required"`
	SubscriberID         string `json:"subscriberId" validate:"required"`
	SubscriptionEndpoint string `json:"subscriptionEndpoint" validate:"required"`
	SubscriptionARN      string `json:"subscriptionArn,omitempty"`
}

type SubscriptionService

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

func (*SubscriptionService) ConfirmSubscription

func (p *SubscriptionService) ConfirmSubscription(confirm ConfirmRequest) (*Subscription, *Response, error)

func (*SubscriptionService) CreateSubscription

func (p *SubscriptionService) CreateSubscription(subscription Subscription) (*Subscription, *Response, error)

func (*SubscriptionService) DeleteSubscription

func (p *SubscriptionService) DeleteSubscription(subscription Subscription) (bool, *Response, error)

func (*SubscriptionService) GetSubscription

func (p *SubscriptionService) GetSubscription(id string) (*Subscription, *Response, error)

func (*SubscriptionService) GetSubscriptions

func (p *SubscriptionService) GetSubscriptions(opt *GetOptions, options ...OptionFunc) ([]Subscription, *Response, error)

type Topic

type Topic struct {
	ID            string   `json:"_id,omitempty"`
	ResourceType  string   `json:"resourceType,omitempty"`
	Name          string   `json:"name" validate:"required"`
	ProducerID    string   `json:"producerId" validate:"required"`
	Scope         string   `json:"scope" validate:"required"`
	AllowedScopes []string `json:"allowedScopes,omitempty"`
	IsAuditable   bool     `json:"isAuditable,omitempty"`
	Description   string   `json:"description,omitempty"`
}

type TopicService

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

func (*TopicService) CreateTopic

func (p *TopicService) CreateTopic(topic Topic) (*Topic, *Response, error)

func (*TopicService) DeleteTopic

func (p *TopicService) DeleteTopic(topic Topic) (bool, *Response, error)

func (*TopicService) GetTopic

func (p *TopicService) GetTopic(id string) (*Topic, *Response, error)

func (*TopicService) GetTopics

func (p *TopicService) GetTopics(opt *GetOptions, options ...OptionFunc) ([]Topic, *Response, error)

func (*TopicService) UpdateTopic

func (p *TopicService) UpdateTopic(topic Topic) (*Topic, *Response, error)

Jump to

Keyboard shortcuts

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