Class Space


  • public class Space
    extends com.pulumi.resources.CustomResource
    Manages a CloudWatch Omni Space. A space is the container that holds your observability data within a CloudWatch Omni domain. > **NOTE:** CloudWatch Omni allows only **one space per AWS account per region**. Creating a second space in the same region returns `ConflictException`. A space in a different region is permitted, and a space does not have to be in the same region as its domain. > **NOTE:** CloudWatch Omni is not available in every region. In unsupported regions the API returns `AccessDeniedException`. ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.iam.Role;
     import com.pulumi.aws.iam.RoleArgs;
     import com.pulumi.aws.cloudwatchomni.Domain;
     import com.pulumi.aws.cloudwatchomni.DomainArgs;
     import com.pulumi.aws.cloudwatchomni.Space;
     import com.pulumi.aws.cloudwatchomni.SpaceArgs;
     import static com.pulumi.codegen.internal.Serialization.*;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new Role("example", RoleArgs.builder()
                 .name("cloudwatch-omni-data-access")
                 .assumeRolePolicy(serializeJson(
                     jsonObject(
                         jsonProperty("Version", "2012-10-17"),
                         jsonProperty("Statement", jsonArray(jsonObject(
                             jsonProperty("Action", "sts:AssumeRole"),
                             jsonProperty("Effect", "Allow"),
                             jsonProperty("Principal", jsonObject(
                                 jsonProperty("Service", "cloudwatch.amazonaws.com")
                             ))
                         )))
                     )))
                 .build());
     
             var exampleDomain = new Domain("exampleDomain", DomainArgs.builder()
                 .name("example")
                 .identityProviders("IAM")
                 .build());
     
             var exampleSpace = new Space("exampleSpace", SpaceArgs.builder()
                 .name("example")
                 .domainId(exampleDomain.domainId())
                 .dataAccessRoleArn(example.arn())
                 .build());
     
         }
     }
     
     
    ### AgentCore Online Evaluation Supply `agentCoreEvaluationRoleArn` to let the space run AgentCore online evaluation.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.cloudwatchomni.Space;
     import com.pulumi.aws.cloudwatchomni.SpaceArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new Space("example", SpaceArgs.builder()
                 .name("example")
                 .domainId(exampleAwsCloudwatchomniDomain.domainId())
                 .dataAccessRoleArn(dataAccess.arn())
                 .agentCoreEvaluationRoleArn(agentCore.arn())
                 .build());
     
         }
     }
     
     
    ### Customer Managed Encryption Omitting `encryptionConfiguration` leaves the space encrypted with an AWS owned key. To use a customer managed key, the key policy must grant the `cloudwatch.amazonaws.com` service principal permission to use it, otherwise `CreateSpace` fails with `AccessDeniedException`.
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.AwsFunctions;
     import com.pulumi.aws.inputs.GetCallerIdentityArgs;
     import com.pulumi.aws.kms.Key;
     import com.pulumi.aws.kms.KeyArgs;
     import com.pulumi.aws.cloudwatchomni.Space;
     import com.pulumi.aws.cloudwatchomni.SpaceArgs;
     import com.pulumi.aws.cloudwatchomni.inputs.SpaceEncryptionConfigurationArgs;
     import static com.pulumi.codegen.internal.Serialization.*;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
                 .build());
     
             var example = new Key("example", KeyArgs.builder()
                 .description("CloudWatch Omni Space encryption")
                 .policy(serializeJson(
                     jsonObject(
                         jsonProperty("Version", "2012-10-17"),
                         jsonProperty("Statement", jsonArray(
                             jsonObject(
                                 jsonProperty("Sid", "EnableIAMUserPermissions"),
                                 jsonProperty("Effect", "Allow"),
                                 jsonProperty("Principal", jsonObject(
                                     jsonProperty("AWS", String.format("arn:aws:iam::%s:root", current.accountId()))
                                 )),
                                 jsonProperty("Action", "kms:*"),
                                 jsonProperty("Resource", "*")
                             ), 
                             jsonObject(
                                 jsonProperty("Sid", "AllowCloudWatchOmni"),
                                 jsonProperty("Effect", "Allow"),
                                 jsonProperty("Principal", jsonObject(
                                     jsonProperty("Service", "cloudwatch.amazonaws.com")
                                 )),
                                 jsonProperty("Action", jsonArray(
                                     "kms:Decrypt", 
                                     "kms:DescribeKey", 
                                     "kms:Encrypt", 
                                     "kms:GenerateDataKey*", 
                                     "kms:ReEncrypt*"
                                 )),
                                 jsonProperty("Resource", "*")
                             )
                         ))
                     )))
                 .build());
     
             var exampleSpace = new Space("exampleSpace", SpaceArgs.builder()
                 .encryptionConfiguration(SpaceEncryptionConfigurationArgs.builder()
                     .encryptionStrategy("CUSTOMER_MANAGED")
                     .kmsKeyArn(example.arn())
                     .build())
                 .name("example")
                 .domainId(exampleAwsCloudwatchomniDomain.domainId())
                 .dataAccessRoleArn(exampleAwsIamRole.arn())
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `spaceId` (String) Space ID. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import a CloudWatch Omni Space using the `spaceId`. For example: ```sh $ pulumi import aws:cloudwatchomni/space:Space example 12345678-1234-1234-1234-123456789012 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      Space​(java.lang.String name)  
      Space​(java.lang.String name, SpaceArgs args)  
      Space​(java.lang.String name, SpaceArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> agentCoreEvaluationRoleArn()  
      com.pulumi.core.Output<java.lang.String> dataAccessRoleArn()  
      com.pulumi.core.Output<java.lang.String> domainArn()  
      com.pulumi.core.Output<java.lang.String> domainId()  
      com.pulumi.core.Output<java.util.Optional<SpaceEncryptionConfiguration>> encryptionConfiguration()  
      static Space get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, SpaceState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> spaceArn()  
      com.pulumi.core.Output<java.lang.String> spaceId()  
      com.pulumi.core.Output<java.lang.String> status()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Space

        public Space​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • Space

        public Space​(java.lang.String name,
                     SpaceArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • Space

        public Space​(java.lang.String name,
                     SpaceArgs args,
                     @Nullable
                     com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • agentCoreEvaluationRoleArn

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> agentCoreEvaluationRoleArn()
        Returns:
        ARN of the IAM role used by AgentCore online evaluation. Changing this forces a new resource.
      • dataAccessRoleArn

        public com.pulumi.core.Output<java.lang.String> dataAccessRoleArn()
        Returns:
        ARN of the IAM role CloudWatch Omni assumes to access data. Must be in the same account as the space. Changing this forces a new resource.
      • domainArn

        public com.pulumi.core.Output<java.lang.String> domainArn()
        Returns:
        ARN of the domain the space belongs to.
      • domainId

        public com.pulumi.core.Output<java.lang.String> domainId()
        Returns:
        ID of the CloudWatch Omni domain the space belongs to. Changing this forces a new resource.
      • encryptionConfiguration

        public com.pulumi.core.Output<java.util.Optional<SpaceEncryptionConfiguration>> encryptionConfiguration()
        Returns:
        Encryption of the space's data at rest. Omit for AWS owned encryption. See below.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the space. Must be 3-64 characters of lowercase letters, numbers and hyphens, must begin and end with a letter or number, and cannot contain consecutive hyphens. The following arguments are optional:
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource is managed. Defaults to the Region set in the provider configuration.
      • spaceArn

        public com.pulumi.core.Output<java.lang.String> spaceArn()
        Returns:
        ARN of the space.
      • spaceId

        public com.pulumi.core.Output<java.lang.String> spaceId()
        Returns:
        Unique ID of the space.
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        Status of the space.
      • get

        public static Space get​(java.lang.String name,
                                com.pulumi.core.Output<java.lang.String> id,
                                @Nullable
                                SpaceState state,
                                @Nullable
                                com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.