Class: AWSCDK::FileAssetLocation

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
file_asset_location.rb

Overview

The location of the published file asset.

This is where the asset can be consumed at runtime.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name:, http_url:, object_key:, s3_object_url:, kms_key_arn: nil, s3_object_url_with_placeholders: nil) ⇒ FileAssetLocation

Returns a new instance of FileAssetLocation.

Parameters:

  • bucket_name (String)

    The name of the Amazon S3 bucket.

  • http_url (String)

    The HTTP URL of this asset on Amazon S3.

  • object_key (String)

    The Amazon S3 object key.

  • s3_object_url (String)

    The S3 URL of this asset on Amazon S3.

  • kms_key_arn (String, nil) (defaults to: nil)

    The ARN of the KMS key used to encrypt the file asset bucket, if any.

  • s3_object_url_with_placeholders (String, nil) (defaults to: nil)

    Like s3ObjectUrl, but not suitable for CloudFormation consumption.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'file_asset_location.rb', line 16

def initialize(bucket_name:, http_url:, object_key:, s3_object_url:, kms_key_arn: nil, s3_object_url_with_placeholders: nil)
  @bucket_name = bucket_name
  Jsii::Type.check_type(@bucket_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketName")
  @http_url = http_url
  Jsii::Type.check_type(@http_url, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "httpUrl")
  @object_key = object_key
  Jsii::Type.check_type(@object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKey")
  @s3_object_url = s3_object_url
  Jsii::Type.check_type(@s3_object_url, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3ObjectUrl")
  @kms_key_arn = kms_key_arn
  Jsii::Type.check_type(@kms_key_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kmsKeyArn") unless @kms_key_arn.nil?
  @s3_object_url_with_placeholders = s3_object_url_with_placeholders
  Jsii::Type.check_type(@s3_object_url_with_placeholders, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3ObjectUrlWithPlaceholders") unless @s3_object_url_with_placeholders.nil?
end

Instance Attribute Details

#bucket_nameString (readonly)

The name of the Amazon S3 bucket.

Returns:

  • (String)


34
35
36
# File 'file_asset_location.rb', line 34

def bucket_name
  @bucket_name
end

#http_urlString (readonly)

The HTTP URL of this asset on Amazon S3.

This value suitable for inclusion in a CloudFormation template, and may be an encoded token.

Example value: https://s3-us-east-1.amazonaws.com/mybucket/myobject

Returns:

  • (String)


43
44
45
# File 'file_asset_location.rb', line 43

def http_url
  @http_url
end

#kms_key_arnString? (readonly)

Note:

Default: - Asset bucket is not encrypted, or decryption permissions are defined by a Key Policy.

The ARN of the KMS key used to encrypt the file asset bucket, if any.

The CDK bootstrap stack comes with a key policy that does not require setting this property, so you only need to set this property if you have customized the bootstrap stack to require it.

Returns:

  • (String, nil)


65
66
67
# File 'file_asset_location.rb', line 65

def kms_key_arn
  @kms_key_arn
end

#object_keyString (readonly)

The Amazon S3 object key.

Returns:

  • (String)


47
48
49
# File 'file_asset_location.rb', line 47

def object_key
  @object_key
end

#s3_object_urlString (readonly)

The S3 URL of this asset on Amazon S3.

This value suitable for inclusion in a CloudFormation template, and may be an encoded token.

Example value: s3://mybucket/myobject

Returns:

  • (String)


56
57
58
# File 'file_asset_location.rb', line 56

def s3_object_url
  @s3_object_url
end

#s3_object_url_with_placeholdersString? (readonly)

Note:

Default: - This feature cannot be used

Like s3ObjectUrl, but not suitable for CloudFormation consumption.

If there are placeholders in the S3 URL, they will be returned un-replaced and un-evaluated.

Returns:

  • (String, nil)


73
74
75
# File 'file_asset_location.rb', line 73

def s3_object_url_with_placeholders
  @s3_object_url_with_placeholders
end

Class Method Details

.jsii_propertiesObject



75
76
77
78
79
80
81
82
83
84
# File 'file_asset_location.rb', line 75

def self.jsii_properties
  {
    :bucket_name => "bucketName",
    :http_url => "httpUrl",
    :object_key => "objectKey",
    :s3_object_url => "s3ObjectUrl",
    :kms_key_arn => "kmsKeyArn",
    :s3_object_url_with_placeholders => "s3ObjectUrlWithPlaceholders",
  }
end

Instance Method Details

#to_jsiiObject



86
87
88
89
90
91
92
93
94
95
96
97
# File 'file_asset_location.rb', line 86

def to_jsii
  result = {}
  result.merge!({
    "bucketName" => @bucket_name,
    "httpUrl" => @http_url,
    "objectKey" => @object_key,
    "s3ObjectUrl" => @s3_object_url,
    "kmsKeyArn" => @kms_key_arn,
    "s3ObjectUrlWithPlaceholders" => @s3_object_url_with_placeholders,
  })
  result.compact
end