Class ServiceAccount

All Implemented Interfaces:
IGrantable, IPrincipal,, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-17T05:10:10.832Z") @Stability(Stable) public class ServiceAccount extends software.constructs.Construct implements IPrincipal
Service Account.


 // or create a new one using an existing issuer url
 String issuerUrl;
 // you can import an existing provider
 IOpenIdConnectProvider provider = OpenIdConnectProvider.fromOpenIdConnectProviderArn(this, "Provider", "arn:aws:iam::123456:oidc-provider/");
 OpenIdConnectProvider provider2 = OpenIdConnectProvider.Builder.create(this, "Provider")
 ICluster cluster = Cluster.fromClusterAttributes(this, "MyCluster", ClusterAttributes.builder()
 ServiceAccount serviceAccount = cluster.addServiceAccount("MyServiceAccount");
 Bucket bucket = new Bucket(this, "Bucket");
  • Constructor Details

    • ServiceAccount

      protected ServiceAccount( objRef)
    • ServiceAccount

      protected ServiceAccount( initializationMode)
    • ServiceAccount

      @Stability(Stable) public ServiceAccount(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceAccountProps props)
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • addToPrincipalPolicy

      @Stability(Stable) @NotNull public AddToPrincipalPolicyResult addToPrincipalPolicy(@NotNull PolicyStatement statement)
      Add to the policy of this principal.

      Specified by:
      addToPrincipalPolicy in interface IPrincipal
      statement - This parameter is required.
    • getAssumeRoleAction

      @Stability(Stable) @NotNull public String getAssumeRoleAction()
      When this Principal is used in an AssumeRole policy, the action to use.
      Specified by:
      getAssumeRoleAction in interface IPrincipal
    • getGrantPrincipal

      @Stability(Stable) @NotNull public IPrincipal getGrantPrincipal()
      The principal to grant permissions to.
      Specified by:
      getGrantPrincipal in interface IGrantable
    • getPolicyFragment

      @Stability(Stable) @NotNull public PrincipalPolicyFragment getPolicyFragment()
      Return the policy fragment that identifies this principal in a Policy.
      Specified by:
      getPolicyFragment in interface IPrincipal
    • getRole

      @Stability(Stable) @NotNull public IRole getRole()
      The role which is linked to the service account.
    • getServiceAccountName

      @Stability(Stable) @NotNull public String getServiceAccountName()
      The name of the service account.
    • getServiceAccountNamespace

      @Stability(Stable) @NotNull public String getServiceAccountNamespace()
      The namespace where the service account is located in.