pub struct Manager { /* private fields */ }
Expand description
Implements AWS EC2 manager.
Implementations§
Source§impl Manager
impl Manager
pub fn new(shared_config: &AwsSdkConfig) -> Self
Sourcepub async fn create_key_pair(
&self,
key_name: &str,
key_path: &str,
) -> Result<()>
pub async fn create_key_pair( &self, key_name: &str, key_path: &str, ) -> Result<()>
Creates an AWS EC2 key-pair and saves the private key to disk. It overwrites “key_path” file with the newly created key.
Sourcepub async fn delete_key_pair(&self, key_name: &str) -> Result<()>
pub async fn delete_key_pair(&self, key_name: &str) -> Result<()>
Deletes the AWS EC2 key-pair.
Sourcepub async fn describe_attached_volumes(
&self,
instance_id: Option<String>,
device_path: Option<String>,
) -> Result<Vec<Volume>>
pub async fn describe_attached_volumes( &self, instance_id: Option<String>, device_path: Option<String>, ) -> Result<Vec<Volume>>
Describes all attached volumes by instance Id and device. If “instance_id” is empty, it fetches from the local EC2 instance’s metadata service. The region used for API call is inherited from the EC2 client SDK.
e.g.,
aws ec2 describe-volumes
–region ${AWS::Region}
–filters
Name=attachment.instance-id,Values=$INSTANCE_ID
Name=attachment.device,Values=/dev/xvdb
–query Volumes[].Attachments[].State
–output text
ref. https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumes.html ref. https://github.com/ava-labs/avalanche-ops/blob/fcbac87a219a8d3d6d3c38a1663fe1dafe78e04e/bin/avalancheup-aws/cfn-templates/asg_amd64_ubuntu.yaml#L397-L409
Sourcepub async fn get_volume(
&self,
instance_id: Option<String>,
device_path: &str,
) -> Result<Volume>
pub async fn get_volume( &self, instance_id: Option<String>, device_path: &str, ) -> Result<Volume>
Fetches the EBS volume by its attachment state. If “instance_id” is empty, it fetches from the local EC2 instance’s metadata service.
Sourcepub async fn poll_volume_attachment_state(
&self,
instance_id: Option<String>,
device_path: &str,
desired_attachment_state: VolumeAttachmentState,
timeout: Duration,
interval: Duration,
) -> Result<Volume>
pub async fn poll_volume_attachment_state( &self, instance_id: Option<String>, device_path: &str, desired_attachment_state: VolumeAttachmentState, timeout: Duration, interval: Duration, ) -> Result<Volume>
Polls EBS volume attachment state. If “instance_id” is empty, it fetches from the local EC2 instance’s metadata service.
Fetches all tags for the specified instance.
“If a single piece of data must be accessible from more than one task concurrently, then it must be shared using synchronization primitives such as Arc.” ref. https://tokio.rs/tokio/tutorial/spawning
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manager
impl !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
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 more