Class: AWSCDK::AppSync::Code

Inherits:
Jsii::Object
  • Object
show all
Defined in:
app_sync/code.rb

Overview

Represents source code for an AppSync Function or Resolver.

Direct Known Subclasses

AssetCode, InlineCode

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCode

Returns a new instance of Code.



8
9
10
# File 'app_sync/code.rb', line 8

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.from_asset(path, options = nil) ⇒ AWSCDK::AppSync::AssetCode

Loads the function code from a local disk path.

Parameters:

Returns:



23
24
25
26
27
28
# File 'app_sync/code.rb', line 23

def self.from_asset(path, options = nil)
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path")
  options = options.is_a?(Hash) ? ::AWSCDK::S3Assets::AssetOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfYXNzZXRzLkFzc2V0T3B0aW9ucyJ9")), "options") unless options.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_appsync.Code", "fromAsset", [path, options])
end

.from_inline(code) ⇒ AWSCDK::AppSync::InlineCode

Inline code for AppSync function.

Parameters:

  • code (String)

    The actual handler code (the resulting zip file cannot exceed 4MB).

Returns:



34
35
36
37
# File 'app_sync/code.rb', line 34

def self.from_inline(code)
  Jsii::Type.check_type(code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "code")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_appsync.Code", "fromInline", [code])
end

.jsii_overridable_methodsObject



12
13
14
15
16
# File 'app_sync/code.rb', line 12

def self.jsii_overridable_methods
  {
    :bind => { kind: :method, name: "bind", is_optional: false },
  }
end

Instance Method Details

#bind(scope) ⇒ AWSCDK::AppSync::CodeConfig

Bind source code to an AppSync Function or resolver.

Parameters:

  • scope (Constructs::Construct)

Returns:



43
44
45
46
# File 'app_sync/code.rb', line 43

def bind(scope)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  jsii_call_method("bind", [scope])
end