Documentation
¶
Overview ¶
package control is an implementation of the Ably Control API.
The Ably Control API is a REST API that enables you to manage your Ably account programmatically https://ably.com/documentation/control-api.
Using the Control API you can automate the provisioning, management, and testing of your Ably realtime infrastructure. You can dynamically create Ably apps, configure them, and delete them if necessary.
With the Control API you can create and manage:
- Your Ably apps
- API keys for an Ably app
- Namespaces (for channel rules)
- Queues
- Integration rules
Control API is currently in Preview.
Index ¶
- Constants
- func Interval(interval int) *int
- func NewClient(token string) (Client, Me, error)
- func NewClientWithURL(token, url string) (Client, Me, error)
- type Account
- type Amqp
- type AmqpExternalTarget
- type AmqpTarget
- type App
- type AuthenticationModeAssumeRole
- type AuthenticationModeCredentials
- type AwsAuthentication
- type AwsAuthenticationType
- type AwsKinesisTarget
- type AwsLambdaTarget
- type AwsSqsTarget
- type Client
- func (c *Client) AppendAblyAgent(product, version string)
- func (c *Client) Apps() ([]App, error)
- func (c *Client) CreateApp(app *NewApp) (App, error)
- func (c *Client) CreateIngressRule(appID string, rule *NewIngressRule) (IngressRule, error)
- func (c *Client) CreateKey(appID string, key *NewKey) (Key, error)
- func (c *Client) CreateNamespace(appID string, namespace *Namespace) (Namespace, error)
- func (c *Client) CreateQueue(appID string, queue *NewQueue) (Queue, error)
- func (c *Client) CreateRule(appID string, rule *NewRule) (Rule, error)
- func (c *Client) DeleteApp(id string) error
- func (c *Client) DeleteIngressRule(appID, ruleID string) error
- func (c *Client) DeleteNamespace(appID, namespaceID string) error
- func (c *Client) DeleteQueue(appID, queueID string) error
- func (c *Client) DeleteRule(appID, ruleID string) error
- func (c *Client) IngressRule(appID, ruleID string) (IngressRule, error)
- func (c *Client) IngressRules(appID string) ([]IngressRule, error)
- func (c *Client) Keys(appID string) ([]Key, error)
- func (c *Client) Me() (Me, error)
- func (c *Client) Namespaces(appID string) ([]Namespace, error)
- func (c *Client) Queues(appID string) ([]Queue, error)
- func (c *Client) RevokeKey(appID, keyID string) error
- func (c *Client) Rule(appID, ruleID string) (Rule, error)
- func (c *Client) Rules(appID string) ([]Rule, error)
- func (c *Client) UpdateApp(id string, app *NewApp) (App, error)
- func (c *Client) UpdateIngressRule(appID, ruleID string, rule *NewIngressRule) (IngressRule, error)
- func (c *Client) UpdateKey(appID, keyID string, key *NewKey) (Key, error)
- func (c *Client) UpdateNamespace(appID string, namespace *Namespace) (Namespace, error)
- func (c *Client) UpdateRule(appID, ruleID string, rule *NewRule) (Rule, error)
- type ErrorInfo
- type Format
- type Header
- type HttpAzureFunctionTarget
- type HttpCloudfareWorkerTarget
- type HttpGoogleCloudFunctionTarget
- type HttpIftttTarget
- type HttpTarget
- type HttpZapierTarget
- type IngressMongoTarget
- type IngressPostgresOutboxTarget
- type IngressRule
- type IngressTarget
- type KafkaAuthentication
- type KafkaTarget
- type Key
- type Me
- type Messages
- type Namespace
- type NewApp
- type NewIngressRule
- type NewIngressRuleNoJson
- type NewKey
- type NewQueue
- type NewRule
- type NewRuleNoJson
- type PularAuthenticationMode
- type PulsarAuthentication
- type PulsarTarget
- type Queue
- type Region
- type RequestMode
- type Rule
- type Sasl
- type SaslMechanism
- type Source
- type SourceType
- type Stats
- type Stomp
- type Target
- type Token
- type User
Constants ¶
const API_URL = "https://control.ably.net/v1"
The URL of the Ably Control API.
const VERSION = "0.6.0"
VERSION is the version of this package.
It is sent in requests to the Control API in the Ably-Agent HTTP header.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { // The ID of the account. ID string `json:"id"` // The name of the account. Name string `json:"name"` }
The account detials of an Ably account.
type Amqp ¶
type Amqp struct { // URI for the AMQP queue interface. Uri string `json:"uri,omitempty"` // Name of the Ably queue. QueueName string `json:"queueName,omitempty"` }
Amqp contains a queue's amqp data.
type AmqpExternalTarget ¶
type AmqpExternalTarget struct { // The webhook URL that Ably will POST events to. Url string `json:"url,omitempty"` // The AMQP routing key. The routing key is used by the AMQP exchange to route messages to a // physical queue. See this Ably knowledge base article for details. // https://knowledge.ably.com/what-is-the-format-of-the-routingkey-for-an-amqp-or-kinesis-reactor-rule RoutingKey string `json:"routingKey,omitempty"` // The RabbitMQ exchange, if needed supports interpolation; // see https://faqs.ably.com/what-is-the-format-of-the-routingkey-for-an-amqp-or-kinesis-reactor-rule // for more info. If you don't use RabbitMQ exchanges, leave this blank. Exchange string `json:"exchange,omitempty"` // Reject delivery of the message if the route does not exist, otherwise fail silently. MandatoryRoute bool `json:"mandatoryRoute"` // Marks the message as persistent, instructing the broker to write it to disk if it is in a durable queue. PersistentMessages bool `json:"persistentMessages"` //You can optionally override the default TTL on a queue and specify a TTL in minutes for //messages to be persisted. It is unusual to change the default TTL, so if this field is //left empty, the default TTL for the queue will be used. MessageTTL int `json:"messageTtl,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
AmqpExternalTarget is the type used for AMQP/external rules.
func (*AmqpExternalTarget) TargetType ¶
func (s *AmqpExternalTarget) TargetType() string
AmqpExternalTarget implements the Target interface.
type AmqpTarget ¶
type AmqpTarget struct { // The ID of the Ably queue for input. QueueID string `json:"queueId,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
AmqpTarget is the type used for AMQP rules.
func (*AmqpTarget) TargetType ¶
func (s *AmqpTarget) TargetType() string
AmqpTarget implements the Target interface.
type App ¶
type App struct { // The application ID. ID string `json:"id,omitempty"` // The ID of your Ably account. AccountID string `json:"accountId,omitempty"` // The application name. Name string `json:"name,omitempty"` // The application status. Disabled applications will not accept // new connections and will return an error to all clients. Status string `json:"status,omitempty"` // Enforce TLS for all connections. This setting overrides any channel setting. TLSOnly bool `json:"tlsOnly"` // The Firebase Cloud Messaging key. FcmKey string `json:"fcmKey"` // The Firebase Service Account key. To use the service account key you must also provide a projectId. FcmServiceAccount string `json:"fcmServiceAccount"` // The Firebase Project ID. To authenticate with firebase you must also provide a service account key. FcmProjectId string `json:"fcmProjectId"` // The Apple Push Notification service certificate. // This field can only be used to set a new value, // it will not be populated by queries. ApnsCertificate string `json:"apnsCertificate"` // The Apple Push Notification service private key. // This field can only be used to set a new value, // it will not be populated by queries. ApnsPrivateKey string `json:"apnsPrivateKey"` // Use the Apple Push Notification service sandbox endpoint. ApnsUseSandboxEndpoint bool `json:"apnsUseSandboxEndpoint"` }
A struct representing an Ably application.
type AuthenticationModeAssumeRole ¶
type AuthenticationModeAssumeRole struct { // If you are using the "ARN of an assumable role" authentication method, // this is your Assume Role ARN. See this Ably knowledge base article for details. // https://ably.com/documentation/general/aws-authentication/ AssumeRoleArn string `json:"assumeRoleArn,omitempty"` }
AuthenticationModeAssumeRole is the assume role authentication mode for AWS.
func (*AuthenticationModeAssumeRole) AuthenticationMode ¶
func (a *AuthenticationModeAssumeRole) AuthenticationMode() string
AuthenticationModeAssumeRole implements AwsAuthenticationType.
type AuthenticationModeCredentials ¶
type AuthenticationModeCredentials struct { // The AWS key ID for the AWS IAM user. See this Ably knowledge base article for details. // https://ably.com/documentation/general/aws-authentication/ AccessKeyId string `json:"accessKeyId,omitempty"` // The AWS secret key for the AWS IAM user. See this Ably knowledge base article for details. // https://ably.com/documentation/general/aws-authentication/ SecretAccessKey string `json:"secretAccessKey,omitempty"` }
AuthenticationModeCredentials is the credentials authentication mode for AWS.
func (*AuthenticationModeCredentials) AuthenticationMode ¶
func (a *AuthenticationModeCredentials) AuthenticationMode() string
AuthenticationModeCredentials implements the AwsAuthenticationType interface.
type AwsAuthentication ¶
type AwsAuthentication struct { // Authentication can be any supported AWS authentication type. Authentication AwsAuthenticationType }
AwsAuthentication are the params used for authenticating with AWS.
func (*AwsAuthentication) MarshalJSON ¶
func (a *AwsAuthentication) MarshalJSON() ([]byte, error)
func (*AwsAuthentication) UnmarshalJSON ¶
func (a *AwsAuthentication) UnmarshalJSON(data []byte) error
type AwsAuthenticationType ¶
type AwsAuthenticationType interface {
AuthenticationMode() string
}
AwsAuthenticationType is an interface implemented by the different structs that can be used in AWS authentication.
type AwsKinesisTarget ¶
type AwsKinesisTarget struct { // The region is which AWS Kinesis is hosted. See the AWS documentation for more detail. // https://docs.aws.amazon.com/general/latest/gr/rande.html#lambda_region Region string `json:"region,omitempty"` // The name of your AWS Kinesis Stream. StreamName string `json:"streamName,omitempty"` // The AWS Kinesis partition key. The partition key is used by Kinesis to route messages // to one of the stream shards. See this Ably knowledge base article for details. // https://knowledge.ably.com/what-is-the-format-of-the-routingkey-for-an-amqp-or-kinesis-reactor-rule PartitionKey string `json:"partitionKey,omitempty"` // Authentication details. Authentication AwsAuthentication `json:"authentication"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
AwsKinesisTarget is the type used for aws/kinesis rules.
func (*AwsKinesisTarget) TargetType ¶
func (s *AwsKinesisTarget) TargetType() string
AwsKinesisTarget implements the Target interface.
type AwsLambdaTarget ¶
type AwsLambdaTarget struct { // The region is which your AWS Lambda Function is hosted. See the AWS documentation for more detail. // https://docs.aws.amazon.com/general/latest/gr/rande.html#lambda_region Region string `json:"region,omitempty"` // The name of your AWS Lambda Function. FunctionName string `json:"functionName,omitempty"` // Authentication details. Authentication AwsAuthentication `json:"authentication"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` }
AwsLambdaTarget is the type used for aws/lambda rules.
func (*AwsLambdaTarget) TargetType ¶
func (s *AwsLambdaTarget) TargetType() string
AwsLambdaTarget implements the Target interface.
type AwsSqsTarget ¶
type AwsSqsTarget struct { // The region is which AWS SQS is hosted. See the AWS documentation for more detail. // https://docs.aws.amazon.com/general/latest/gr/rande.html#lambda_region Region string `json:"region,omitempty"` // Your AWS account ID. AwsAccountID string `json:"awsAccountId,omitempty"` // The AWS SQS queue name. QueueName string `json:"queueName,omitempty"` // Authentication details. Authentication AwsAuthentication `json:"authentication"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
AwsSqsTarget is the type used for aws/sqs rules.
func (*AwsSqsTarget) TargetType ¶
func (s *AwsSqsTarget) TargetType() string
AwsSqsTarget implements the Target interface.
type Client ¶
type Client struct { // Url is the base url for the REST API. Url string // contains filtered or unexported fields }
Client represents a REST client for the Ably Control API.
func (*Client) AppendAblyAgent ¶
AppendAblyAgent appends an extra entry to the value sent as the Ably-Agent HTTP header.
func (*Client) CreateIngressRule ¶ added in v0.5.0
func (c *Client) CreateIngressRule(appID string, rule *NewIngressRule) (IngressRule, error)
Creates an Ingress rule for the application with the specified application ID.
func (*Client) CreateNamespace ¶
CreateNamespace creates a namespace for the specified application ID.
func (*Client) CreateQueue ¶
CreateQueue creates a queue for the application specified by application ID.
func (*Client) CreateRule ¶
Creates a rule for the application with the specified application ID.
func (*Client) DeleteIngressRule ¶ added in v0.5.0
Deletes the rule specified by the rule ID, for the application specified by application ID.
func (*Client) DeleteNamespace ¶
DeleteNamespace deletes the namespace with the specified ID, for the specified application ID.
func (*Client) DeleteQueue ¶
DeleteQueue delete the queue with the specified queue name, from the application with the specified application ID.
func (*Client) DeleteRule ¶
Deletes the rule specified by the rule ID, for the application specified by application ID.
func (*Client) IngressRule ¶ added in v0.5.0
func (c *Client) IngressRule(appID, ruleID string) (IngressRule, error)
Returns the ingess rule specified by the rule ID, for the application specified by application ID.
func (*Client) IngressRules ¶ added in v0.5.0
func (c *Client) IngressRules(appID string) ([]IngressRule, error)
Lists the rules for the application specified by the application ID.
func (*Client) Namespaces ¶
Namespaces lists the namespaces for the specified application ID.
func (*Client) RevokeKey ¶
RevokeKey revokes the API key with the specified ID. This deletes the key.
func (*Client) Rule ¶
Returns the rule specified by the rule ID, for the application specified by application ID.
func (*Client) UpdateIngressRule ¶ added in v0.5.0
func (c *Client) UpdateIngressRule(appID, ruleID string, rule *NewIngressRule) (IngressRule, error)
Updates the rule specified by the rule ID, for the application specified by application ID.
func (*Client) UpdateNamespace ¶
UpdateNamespace updates the namespace with the specified ID, for the application with the specified application ID.
type ErrorInfo ¶
type ErrorInfo struct { // The error message. Message string `json:"message"` // The Ably error code. Code int `json:"code"` // The HTTP status code returned. StatusCode int `json:"statusCode"` // The URL to documentation about the error code. HRef string `json:"href"` // Any additional details about the error message. Details map[string][]string `json:"details"` // The API path that resulted in this error. APIPath string }
ErrorInfo represents an error type that the REST API may return.
type Format ¶
type Format string
Format is the format used for encoding.
const Json Format = "json"
Json encodes using json.
const MsgPack Format = "msgpack"
MsgPack encodes using message pack.
type Header ¶
type Header struct { // The name of the header. Name string `json:"name,omitempty"` // The value of the header. Value string `json:"value,omitempty"` }
Headers that can be used for some rule kinds.
type HttpAzureFunctionTarget ¶
type HttpAzureFunctionTarget struct { // The Microsoft Azure Application ID. You can find your Microsoft Azure Application // ID as shown in this article. https://dev.applicationinsights.io/documentation/Authorization/API-key-and-App-ID AzureAppID string `json:"azureAppId,omitempty"` // The name of your Microsoft Azure Function. AzureFunctionName string `json:"azureFunctionName,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // The signing key ID for use in batch mode. Ably will optionally sign the payload using an API key // ensuring your servers can validate the payload using the private API key. See the webhook security // docs for more information. https://ably.com/documentation/general/events#security SigningKeyID string `json:"signingKeyId"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
HttpAzureFunctionTarget is the type used for http/azure-function targets.
func (*HttpAzureFunctionTarget) TargetType ¶
func (s *HttpAzureFunctionTarget) TargetType() string
HttpAzureFunctionTarget implements the Target interface.
type HttpCloudfareWorkerTarget ¶
type HttpCloudfareWorkerTarget struct { // The webhook URL that Ably will POST events to. Url string `json:"url,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // The signing key ID for use in batch mode. Ably will optionally sign the payload using an API key // ensuring your servers can validate the payload using the private API key. See the webhook security // docs for more information. https://ably.com/documentation/general/events#security SigningKeyID string `json:"signingKeyId"` }
HttpCloudfareWorkerTarget is the type used for http/cloudflare-worker rules.
func (*HttpCloudfareWorkerTarget) TargetType ¶
func (s *HttpCloudfareWorkerTarget) TargetType() string
HttpCloudfareWorkerTarget implements the Target interface.
type HttpGoogleCloudFunctionTarget ¶
type HttpGoogleCloudFunctionTarget struct { // The region in which your Google Cloud Function is hosted. See the Google documentation for more details. // https://cloud.google.com/compute/docs/regions-zones/ Region string `json:"region,omitempty"` // The project ID for your Google Cloud Project that was generated when you created your project. ProjectID string `json:"projectId,omitempty"` // The name of your Google Cloud Function. FunctionName string `json:"functionName,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // The signing key ID for use in batch mode. Ably will optionally sign the payload using // an API key ensuring your servers can validate the payload using the private API key. // See the webhook security docs for more information. // https://ably.com/documentation/general/events#security SigningKeyID string `json:"signingKeyId"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
HttpGoogleCloudFunctionTarget is type type used for http/goole-cloud-function targets.
func (*HttpGoogleCloudFunctionTarget) TargetType ¶
func (s *HttpGoogleCloudFunctionTarget) TargetType() string
HttpGoogleCloudFunctionTarget implements the Target interface.
type HttpIftttTarget ¶
type HttpIftttTarget struct { // The key in the Webhook Service Documentation page of your IFTTT account. WebhookKey string `json:"webhookKey,omitempty"` // The Event name is used to identify the IFTTT applet that will receive the Event, // make sure the name matches the name of the IFTTT applet. EventName string `json:"eventName,omitempty"` }
HttpIftttTarget is the type used for http/ifttt rules.
func (*HttpIftttTarget) TargetType ¶
func (s *HttpIftttTarget) TargetType() string
HttpIftttTarget implements the Target interface.
type HttpTarget ¶
type HttpTarget struct { // The webhook URL that Ably will POST events to. Url string `json:"url,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // The signing key ID for use in batch mode. Ably will optionally sign the payload using an // API key ensuring your servers can validate the payload using the private API key. // See the webhook security docs for more information. // https://ably.com/documentation/general/events#security SigningKeyID string `json:"signingKeyId"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
HttpTarget is the type used for http rules.
func (*HttpTarget) TargetType ¶
func (s *HttpTarget) TargetType() string
HttpTarget implements the Target interface.
type HttpZapierTarget ¶
type HttpZapierTarget struct { // The webhook URL that Ably will POST events to. Url string `json:"url,omitempty"` // If you have additional information to send, you'll need to include the relevant headers. Headers []Header `json:"headers,omitempty"` // The signing key ID for use in batch mode. Ably will optionally sign the payload using an API key // ensuring your servers can validate the payload using the private API key. See the webhook security // docs for more information. https://ably.com/documentation/general/events#security SigningKeyID string `json:"signingKeyId"` }
HttpZapierTarget is the type used for http/zapier rules.
func (*HttpZapierTarget) TargetType ¶
func (s *HttpZapierTarget) TargetType() string
HttpZapierTarget implements the Target interface.
type IngressMongoTarget ¶ added in v0.5.0
type IngressMongoTarget struct { // The URL of the MongoDB server. Url string `json:"url,omitempty"` // Watch is the collection to watch. Database string `json:"database,omitempty"` // The collection to watch. Collection string `json:"collection,omitempty"` // The pipeline to use. Pipeline string `json:"pipeline,omitempty"` // FullDocument controls how the full document is sent. FullDocument string `json:"fullDocument,omitempty"` // FullDocumentBeforeChange controls how the full document is sent. FullDocumentBeforeChange string `json:"fullDocumentBeforeChange,omitempty"` // The primary site. PrimarySite string `json:"primarySite,omitempty"` }
IngressMongoTarget is the type used for MongoDB Ingress rules.
func (*IngressMongoTarget) TargetType ¶ added in v0.5.0
func (s *IngressMongoTarget) TargetType() string
IngressMongoTarget implements the Target interface.
type IngressPostgresOutboxTarget ¶ added in v0.5.0
type IngressPostgresOutboxTarget struct { // The URL for your Postgres database. Url string `json:"url,omitempty"` // Schema for the outbox table in your database which allows for the // reliable publication of an ordered sequence of change event messages // over Ably. OutboxTableSchema string `json:"outboxTableSchema,omitempty"` // Name for the outbox table. OutboxTableName string `json:"outboxTableName,omitempty"` // Schema for the nodes table in your database to allow for operation as a // cluster to provide fault tolerance. NodesTableSchema string `json:"nodesTableSchema,omitempty"` // Name for the nodes table. NodesTableName string `json:"nodesTableName,omitempty"` // Determines the level of protection provided by the SSL connection. // Options are: prefer, require, verify-ca, verify-full; // default value is prefer. SslMode string `json:"sslMode,omitempty"` // Optional. Specifies the SSL certificate authority (CA) certificates. // Required if SSL mode is verify-ca or verify-full. SslRootCert string `json:"sslRootCert,omitempty"` //The primary data center in which to run the integration rule. PrimarySite string `json:"primarySite,omitempty"` }
func (*IngressPostgresOutboxTarget) TargetType ¶ added in v0.5.0
func (s *IngressPostgresOutboxTarget) TargetType() string
IngressPostgresTarget implements the Target interface.
type IngressRule ¶ added in v0.5.0
type IngressRule struct { // The rule ID. ID string `json:"id,omitempty"` // The Ably application ID. AppID string `json:"appId,omitempty"` // API version. Events and the format of their payloads are versioned. // Please see the Events documentation. https://ably.com/documentation/general/events Version string `json:"version,omitempty"` // The status of the rule. Rules can be enabled or disabled. Status string `json:"status,omitempty"` // Unix timestamp representing the date and time of creation of the rule. Created int `json:"created"` // Unix timestamp representing the date and time of last modification of the rule. Modified int `json:"modified"` // The rule target. Target IngressTarget `json:"target"` }
IngressRule is a struct representing an Ably Ingress rule.
func (*IngressRule) IngressRuleType ¶ added in v0.5.0
func (r *IngressRule) IngressRuleType() string
IngressRuleType gets the type of target this rule has.
func (*IngressRule) RuleType ¶ added in v0.5.0
func (r *IngressRule) RuleType() string
RuleType gets the type of target this rule has.
func (*IngressRule) UnmarshalJSON ¶ added in v0.5.0
func (r *IngressRule) UnmarshalJSON(data []byte) error
type IngressTarget ¶ added in v0.5.0
type IngressTarget interface { // TargetType returns the kind of target. TargetType() string }
type KafkaAuthentication ¶
type KafkaAuthentication struct { // SASL (Simple Authentication Security Layer) / SCRAM (Salted Challenge Response Authentication Mechanism) // uses usernames and passwords stored in ZooKeeper. Credentials are created during installation. // See documentation on configuring SCRAM. Sasl Sasl `json:"sasl"` }
KafkaAuthentication are params used for authenticating with Kafka.
type KafkaTarget ¶
type KafkaTarget struct { // The Kafka partition key. This is used to determine which partition a message should be routed to, // where a topic has been partitioned. routingKey should be in the format topic:key where topic is // the topic to publish to, and key is the value to use as the message key. RoutingKey string `json:"routingKey,omitempty"` // This is an array of brokers that host your Kafka partitions. Each broker is specified // using the format host, host:port or ip:port. Brokers []string `json:"brokers,omitempty"` // The Kafka authentication mechanism. Authentication KafkaAuthentication `json:"auth"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
KafkaTarget is the type for Kafka targets.
func (*KafkaTarget) TargetType ¶
func (s *KafkaTarget) TargetType() string
KafkaTarget implements the Target interface.
type Key ¶
type Key struct { // The key ID. ID string `json:"id,omitempty"` // The Ably application ID which this key is associated with. AppID string `json:"appId,omitempty"` // The name for your API key. This is a friendly name for your reference. Name string `json:"name,omitempty"` // The status of the key. 0 is enabled, 1 is revoked. Status int `json:"status"` // The complete API key including API secret. Key string `json:"key,omitempty"` // The capabilities that this key has. More information on capabilities // can be found in the Ably documentation https://ably.com/documentation/core-features/authentication#capabilities-explained. Capability map[string][]string `json:"capability"` // Unix timestamp representing the date and time of creation of the key. Created int `json:"created"` // Unix timestamp representing the date and time of the last modification of the key. Modified int `json:"modified"` // Token revocation is a security mechanism allowing an app to invalidate authentication tokens, // primarily used against malicious clients. Implementation sets tokens' maximum time-to-live (TTL) to one hour. RevocableTokens bool `json:"revocableTokens"` }
A struct representing an Ably Key.
type Me ¶
type Me struct { // The access token used to authenticate. Token Token `json:"token"` // The user accociated with the used token. User User `json:"user"` // The account accociated with the used token. Account Account `json:"account"` }
The Me struct contains information about the token the current user authenticates with.
type Messages ¶
type Messages struct { // The number of ready messages in the queue. Ready int `json:"ready"` // The number of unacknowledged messages in the queue. Unacknowledged int `json:"unacknowledged"` // The total number of messages in the queue.. Total int `json:"total"` }
Messages contains messages in a queue.
type Namespace ¶
type Namespace struct { //The namespace or channel name that the channel rule will apply to. For example, //if you specify namespace the namespace will be set to namespace and will match //with channels namespace:* and namespace. ID string `json:"id,omitempty"` // If true, clients will not be permitted to use (including to attach, publish, or subscribe) // any channels within this namespace unless they are identified, that is, authenticated using // a client ID. See the Ably knowledge base for more details. https://knowledge.ably.com/authenticated-and-identified-clients Authenticated bool `json:"authenticated"` // If true, all messages on a channel will be stored for 24 hours. You can access stored // messages via the History API. Please note that for each message stored, an additional // message is deducted from your monthly allocation. Persisted bool `json:"persisted"` // If true, the last message published on a channel will be stored for 365 days. You can // access the stored message only by using the channel rewind mechanism and attaching with rewind=1. // Please note that for each message stored, an additional message is deducted from your monthly allocation. PersistLast bool `json:"persistLast"` // If true, publishing messages with a push payload in the extras field is permitted // and can trigger the delivery of a native push notification to registered devices for the channel. PushEnabled bool `json:"pushEnabled"` // If true, only clients that are connected using TLS will be permitted to subscribe to any // channels within this namespace. TlsOnly bool `json:"tlsOnly"` // If true, messages received on a channel will contain a unique timeserial that can be // referenced by later messages for use with message interactions. ExposeTimeserial bool `json:"exposeTimeserial"` // If true, channels within this namespace will start batching inbound // messages instead of sending them out immediately to subscribers as per // the configured policy. BatchingEnabled bool `json:"batchingEnabled"` // When configured, sets the maximium batching interval in the channel. BatchingInterval *int `json:"batchingInterval,omitempty"` // If `true`, enables conflation for channels within this namespace. // Conflation reduces the number of messages sent to subscribers by // combining multiple messages into a single message. ConflationEnabled bool `json:"conflationEnabled"` // The interval in milliseconds at which messages are conflated. This // determines how frequently messages are combined into a single message. ConflationInterval *int `json:"conflationInterval"` // The key used to determine which messages should be conflated. Messages // with the same conflation key will be combined into a single message. ConflationKey string `json:"conflationKey"` }
A struct representing an Ably namespace.
type NewApp ¶
type NewApp struct { // The application ID. ID string `json:"id,omitempty"` // The application name. Name string `json:"name,omitempty"` // The application status. Disabled applications will not accept // new connections and will return an error to all clients. Status string `json:"status,omitempty"` // Enforce TLS for all connections. This setting overrides any channel setting. TLSOnly bool `json:"tlsOnly"` // The Firebase Cloud Messaging key. FcmKey string `json:"fcmKey"` // The Firebase Service Account key. To use the service account key you must also provide a projectId. FcmServiceAccount string `json:"fcmServiceAccount"` // The Firebase Project ID. To authenticate with firebase you must also provide a service account key. FcmProjectId string `json:"fcmProjectId"` // The Apple Push Notification service certificate. // This field can only be used to set a new value, // it will not be populated by queries. ApnsCertificate string `json:"apnsCertificate"` // The Apple Push Notification service private key. // This field can only be used to set a new value, // it will not be populated by queries. ApnsPrivateKey string `json:"apnsPrivateKey"` // Use the Apple Push Notification service sandbox endpoint. ApnsUseSandboxEndpoint bool `json:"apnsUseSandboxEndpoint"` }
A struct representing the settable fields of an Ably application.
type NewIngressRule ¶ added in v0.5.0
type NewIngressRule struct { // The status of the rule. Rules can be enabled or disabled. Status string `json:"status,omitempty"` // The rule target. Target IngressTarget `json:"target"` }
NewRule is used to create a new rule.
func (*NewIngressRule) IngressRuleType ¶ added in v0.5.0
func (r *NewIngressRule) IngressRuleType() string
IngressRuleType gets the type of target this rule has.
func (*NewIngressRule) MarshalJSON ¶ added in v0.5.0
func (r *NewIngressRule) MarshalJSON() ([]byte, error)
type NewIngressRuleNoJson ¶ added in v0.5.0
type NewIngressRuleNoJson NewIngressRule
type NewKey ¶
type NewKey struct { // The name for your API key. This is a friendly name for your reference. Name string `json:"name,omitempty"` // The capabilities that this key has. More information on capabilities // can be found in the Ably documentation https://ably.com/documentation/core-features/authentication#capabilities-explained. Capability map[string][]string `json:"capability"` // Enable Revocable Tokens. More information on Token Revocation can be // found in the Ably documentation https://ably.com/docs/auth/revocation RevocableTokens bool `json:"revocableTokens"` }
A struct representing the settable fields of an Ably key.
type NewQueue ¶
type NewQueue struct { // The friendly name of the queue. Name string `json:"name,omitempty"` // TTL in minutes. Ttl int `json:"ttl"` // Message limit in number of messages. MaxLength int `json:"maxLength"` // The data center region for the queue. Region Region `json:"region,omitempty"` }
NewQueue is used to create a new Ably queue.
type NewRule ¶
type NewRule struct { // The status of the rule. Rules can be enabled or disabled. Status string `json:"status,omitempty"` // RequestMode. You can read more about the difference between single and batched // events in the Ably documentation. https://ably.com/documentation/general/events#batching RequestMode RequestMode `json:"requestMode,omitempty"` // The rule source. Source Source `json:"source"` // The rule target. Target Target `json:"target"` }
NewRule is used to create a new rule.
func (*NewRule) MarshalJSON ¶
type NewRuleNoJson ¶
type NewRuleNoJson NewRule
type PularAuthenticationMode ¶
type PularAuthenticationMode string
PularAuthenticationMode is an enum of authentication modes used by Pulsar rules.
const AuthToken PularAuthenticationMode = "token"
AuthToken AuthenticationMode.
type PulsarAuthentication ¶
type PulsarAuthentication struct { // Authentication mode. AuthenticationMode PularAuthenticationMode `json:"authenticationMode,omitempty"` // The JWT string. Token string `json:"token,omitempty"` }
PulsarAuthentication is used to authenticate for Pulsar rules
type PulsarTarget ¶
type PulsarTarget struct { // The optional routing key (partition key) used // to publish messages. Supports interpolation as described in the Ably FAQs. // https://faqs.ably.com/what-is-the-format-of-the-routingkey-for-an-amqp-or-kinesis-reactor-rule RoutingKey string `json:"routingKey,omitempty"` // A Pulsar topic. This is a named channel for transmission of messages between producers and consumers. // The topic has the form: {persistent|non-persistent}://tenant/namespace/topic Topic string `json:"topic,omitempty"` // The URL of the Pulsar cluster in the form pulsar://host:port or pulsar+ssl://host:port. ServiceURL string `json:"serviceUrl,omitempty"` // All connections to a Pulsar endpoint require TLS. The tlsTrustCerts option // allows you to configure different or additional trust anchors for those TLS // connections. This enables server verification. You can specify an optional // list of trusted CA certificates to use to verify the TLS certificate presented // by the Pulsar cluster. Each certificate should be encoded in PEM format. TlsTrustCerts []string `json:"tlsTrustCerts"` // Pulsar supports authenticating clients using security tokens that are based on JSON Web Tokens. Authentication PulsarAuthentication `json:"authentication"` // Delivered messages are wrapped in an Ably envelope by default that contains metadata about the message // and its payload. The form of the envelope depends on whether it is part of a Webhook/Function or a // Queue/Firehose rule. For everything besides Webhooks, you can ensure you only get the raw payload by // unchecking "Enveloped" when setting up the rule. Enveloped bool `json:"enveloped"` // JSON provides a simpler text-based encoding, whereas MsgPack provides a more efficient binary encoding. Format Format `json:"format,omitempty"` }
PulsarTarget is the type used for Pular rules.
func (*PulsarTarget) TargetType ¶
func (s *PulsarTarget) TargetType() string
PulsarTarget implements the Target interface.
type Queue ¶
type Queue struct { // The ID of the Ably queue. ID string `json:"id,omitempty"` // The Ably application ID. AppID string `json:"appId,omitempty"` // The friendly name of the queue. Name string `json:"name,omitempty"` // The data center region for the queue. Region Region `json:"region,omitempty"` // The amqp data. Amqp Amqp `json:"amqp"` // The stomp data. Stomp Stomp `json:"stomp"` // The current state of the queue. State string `json:"state,omitempty"` // Details of messages in the queue. Messages Messages `json:"messages"` // Queue stats. Stats Stats `json:"stats"` // TTL in minutes. Ttl int `json:"ttl"` // Message limit in number of messages. MaxLength int `json:"maxLength"` // A boolean that indicates whether this is a dead letter queue or not. DeadLetter bool `json:"deadLetter"` // The ID of the dead letter queue. DeadLetterID string `json:"deadLetterId,omitempty"` }
Queue represents an Ably queue.
type Region ¶
type Region string
Region is an enum of the possible queue regions.
const EuWest1A Region = "eu-west-1-a"
EuWest1A is the eu west 1 a region.
const UsEast1A Region = "us-east-1-a"
UsEast1A is the us east 1 a region.
type RequestMode ¶
type RequestMode string
RequestMode is a source's request mode.
const Batch RequestMode = "batch"
Batch is the Batch Request Mode
const Single RequestMode = "single"
Single is the Single Request Mode
type Rule ¶
type Rule struct { // The rule ID. ID string `json:"id,omitempty"` // The Ably application ID. AppID string `json:"appId,omitempty"` // API version. Events and the format of their payloads are versioned. // Please see the Events documentation. https://ably.com/documentation/general/events Version string `json:"version,omitempty"` // The status of the rule. Rules can be enabled or disabled. Status string `json:"status,omitempty"` // Unix timestamp representing the date and time of creation of the rule. Created int `json:"created"` // Unix timestamp representing the date and time of last modification of the rule. Modified int `json:"modified"` // RequestMode. You can read more about the difference between single and batched // events in the Ably documentation. https://ably.com/documentation/general/events#batching RequestMode RequestMode `json:"requestMode,omitempty"` // The rule source. Source Source `json:"source"` // The rule target. Target Target `json:"target"` }
Rule is a struct representing an Ably rule.
func (*Rule) UnmarshalJSON ¶
type Sasl ¶
type Sasl struct { // The hash type to use. Mechanism SaslMechanism `json:"mechanism,omitempty"` // Kafka login credential. Username string `json:"username,omitempty"` // Kafka login credential. Password string `json:"password,omitempty"` }
SASL (Simple Authentication Security Layer) / SCRAM (Salted Challenge Response Authentication Mechanism) uses usernames and passwords stored in ZooKeeper. Credentials are created during installation. See documentation on configuring SCRAM.
type SaslMechanism ¶
type SaslMechanism string
SaslMechanism is the hash type used for Sasl authentication.
const Plain SaslMechanism = "plain"
Plain do not use a hash.
const Scram_sha_256 SaslMechanism = "scra-sha-256"
Scram_sha_256 use sha256 hashes.
const Scram_sha_512 SaslMechanism = "scra-sha-512"
Scram_sha_512 use sha512 hashes.
type Source ¶
type Source struct { // ChannelFilter allows you to filter your rule based on a regular expression that is matched against the complete channel name. // Leave this empty if you want the rule to apply to all channels. ChannelFilter string `json:"channelFilter"` // Type controls the type of messages that are sent to the rule. Type SourceType `json:"type,omitempty"` }
Source controls how a rule gets data from channels.
type SourceType ¶
type SourceType string
SourceType is the type of messages a source applies to.
const ChannelLifeCycle SourceType = "channel.lifecycle"
ChannelLifeCycle represents channel lifecycle events.
const ChannelMessage SourceType = "channel.message"
ChannelMessage represents message published to a channel.
const ChannelOccupancy SourceType = "channel.occupancy"
ChannelOccupancy representing channel occupancy events.
const ChannelPresence SourceType = "channel.presence"
ChannelPresence represents presence events on a channel.
type Stats ¶
type Stats struct { // The rate at which messages are published to the queue. Rate is messages per minute. PublishRate float64 `json:"publishRate"` // The rate at which messages are delivered from the queue. Rate is messages per minute. DeliveryRate float64 `json:"deliveryRate"` // The rate at which messages are acknowledged. Rate is messages per minute. AcknowledgementRate float64 `json:"acknowledgementRate"` }
Stats contains statistics about an Ably queue
type Stomp ¶
type Stomp struct { // URI for the STOMP queue interface. Uri string `json:"uri,omitempty"` // The host type for the queue. Host string `json:"host,omitempty"` // Destination queue. Destination string `destination:"uri,omitempty"` }
Stomp contains a queue's stomp data.
type Target ¶
type Target interface { // TargetType returns the kind of target. TargetType() string }
The Target interface is implemented by targets and allows querying what kind of target they are.