Class ClusterRole

  • All Implemented Interfaces:
    IApiEndpoint, IApiResource, IClusterRole, IResource, IRole, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

    @Generated(value="jsii-pacmak/1.69.0 (build f656c31)",
               date="2022-10-15T03:08:34.982Z")
    @Stability(Stable)
    public class ClusterRole
    extends Resource
    implements IClusterRole, IRole
    ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.
    • Constructor Detail

      • ClusterRole

        protected ClusterRole​(software.amazon.jsii.JsiiObjectRef objRef)
      • ClusterRole

        protected ClusterRole​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • ClusterRole

        @Stability(Stable)
        public ClusterRole​(@NotNull
                           software.constructs.Construct scope,
                           @NotNull
                           String id,
                           @Nullable
                           ClusterRoleProps props)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        props -
      • ClusterRole

        @Stability(Stable)
        public ClusterRole​(@NotNull
                           software.constructs.Construct scope,
                           @NotNull
                           String id)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
    • Method Detail

      • fromClusterRoleName

        @Stability(Stable)
        @NotNull
        public static IClusterRole fromClusterRoleName​(@NotNull
                                                       software.constructs.Construct scope,
                                                       @NotNull
                                                       String id,
                                                       @NotNull
                                                       String name)
        Imports a role from the cluster as a reference.

        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        name - This parameter is required.
      • aggregate

        @Stability(Stable)
        public void aggregate​(@NotNull
                              String key,
                              @NotNull
                              String value)
        Aggregate rules from roles matching this label selector.

        Parameters:
        key - This parameter is required.
        value - This parameter is required.
      • allowCreate

        @Stability(Stable)
        public void allowCreate​(@NotNull
                                @NotNull IApiEndpoint... endpoints)
        Add "create" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowDelete

        @Stability(Stable)
        public void allowDelete​(@NotNull
                                @NotNull IApiEndpoint... endpoints)
        Add "delete" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowDeleteCollection

        @Stability(Stable)
        public void allowDeleteCollection​(@NotNull
                                          @NotNull IApiEndpoint... endpoints)
        Add "deletecollection" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowGet

        @Stability(Stable)
        public void allowGet​(@NotNull
                             @NotNull IApiEndpoint... endpoints)
        Add "get" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowList

        @Stability(Stable)
        public void allowList​(@NotNull
                              @NotNull IApiEndpoint... endpoints)
        Add "list" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowPatch

        @Stability(Stable)
        public void allowPatch​(@NotNull
                               @NotNull IApiEndpoint... endpoints)
        Add "patch" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowRead

        @Stability(Stable)
        public void allowRead​(@NotNull
                              @NotNull IApiEndpoint... endpoints)
        Add "get", "list", and "watch" permissions for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowReadWrite

        @Stability(Stable)
        public void allowReadWrite​(@NotNull
                                   @NotNull IApiEndpoint... endpoints)
        Add "get", "list", "watch", "create", "update", "patch", "delete", and "deletecollection" permissions for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowUpdate

        @Stability(Stable)
        public void allowUpdate​(@NotNull
                                @NotNull IApiEndpoint... endpoints)
        Add "update" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • allowWatch

        @Stability(Stable)
        public void allowWatch​(@NotNull
                               @NotNull IApiEndpoint... endpoints)
        Add "watch" permission for the resources.

        Parameters:
        endpoints - The resource(s) to apply to. This parameter is required.
      • bind

        @Stability(Stable)
        @NotNull
        public ClusterRoleBinding bind​(@NotNull
                                       @NotNull ISubject... subjects)
        Create a ClusterRoleBinding that binds the permissions in this ClusterRole to a list of subjects, without namespace restrictions.

        Parameters:
        subjects - a list of subjects to bind to. This parameter is required.
      • bindInNamespace

        @Stability(Stable)
        @NotNull
        public RoleBinding bindInNamespace​(@NotNull
                                           String namespace,
                                           @NotNull
                                           @NotNull ISubject... subjects)
        Create a RoleBinding that binds the permissions in this ClusterRole to a list of subjects, that will only apply to the given namespace.

        Parameters:
        namespace - the namespace to limit permissions to. This parameter is required.
        subjects - a list of subjects to bind to. This parameter is required.
      • combine

        @Stability(Stable)
        public void combine​(@NotNull
                            ClusterRole rol)
        Combines the rules of the argument ClusterRole into this ClusterRole using aggregation labels.

        Parameters:
        rol - This parameter is required.
      • getRules

        @Stability(Stable)
        @NotNull
        public List<ClusterRolePolicyRule> getRules()
        Rules associaated with this Role.

        Returns a copy, use allow to add rules.