Class: CDK8sPlus25::K8S::Subject

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
k8_s/subject.rb

Overview

Subject contains a reference to the object or user identities a role binding applies to.

This can either hold a direct API object reference, or a value for non-objects such as user and group names.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, name:, api_group: nil, namespace: nil) ⇒ Subject

Returns a new instance of Subject.

Parameters:

  • kind (String)

    Kind of object being referenced.

  • name (String)

    Name of the object being referenced.

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

    APIGroup holds the API group of the referenced subject.

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

    Namespace of the referenced object.



13
14
15
16
17
18
19
20
21
22
# File 'k8_s/subject.rb', line 13

def initialize(kind:, name:, api_group: nil, namespace: nil)
  @kind = kind
  Jsii::Type.check_type(@kind, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "kind")
  @name = name
  Jsii::Type.check_type(@name, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "name")
  @api_group = api_group
  Jsii::Type.check_type(@api_group, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "apiGroup") unless @api_group.nil?
  @namespace = namespace
  Jsii::Type.check_type(@namespace, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "namespace") unless @namespace.nil?
end

Instance Attribute Details

#api_groupString? (readonly)

Note:

Default: for ServiceAccount subjects. Defaults to "rbac.authorization.k8s.io" for User and Group subjects.

APIGroup holds the API group of the referenced subject.

Defaults to "" for ServiceAccount subjects. Defaults to "rbac.authorization.k8s.io" for User and Group subjects.

Returns:

  • (String, nil)


40
41
42
# File 'k8_s/subject.rb', line 40

def api_group
  @api_group
end

#kindString (readonly)

Kind of object being referenced.

Values defined by this API group are "User", "Group", and "ServiceAccount". If the Authorizer does not recognized the kind value, the Authorizer should report an error.

Returns:

  • (String)


29
30
31
# File 'k8_s/subject.rb', line 29

def kind
  @kind
end

#nameString (readonly)

Name of the object being referenced.

Returns:

  • (String)


33
34
35
# File 'k8_s/subject.rb', line 33

def name
  @name
end

#namespaceString? (readonly)

Namespace of the referenced object.

If the object kind is non-namespace, such as "User" or "Group", and this value is not empty the Authorizer should report an error.

Returns:

  • (String, nil)


46
47
48
# File 'k8_s/subject.rb', line 46

def namespace
  @namespace
end

Class Method Details

.jsii_propertiesObject



48
49
50
51
52
53
54
55
# File 'k8_s/subject.rb', line 48

def self.jsii_properties
  {
    :kind => "kind",
    :name => "name",
    :api_group => "apiGroup",
    :namespace => "namespace",
  }
end

Instance Method Details

#to_jsiiObject



57
58
59
60
61
62
63
64
65
66
# File 'k8_s/subject.rb', line 57

def to_jsii
  result = {}
  result.merge!({
    "kind" => @kind,
    "name" => @name,
    "apiGroup" => @api_group,
    "namespace" => @namespace,
  })
  result.compact
end