java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apprunner.alpha.Service
All Implemented Interfaces:
IResource, IGrantable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.102.0 (build e354887)", date="2024-08-29T22:54:27.645Z") @Stability(Experimental) public class Service extends Resource implements IGrantable
(experimental) The App Runner Service.

Example:

 import software.amazon.awscdk.services.iam.*;
 Service service = Service.Builder.create(this, "Service")
         .source(Source.fromEcrPublic(EcrPublicProps.builder()
                 .imageConfiguration(ImageConfiguration.builder().port(8000).build())
                 .imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
                 .build()))
         .build();
 service.addToRolePolicy(PolicyStatement.Builder.create()
         .effect(Effect.ALLOW)
         .actions(List.of("s3:GetObject"))
         .resources(List.of("*"))
         .build());
 
  • Constructor Details

    • Service

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

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

      @Stability(Experimental) public Service(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromServiceAttributes

      @Stability(Experimental) @NotNull public static IService fromServiceAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceAttributes attrs)
      (experimental) Import from service attributes.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • fromServiceName

      @Stability(Experimental) @NotNull public static IService fromServiceName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String serviceName)
      (experimental) Import from service name.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      serviceName - This parameter is required.
    • addEnvironmentVariable

      @Stability(Experimental) public void addEnvironmentVariable(@NotNull String name, @NotNull String value)
      (experimental) This method adds an environment variable to the App Runner service.

      Parameters:
      name - This parameter is required.
      value - This parameter is required.
    • addSecret

      @Stability(Experimental) public void addSecret(@NotNull String name, @NotNull Secret secret)
      (experimental) This method adds a secret as environment variable to the App Runner service.

      Parameters:
      name - This parameter is required.
      secret - This parameter is required.
    • addToRolePolicy

      @Stability(Experimental) public void addToRolePolicy(@NotNull PolicyStatement statement)
      (experimental) Adds a statement to the instance role.

      Parameters:
      statement - This parameter is required.
    • getEnvironment

      @Stability(Deprecated) @Deprecated @NotNull public Map<String,String> getEnvironment()
      Deprecated.
      use environmentVariables.
      (deprecated) Environment variables for this service.

    • getGrantPrincipal

      @Stability(Experimental) @NotNull public IPrincipal getGrantPrincipal()
      (experimental) The principal to grant permissions to.
      Specified by:
      getGrantPrincipal in interface IGrantable
    • getServiceArn

      @Stability(Experimental) @NotNull public String getServiceArn()
      (experimental) The ARN of the Service.
    • getServiceId

      @Stability(Experimental) @NotNull public String getServiceId()
      (experimental) The ID of the Service.
    • getServiceName

      @Stability(Experimental) @NotNull public String getServiceName()
      (experimental) The name of the service.
    • getServiceStatus

      @Stability(Experimental) @NotNull public String getServiceStatus()
      (experimental) The status of the Service.
    • getServiceUrl

      @Stability(Experimental) @NotNull public String getServiceUrl()
      (experimental) The URL of the Service.