pub struct Service { /* private fields */ }
Expand description

Details about an AWS or AWS-like service.

Service structs are immutable.

Implementations§

Create a Service object representing an AWS(-ish) service.

Arguments
  • service_name: The name of the service. This must meet the following requirements or a PrincipalError::InvalidService error will be returned:
    • The name must contain between 1 and 32 characters.
    • The name must be composed to ASCII alphanumeric characters or one of , - . = @ _.
  • region: The region the service is running in. If None, the service is global.
  • dns_suffix: The DNS suffix of the service. This is usually amazonaws.com.

If all of the requirements are met, a Service object is returned. Otherwise, a PrincipalError error is returned.

Example
let service = Service::new("s3", Some("us-east-1".to_string()), "amazonaws.com").unwrap();
assert_eq!(service.service_name(), "s3");
assert_eq!(service.region(), Some("us-east-1"));
assert_eq!(service.dns_suffix(), "amazonaws.com");
assert_eq!(service.regional_dns_name(), "s3.us-east-1.amazonaws.com");
assert_eq!(service.global_dns_name(), "s3.amazonaws.com");

The name of the service.

The region of the service. If the service is global, this will be None.

The DNS suffix of the service.

The regional DNS name of the service. If the service is global, this will be the same as the global DNS name.

The global DNS name of the service (omitting the regional component, if any).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.