Class: AWSCDK::IAM::ServicePrincipalOpts

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
iam/service_principal_opts.rb

Overview

Options for a service principal.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conditions: nil, region: nil) ⇒ ServicePrincipalOpts

Returns a new instance of ServicePrincipalOpts.

Parameters:

  • conditions (Hash{String => Object}, nil) (defaults to: nil)

    Additional conditions to add to the Service Principal.

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

    The region in which you want to reference the service.



9
10
11
12
13
14
# File 'iam/service_principal_opts.rb', line 9

def initialize(conditions: nil, region: nil)
  @conditions = conditions
  Jsii::Type.check_type(@conditions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "conditions") unless @conditions.nil?
  @region = region
  Jsii::Type.check_type(@region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region") unless @region.nil?
end

Instance Attribute Details

#conditionsHash{String => Object}? (readonly)

Note:

Default: - No conditions

Additional conditions to add to the Service Principal.

Returns:

  • (Hash{String => Object}, nil)


20
21
22
# File 'iam/service_principal_opts.rb', line 20

def conditions
  @conditions
end

#regionString? (readonly)

Note:

Default: - the resolving Stack's region.

The region in which you want to reference the service.

This is only necessary for cross-region references to opt-in regions. In those cases, the region name needs to be included to reference the correct service principal. In all other cases, the global service principal name is sufficient.

This field behaves differently depending on whether the @aws-cdk/aws-iam:standardizedServicePrincipals flag is set or not:

  • If the flag is set, the input service principal is assumed to be of the form SERVICE.amazonaws.com. That value will always be returned, unless the given region is an opt-in region and the service principal is rendered in a stack in a different region, in which case SERVICE.REGION.amazonaws.com will be rendered. Under this regime, there is no downside to always specifying the region property: it will be rendered only if necessary.
  • If the flag is not set, the service principal will resolve to a single principal whose name comes from the @aws-cdk/region-info package, using the region to override the stack region. If there is no entry for this service principal in the database,, the input service name is returned literally. This is legacy behavior and is not recommended.

Returns:

  • (String, nil)


42
43
44
# File 'iam/service_principal_opts.rb', line 42

def region
  @region
end

Class Method Details

.jsii_propertiesObject



44
45
46
47
48
49
# File 'iam/service_principal_opts.rb', line 44

def self.jsii_properties
  {
    :conditions => "conditions",
    :region => "region",
  }
end

Instance Method Details

#to_jsiiObject



51
52
53
54
55
56
57
58
# File 'iam/service_principal_opts.rb', line 51

def to_jsii
  result = {}
  result.merge!({
    "conditions" => @conditions,
    "region" => @region,
  })
  result.compact
end