package awscdk import ( _init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" "github.com/aws/constructs-go/constructs/v10" ) // Instantiation of a custom resource, whose implementation is provided a Provider. // // This class is intended to be used by construct library authors. Application // builder should not be able to tell whether or not a construct is backed by // a custom resource, and so the use of this class should be invisible. // // Instead, construct library authors declare a custom construct that hides the // choice of provider, and accepts a strongly-typed properties object with the // properties your provider accepts. // // Your custom resource provider (identified by the `serviceToken` property) // can be one of 4 constructs: // // - If you are authoring a construct library or application, we recommend you // use the `Provider` class in the `custom-resources` module. // - If you are authoring a construct for the CDK's AWS Construct Library, // you should use the `CustomResourceProvider` construct in this package. // - If you want full control over the provider, you can always directly use // a Lambda Function or SNS Topic by passing the ARN into `serviceToken`. // // Example: // serviceToken := awscdk.CustomResourceProvider_GetOrCreate(this, jsii.String("Custom::MyCustomResourceType"), &CustomResourceProviderProps{ // CodeDirectory: fmt.Sprintf("%v/my-handler", __dirname), // Runtime: awscdk.CustomResourceProviderRuntime_NODEJS_14_X, // Description: jsii.String("Lambda function created by the custom resource provider"), // }) // // awscdk.NewCustomResource(this, jsii.String("MyResource"), &CustomResourceProps{ // ResourceType: jsii.String("Custom::MyCustomResourceType"), // ServiceToken: serviceToken, // }) // type CustomResource interface { Resource // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *ResourceEnvironment // The tree node. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // The physical name of this custom resource. Ref() *string // The stack in which this resource is defined. Stack() Stack // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy RemovalPolicy) GeneratePhysicalName() *string // Returns the value of an attribute of the custom resource of an arbitrary type. // // Attributes are returned from the custom resource provider through the // `Data` map where the key is the attribute name. // // Returns: a token for `Fn::GetAtt`. Use `Token.asXxx` to encode the returned `Reference` as a specific type or // use the convenience `getAttString` for string attributes. GetAtt(attributeName *string) Reference // Returns the value of an attribute of the custom resource of type string. // // Attributes are returned from the custom resource provider through the // `Data` map where the key is the attribute name. // // Returns: a token for `Fn::GetAtt` encoded as a string. GetAttString(attributeName *string) *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. ToString() *string } // The jsii proxy struct for CustomResource type jsiiProxy_CustomResource struct { jsiiProxy_Resource } func (j *jsiiProxy_CustomResource) Env() *ResourceEnvironment { var returns *ResourceEnvironment _jsii_.Get( j, "env", &returns, ) return returns } func (j *jsiiProxy_CustomResource) Node() constructs.Node { var returns constructs.Node _jsii_.Get( j, "node", &returns, ) return returns } func (j *jsiiProxy_CustomResource) PhysicalName() *string { var returns *string _jsii_.Get( j, "physicalName", &returns, ) return returns } func (j *jsiiProxy_CustomResource) Ref() *string { var returns *string _jsii_.Get( j, "ref", &returns, ) return returns } func (j *jsiiProxy_CustomResource) Stack() Stack { var returns Stack _jsii_.Get( j, "stack", &returns, ) return returns } func NewCustomResource(scope constructs.Construct, id *string, props *CustomResourceProps) CustomResource { _init_.Initialize() if err := validateNewCustomResourceParameters(scope, id, props); err != nil { panic(err) } j := jsiiProxy_CustomResource{} _jsii_.Create( "aws-cdk-lib.CustomResource", []interface{}{scope, id, props}, &j, ) return &j } func NewCustomResource_Override(c CustomResource, scope constructs.Construct, id *string, props *CustomResourceProps) { _init_.Initialize() _jsii_.Create( "aws-cdk-lib.CustomResource", []interface{}{scope, id, props}, c, ) } // 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 CustomResource_IsConstruct(x interface{}) *bool { _init_.Initialize() if err := validateCustomResource_IsConstructParameters(x); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "aws-cdk-lib.CustomResource", "isConstruct", []interface{}{x}, &returns, ) return returns } // Returns true if the construct was created by CDK, and false otherwise. func CustomResource_IsOwnedResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateCustomResource_IsOwnedResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "aws-cdk-lib.CustomResource", "isOwnedResource", []interface{}{construct}, &returns, ) return returns } // Check whether the given construct is a Resource. func CustomResource_IsResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateCustomResource_IsResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "aws-cdk-lib.CustomResource", "isResource", []interface{}{construct}, &returns, ) return returns } func (c *jsiiProxy_CustomResource) ApplyRemovalPolicy(policy RemovalPolicy) { if err := c.validateApplyRemovalPolicyParameters(policy); err != nil { panic(err) } _jsii_.InvokeVoid( c, "applyRemovalPolicy", []interface{}{policy}, ) } func (c *jsiiProxy_CustomResource) GeneratePhysicalName() *string { var returns *string _jsii_.Invoke( c, "generatePhysicalName", nil, // no parameters &returns, ) return returns } func (c *jsiiProxy_CustomResource) GetAtt(attributeName *string) Reference { if err := c.validateGetAttParameters(attributeName); err != nil { panic(err) } var returns Reference _jsii_.Invoke( c, "getAtt", []interface{}{attributeName}, &returns, ) return returns } func (c *jsiiProxy_CustomResource) GetAttString(attributeName *string) *string { if err := c.validateGetAttStringParameters(attributeName); err != nil { panic(err) } var returns *string _jsii_.Invoke( c, "getAttString", []interface{}{attributeName}, &returns, ) return returns } func (c *jsiiProxy_CustomResource) GetResourceArnAttribute(arnAttr *string, arnComponents *ArnComponents) *string { if err := c.validateGetResourceArnAttributeParameters(arnAttr, arnComponents); err != nil { panic(err) } var returns *string _jsii_.Invoke( c, "getResourceArnAttribute", []interface{}{arnAttr, arnComponents}, &returns, ) return returns } func (c *jsiiProxy_CustomResource) GetResourceNameAttribute(nameAttr *string) *string { if err := c.validateGetResourceNameAttributeParameters(nameAttr); err != nil { panic(err) } var returns *string _jsii_.Invoke( c, "getResourceNameAttribute", []interface{}{nameAttr}, &returns, ) return returns } func (c *jsiiProxy_CustomResource) ToString() *string { var returns *string _jsii_.Invoke( c, "toString", nil, // no parameters &returns, ) return returns }