Interface CcApiContextQuery
-
- All Superinterfaces:
ContextLookupRoleOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CcApiContextQuery.Jsii$Proxy
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)", date="2025-11-06T20:25:05.765Z") @Stability(Stable) public interface CcApiContextQuery extends software.amazon.jsii.JsiiSerializable, ContextLookupRoleOptions
Query input for lookup up CloudFormation resources using CC API.The example below is required to successfully compile CDK (otherwise, the CDK build will generate a synthetic example for the below, but it doesn't have enough type information about the literal string union to generate a validly compiling example).
Example:
import software.amazon.awscdk.cloudassembly.schema.CcApiContextQuery; CcApiContextQuery x = CcApiContextQuery.builder() .typeName("AWS::Some::Type") .expectedMatchCount("exactly-one") .propertiesToReturn(List.of("SomeProp")) .account("11111111111") .region("us-east-1") .build();
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCcApiContextQuery.BuilderA builder forCcApiContextQuerystatic classCcApiContextQuery.Jsii$ProxyAn implementation forCcApiContextQuery
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static CcApiContextQuery.Builderbuilder()default ObjectgetDummyValue()The value to return if the resource was not found andignoreErrorOnMissingContextis true.default StringgetExactIdentifier()Identifier of the resource to look up usingGetResource.default StringgetExpectedMatchCount()Expected count of results ifpropertyMatchis specified.default BooleangetIgnoreErrorOnMissingContext()Ignore an error and return thedummyValueinstead if the resource was not found.List<String>getPropertiesToReturn()This is a set of properties returned from CC API that we want to return from ContextQuery.default Map<String,Object>getPropertyMatch()Returns any resources matching these properties, usingListResources.StringgetTypeName()The CloudFormation resource type.-
Methods inherited from interface software.amazon.awscdk.cloudassembly.schema.ContextLookupRoleOptions
getAccount, getAssumeRoleAdditionalOptions, getLookupRoleArn, getLookupRoleExternalId, getRegion
-
-
-
-
Method Detail
-
getPropertiesToReturn
@Stability(Stable) @NotNull List<String> getPropertiesToReturn()
This is a set of properties returned from CC API that we want to return from ContextQuery.If any properties listed here are absent from the target resource, an error will be thrown.
The returned object will always include the key
Identifierwith the CC-API returned fieldIdentifier.Notes on property completeness
CloudControl API's
ListResourcesmay return fewer properties thanGetResourcewould, depending on the resource implementation.The returned properties here are currently selected from the response object that CloudControl API returns to the CDK CLI.
However, if we find there is need to do so, we may decide to change this behavior in the future: we might change it to perform an additional
GetResourcecall for resources matched bypropertyMatch.
-
getTypeName
@Stability(Stable) @NotNull String getTypeName()
The CloudFormation resource type.See https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html
-
getDummyValue
@Stability(Stable) @Nullable default Object getDummyValue()
The value to return if the resource was not found andignoreErrorOnMissingContextis true.If supplied,
dummyValueshould be an array of objects.dummyValuedoes not have to have elements, and it may have objects with different properties than the properties inpropertiesToReturn, but it will be easiest for downstream code if thedummyValueconforms to the expected response shape.Default: - No dummy value available
-
getExactIdentifier
@Stability(Stable) @Nullable default String getExactIdentifier()
Identifier of the resource to look up usingGetResource.Specifying exactIdentifier will return exactly one result, or throw an error unless
ignoreErrorOnMissingContextis set.Default: - Either exactIdentifier or propertyMatch should be specified.
-
getExpectedMatchCount
@Stability(Stable) @Nullable default String getExpectedMatchCount()
Expected count of results ifpropertyMatchis specified.If the expected result count does not match the actual count, by default an error is produced and the result is not committed to cached context, and the user can correct the situation and try again without having to manually clear out the context key using
cdk context --removeIf the value of *
ignoreErrorOnMissingContextistrue, the value ofexpectedMatchCountisat-least-one | exactly-oneand the number of found resources is 0,dummyValueis returned and committed to context instead.Default: 'any'
-
getIgnoreErrorOnMissingContext
@Stability(Stable) @Nullable default Boolean getIgnoreErrorOnMissingContext()
Ignore an error and return thedummyValueinstead if the resource was not found.- In case of an
exactIdentifierlookup, return thedummyValueif the resource with that identifier was not found. - In case of a
propertyMatchlookup, return thedummyValueifexpectedMatchCountisat-least-one | exactly-oneand the number of resources found was 0.
if
ignoreErrorOnMissingContextis set,dummyValueshould be set and be an array.Default: false
- In case of an
-
getPropertyMatch
@Stability(Stable) @Nullable default Map<String,Object> getPropertyMatch()
Returns any resources matching these properties, usingListResources.By default, specifying propertyMatch will successfully return 0 or more results. To throw an error if the number of results is unexpected (and prevent the query results from being committed to context), specify
expectedMatchCount.Notes on property completeness
CloudControl API's
ListResourcesmay return fewer properties thanGetResourcewould, depending on the resource implementation.The resources that
propertyMatchmatches against will only ever be the properties returned by theListResourcescall.Default: - Either exactIdentifier or propertyMatch should be specified.
-
builder
@Stability(Stable) static CcApiContextQuery.Builder builder()
- Returns:
- a
CcApiContextQuery.BuilderofCcApiContextQuery
-
-