Class Role

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

    @Generated(value="jsii-pacmak/1.59.0 (build eb02c92)",
               date="2022-05-25T20:54:33.756Z")
    @Stability(Stable)
    public class Role
    extends Resource
    implements IRole
    Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.
    • Constructor Detail

      • Role

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

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

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

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

      • fromRoleName

        @Stability(Stable)
        @NotNull
        public static IRole fromRoleName​(@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.
      • allow

        @Stability(Stable)
        public void allow​(@NotNull
                          List<String> verbs,
                          @NotNull
                          @NotNull IApiResource... resources)
        Add permission to perform a list of HTTP verbs on a collection of resources.

        Parameters:
        verbs - This parameter is required.
        resources - The resource(s) to apply to. This parameter is required.
      • allowCreate

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        @Stability(Stable)
        @NotNull
        public RoleBinding bind​(@NotNull
                                @NotNull ISubject... subjects)
        Create a RoleBinding that binds the permissions in this Role to a list of subjects, that will only apply this role's namespace.

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

        @Stability(Stable)
        @NotNull
        protected org.cdk8s.ApiObject getApiObject()
        The underlying cdk8s API object.

        Specified by:
        getApiObject in class Resource
        See Also:
        base.Resource.apiObject
      • getRules

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

        Returns a copy, use allow to add rules.