Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.premain.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.18.2-rc"
".": "0.19.0-rc"
}
176 changes: 176 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBridgeBus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package apptheorycdk

import (
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
_init_ "github.com/theory-cloud/apptheory/cdk-go/apptheorycdk/jsii"

"github.com/aws/aws-cdk-go/awscdk/v2/awsevents"
"github.com/aws/constructs-go/constructs/v10"
"github.com/theory-cloud/apptheory/cdk-go/apptheorycdk/internal"
)

// Opinionated custom EventBridge bus with explicit cross-account publish allowlist.
type AppTheoryEventBridgeBus interface {
constructs.Construct
EventBus() awsevents.EventBus
// The tree node.
Node() constructs.Node
Policies() *[]awsevents.CfnEventBusPolicy
// Adds a single account ID to the cross-account publish allowlist.
AllowAccount(accountId *string) awsevents.CfnEventBusPolicy
// Returns a string representation of this construct.
ToString() *string
// Applies one or more mixins to this construct.
//
// Mixins are applied in order. The list of constructs is captured at the
// start of the call, so constructs added by a mixin will not be visited.
// Use multiple `with()` calls if subsequent mixins should apply to added
// constructs.
//
// Returns: This construct for chaining.
With(mixins ...constructs.IMixin) constructs.IConstruct
}

// The jsii proxy struct for AppTheoryEventBridgeBus
type jsiiProxy_AppTheoryEventBridgeBus struct {
internal.Type__constructsConstruct
}

func (j *jsiiProxy_AppTheoryEventBridgeBus) EventBus() awsevents.EventBus {
var returns awsevents.EventBus
_jsii_.Get(
j,
"eventBus",
&returns,
)
return returns
}

func (j *jsiiProxy_AppTheoryEventBridgeBus) Node() constructs.Node {
var returns constructs.Node
_jsii_.Get(
j,
"node",
&returns,
)
return returns
}

func (j *jsiiProxy_AppTheoryEventBridgeBus) Policies() *[]awsevents.CfnEventBusPolicy {
var returns *[]awsevents.CfnEventBusPolicy
_jsii_.Get(
j,
"policies",
&returns,
)
return returns
}

func NewAppTheoryEventBridgeBus(scope constructs.Construct, id *string, props *AppTheoryEventBridgeBusProps) AppTheoryEventBridgeBus {
_init_.Initialize()

if err := validateNewAppTheoryEventBridgeBusParameters(scope, id, props); err != nil {
panic(err)
}
j := jsiiProxy_AppTheoryEventBridgeBus{}

_jsii_.Create(
"@theory-cloud/apptheory-cdk.AppTheoryEventBridgeBus",
[]interface{}{scope, id, props},
&j,
)

return &j
}

func NewAppTheoryEventBridgeBus_Override(a AppTheoryEventBridgeBus, scope constructs.Construct, id *string, props *AppTheoryEventBridgeBusProps) {
_init_.Initialize()

_jsii_.Create(
"@theory-cloud/apptheory-cdk.AppTheoryEventBridgeBus",
[]interface{}{scope, id, props},
a,
)
}

// Checks if `x` is a construct.
//
// Use this method instead of `instanceof` to properly detect `Construct`
// instances, even when the construct library is symlinked.
//
// Explanation: in JavaScript, multiple copies of the `constructs` library on
// disk are seen as independent, completely different libraries. As a
// consequence, the class `Construct` in each copy of the `constructs` library
// is seen as a different class, and an instance of one class will not test as
// `instanceof` the other class. `npm install` will not create installations
// like this, but users may manually symlink construct libraries together or
// use a monorepo tool: in those cases, multiple copies of the `constructs`
// library can be accidentally installed, and `instanceof` will behave
// unpredictably. It is safest to avoid using `instanceof`, and using
// this type-testing method instead.
//
// Returns: true if `x` is an object created from a class which extends `Construct`.
func AppTheoryEventBridgeBus_IsConstruct(x interface{}) *bool {
_init_.Initialize()

if err := validateAppTheoryEventBridgeBus_IsConstructParameters(x); err != nil {
panic(err)
}
var returns *bool

_jsii_.StaticInvoke(
"@theory-cloud/apptheory-cdk.AppTheoryEventBridgeBus",
"isConstruct",
[]interface{}{x},
&returns,
)

return returns
}

func (a *jsiiProxy_AppTheoryEventBridgeBus) AllowAccount(accountId *string) awsevents.CfnEventBusPolicy {
if err := a.validateAllowAccountParameters(accountId); err != nil {
panic(err)
}
var returns awsevents.CfnEventBusPolicy

_jsii_.Invoke(
a,
"allowAccount",
[]interface{}{accountId},
&returns,
)

return returns
}

func (a *jsiiProxy_AppTheoryEventBridgeBus) ToString() *string {
var returns *string

_jsii_.Invoke(
a,
"toString",
nil, // no parameters
&returns,
)

return returns
}

func (a *jsiiProxy_AppTheoryEventBridgeBus) With(mixins ...constructs.IMixin) constructs.IConstruct {
args := []interface{}{}
for _, a := range mixins {
args = append(args, a)
}

var returns constructs.IConstruct

_jsii_.Invoke(
a,
"with",
args,
&returns,
)

return returns
}
18 changes: 18 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBridgeBusProps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package apptheorycdk

