CcApiContextQuery Struct
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).
| Source | lib/cloud-assembly/context-queries.ts |
|---|---|
| Type last changed |
Example
import { CcApiContextQuery } from '@aws-cdk/cloud-assembly-schema';
const x: CcApiContextQuery = {
typeName: 'AWS::Some::Type',
expectedMatchCount: 'exactly-one',
resourceModel: {SomeArn: 'arn:aws:....'},
propertiesToReturn: ['SomeProp'],
account: '11111111111',
region: 'us-east-1',
};
from aws_cdk.cloud_assembly_schema import CcApiContextQuery
from aws_cdk.cloud_assembly_schema import CcApiContextQuery
x = CcApiContextQuery(
type_name="AWS::Some::Type",
expected_match_count="exactly-one",
resource_model={"SomeArn": "arn:aws:...."},
properties_to_return=["SomeProp"],
account="11111111111",
region="us-east-1"
)
import software.amazon.awscdk.cloudassembly.schema.CcApiContextQuery;
CcApiContextQuery x = CcApiContextQuery.builder()
.typeName("AWS::Some::Type")
.expectedMatchCount("exactly-one")
.resourceModel(Map.of("SomeArn", "arn:aws:...."))
.propertiesToReturn(List.of("SomeProp"))
.account("11111111111")
.region("us-east-1")
.build();
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.CloudAssembly.Schema;
var x = new CcApiContextQuery {
TypeName = "AWS::Some::Type",
ExpectedMatchCount = "exactly-one",
ResourceModel = new Dictionary<string, object> { { "SomeArn", "arn:aws:...." } },
PropertiesToReturn = new [] { "SomeProp" },
Account = "11111111111",
Region = "us-east-1"
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/cdklabs/cloud-assembly-schema-go/awscdkcloudassemblyschema"
x := &CcApiContextQuery{
TypeName: jsii.String("AWS::Some::Type"),
ExpectedMatchCount: jsii.String("exactly-one"),
ResourceModel: map[string]interface{}{
"SomeArn": jsii.String("arn:aws:...."),
},
PropertiesToReturn: []*string{
jsii.String("SomeProp"),
},
Account: jsii.String("11111111111"),
Region: jsii.String("us-east-1"),
}
Properties
assumeRoleAdditionalOptionsoptional{ [key: string]: any }assume_role_additional_optionsoptionaltyping.Mapping[str, Any]assumeRoleAdditionalOptionsoptionalMap<String, Object>AssumeRoleAdditionalOptionsoptionalIDictionary<string, object>AssumeRoleAdditionalOptionsoptional*map[string]interface{} #Default: No additional options.
RoleArnshould not be used. Use the dedicatedlookupRoleArnproperty instead.ExternalIdshould not be used. Use the dedicatedlookupRoleExternalIdinstead.
dummyValueoptionalanydummy_valueoptionalAnydummyValueoptionalObjectDummyValueoptionalobjectDummyValueoptionalinterface{} #Default: No dummy value available
notes
If supplied, dummyValue should be an array of objects.
dummyValue does not have to have elements, and it may have objects with different properties than the properties in propertiesToReturn, but it will be easiest for downstream code if the dummyValue conforms to the expected response shape.
exactIdentifieroptionalstringexact_identifieroptionalstrexactIdentifieroptionalStringExactIdentifieroptionalstringExactIdentifieroptional*string #Default: Either exactIdentifier or propertyMatch should be specified.
Specifying exactIdentifier will return exactly one result, or throw an error unless ignoreErrorOnMissingContext is set.
expectedMatchCountoptionalstringexpected_match_countoptionalstrexpectedMatchCountoptionalStringExpectedMatchCountoptionalstringExpectedMatchCountoptional*string = 'any' #notes
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 --remove
If the value of * ignoreErrorOnMissingContext is true, the value of expectedMatchCount is at-least-one | exactly-one and the number of found resources is 0, dummyValue is returned and committed to context instead.
ignoreErrorOnMissingContextoptionalbooleanignore_error_on_missing_contextoptionalboolignoreErrorOnMissingContextoptionalBooleanIgnoreErrorOnMissingContextoptionalboolIgnoreErrorOnMissingContextoptional*bool = false #notes
- 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 ignoreErrorOnMissingContext is set, dummyValue should be set and be an array.
lookupRoleArnoptionalstringlookup_role_arnoptionalstrlookupRoleArnoptionalStringLookupRoleArnoptionalstringLookupRoleArnoptional*string = None #lookupRoleExternalIdoptionalstringlookup_role_external_idoptionalstrlookupRoleExternalIdoptionalStringLookupRoleExternalIdoptionalstringLookupRoleExternalIdoptional*string #Default: No ExternalId will be supplied
propertiesToReturnstring[]properties_to_returntyping.List[str]propertiesToReturnList<String>PropertiesToReturnstring[]PropertiesToReturn*[]*string required #notes
If any properties listed here are absent from the target resource, an error will be thrown.
The returned object will always include the key Identifier with the CC-API returned field Identifier.
Notes on property completeness
CloudControl API's ListResources may return fewer properties than GetResource would, 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 GetResource call for resources matched by propertyMatch.
propertyMatchoptional{ [key: string]: any }property_matchoptionaltyping.Mapping[str, Any]propertyMatchoptionalMap<String, Object>PropertyMatchoptionalIDictionary<string, object>PropertyMatchoptional*map[string]interface{} #Default: Either exactIdentifier or propertyMatch should be specified.
notes
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 ListResources may return fewer properties than GetResource would, depending on the resource implementation.
The resources that propertyMatch matches against will only ever be the properties returned by the ListResources call.
resourceModeloptional{ [key: string]: any }resource_modeloptionaltyping.Mapping[str, Any]resourceModeloptionalMap<String, Object>ResourceModeloptionalIDictionary<string, object>ResourceModeloptional*map[string]interface{} #Default: no resource Model is provided
This is needed for sub-resources where the parent Arn is required.