Class: AWSCDK::EKS::AWSAuth

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
eks/aws_auth.rb

Overview

Manages mapping between IAM users and roles to Kubernetes RBAC configuration.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ AWSAuth

Returns a new instance of AWSAuth.

Parameters:



13
14
15
16
17
18
19
# File 'eks/aws_auth.rb', line 13

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::EKS::AWSAuthProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkF3c0F1dGhQcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.jsii_overridable_methodsObject



21
22
23
24
25
26
27
28
29
30
31
# File 'eks/aws_auth.rb', line 21

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_account => { kind: :method, name: "addAccount", is_optional: false },
    :add_masters_role => { kind: :method, name: "addMastersRole", is_optional: false },
    :add_role_mapping => { kind: :method, name: "addRoleMapping", is_optional: false },
    :add_user_mapping => { kind: :method, name: "addUserMapping", is_optional: false },
  }
end

Instance Method Details

#add_account(account_id) ⇒ void

This method returns an undefined value.

Additional AWS account to add to the aws-auth configmap.

Parameters:

  • account_id (String)

    account number.



67
68
69
70
# File 'eks/aws_auth.rb', line 67

def ()
  Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "accountId")
  jsii_call_method("addAccount", [])
end

#add_masters_role(role, username = nil) ⇒ void

This method returns an undefined value.

Adds the specified IAM role to the system:masters RBAC group, which means that anyone that can assume it will be able to administer this Kubernetes system.

Parameters:

  • role (AWSCDK::IAM::IRole)

    The IAM role to add.

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

    Optional user (defaults to the role ARN).



77
78
79
80
81
# File 'eks/aws_auth.rb', line 77

def add_masters_role(role, username = nil)
  Jsii::Type.check_type(role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role")
  Jsii::Type.check_type(username, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "username") unless username.nil?
  jsii_call_method("addMastersRole", [role, username])
end

#add_role_mapping(role, mapping) ⇒ void

This method returns an undefined value.

Adds a mapping between an IAM role to a Kubernetes user and groups.

Parameters:



88
89
90
91
92
93
# File 'eks/aws_auth.rb', line 88

def add_role_mapping(role, mapping)
  Jsii::Type.check_type(role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role")
  mapping = mapping.is_a?(Hash) ? ::AWSCDK::EKS::AWSAuthMapping.new(**mapping.transform_keys(&:to_sym)) : mapping
  Jsii::Type.check_type(mapping, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkF3c0F1dGhNYXBwaW5nIn0=")), "mapping")
  jsii_call_method("addRoleMapping", [role, mapping])
end

#add_user_mapping(user, mapping) ⇒ void

This method returns an undefined value.

Adds a mapping between an IAM user to a Kubernetes user and groups.

Parameters:



100
101
102
103
104
105
# File 'eks/aws_auth.rb', line 100

def add_user_mapping(user, mapping)
  Jsii::Type.check_type(user, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklVc2VyIn0=")), "user")
  mapping = mapping.is_a?(Hash) ? ::AWSCDK::EKS::AWSAuthMapping.new(**mapping.transform_keys(&:to_sym)) : mapping
  Jsii::Type.check_type(mapping, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkF3c0F1dGhNYXBwaW5nIn0=")), "mapping")
  jsii_call_method("addUserMapping", [user, mapping])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


36
37
38
# File 'eks/aws_auth.rb', line 36

def node()
  jsii_get_property("node")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


43
44
45
# File 'eks/aws_auth.rb', line 43

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



56
57
58
59
60
61
# File 'eks/aws_auth.rb', line 56

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end