Class ServiceAccount
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.services.eks.ServiceAccount
- All Implemented Interfaces:
IConstruct,IDependable,IGrantable,IPrincipal,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:46.662Z")
@Stability(Stable)
public class ServiceAccount
extends Construct
implements IPrincipal
Service Account.
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);
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default, IConstruct.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IPrincipal
IPrincipal.Jsii$Default, IPrincipal.Jsii$Proxy -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedServiceAccount(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedServiceAccount(software.amazon.jsii.JsiiObjectRef objRef) ServiceAccount(software.constructs.Construct scope, String id, ServiceAccountProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddToPolicy(PolicyStatement statement) Deprecated.addToPrincipalPolicy(PolicyStatement statement) Add to the policy of this principal.When this Principal is used in an AssumeRole policy, the action to use.The principal to grant permissions to.Return the policy fragment that identifies this principal in a Policy.getRole()The role which is linked to the service account.The name of the service account.The namespace where the service account is located in.Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.constructs.Construct
toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.services.iam.IPrincipal
getPrincipalAccountMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ServiceAccount
protected ServiceAccount(software.amazon.jsii.JsiiObjectRef objRef) -
ServiceAccount
protected ServiceAccount(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ServiceAccount
@Stability(Stable) public ServiceAccount(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceAccountProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
addToPolicy
@Stability(Deprecated) @Deprecated @NotNull public Boolean addToPolicy(@NotNull PolicyStatement statement) Deprecated.useaddToPrincipalPolicy()(deprecated) Add to the policy of this principal.- Specified by:
addToPolicyin interfaceIPrincipal- Parameters:
statement- This parameter is required.- Returns:
- true if the statement was added, false if the principal in question does not have a policy document to add the statement to.
-
addToPrincipalPolicy
@Stability(Stable) @NotNull public AddToPrincipalPolicyResult addToPrincipalPolicy(@NotNull PolicyStatement statement) Add to the policy of this principal.- Specified by:
addToPrincipalPolicyin interfaceIPrincipal- Parameters:
statement- This parameter is required.
-
getAssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.- Specified by:
getAssumeRoleActionin interfaceIPrincipal
-
getGrantPrincipal
The principal to grant permissions to.- Specified by:
getGrantPrincipalin interfaceIGrantable
-
getPolicyFragment
Return the policy fragment that identifies this principal in a Policy.- Specified by:
getPolicyFragmentin interfaceIPrincipal
-
getRole
The role which is linked to the service account. -
getServiceAccountName
The name of the service account. -
getServiceAccountNamespace
The namespace where the service account is located in.
-
addToPrincipalPolicy()