dbs

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: 0

Documentation

Overview

Package dbs provides support the HSDP Data Broker services

Index

Constants

View Source
const (
	APIVersion = "1"
)

Variables

View Source
var (
	ErrNotFound                       = errors.New("entity not found")
	ErrBaseURLCannotBeEmpty           = errors.New("base URL cannot be empty")
	ErrEmptyResult                    = errors.New("empty result")
	ErrInvalidEndpointURL             = errors.New("invalid endpoint URL")
	ErrMissingName                    = errors.New("missing name value")
	ErrMissingDescription             = errors.New("missing description value")
	ErrMalformedInputValue            = errors.New("malformed input value")
	ErrMissingOrganization            = errors.New("missing organization")
	ErrMissingProposition             = errors.New("missing proposition")
	ErrMissingGlobalReference         = errors.New("missing global reference")
	ErrNotImplementedByHSDP           = errors.New("method not implemented by HSDP")
	ErrEmptyResults                   = errors.New("empty results")
	ErrOperationFailed                = errors.New("operation failed")
	ErrCouldNoReadResourceAfterCreate = errors.New("could not read resource after create")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// HTTP Client used to communicate with IAM API
	*iam.Client

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

	Subscribers   *SubscribersService
	Subscriptions *SubscriptionService
	// contains filtered or unexported fields
}

A Client manages communication with HSDP Data Broker APIs

func NewClient

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

NewClient returns a new DBS client

func (*Client) Close

func (c *Client) Close()

Close releases allocated resources of clients

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do performs a http request. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) GetBaseURL

func (c *Client) GetBaseURL() string

GetBaseURL returns the base URL as configured

func (*Client) GetEndpointURL

func (c *Client) GetEndpointURL() string

GetEndpointURL returns the Discovery Endpoint URL as configured

func (*Client) NewRequest

func (c *Client) NewRequest(method, requestPath string, opt interface{}, options ...OptionFunc) (*http.Request, error)

func (*Client) SetBaseURL

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

SetBaseURL sets the base URL for API requests

type Config

type Config struct {
	Region      string
	Environment string
	BaseURL     string
	DebugLog    io.Writer
	Retry       int
}

Config contains the configuration of a Client

type GetSQSSubscriberOptions

type GetSQSSubscriberOptions struct {
	ID          *string `url:"_id,omitempty"`
	Name        *string `url:"name,omitempty"`
	LastUpdated *string `url:"_lastUpdated,omitempty"`
}

type GetTopicSubscriptionOptions

type GetTopicSubscriptionOptions struct {
	ID          *string `url:"_id,omitempty"`
	Name        *string `url:"name,omitempty"`
	LastUpdated *string `url:"_lastUpdated,omitempty"`
}

type Meta

type Meta struct {
	LastUpdated time.Time `json:"lastUpdated,omitempty"`
	VersionID   string    `json:"versionId,omitempty"`
}

type OptionFunc

type OptionFunc func(*http.Request) error

OptionFunc is the function signature function for options

type Response

type Response struct {
	*http.Response
}

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

func (*Response) StatusCode

func (r *Response) StatusCode() int

type SQSBundle

type SQSBundle struct {
	Type  string          `json:"type,omitempty"`
	Entry []SQSSubscriber `json:"entry,omitempty"`
}

type SQSSubscriber

type SQSSubscriber struct {
	ID                            string `json:"id"`
	Meta                          *Meta  `json:"meta"`
	Name                          string `json:"name" validate:"required"`
	Description                   string `json:"description" validate:"required"`
	Status                        string `json:"status" validate:"required" enum:"Creating|Deleting|Active|Updating|InError"`
	ErrorMessage                  string `json:"errorMessage,omitempty"`
	ResourceType                  string `json:"resourceType" validate:"required" enum:"SQSSubscriber"`
	QueueName                     string `json:"queueName" validate:"required"`
	QueueType                     string `json:"queueType" validate:"required" enum:"Standard|FIFO"`
	DeliveryDelaySeconds          int    `json:"deliveryDelaySeconds" validate:"required"`
	MessageRetentionPeriod        int    `json:"messageRetentionPeriod" validate:"required"`
	ReceiveMessageWaitTimeSeconds int    `json:"receiveMessageWaitTimeSeconds" validate:"required"`
	ServerSideEncryption          bool   `json:"serverSideEncryption" validate:"required"`
}

