Class: AWSCDK::StageProps

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

Overview

Initialization props for a stage.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env: nil, outdir: nil, permissions_boundary: nil, policy_validation_beta1: nil, property_injectors: nil, stage_name: nil) ⇒ StageProps

Returns a new instance of StageProps.

Parameters:

  • env (AWSCDK::Environment, nil) (defaults to: nil)

    Default AWS environment (account/region) for Stacks in this Stage.

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

    The output directory into which to emit synthesized artifacts.

  • permissions_boundary (AWSCDK::PermissionsBoundary, nil) (defaults to: nil)

    Options for applying a permissions boundary to all IAM Roles and Users created within this Stage.

  • policy_validation_beta1 (Array<AWSCDK::IPolicyValidationPluginBeta1>, nil) (defaults to: nil)

    Validation plugins to run during synthesis.

  • property_injectors (Array<AWSCDK::IPropertyInjector>, nil) (defaults to: nil)

    A list of IPropertyInjector attached to this Stage.

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

    Name of this stage.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'stage_props.rb', line 13

def initialize(env: nil, outdir: nil, permissions_boundary: nil, policy_validation_beta1: nil, property_injectors: nil, stage_name: nil)
  @env = env.is_a?(Hash) ? ::AWSCDK::Environment.new(**env.transform_keys(&:to_sym)) : env
  Jsii::Type.check_type(@env, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5FbnZpcm9ubWVudCJ9")), "env") unless @env.nil?
  @outdir = outdir
  Jsii::Type.check_type(@outdir, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outdir") unless @outdir.nil?
  @permissions_boundary = permissions_boundary
  Jsii::Type.check_type(@permissions_boundary, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5QZXJtaXNzaW9uc0JvdW5kYXJ5In0=")), "permissionsBoundary") unless @permissions_boundary.nil?
  @policy_validation_beta1 = policy_validation_beta1
  Jsii::Type.check_type(@policy_validation_beta1, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLklQb2xpY3lWYWxpZGF0aW9uUGx1Z2luQmV0YTEifSwia2luZCI6ImFycmF5In19")), "policyValidationBeta1") unless @policy_validation_beta1.nil?
  @property_injectors = property_injectors
  Jsii::Type.check_type(@property_injectors, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLklQcm9wZXJ0eUluamVjdG9yIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "propertyInjectors") unless @property_injectors.nil?
  @stage_name = stage_name
  Jsii::Type.check_type(@stage_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stageName") unless @stage_name.nil?
end

Instance Attribute Details

#envAWSCDK::Environment? (readonly)

Note:

Default: - The environments should be configured on the Stacks.

Default AWS environment (account/region) for Stacks in this Stage.

Stacks defined inside this Stage with either region or account missing from its env will use the corresponding field given here.

If either region or accountis is not configured for Stack (either on the Stack itself or on the containing Stage), the Stack will be environment-agnostic.

Environment-agnostic stacks can be deployed to any environment, may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups, will not automatically translate Service Principals to the right format based on the environment's AWS partition, and other such enhancements.

Examples:

# Use a concrete account and region to deploy this Stage to
AWSCDK::Stage.new(app, "Stage1", {
    env: {account: "123456789012", region: "us-east-1"},
})

# Use the CLI's current credentials to determine the target environment
AWSCDK::Stage.new(app, "Stage2", {
    env: {account: Process::Env::CDK_DEFAULT_ACCOUNT, region: Process::Env::CDK_DEFAULT_REGION},
})

Returns:



55
56
57
# File 'stage_props.rb', line 55

def env
  @env
end

#outdirString? (readonly)

Note:

Default: - for nested stages, outdir will be determined as a relative directory to the outdir of the app. For apps, if outdir is not specified, a temporary directory will be created.

The output directory into which to emit synthesized artifacts.

Can only be specified if this stage is the root stage (the app). If this is specified and this stage is nested within another stage, an error will be thrown.

Returns:

  • (String, nil)


64
65
66
# File 'stage_props.rb', line 64

def outdir
  @outdir
end

#permissions_boundaryAWSCDK::PermissionsBoundary? (readonly)

Note:

Default: - no permissions boundary is applied

Options for applying a permissions boundary to all IAM Roles and Users created within this Stage.

Be aware that this feature uses Aspects, and the Aspects are applied at the Stack level with a priority of MUTATING (if the feature flag @aws-cdk/core:aspectPrioritiesMutating is set) or DEFAULT (if the flag is not set). This is relevant if you are both using your own Aspects to assign Permissions Boundaries, as well as specifying this property. The Aspect added by this property will overwrite the Permissions Boundary assigned by your own Aspect if both: (a) your Aspect has a lower or equal priority to the automatic Aspect, and (b) your Aspect is applied above the Stack level. If either of those conditions are not true, your own Aspect will win.

We recommend assigning Permissions Boundaries only using the provided APIs, and not using custom Aspects.

Returns:



83
84
85
# File 'stage_props.rb', line 83

def permissions_boundary
  @permissions_boundary
end

#policy_validation_beta1Array<AWSCDK::IPolicyValidationPluginBeta1>? (readonly)

Deprecated.

Use Validations.of(stage).addPlugins() instead.

Note:

Default: - no validation plugins are used

Validation plugins to run during synthesis.

If any plugin reports any violation, synthesis will be interrupted and the report displayed to the user.

Returns:



92
93
94
# File 'stage_props.rb', line 92

def policy_validation_beta1
  @policy_validation_beta1
end

#property_injectorsArray<AWSCDK::IPropertyInjector>? (readonly)

Note:

Default: - no PropertyInjectors

A list of IPropertyInjector attached to this Stage.

Returns:



97
98
99
# File 'stage_props.rb', line 97

def property_injectors
  @property_injectors
end

#stage_nameString? (readonly)

Note:

Default: - Derived from the id.

Name of this stage.

Returns:

  • (String, nil)


102
103
104
# File 'stage_props.rb', line 102

def stage_name
  @stage_name
end

Class Method Details

.jsii_propertiesObject



104
105
106
107
108
109
110
111
112
113
# File 'stage_props.rb', line 104

def self.jsii_properties
  {
    :env => "env",
    :outdir => "outdir",
    :permissions_boundary => "permissionsBoundary",
    :policy_validation_beta1 => "policyValidationBeta1",
    :property_injectors => "propertyInjectors",
    :stage_name => "stageName",
  }
end

Instance Method Details

#to_jsiiObject



115
116
117
118
119
120
121
122
123
124
125
126
# File 'stage_props.rb', line 115

def to_jsii
  result = {}
  result.merge!({
    "env" => @env,
    "outdir" => @outdir,
    "permissionsBoundary" => @permissions_boundary,
    "policyValidationBeta1" => @policy_validation_beta1,
    "propertyInjectors" => @property_injectors,
    "stageName" => @stage_name,
  })
  result.compact
end