Class CfnResourcePolicy

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.113.0 (build fc68b25)", date="2025-09-02T11:25:26.534Z") @Stability(Stable) public class CfnResourcePolicy extends CfnResource implements IInspectable
Use resource-based policies to grant permissions to other AWS accounts or services to access your workspace.

Only Prometheus-compatible APIs can be used for workspace sharing. You can add non-Prometheus-compatible APIs to the policy, but they will be ignored. For more information, see Prometheus-compatible APIs in the Amazon Managed Service for Prometheus User Guide .

If your workspace uses customer-managed AWS KMS keys for encryption, you must grant the principals in your resource-based policy access to those AWS KMS keys. You can do this by creating AWS KMS grants. For more information, see CreateGrant in the AWS KMS API Reference and Encryption at rest in the Amazon Managed Service for Prometheus User Guide .

For more information about working with IAM , see Using Amazon Managed Service for Prometheus with IAM in the Amazon Managed Service for Prometheus User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.aps.*;
 CfnResourcePolicy cfnResourcePolicy = CfnResourcePolicy.Builder.create(this, "MyCfnResourcePolicy")
         .policyDocument("policyDocument")
         .workspaceArn("workspaceArn")
         .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

    • CfnResourcePolicy

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

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

      @Stability(Stable) public CfnResourcePolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnResourcePolicyProps 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. 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.
    • getCfnProperties

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

      @Stability(Stable) @NotNull public String getPolicyDocument()
      The JSON to use as the Resource-based Policy.
    • setPolicyDocument

      @Stability(Stable) public void setPolicyDocument(@NotNull String value)
      The JSON to use as the Resource-based Policy.
    • getWorkspaceArn

      @Stability(Stable) @NotNull public String getWorkspaceArn()
      An ARN identifying a Workspace.
    • setWorkspaceArn

      @Stability(Stable) public void setWorkspaceArn(@NotNull String value)
      An ARN identifying a Workspace.