@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-08T20:48:14.013Z") @Stability(value=Stable) public class ServicePrincipal extends PrincipalBase
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);
Modifier and Type | Class and Description |
---|---|
static class |
ServicePrincipal.Builder
A fluent builder for
ServicePrincipal . |
software.amazon.jsii.JsiiObject.InitializationMode
IAssumeRolePrincipal.Jsii$Default
IComparablePrincipal.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
ServicePrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ServicePrincipal(software.amazon.jsii.JsiiObjectRef objRef) |
|
ServicePrincipal(String service) |
|
ServicePrincipal(String service,
ServicePrincipalOpts opts) |
Modifier and Type | Method and Description |
---|---|
String |
dedupeString()
Return whether or not this principal is equal to the given principal.
|
PrincipalPolicyFragment |
getPolicyFragment()
Return the policy fragment that identifies this principal in a Policy.
|
String |
getService()
AWS service (i.e.
|
static String |
servicePrincipalName(String service)
Translate the given service principal name based on the region it's used in.
|
String |
toString()
Returns a string representation of an object.
|
addToAssumeRolePolicy, addToPolicy, addToPrincipalPolicy, getAssumeRoleAction, getGrantPrincipal, getPrincipalAccount, toJSON, withConditions, withSessionTags
protected ServicePrincipal(software.amazon.jsii.JsiiObjectRef objRef)
protected ServicePrincipal(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) public ServicePrincipal(@NotNull String service, @Nullable ServicePrincipalOpts opts)
service
- AWS service (i.e. sqs.amazonaws.com). This parameter is required.opts
- @Stability(value=Stable) public ServicePrincipal(@NotNull String service)
service
- AWS service (i.e. sqs.amazonaws.com). This parameter is required.@Stability(value=Stable) @NotNull public static String servicePrincipalName(@NotNull String service)
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");
service
- This parameter is required.@Stability(value=Stable) @Nullable public String dedupeString()
dedupeString
in interface IComparablePrincipal
dedupeString
in class PrincipalBase
@Stability(value=Stable) @NotNull public String toString()
toString
in class PrincipalBase
@Stability(value=Stable) @NotNull public PrincipalPolicyFragment getPolicyFragment()
getPolicyFragment
in interface IPrincipal
getPolicyFragment
in class PrincipalBase
@Stability(value=Stable) @NotNull public String getService()
Copyright © 2022. All rights reserved.