Struct aws_manager::ec2::Manager
source · [−]pub struct Manager { /* private fields */ }
Expand description
Implements AWS EC2 manager.
Implementations
sourceimpl Manager
impl Manager
pub fn new(shared_config: &AwsSdkConfig) -> Self
pub fn client(&self) -> Client
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_volumes(
&self,
filters: Option<Vec<Filter>>
) -> Result<Vec<Volume>>
pub async fn describe_volumes(
&self,
filters: Option<Vec<Filter>>
) -> Result<Vec<Volume>>
Describes the EBS volumes by filters. ref. https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumes.html
sourcepub async fn poll_volume_state(
&self,
ebs_volume_id: String,
desired_state: VolumeState,
timeout: Duration,
interval: Duration
) -> Result<Option<Volume>>
pub async fn poll_volume_state(
&self,
ebs_volume_id: String,
desired_state: VolumeState,
timeout: Duration,
interval: Duration
) -> Result<Option<Volume>>
Polls the EBS volume by its state.
sourcepub async fn describe_local_volumes(
&self,
ebs_volume_id: Option<String>,
ebs_device_name: String,
local_ec2_instance_id: Option<String>
) -> Result<Vec<Volume>>
pub async fn describe_local_volumes(
&self,
ebs_volume_id: Option<String>,
ebs_device_name: String,
local_ec2_instance_id: Option<String>
) -> Result<Vec<Volume>>
Describes the attached volume by the volume Id and EBS device name. The “local_ec2_instance_id” is only set to bypass extra EC2 metadata service API calls. 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 poll_local_volume_by_attachment_state(
&self,
ebs_volume_id: Option<String>,
ebs_device_name: String,
desired_attachment_state: VolumeAttachmentState,
timeout: Duration,
interval: Duration
) -> Result<Volume>
pub async fn poll_local_volume_by_attachment_state(
&self,
ebs_volume_id: Option<String>,
ebs_device_name: String,
desired_attachment_state: VolumeAttachmentState,
timeout: Duration,
interval: Duration
) -> Result<Volume>
Polls the EBS volume attachment state. For instance, the “device_name” can be either “/dev/xvdb” or “xvdb” (for the secondary volume).
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 !RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl !UnwindSafe for Manager
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more