Class ServicePrincipal
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.iam.PrincipalBase
software.amazon.awscdk.services.iam.ServicePrincipal
- All Implemented Interfaces:
IAssumeRolePrincipal,IComparablePrincipal,IGrantable,IPrincipal,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:29:57.374Z")
@Stability(Stable)
public class ServicePrincipal
extends PrincipalBase
An IAM principal that represents an AWS service (i.e. sqs.amazonaws.com).
Example:
Role lambdaRole = Role.Builder.create(this, "Role")
.assumedBy(new ServicePrincipal("lambda.amazonaws.com"))
.description("Example role...")
.build();
Stream stream = Stream.Builder.create(this, "MyEncryptedStream")
.encryption(StreamEncryption.KMS)
.build();
// give lambda permissions to read stream
stream.grantRead(lambdaRole);
-
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.services.iam.IAssumeRolePrincipal
IAssumeRolePrincipal.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IComparablePrincipal
IComparablePrincipal.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionServicePrincipal(String service) ServicePrincipal(String service, ServicePrincipalOpts opts) protectedServicePrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedServicePrincipal(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionReturn whether or not this principal is equal to the given principal.Return the policy fragment that identifies this principal in a Policy.AWS service (i.e.static StringservicePrincipalName(String service) Translate the given service principal name based on the region it's used in.toString()Returns a string representation of an object.Methods inherited from class software.amazon.awscdk.services.iam.PrincipalBase
addToAssumeRolePolicy, addToPolicy, addToPrincipalPolicy, getAssumeRoleAction, getGrantPrincipal, getPrincipalAccount, toJSON, withConditions, withSessionTagsMethods 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.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ServicePrincipal
protected ServicePrincipal(software.amazon.jsii.JsiiObjectRef objRef) -
ServicePrincipal
protected ServicePrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ServicePrincipal
@Stability(Stable) public ServicePrincipal(@NotNull String service, @Nullable ServicePrincipalOpts opts) - Parameters:
service- AWS service (i.e. sqs.amazonaws.com). This parameter is required.opts-
-
ServicePrincipal
- Parameters:
service- AWS service (i.e. sqs.amazonaws.com). This parameter is required.
-
-
Method Details
-
servicePrincipalName
Translate the given service principal name based on the region it's used in.For example, for Chinese regions this may (depending on whether that's necessary for the given service principal) append
.cnto the name.The
region-infomodule is used to obtain this information.Example:
String principalName = ServicePrincipal.servicePrincipalName("ec2.amazonaws.com");- Parameters:
service- This parameter is required.
-
dedupeString
Return whether or not this principal is equal to the given principal.- Specified by:
dedupeStringin interfaceIComparablePrincipal- Specified by:
dedupeStringin classPrincipalBase
-
toString
Returns a string representation of an object.- Overrides:
toStringin classPrincipalBase
-
getPolicyFragment
Return the policy fragment that identifies this principal in a Policy.- Specified by:
getPolicyFragmentin interfaceIPrincipal- Specified by:
getPolicyFragmentin classPrincipalBase
-
getService
AWS service (i.e. sqs.amazonaws.com).
-