pub struct Shield { /* private fields */ }Expand description
A structure representing a shielding site within Fastly.
Implementations§
Source§impl Shield
impl Shield
Sourcepub fn new<S: AsRef<str>>(name: S) -> Result<Self, FastlyStatus>
pub fn new<S: AsRef<str>>(name: S) -> Result<Self, FastlyStatus>
Load information about the given shield.
Returns an object representing the shield if it is active, or an error if the string is malformed or the shield doesn’t exist.
Shield names are defined on this webpage, in the “shield code” column. For example, the string “pdx-or-us” will look up our Portland, OR, USA shield site, while “paris-fr” will look up our Paris site.
If you are using a major cloud provider for your primary origin site, consider looking at the “Recommended for” column, to find the Fastly POP most closely located to the given cloud provider.
Sourcepub fn running_on(&self) -> bool
pub fn running_on(&self) -> bool
Returns whether we are currently operating on the given shield.
Technically, this may also return true in very isolated incidents in which Fastly is routing traffic from the target shield POP to the POP that this code is running on, but in these situations the results should be approximately identical.
(For example, it may be the case that you are asking to shield to ‘pdx-or-us’. But, for load balancing, performance, or other reasons, Fastly is temporarily shifting shielding traffic from Portland to Seattle. In that case, this function may return true for hosts running on ‘bfi-wa-us’, our Seattle site, because effectively the shield has moved to that location. This should give you a slightly faster experience than the alternative, in which this function would return false, you would try to forward your traffic to the Portland site, and then that traffic would be caught and redirected back to Seattle.)
Sourcepub fn with_first_byte_timeout(&self, timeout: Duration) -> Self
pub fn with_first_byte_timeout(&self, timeout: Duration) -> Self
Creates a copy of this Shield with the first-byte timeout configured.
The configured first-byte timeout will apply to any backends derived from
the returned Shield (Shield::encrypted_backend or Shield::unencrypted_backend).
See BackendBuilder::set_first_byte_timeout.
Sourcepub fn unencrypted_backend(&self) -> Result<Backend, FastlyStatus>
pub fn unencrypted_backend(&self) -> Result<Backend, FastlyStatus>
Returns a Backend representing an unencrypted connetion to the POP.
Generally speaking, we encourage users to use Shield::encrypted_backend
instead of this function. Data sent over this backend – the unencrypted
version – will be sent over the open internet, with no protections. In
most cases, this is not what you want. However, in some cases – such as
when you want to ship large data blobs that you know are already encrypted
— using these backends can prevent a double-encryption performance
penalty.
Sourcepub fn encrypted_backend(&self) -> Result<Backend, FastlyStatus>
pub fn encrypted_backend(&self) -> Result<Backend, FastlyStatus>
Returns a Backend representing an encrypted connection to the POP.
For reference, this is almost always the backend that you want to use. Only
use Shield::unencrypted_backend in situations in which you are 100% sure
that all the data you will send and receive over the backend is already
encrypted.
Auto Trait Implementations§
impl Freeze for Shield
impl RefUnwindSafe for Shield
impl Send for Shield
impl Sync for Shield
impl Unpin for Shield
impl UnsafeUnpin for Shield
impl UnwindSafe for Shield
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 more