Class CfnServiceLinkedRole

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:18.051Z") @Stability(Stable) public class CfnServiceLinkedRole extends CfnResource implements IInspectable
Creates an IAM role that is linked to a specific AWS service.

The service controls the attached policies and when the role can be deleted. This helps ensure that the service is not broken by an unexpectedly changed or deleted role, which could put your AWS resources into an unknown state. Allowing the service to control the role helps improve service stability and proper cleanup when a service and its role are no longer needed. For more information, see Using service-linked roles in the IAM User Guide .

To attach a policy to this service-linked role, you must make the request using the AWS service that depends on this role.

Example:

 CfnServiceLinkedRole slr = CfnServiceLinkedRole.Builder.create(this, "ElasticSLR")
         .awsServiceName("es.amazonaws.com")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnServiceLinkedRole

      protected CfnServiceLinkedRole(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnServiceLinkedRole

      protected CfnServiceLinkedRole(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnServiceLinkedRole

      @Stability(Stable) public CfnServiceLinkedRole(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnServiceLinkedRoleProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties.
    • CfnServiceLinkedRole

      @Stability(Stable) public CfnServiceLinkedRole(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrRoleName

      @Stability(Stable) @NotNull public String getAttrRoleName()
      Returns the friendly name that identifies the role.

      For example, AWSServiceRoleForAutoScaling or AWSServiceRoleForAutoScaling_TestSuffix if a CustomSuffix is specified.

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getAwsServiceName

      @Stability(Stable) @Nullable public String getAwsServiceName()
      The service principal for the AWS service to which this role is attached.
    • setAwsServiceName

      @Stability(Stable) public void setAwsServiceName(@Nullable String value)
      The service principal for the AWS service to which this role is attached.
    • getCustomSuffix

      @Stability(Stable) @Nullable public String getCustomSuffix()
      A string that you provide, which is combined with the service-provided prefix to form the complete role name.
    • setCustomSuffix

      @Stability(Stable) public void setCustomSuffix(@Nullable String value)
      A string that you provide, which is combined with the service-provided prefix to form the complete role name.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the role.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the role.