type SQSSubscriberConfig

type SQSSubscriberConfig struct {
	ResourceType                  string `json:"resourceType" validate:"required" enum:"SQSSubscriberConfig"`
	NameInfix                     string `json:"nameInfix" validate:"required"`
	Description                   string `json:"description" validate:"required"`
	QueueType                     string `json:"queueType,omitempty" enum:"Standard|FIFO"`
	DeliveryDelaySeconds          int    `json:"deliveryDelaySeconds,omitempty"`
	MessageRetentionPeriod        int    `json:"messageRetentionPeriod,omitempty"`
	ReceiveMessageWaitTimeSeconds int    `json:"receiveMessageWaitTimeSeconds,omitempty"`
	ServerSideEncryption          bool   `json:"serverSideEncryption,omitempty"`
}

type Subscriber

type Subscriber struct {
	ID       string `json:"id" validate:"required"`
	Type     string `json:"type" validate:"required"`
	Location string `json:"location" validate:"required"`
}

type SubscribersService

type SubscribersService struct {
	*Client
	// contains filtered or unexported fields
}

func (*SubscribersService) CreateSQS

func (b *SubscribersService) CreateSQS(sqsConfig SQSSubscriberConfig) (*SQSSubscriber, *Response, error)

func (*SubscribersService) DeleteSQS

func (b *SubscribersService) DeleteSQS(subscriber SQSSubscriber) (bool, *Response, error)

func (*SubscribersService) FindSQS

func (*SubscribersService) GetSQSByID

func (b *SubscribersService) GetSQSByID(id string) (*SQSSubscriber, *Response, error)

type SubscriptionService

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

func (*SubscriptionService) CreateTopicSubscription

func (b *SubscriptionService) CreateTopicSubscription(subscriptionConfig TopicSubscriptionConfig) (*TopicSubscription, *Response, error)

func (*SubscriptionService) DeleteTopicSubscription

func (b *SubscriptionService) DeleteTopicSubscription(subscription TopicSubscription) (bool, *Response, error)

func (*SubscriptionService) FindTopicSubscription

func (b *SubscriptionService) FindTopicSubscription(opt *GetTopicSubscriptionOptions, options ...OptionFunc) (*[]TopicSubscription, *Response, error)

func (*SubscriptionService) GetTopicSubscriptionByID

func (b *SubscriptionService) GetTopicSubscriptionByID(id string) (*TopicSubscription, *Response, error)

type TopicSubscription

type TopicSubscription struct {
	ResourceType              string      `json:"resourceType" validate:"required" enum:"TopicSubscription"`
	ID                        string      `json:"id"`
	Meta                      *Meta       `json:"meta"`
	Name                      string      `json:"name" validate:"required"`
	Description               string      `json:"description" validate:"required"`
	Subscriber                *Subscriber `json:"subscriber" validate:"required"`
	DeliverDataOnly           bool        `json:"deliverDataOnly,omitempty"`
	KinesisStreamPartitionKey string      `json:"kinesisStreamPartitionKey,omitempty"`
	Status                    string      `json:"status" validate:"required" enum:"Creating|Deleting|Active|Updating|InError"`
	ErrorMessage              string      `json:"errorMessage,omitempty"`
	DataType                  string      `json:"dataType" validate:"required"`
	RuleName                  string      `json:"ruleName" validate:"required"`
}

type TopicSubscriptionBundle

type TopicSubscriptionBundle struct {
	Type  string              `json:"type,omitempty"`
	Entry []TopicSubscription `json:"entry,omitempty"`
}

type TopicSubscriptionConfig

type TopicSubscriptionConfig struct {
	ResourceType              string `json:"resourceType" validate:"required" enum:"TopicSubscriptionConfig"`
	NameInfix                 string `json:"nameInfix" validate:"required"`
	Description               string `json:"description" validate:"required"`
	SubscriberId              string `json:"subscriberId" validate:"required"`
	DeliverDataOnly           bool   `json:"deliverDataOnly,omitempty"`
	KinesisStreamPartitionKey string `json:"kinesisStreamPartitionKey,omitempty"`
	DataType                  string `json:"dataType" validate:"required"`
}

Jump to

Keyboard shortcuts

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