@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-09T19:16:43.405Z") public class ServiceAccount extends Construct implements IPrincipal
Example:
// 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/oidc.eks.eu-west-1.amazonaws.com/id/AB123456ABC"); OpenIdConnectProvider provider2 = OpenIdConnectProvider.Builder.create(this, "Provider") .url(issuerUrl) .build(); ICluster cluster = Cluster.fromClusterAttributes(this, "MyCluster", ClusterAttributes.builder() .clusterName("Cluster") .openIdConnectProvider(provider) .kubectlRoleArn("arn:aws:iam::123456:role/service-role/k8sservicerole") .build()); ServiceAccount serviceAccount = cluster.addServiceAccount("MyServiceAccount"); Bucket bucket = new Bucket(this, "Bucket"); bucket.grantReadWrite(serviceAccount);
Modifier and Type | Class and Description |
---|---|
static class |
ServiceAccount.Builder
A fluent builder for
ServiceAccount . |
IPrincipal.Jsii$Default, IPrincipal.Jsii$Proxy
IConstruct.Jsii$Default, IConstruct.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
ServiceAccount(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ServiceAccount(software.amazon.jsii.JsiiObjectRef objRef) |
|
ServiceAccount(software.constructs.Construct scope,
java.lang.String id,
ServiceAccountProps props) |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
addToPolicy(PolicyStatement statement)
Deprecated.
use `addToPrincipalPolicy()`
|
AddToPrincipalPolicyResult |
addToPrincipalPolicy(PolicyStatement statement)
Add to the policy of this principal.
|
java.lang.String |
getAssumeRoleAction()
When this Principal is used in an AssumeRole policy, the action to use.
|
IPrincipal |
getGrantPrincipal()
The principal to grant permissions to.
|
PrincipalPolicyFragment |
getPolicyFragment()
Return the policy fragment that identifies this principal in a Policy.
|
IRole |
getRole()
The role which is linked to the service account.
|
java.lang.String |
getServiceAccountName()
The name of the service account.
|
java.lang.String |
getServiceAccountNamespace()
The namespace where the service account is located in.
|
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPrincipalAccount
protected ServiceAccount(software.amazon.jsii.JsiiObjectRef objRef)
protected ServiceAccount(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public ServiceAccount(software.constructs.Construct scope, java.lang.String id, ServiceAccountProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.@Deprecated public java.lang.Boolean addToPolicy(PolicyStatement statement)
addToPolicy
in interface IPrincipal
statement
- This parameter is required.public AddToPrincipalPolicyResult addToPrincipalPolicy(PolicyStatement statement)
addToPrincipalPolicy
in interface IPrincipal
statement
- This parameter is required.public java.lang.String getAssumeRoleAction()
getAssumeRoleAction
in interface IPrincipal
public IPrincipal getGrantPrincipal()
getGrantPrincipal
in interface IGrantable
public PrincipalPolicyFragment getPolicyFragment()
getPolicyFragment
in interface IPrincipal
public IRole getRole()
public java.lang.String getServiceAccountName()
public java.lang.String getServiceAccountNamespace()