type AppTheoryEventBridgeBusProps struct {
// Explicit cross-account allowlist for `events:PutEvents`.
//
// Partners can be onboarded one account at a time by adding IDs here.
// Default: [].
//
AllowedAccountIds *[]*string `field:"optional" json:"allowedAccountIds" yaml:"allowedAccountIds"`
// Optional event bus description.
// Default: - no description.
//
Description *string `field:"optional" json:"description" yaml:"description"`
// Optional custom event bus name.
// Default: - CloudFormation-generated name.
//
EventBusName *string `field:"optional" json:"eventBusName" yaml:"eventBusName"`
}
43 changes: 43 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBridgeBus__checks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//go:build !no_runtime_type_checking

package apptheorycdk

import (
"fmt"

_jsii_ "github.com/aws/jsii-runtime-go/runtime"

"github.com/aws/constructs-go/constructs/v10"
)

func (a *jsiiProxy_AppTheoryEventBridgeBus) validateAllowAccountParameters(accountId *string) error {
if accountId == nil {
return fmt.Errorf("parameter accountId is required, but nil was provided")
}

return nil
}

func validateAppTheoryEventBridgeBus_IsConstructParameters(x interface{}) error {
if x == nil {
return fmt.Errorf("parameter x is required, but nil was provided")
}

return nil
}

func validateNewAppTheoryEventBridgeBusParameters(scope constructs.Construct, id *string, props *AppTheoryEventBridgeBusProps) error {
if scope == nil {
return fmt.Errorf("parameter scope is required, but nil was provided")
}

if id == nil {
return fmt.Errorf("parameter id is required, but nil was provided")
}

if err := _jsii_.ValidateStruct(props, func() string { return "parameter props" }); err != nil {
return err
}

return nil
}
17 changes: 17 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBridgeBus__no_checks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//go:build no_runtime_type_checking

package apptheorycdk

// Building without runtime type checking enabled, so all the below just return nil

func (a *jsiiProxy_AppTheoryEventBridgeBus) validateAllowAccountParameters(accountId *string) error {
return nil
}

func validateAppTheoryEventBridgeBus_IsConstructParameters(x interface{}) error {
return nil
}

func validateNewAppTheoryEventBridgeBusParameters(scope constructs.Construct, id *string, props *AppTheoryEventBridgeBusProps) error {
return nil
}
14 changes: 14 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBusTable.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
_init_ "github.com/theory-cloud/apptheory/cdk-go/apptheorycdk/jsii"

"github.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb"
"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
"github.com/aws/constructs-go/constructs/v10"
"github.com/theory-cloud/apptheory/cdk-go/apptheorycdk/internal"
)
Expand All @@ -14,6 +15,8 @@ type AppTheoryEventBusTable interface {
// The tree node.
Node() constructs.Node
Table() awsdynamodb.Table
// Binds the table to a Lambda function for EventBus publish/query/replay flows.
Bind(handler awslambda.IFunction, options *AppTheoryEventBusTableBindingOptions)
// Returns a string representation of this construct.
ToString() *string
// Applies one or more mixins to this construct.
Expand Down Expand Up @@ -114,6 +117,17 @@ func AppTheoryEventBusTable_IsConstruct(x interface{}) *bool {
return returns
}

func (a *jsiiProxy_AppTheoryEventBusTable) Bind(handler awslambda.IFunction, options *AppTheoryEventBusTableBindingOptions) {
if err := a.validateBindParameters(handler, options); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"bind",
[]interface{}{handler, options},
)
}

func (a *jsiiProxy_AppTheoryEventBusTable) ToString() *string {
var returns *string

Expand Down
16 changes: 16 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBusTableBindingOptions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package apptheorycdk

type AppTheoryEventBusTableBindingOptions struct {
// Environment variable name used for the table name binding.
//
// AppTheory runtime code reads `APPTHEORY_EVENTBUS_TABLE_NAME` by default.
// Default: APPTHEORY_EVENTBUS_TABLE_NAME.
//
EnvVarName *string `field:"optional" json:"envVarName" yaml:"envVarName"`
// Grant read-only access for replay/query consumers.
//
// When false, the handler receives read/write access for publish + replay flows.
// Default: false.
//
ReadOnly *bool `field:"optional" json:"readOnly" yaml:"readOnly"`
}
13 changes: 13 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBusTable__checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@ import (

_jsii_ "github.com/aws/jsii-runtime-go/runtime"

"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
"github.com/aws/constructs-go/constructs/v10"
)

func (a *jsiiProxy_AppTheoryEventBusTable) validateBindParameters(handler awslambda.IFunction, options *AppTheoryEventBusTableBindingOptions) error {
if handler == nil {
return fmt.Errorf("parameter handler is required, but nil was provided")
}

if err := _jsii_.ValidateStruct(options, func() string { return "parameter options" }); err != nil {
return err
}

return nil
}

func validateAppTheoryEventBusTable_IsConstructParameters(x interface{}) error {
if x == nil {
return fmt.Errorf("parameter x is required, but nil was provided")
Expand Down
4 changes: 4 additions & 0 deletions cdk-go/apptheorycdk/AppTheoryEventBusTable__no_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ package apptheorycdk

// Building without runtime type checking enabled, so all the below just return nil

func (a *jsiiProxy_AppTheoryEventBusTable) validateBindParameters(handler awslambda.IFunction, options *AppTheoryEventBusTableBindingOptions) error {
return nil
}

func validateAppTheoryEventBusTable_IsConstructParameters(x interface{}) error {
return nil
}
Expand Down
Loading