pub struct Client { /* private fields */ }
Expand description
Client for Amazon Elastic VMware Service
Client for invoking operations on Amazon Elastic VMware Service. Each operation on Amazon Elastic VMware Service is a method on this
this struct. .send()
MUST be invoked on the generated operations to dispatch the request to the service.
§Constructing a Client
A Config
is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env()
, since this will resolve an SdkConfig
which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env()
instead, which returns a ConfigLoader
that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_evs::Client::new(&config);
Occasionally, SDKs may have additional service-specific values that can be set on the Config
that
is absent from SdkConfig
, or slightly different settings for a specific client may be desired.
The Builder
struct implements From<&SdkConfig>
, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_evs::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();
See the aws-config
docs and Config
for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CreateEnvironment
operation has
a Client::create_environment
, function which returns a builder for that operation.
The fluent builder ultimately has a send()
function that returns an async future that
returns a result, as illustrated below:
let result = client.create_environment()
.client_token("example")
.send()
.await;
The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize
module for more
information.
Implementations§
Source§impl Client
impl Client
Sourcepub fn create_environment(&self) -> CreateEnvironmentFluentBuilder
pub fn create_environment(&self) -> CreateEnvironmentFluentBuilder
Constructs a fluent builder for the CreateEnvironment
operation.
- The fluent builder is configurable:
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseThis parameter is not used in Amazon EVS currently. If you supply input for this parameter, it will have no effect.
A unique, case-sensitive identifier that you provide to ensure the idempotency of the environment creation request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
environment_name(impl Into<String>)
/set_environment_name(Option<String>)
:
required: falseThe name to give to your environment. The name can contain only alphanumeric characters (case-sensitive), hyphens, and underscores. It must start with an alphanumeric character, and can’t be longer than 100 characters. The name must be unique within the Amazon Web Services Region and Amazon Web Services account that you’re creating the environment in.
kms_key_id(impl Into<String>)
/set_kms_key_id(Option<String>)
:
required: falseA unique ID for the customer-managed KMS key that is used to encrypt the VCF credential pairs for SDDC Manager, NSX Manager, and vCenter appliances. These credentials are stored in Amazon Web Services Secrets Manager.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: falseMetadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don’t propagate to any other cluster or Amazon Web Services resources.
service_access_security_groups(ServiceAccessSecurityGroups)
/set_service_access_security_groups(Option<ServiceAccessSecurityGroups>)
:
required: falseThe security group that controls communication between the Amazon EVS control plane and VPC. The default security group is used if a custom security group isn’t specified.
The security group should allow access to the following.
-
TCP/UDP access to the DNS servers
-
HTTPS/SSH access to the host management VLAN subnet
-
HTTPS/SSH access to the Management VM VLAN subnet
You should avoid modifying the security group rules after deployment, as this can break the persistent connection between the Amazon EVS control plane and VPC. This can cause future environment actions like adding or removing hosts to fail.
-
vpc_id(impl Into<String>)
/set_vpc_id(Option<String>)
:
required: trueA unique ID for the VPC that connects to the environment control plane for service access.
Amazon EVS requires that all VPC subnets exist in a single Availability Zone in a Region where the service is available.
The VPC that you select must have a valid DHCP option set with domain name, at least two DNS servers, and an NTP server. These settings are used to configure your VCF appliances and hosts.
If you plan to use HCX over the internet, choose a VPC that has a primary CIDR block and a /28 secondary CIDR block from an IPAM pool. Make sure that your VPC also has an attached internet gateway.
Amazon EVS does not support the following Amazon Web Services networking options for NSX overlay connectivity: cross-Region VPC peering, Amazon S3 gateway endpoints, or Amazon Web Services Direct Connect virtual private gateway associations.
service_access_subnet_id(impl Into<String>)
/set_service_access_subnet_id(Option<String>)
:
required: trueThe subnet that is used to establish connectivity between the Amazon EVS control plane and VPC. Amazon EVS uses this subnet to validate mandatory DNS records for your VCF appliances and hosts and create the environment.
vcf_version(VcfVersion)
/set_vcf_version(Option<VcfVersion>)
:
required: trueThe VCF version to use for the environment. Amazon EVS only supports VCF version 5.2.1 at this time.
terms_accepted(bool)
/set_terms_accepted(Option<bool>)
:
required: trueCustomer confirmation that the customer has purchased and maintains sufficient VCF software licenses to cover all physical processor cores in the environment, in compliance with VMware’s licensing requirements and terms of use.
license_info(LicenseInfo)
/set_license_info(Option<Vec::<LicenseInfo>>)
:
required: trueThe license information that Amazon EVS requires to create an environment. Amazon EVS requires two license keys: a VCF solution key and a vSAN license key. VCF licenses must have sufficient core entitlements to cover vCPU core and vSAN storage capacity needs.
VCF licenses can be used for only one Amazon EVS environment. Amazon EVS does not support reuse of VCF licenses for multiple environments.
VCF license information can be retrieved from the Broadcom portal.
initial_vlans(InitialVlans)
/set_initial_vlans(Option<InitialVlans>)
:
required: trueThe initial VLAN subnets for the environment. You must specify a non-overlapping CIDR block for each VLAN subnet.
hosts(HostInfoForCreate)
/set_hosts(Option<Vec::<HostInfoForCreate>>)
:
required: trueThe ESXi hosts to add to the environment. Amazon EVS requires that you provide details for a minimum of 4 hosts during environment creation.
For each host, you must provide the desired hostname, EC2 SSH key, and EC2 instance type. Optionally, you can also provide a partition or cluster placement group to use, or use Amazon EC2 Dedicated Hosts.
connectivity_info(ConnectivityInfo)
/set_connectivity_info(Option<ConnectivityInfo>)
:
required: trueThe connectivity configuration for the environment. Amazon EVS requires that you specify two route server peer IDs. During environment creation, the route server endpoints peer with the NSX edges over the NSX, providing BGP dynamic routing for overlay networks.
vcf_hostnames(VcfHostnames)
/set_vcf_hostnames(Option<VcfHostnames>)
:
required: trueThe DNS hostnames for the virtual machines that host the VCF management appliances. Amazon EVS requires that you provide DNS hostnames for the following appliances: vCenter, NSX Manager, SDDC Manager, and Cloud Builder.
site_id(impl Into<String>)
/set_site_id(Option<String>)
:
required: trueThe Broadcom Site ID that is allocated to you as part of your electronic software delivery. This ID allows customer access to the Broadcom portal, and is provided to you by Broadcom at the close of your software contract or contract renewal. Amazon EVS uses the Broadcom Site ID that you provide to meet Broadcom VCF license usage reporting requirements for Amazon EVS.
- On success, responds with
CreateEnvironmentOutput
with field(s):environment(Option<Environment>)
:A description of the created environment.
- On failure, responds with
SdkError<CreateEnvironmentError>
Source§impl Client
impl Client
Sourcepub fn create_environment_host(&self) -> CreateEnvironmentHostFluentBuilder
pub fn create_environment_host(&self) -> CreateEnvironmentHostFluentBuilder
Constructs a fluent builder for the CreateEnvironmentHost
operation.
- The fluent builder is configurable:
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseThis parameter is not used in Amazon EVS currently. If you supply input for this parameter, it will have no effect.
A unique, case-sensitive identifier that you provide to ensure the idempotency of the host creation request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
environment_id(impl Into<String>)
/set_environment_id(Option<String>)
:
required: trueA unique ID for the environment that the host is added to.
host(HostInfoForCreate)
/set_host(Option<HostInfoForCreate>)
:
required: trueThe host that is created and added to the environment.
- On success, responds with
CreateEnvironmentHostOutput
with field(s):environment_summary(Option<EnvironmentSummary>)
:A summary of the environment that the host is created in.
host(Option<Host>)
:A description of the created host.
- On failure, responds with
SdkError<CreateEnvironmentHostError>
Source§impl Client
impl Client
Sourcepub fn delete_environment(&self) -> DeleteEnvironmentFluentBuilder
pub fn delete_environment(&self) -> DeleteEnvironmentFluentBuilder
Constructs a fluent builder for the DeleteEnvironment
operation.
- The fluent builder is configurable:
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseThis parameter is not used in Amazon EVS currently. If you supply input for this parameter, it will have no effect.
A unique, case-sensitive identifier that you provide to ensure the idempotency of the environment deletion request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
environment_id(impl Into<String>)
/set_environment_id(Option<String>)
:
required: trueA unique ID associated with the environment to be deleted.
- On success, responds with
DeleteEnvironmentOutput
with field(s):environment(Option<Environment>)
:A description of the deleted environment.
- On failure, responds with
SdkError<DeleteEnvironmentError>
Source§impl Client
impl Client
Sourcepub fn delete_environment_host(&self) -> DeleteEnvironmentHostFluentBuilder
pub fn delete_environment_host(&self) -> DeleteEnvironmentHostFluentBuilder
Constructs a fluent builder for the DeleteEnvironmentHost
operation.
- The fluent builder is configurable:
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseThis parameter is not used in Amazon EVS currently. If you supply input for this parameter, it will have no effect.
A unique, case-sensitive identifier that you provide to ensure the idempotency of the host deletion request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
environment_id(impl Into<String>)
/set_environment_id(Option<String>)
:
required: trueA unique ID for the host’s environment.
host_name(impl Into<String>)
/set_host_name(Option<String>)
:
required: trueThe DNS hostname associated with the host to be deleted.
- On success, responds with
DeleteEnvironmentHostOutput
with field(s):environment_summary(Option<EnvironmentSummary>)
:A summary of the environment that the host was deleted from.
host(Option<Host>)
:A description of the deleted host.
- On failure, responds with
SdkError<DeleteEnvironmentHostError>
Source§impl Client
impl Client
Sourcepub fn get_environment(&self) -> GetEnvironmentFluentBuilder
pub fn get_environment(&self) -> GetEnvironmentFluentBuilder
Constructs a fluent builder for the GetEnvironment
operation.
- The fluent builder is configurable:
environment_id(impl Into<String>)
/set_environment_id(Option<String>)
:
required: trueA unique ID for the environment.
- On success, responds with
GetEnvironmentOutput
with field(s):environment(Option<Environment>)
:A description of the requested environment.
- On failure, responds with
SdkError<GetEnvironmentError>
Source§impl Client
impl Client
Sourcepub fn list_environment_hosts(&self) -> ListEnvironmentHostsFluentBuilder
pub fn list_environment_hosts(&self) -> ListEnvironmentHostsFluentBuilder
Constructs a fluent builder for the ListEnvironmentHosts
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA unique pagination token for each page. If
nextToken
is returned, there are more results available. Make the call again using the returned token with all other arguments unchanged to retrieve the next page. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return. If you specify
MaxResults
in the request, the response includes information up to the limit specified.environment_id(impl Into<String>)
/set_environment_id(Option<String>)
:
required: trueA unique ID for the environment.
- On success, responds with
ListEnvironmentHostsOutput
with field(s):next_token(Option<String>)
:A unique pagination token for next page results. Make the call again using this token to retrieve the next page.
environment_hosts(Option<Vec::<Host>>)
:A list of hosts in the environment.
- On failure, responds with
SdkError<ListEnvironmentHostsError>
Source§impl Client
impl Client
Sourcepub fn list_environment_vlans(&self) -> ListEnvironmentVlansFluentBuilder
pub fn list_environment_vlans(&self) -> ListEnvironmentVlansFluentBuilder
Constructs a fluent builder for the ListEnvironmentVlans
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA unique pagination token for each page. If
nextToken
is returned, there are more results available. Make the call again using the returned token with all other arguments unchanged to retrieve the next page. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return. If you specify
MaxResults
in the request, the response includes information up to the limit specified.environment_id(impl Into<String>)
/set_environment_id(Option<String>)
:
required: trueA unique ID for the environment.
- On success, responds with
ListEnvironmentVlansOutput
with field(s):next_token(Option<String>)
:A unique pagination token for next page results. Make the call again using this token to retrieve the next page.
environment_vlans(Option<Vec::<Vlan>>)
:A list of VLANs that are associated with the specified environment.
- On failure, responds with
SdkError<ListEnvironmentVlansError>
Source§impl Client
impl Client
Sourcepub fn list_environments(&self) -> ListEnvironmentsFluentBuilder
pub fn list_environments(&self) -> ListEnvironmentsFluentBuilder
Constructs a fluent builder for the ListEnvironments
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseA unique pagination token for each page. If
nextToken
is returned, there are more results available. Make the call again using the returned token with all other arguments unchanged to retrieve the next page. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return. If you specify
MaxResults
in the request, the response includes information up to the limit specified.state(EnvironmentState)
/set_state(Option<Vec::<EnvironmentState>>)
:
required: falseThe state of an environment. Used to filter response results to return only environments with the specified
environmentState
.
- On success, responds with
ListEnvironmentsOutput
with field(s):next_token(Option<String>)
:A unique pagination token for next page results. Make the call again using this token to retrieve the next page.
environment_summaries(Option<Vec::<EnvironmentSummary>>)
:A list of environments with summarized environment details.
- On failure, responds with
SdkError<ListEnvironmentsError>
Source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) that identifies the resource to list tags for.
- On success, responds with
ListTagsForResourceOutput
with field(s):tags(Option<HashMap::<String, String>>)
:The tags for the resource.
- On failure, responds with
SdkError<ListTagsForResourceError>
Source§impl Client
impl Client
Sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource to add tags to.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: trueMetadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don’t propagate to any other environment or Amazon Web Services resources.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
Source§impl Client
impl Client
Sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource to delete tags from.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueThe keys of the tags to delete.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
Source§impl Client
impl Client
Sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config
.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_impl
configured. - Identity caching is enabled without a
sleep_impl
andtime_source
configured. - No
behavior_version
is provided.
The panic message for each of these will have instructions on how to resolve them.
Source§impl Client
impl Client
Sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_config
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
sdk_config
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it. - This method will panic if no
BehaviorVersion
is provided. If you experience this panic, setbehavior_version
on the Config or enable thebehavior-version-latest
Cargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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);