CcApiContextQuery
- class aws_cdk.cloud_assembly_schema.CcApiContextQuery(*, account, region, assume_role_additional_options=None, lookup_role_arn=None, lookup_role_external_id=None, properties_to_return, type_name, dummy_value=None, exact_identifier=None, expected_match_count=None, ignore_error_on_missing_context=None, property_match=None)
Bases:
ContextLookupRoleOptionsQuery 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).
- Parameters:
account (
str) – Query account.region (
str) – Query region.assume_role_additional_options (
Optional[Mapping[str,Any]]) – Additional options to pass to STS when assuming the lookup role. -RoleArnshould not be used. Use the dedicatedlookupRoleArnproperty instead. -ExternalIdshould not be used. Use the dedicatedlookupRoleExternalIdinstead. Default: - No additional options.lookup_role_arn (
Optional[str]) – The ARN of the role that should be used to look up the missing values. Default: - Nonelookup_role_external_id (
Optional[str]) – The ExternalId that needs to be supplied while assuming this role. Default: - No ExternalId will be suppliedproperties_to_return (
Sequence[str]) – 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 keyIdentifierwith the CC-API returned fieldIdentifier. Notes on property completeness CloudControl API’sListResourcesmay 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 additionalGetResourcecall for resources matched bypropertyMatch.type_name (
str) – The CloudFormation resource type. See https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.htmldummy_value (
Any) – 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 availableexact_identifier (
Optional[str]) – Identifier of the resource to look up usingGetResource. Specifying exactIdentifier will return exactly one result, or throw an error unlessignoreErrorOnMissingContextis set. Default: - Either exactIdentifier or propertyMatch should be specified.expected_match_count (
Optional[str]) – 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 usingcdk 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’ignore_error_on_missing_context (
Optional[bool]) – Ignore an error and return thedummyValueinstead if the resource was not found. - In case of anexactIdentifierlookup, return thedummyValueif the resource with that identifier was not found. - In case of apropertyMatchlookup, return thedummyValueifexpectedMatchCountisat-least-one | exactly-oneand the number of resources found was 0. ifignoreErrorOnMissingContextis set,dummyValueshould be set and be an array. Default: falseproperty_match (
Optional[Mapping[str,Any]]) – 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), specifyexpectedMatchCount. Notes on property completeness CloudControl API’sListResourcesmay return fewer properties thanGetResourcewould, depending on the resource implementation. The resources thatpropertyMatchmatches against will only ever be the properties returned by theListResourcescall. Default: - Either exactIdentifier or propertyMatch should be specified.
Example:
from aws_cdk.cloud_assembly_schema import CcApiContextQuery x = CcApiContextQuery( type_name="AWS::Some::Type", expected_match_count="exactly-one", properties_to_return=["SomeProp"], account="11111111111", region="us-east-1" )
Attributes
- account
Query account.
- assume_role_additional_options
Additional options to pass to STS when assuming the lookup role.
RoleArnshould not be used. Use the dedicatedlookupRoleArnproperty instead.ExternalIdshould not be used. Use the dedicatedlookupRoleExternalIdinstead.
- Default:
No additional options.
- See:
- dummy_value
The value to return if the resource was not found and
ignoreErrorOnMissingContextis 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
- exact_identifier
Identifier of the resource to look up using
GetResource.Specifying exactIdentifier will return exactly one result, or throw an error unless
ignoreErrorOnMissingContextis set.- Default:
Either exactIdentifier or propertyMatch should be specified.
- expected_match_count
Expected count of results if
propertyMatchis 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’
- ignore_error_on_missing_context
Ignore an error and return the
dummyValueinstead 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
- lookup_role_arn
The ARN of the role that should be used to look up the missing values.
- Default:
None
- lookup_role_external_id
The ExternalId that needs to be supplied while assuming this role.
- Default:
No ExternalId will be supplied
- properties_to_return
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.
- property_match
Returns any resources matching these properties, using
ListResources.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.
- region
Query region.
- type_name
The CloudFormation resource type.