#[non_exhaustive]pub struct ResourceQuery {
pub type: QueryType,
pub query: String,
}
Expand description
The query you can use to define a resource group or a search for resources. A ResourceQuery
specifies both a query Type
and a Query
string as JSON string objects. See the examples section for example JSON strings. For more information about creating a resource group with a resource query, see Build queries and groups in Resource Groups in the Resource Groups User Guide
When you combine all of the elements together into a single string, any double quotes that are embedded inside another double quote pair must be escaped by preceding the embedded double quote with a backslash character (\). For example, a complete ResourceQuery
parameter must be formatted like the following CLI parameter example:
--resource-query '{"Type":"TAG_FILTERS_1_0","Query":"{\"ResourceTypeFilters\":\[\"AWS::AllSupported\"\],\"TagFilters\":\[{\"Key\":\"Stage\",\"Values\":\[\"Test\"\]}\]}"}'
In the preceding example, all of the double quote characters in the value part of the Query
element must be escaped because the value itself is surrounded by double quotes. For more information, see Quoting strings in the Command Line Interface User Guide.
For the complete list of resource types that you can use in the array value for ResourceTypeFilters
, see Resources you can use with Resource Groups and Tag Editor in the Resource Groups User Guide. For example:
"ResourceTypeFilters":\["AWS::S3::Bucket", "AWS::EC2::Instance"\]
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.type: QueryType
The type of the query to perform. This can have one of two values:
-
CLOUDFORMATION_STACK_1_0:
Specifies that you want the group to contain the members of an CloudFormation stack. TheQuery
contains aStackIdentifier
element with an Amazon resource name (ARN) for a CloudFormation stack. -
TAG_FILTERS_1_0:
Specifies that you want the group to include resource that have tags that match the query.
query: String
The query that defines a group or a search. The contents depends on the value of the Type
element.
-
ResourceTypeFilters
– Applies to allResourceQuery
objects of eitherType
. This element contains one of the following two items:-
The value
AWS::AllSupported
. This causes the ResourceQuery to match resources of any resource type that also match the query. -
A list (a JSON array) of resource type identifiers that limit the query to only resources of the specified types. For the complete list of resource types that you can use in the array value for
ResourceTypeFilters
, see Resources you can use with Resource Groups and Tag Editor in the Resource Groups User Guide.
Example:
"ResourceTypeFilters": \["AWS::AllSupported"\]
or"ResourceTypeFilters": \["AWS::EC2::Instance", "AWS::S3::Bucket"\]
-
-
TagFilters
– applicable only ifType
=TAG_FILTERS_1_0
. TheQuery
contains a JSON string that represents a collection of simple tag filters. The JSON string uses a syntax similar to theGetResources
operation, but uses only theResourceTypeFilters
andTagFilters
fields. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.For example, consider the following sample query for resources that have two tags,
Stage
andVersion
, with two values each:\[{"Stage":\["Test","Deploy"\]},{"Version":\["1","2"\]}\]
The results of this resource query could include the following.
-
An Amazon EC2 instance that has the following two tags:
{"Stage":"Deploy"}
, and{"Version":"2"}
-
An S3 bucket that has the following two tags:
{"Stage":"Test"}
, and{"Version":"1"}
The resource query results would not include the following items in the results, however.
-
An Amazon EC2 instance that has only the following tag:
{"Stage":"Deploy"}
.The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.
-
An RDS database that has the following two tags:
{"Stage":"Archived"}
and{"Version":"4"}
The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.
Example:
"TagFilters": \[ { "Key": "Stage", "Values": \[ "Gamma", "Beta" \] }
-
-
StackIdentifier
– applicable only ifType
=CLOUDFORMATION_STACK_1_0
. The value of this parameter is the Amazon Resource Name (ARN) of the CloudFormation stack whose resources you want included in the group.
Implementations§
Source§impl ResourceQuery
impl ResourceQuery
Sourcepub fn type(&self) -> &QueryType
pub fn type(&self) -> &QueryType
The type of the query to perform. This can have one of two values:
-
CLOUDFORMATION_STACK_1_0:
Specifies that you want the group to contain the members of an CloudFormation stack. TheQuery
contains aStackIdentifier
element with an Amazon resource name (ARN) for a CloudFormation stack. -
TAG_FILTERS_1_0:
Specifies that you want the group to include resource that have tags that match the query.
Sourcepub fn query(&self) -> &str
pub fn query(&self) -> &str
The query that defines a group or a search. The contents depends on the value of the Type
element.
-
ResourceTypeFilters
– Applies to allResourceQuery
objects of eitherType
. This element contains one of the following two items:-
The value
AWS::AllSupported
. This causes the ResourceQuery to match resources of any resource type that also match the query. -
A list (a JSON array) of resource type identifiers that limit the query to only resources of the specified types. For the complete list of resource types that you can use in the array value for
ResourceTypeFilters
, see Resources you can use with Resource Groups and Tag Editor in the Resource Groups User Guide.
Example:
"ResourceTypeFilters": \["AWS::AllSupported"\]
or"ResourceTypeFilters": \["AWS::EC2::Instance", "AWS::S3::Bucket"\]
-
-
TagFilters
– applicable only ifType
=TAG_FILTERS_1_0
. TheQuery
contains a JSON string that represents a collection of simple tag filters. The JSON string uses a syntax similar to theGetResources
operation, but uses only theResourceTypeFilters
andTagFilters
fields. If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.For example, consider the following sample query for resources that have two tags,
Stage
andVersion
, with two values each:\[{"Stage":\["Test","Deploy"\]},{"Version":\["1","2"\]}\]
The results of this resource query could include the following.
-
An Amazon EC2 instance that has the following two tags:
{"Stage":"Deploy"}
, and{"Version":"2"}
-
An S3 bucket that has the following two tags:
{"Stage":"Test"}
, and{"Version":"1"}
The resource query results would not include the following items in the results, however.
-
An Amazon EC2 instance that has only the following tag:
{"Stage":"Deploy"}
.The instance does not have all of the tag keys specified in the filter, so it is excluded from the results.
-
An RDS database that has the following two tags:
{"Stage":"Archived"}
and{"Version":"4"}
The database has all of the tag keys, but none of those keys has an associated value that matches at least one of the specified values in the filter.
Example:
"TagFilters": \[ { "Key": "Stage", "Values": \[ "Gamma", "Beta" \] }
-
-
StackIdentifier
– applicable only ifType
=CLOUDFORMATION_STACK_1_0
. The value of this parameter is the Amazon Resource Name (ARN) of the CloudFormation stack whose resources you want included in the group.
Source§impl ResourceQuery
impl ResourceQuery
Sourcepub fn builder() -> ResourceQueryBuilder
pub fn builder() -> ResourceQueryBuilder
Creates a new builder-style object to manufacture ResourceQuery
.
Trait Implementations§
Source§impl Clone for ResourceQuery
impl Clone for ResourceQuery
Source§fn clone(&self) -> ResourceQuery
fn clone(&self) -> ResourceQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ResourceQuery
impl Debug for ResourceQuery
Source§impl PartialEq for ResourceQuery
impl PartialEq for ResourceQuery
impl StructuralPartialEq for ResourceQuery
Auto Trait Implementations§
impl Freeze for ResourceQuery
impl RefUnwindSafe for ResourceQuery
impl Send for ResourceQuery
impl Sync for ResourceQuery
impl Unpin for ResourceQuery
impl UnwindSafe for ResourceQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);