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.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IAssumeRolePrincipal
IAssumeRolePrincipal.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IComparablePrincipal
IComparablePrincipal.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionServicePrincipal
(String service) ServicePrincipal
(String service, ServicePrincipalOpts opts) protected
ServicePrincipal
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ServicePrincipal
(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 String
servicePrincipalName
(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, withSessionTags
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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
.cn
to the name.The
region-info
module 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:
dedupeString
in interfaceIComparablePrincipal
- Specified by:
dedupeString
in classPrincipalBase
-
toString
Returns a string representation of an object.- Overrides:
toString
in classPrincipalBase
-
getPolicyFragment
Return the policy fragment that identifies this principal in a Policy.- Specified by:
getPolicyFragment
in interfaceIPrincipal
- Specified by:
getPolicyFragment
in classPrincipalBase
-
getService
AWS service (i.e. sqs.amazonaws.com).
-