subscription

package
v1.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AzureServiceBus   = "AzureServiceBus"
	EventBridge       = "EventBridge"
	EventGrid         = "EventGrid"
	GoogleCloudPubSub = "GoogleCloudPubSub"
	SNS               = "SNS"
	SQS               = "SQS"
	ConfluentCloud    = "ConfluentCloud"
)

Variables

View Source
var SubscriptionResourceV1 = tftypes.Object{
	AttributeTypes: map[string]tftypes.Type{
		"id":      tftypes.String,
		"key":     tftypes.String,
		"version": tftypes.Number,

		"changes": tftypes.Set{
			ElementType: tftypes.Object{
				AttributeTypes: map[string]tftypes.Type{
					"resource_type_ids": tftypes.List{
						ElementType: tftypes.String,
					},
				},
			},
		},
		"destination": tftypes.List{
			ElementType: destinationType,
		},
		"format": tftypes.List{
			ElementType: formatType,
		},
		"message": tftypes.Set{
			ElementType: tftypes.Object{
				AttributeTypes: map[string]tftypes.Type{
					"resource_type_id": tftypes.String,
					"types": tftypes.List{
						ElementType: tftypes.String,
					},
				},
			},
		},
		"event": tftypes.Set{
			ElementType: tftypes.Object{
				AttributeTypes: map[string]tftypes.Type{
					"resource_type_id": tftypes.String,
					"types": tftypes.List{
						ElementType: tftypes.String,
					},
				},
			},
		},
	},
}

SubscriptionResourceV1 represents the currently used structure of the subscription resource. This is used to map legacy structures to the current required structure.

View Source
var SubscriptionResourceV2 = tftypes.Object{
	AttributeTypes: map[string]tftypes.Type{
		"id":      tftypes.String,
		"key":     tftypes.String,
		"version": tftypes.Number,

		"changes": tftypes.Set{
			ElementType: tftypes.Object{
				AttributeTypes: map[string]tftypes.Type{
					"resource_type_ids": tftypes.List{
						ElementType: tftypes.String,
					},
				},
			},
		},
		"destination": tftypes.Object{
			AttributeTypes: map[string]tftypes.Type{
				"type":              tftypes.String,
				"topic_arn":         tftypes.String,
				"queue_url":         tftypes.String,
				"region":            tftypes.String,
				"account_id":        tftypes.String,
				"access_key":        tftypes.String,
				"access_secret":     tftypes.String,
				"uri":               tftypes.String,
				"connection_string": tftypes.String,
				"project_id":        tftypes.String,
				"topic":             tftypes.String,
			},
		},
		"format": tftypes.Object{
			AttributeTypes: map[string]tftypes.Type{
				"type":                 tftypes.String,
				"cloud_events_version": tftypes.String,
			},
		},
		"message": tftypes.Set{
			ElementType: tftypes.Object{
				AttributeTypes: map[string]tftypes.Type{
					"resource_type_id": tftypes.String,
					"types": tftypes.List{
						ElementType: tftypes.String,
					},
				},
			},
		},
	},
}

Functions

func NewSubscriptionResource

func NewSubscriptionResource() resource.Resource

NewSubscriptionResource is a helper function to simplify the provider implementation.

func OrderSubscriptionTypesActions added in v1.20.0

func OrderSubscriptionTypesActions(
	changesAction *platform.SubscriptionSetChangesAction,
	messagesAction *platform.SubscriptionSetMessagesAction,
	eventsAction *platform.SubscriptionSetEventsAction,
) []platform.SubscriptionUpdateAction

OrderSubscriptionTypesActions orders the changes and messages actions. This ensures that if both are present but one has an empty list of changes the action with an empty list will be processed last. This is important because otherwise Commercetools will throw an error that a subscription with an empty list of changes and messages

Types

type Changes

type Changes struct {
	ResourceTypeIds []types.String `tfsdk:"resource_type_ids"`
}

type Destination

type Destination struct {
	Type types.String `tfsdk:"type"`

	// SNS, SQS, EventGrid
	AccessKey    types.String `tfsdk:"access_key"`
	AccessSecret types.String `tfsdk:"access_secret"`
	Region       types.String `tfsdk:"region"`

	// SNS
	TopicARN types.String `tfsdk:"topic_arn"`

	// SQS
	QueueURL  types.String `tfsdk:"queue_url"`
	AccountID types.String `tfsdk:"account_id"`

	// EventGrid
	URI types.String `tfsdk:"uri"`

	// AzureServiceBus
	ConnectionString types.String `tfsdk:"connection_string"`

	// GooglePubSub
	ProjectID types.String `tfsdk:"project_id"`

	// GooglePubSub, ConfluentCloud
	Topic types.String `tfsdk:"topic"`

	// For ConfluentCloud
	BootstrapServer types.String `tfsdk:"bootstrap_server"`
	ApiKey          types.String `tfsdk:"api_key"`
	ApiSecret       types.String `tfsdk:"api_secret"`
	Acks            types.String `tfsdk:"acks"`
	Key             types.String `tfsdk:"key"`
}

func NewDestinationFromNative

func NewDestinationFromNative(n platform.Destination) *Destination

func (*Destination) ToNative

func (d *Destination) ToNative() platform.Destination

type Event added in v1.20.0

type Event struct {
	ResourceTypeID types.String   `tfsdk:"resource_type_id"`
	Types          []types.String `tfsdk:"types"`
}

type Format

type Format struct {
	Type              types.String `tfsdk:"type"`
	CloudEventVersion types.String `tfsdk:"cloud_events_version"`
}

func NewFormatFromNative

func NewFormatFromNative(n platform.DeliveryFormat) *Format

type Message

type Message struct {
	ResourceTypeID types.String   `tfsdk:"resource_type_id"`
	Types          []types.String `tfsdk:"types"`
}

type Subscription

type Subscription struct {
	ID          types.String  `tfsdk:"id"`
	Key         types.String  `tfsdk:"key"`
	Version     types.Int64   `tfsdk:"version"`
	Destination []Destination `tfsdk:"destination"`
	Format      []Format      `tfsdk:"format"`
	Messages    []Message     `tfsdk:"message"`
	Changes     []Changes     `tfsdk:"changes"`
	Events      []Event       `tfsdk:"event"`
}

Subscription is the main resource schema data

func NewSubscriptionFromNative

func NewSubscriptionFromNative(n *platform.Subscription) Subscription

Jump to

Keyboard shortcuts

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