Class: AWSCDK::APIGateway::APIDefinition
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::APIGateway::APIDefinition
- Defined in:
- api_gateway/api_definition.rb
Overview
Represents an OpenAPI definition asset.
Direct Known Subclasses
Class Method Summary collapse
-
.from_asset(file, options = nil) ⇒ AWSCDK::APIGateway::AssetAPIDefinition
Loads the API specification from a local disk asset.
-
.from_bucket(bucket, key, object_version = nil) ⇒ AWSCDK::APIGateway::S3APIDefinition
Creates an API definition from a specification file in an S3 bucket.
-
.from_inline(definition) ⇒ AWSCDK::APIGateway::InlineAPIDefinition
Create an API definition from an inline object.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#bind(scope) ⇒ AWSCDK::APIGateway::APIDefinitionConfig
Called when the specification is initialized to allow this object to bind to the stack, add resources and have fun.
-
#bind_after_create(_scope, _rest_api) ⇒ void
Called after the CFN RestApi resource has been created to allow the Api Definition to bind to it.
-
#initialize ⇒ APIDefinition
constructor
A new instance of APIDefinition.
Constructor Details
#initialize ⇒ APIDefinition
Returns a new instance of APIDefinition.
8 9 10 |
# File 'api_gateway/api_definition.rb', line 8 def initialize Jsii::Object.instance_method(:initialize).bind(self).call end |
Class Method Details
.from_asset(file, options = nil) ⇒ AWSCDK::APIGateway::AssetAPIDefinition
Loads the API specification from a local disk asset.
24 25 26 27 28 29 |
# File 'api_gateway/api_definition.rb', line 24 def self.from_asset(file, = nil) Jsii::Type.check_type(file, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "file") = .is_a?(Hash) ? ::AWSCDK::S3Assets::AssetOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczNfYXNzZXRzLkFzc2V0T3B0aW9ucyJ9")), "options") unless .nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_apigateway.ApiDefinition", "fromAsset", [file, ]) end |
.from_bucket(bucket, key, object_version = nil) ⇒ AWSCDK::APIGateway::S3APIDefinition
Creates an API definition from a specification file in an S3 bucket.
37 38 39 40 41 42 |
# File 'api_gateway/api_definition.rb', line 37 def self.from_bucket(bucket, key, object_version = nil) Jsii::Type.check_type(bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "bucket") Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") Jsii::Type.check_type(object_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectVersion") unless object_version.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_apigateway.ApiDefinition", "fromBucket", [bucket, key, object_version]) end |
.from_inline(definition) ⇒ AWSCDK::APIGateway::InlineAPIDefinition
Create an API definition from an inline object.
The inline object must follow the schema of OpenAPI 2.0 or OpenAPI 3.0
92 93 94 95 |
# File 'api_gateway/api_definition.rb', line 92 def self.from_inline(definition) Jsii::Type.check_type(definition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "definition") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_apigateway.ApiDefinition", "fromInline", [definition]) end |
.jsii_overridable_methods ⇒ Object
12 13 14 15 16 17 |
# File 'api_gateway/api_definition.rb', line 12 def self.jsii_overridable_methods { :bind => { kind: :method, name: "bind", is_optional: false }, :bind_after_create => { kind: :method, name: "bindAfterCreate", is_optional: false }, } end |
Instance Method Details
#bind(scope) ⇒ AWSCDK::APIGateway::APIDefinitionConfig
Called when the specification is initialized to allow this object to bind to the stack, add resources and have fun.
101 102 103 104 |
# File 'api_gateway/api_definition.rb', line 101 def bind(scope) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") jsii_call_method("bind", [scope]) end |
#bind_after_create(_scope, _rest_api) ⇒ void
This method returns an undefined value.
Called after the CFN RestApi resource has been created to allow the Api Definition to bind to it.
Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.
114 115 116 117 118 |
# File 'api_gateway/api_definition.rb', line 114 def bind_after_create(_scope, _rest_api) Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope") Jsii::Type.check_type(_rest_api, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19hcGlnYXRld2F5LklSZXN0QXBpUmVmIn0=")), "_restApi") jsii_call_method("bindAfterCreate", [_scope, _rest_api]) end |