pub struct InstanceClient { /* private fields */ }Expand description
Calls InstanceService.
Instances: virtual machines in one zone, booted from an image onto a durable boot volume, with network interfaces created beforehand with the network service.
Implementations§
Source§impl InstanceClient
impl InstanceClient
Sourcepub fn new(client: &Client) -> Self
pub fn new(client: &Client) -> Self
Returns a client of InstanceService that sends its calls through client.
Sourcepub fn service(&self) -> &Service
pub fn service(&self) -> &Service
The endpoint the client sends its calls to, which also serves the operations its methods answer with.
Sourcepub async fn get_instance(
&self,
request: GetInstanceRequest,
) -> Result<Instance, Error>
pub async fn get_instance( &self, request: GetInstanceRequest, ) -> Result<Instance, Error>
Returns an instance. A terminated instance can be read by name for a day after it was terminated.
Sourcepub async fn list_instances(
&self,
request: ListInstancesRequest,
) -> Result<ListInstancesResponse, Error>
pub async fn list_instances( &self, request: ListInstancesRequest, ) -> Result<ListInstancesResponse, Error>
Lists the instances in a zone, oldest first. A terminated instance is
listed for two hours after it was terminated. For every zone’s
instances, list the zones whose services name compute with the
location service (location.origincloudapis.eu), then each zone’s
instances.
Sourcepub fn all_instances(&self, request: ListInstancesRequest) -> Pages<Instance>
pub fn all_instances(&self, request: ListInstancesRequest) -> Pages<Instance>
Returns everything list_instances lists from request’s page on, fetching the next page as the stream reaches it. A page that fails ends the stream with its error.
Sourcepub async fn create_instance(
&self,
request: CreateInstanceRequest,
) -> Result<Operation<Instance>, Error>
pub async fn create_instance( &self, request: CreateInstanceRequest, ) -> Result<Operation<Instance>, Error>
Launches an instance. The operation is done once the instance is
instance::State::Running, or failed once it is instance::State::Failed, with the reason in
state_reason; a failed instance still exists, and can be started
again or deleted.
It answers with an operation to wait on: Operation::wait returns the Instance once the change is done.
Sourcepub async fn update_instance(
&self,
request: UpdateInstanceRequest,
) -> Result<Operation<Instance>, Error>
pub async fn update_instance( &self, request: UpdateInstanceRequest, ) -> Result<Operation<Instance>, Error>
Changes an instance’s type or tags. A new instance_type needs the
instance instance::State::Stopped, and is refused with FAILED_PRECONDITION
otherwise; it takes effect at the next start. A larger type is checked
against the same vCPU quota a launch is. The operation is done once the
instance shows the change.
It answers with an operation to wait on: Operation::wait returns the Instance once the change is done.
Sourcepub async fn delete_instance(
&self,
request: DeleteInstanceRequest,
) -> Result<Operation<Empty>, Error>
pub async fn delete_instance( &self, request: DeleteInstanceRequest, ) -> Result<Operation<Empty>, Error>
Terminates an instance: its guest is stopped for good, its network
interfaces are released, AVAILABLE again with their addresses (one
created for it at launch is deleted), and
its boot volume is deleted with it unless a snapshot of it exists.
Other attached volumes are detached and kept.
Terminating a terminated instance changes nothing. The operation is
done once the instance is instance::State::Terminated.
It answers with an operation to wait on, which has no result: Operation::wait returns once the change is done.
Sourcepub async fn start_instance(
&self,
request: StartInstanceRequest,
) -> Result<Operation<Instance>, Error>
pub async fn start_instance( &self, request: StartInstanceRequest, ) -> Result<Operation<Instance>, Error>
Starts a instance::State::Stopped or instance::State::Failed instance. It keeps its name, its
addresses and its volumes, and may come back on another machine.
Starting a running instance changes nothing; it is refused while the
instance is instance::State::Initializing, instance::State::Stopping or instance::State::ShuttingDown. The
operation is done once the instance is instance::State::Running, or failed once it is
instance::State::Failed.
It answers with an operation to wait on: Operation::wait returns the Instance once the change is done.
Sourcepub async fn stop_instance(
&self,
request: StopInstanceRequest,
) -> Result<Operation<Instance>, Error>
pub async fn stop_instance( &self, request: StopInstanceRequest, ) -> Result<Operation<Instance>, Error>
Stops a running instance: its guest is shut down, and it keeps its
volumes and addresses. Stopping a stopped instance changes nothing. The
operation is done once the instance is instance::State::Stopped, or failed once it is
instance::State::Failed.
It answers with an operation to wait on: Operation::wait returns the Instance once the change is done.