Skip to main content

Network

Struct Network 

Source
pub struct Network { /* private fields */ }
Expand description

Represents a network accessible by either hosts or virtual machines.

This can be a physical network or a logical network, such as a VLAN.

Networks are created:

  • explicitly when configuring a host.
  • automatically when adding a host to VirtualCenter.
  • automatically when adding a new virtual machine to a host or to VirtualCenter.

To configure network access for hosts and virtual machines, use DistributedVirtualSwitch and DistributedVirtualPortgroup managed objects.

Implementations§

Source§

impl Network

Source

pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self

Source

pub async fn destroy_task(&self) -> Result<ManagedObjectReference>

Destroys this object, deleting its contents and removing it from its parent folder (if any).

NOTE: The appropriate privilege must be held on the parent of the destroyed entity as well as the entity itself. This method can throw one of several exceptions. The exact set of exceptions depends on the kind of entity that is being removed. See comments for each entity for more information on destroy behavior.

Required privileges: System.Read

§Returns:

This method returns a Task object with which to monitor the operation.

Refers instance of Task.

§Errors:

Failure

Source

pub async fn destroy_network(&self) -> Result<()>

Deprecated as of VI API 2.5 do not use this method. This method throws ResourceInUse. Networks are automatically removed when no longer in use, so this method is unnecessary.

Removes a network.

A network can be removed only if it is not used by any host or virtual machine.

Required privileges: Network.Delete

§Errors:

ResourceInUse: if one or more hosts or virtual machines are configured to use the network.

Source

pub async fn reload(&self) -> Result<()>

Reload the entity state.

Clients only need to call this method if they changed some external state that affects the service without using the Web service interface to perform the change. For example, hand-editing a virtual machine configuration file affects the configuration of the associated virtual machine but the service managing the virtual machine might not monitor the file for changes. In this case, after such an edit, a client would call “reload” on the associated virtual machine to ensure the service and its clients have current data for the virtual machine.

Required privileges: System.Read

Source

pub async fn rename_task( &self, new_name: &str, ) -> Result<ManagedObjectReference>

Renames this managed entity.

Any % (percent) character used in this name parameter must be escaped, unless it is used to start an escape sequence. Clients may also escape any other characters in this name parameter.

See also ManagedEntity.name.

Required privileges: System.Read

§Parameters:
§new_name
§Returns:

This method returns a Task object with which to monitor the operation.

Refers instance of Task.

§Errors:

DuplicateName: If another object in the same folder has the target name.

InvalidName: If the new name is not a valid entity name.

Source

pub async fn set_custom_value(&self, key: &str, value: &str) -> Result<()>

Assigns a value to a custom field.

The setCustomValue method requires whichever updatePrivilege is defined as one of the CustomFieldDef.fieldInstancePrivileges for the CustomFieldDef whose value is being changed.

§Parameters:
§key

The name of the field whose value is to be updated.

§value

Value to be assigned to the custom field.

Source

pub async fn alarm_actions_enabled(&self) -> Result<Option<bool>>

Whether alarm actions are enabled for this entity.

True if enabled; false otherwise.

Required privileges: System.Read

Source

pub async fn available_field(&self) -> Result<Option<Vec<CustomFieldDef>>>

List of custom field definitions that are valid for the object’s type.

The fields are sorted by CustomFieldDef.name.

Required privileges: System.View

Source

pub async fn config_issue(&self) -> Result<Option<Vec<Event>>>

Current configuration issues that have been detected for this entity.

Typically, these issues have already been logged as events. The entity stores these events as long as they are still current. The configStatus property provides an overall status based on these events.

Source

pub async fn config_status(&self) -> Result<ManagedEntityStatusEnum>

The configStatus indicates whether or not the system has detected a configuration issue involving this entity.

For example, it might have detected a duplicate IP address or MAC address, or a host in a cluster might be out of compliance. The meanings of the configStatus values are:

  • red: A problem has been detected involving the entity.
  • yellow: A problem is about to occur or a transient condition has occurred (For example, reconfigure fail-over policy).
  • green: No configuration issues have been detected.
  • gray: The configuration status of the entity is not being monitored.

A green status indicates only that a problem has not been detected; it is not a guarantee that the entity is problem-free.

The configIssue property contains a list of the problems that have been detected. In releases after vSphere API 5.0, vSphere Servers might not generate property collector update notifications for this property. To obtain the latest value of the property, you can use PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx. If you use the PropertyCollector.WaitForUpdatesEx method, specify an empty string for the version parameter. Any other version value will not produce any property values as no updates are generated.

Source

pub async fn custom_value( &self, ) -> Result<Option<Vec<Box<dyn CustomFieldValueTrait>>>>

Custom field values.

Required privileges: System.View

Source

pub async fn declared_alarm_state(&self) -> Result<Option<Vec<AlarmState>>>

A set of alarm states for alarms that apply to this managed entity.

The set includes alarms defined on this entity and alarms inherited from the parent entity, or from any ancestors in the inventory hierarchy.

Alarms are inherited if they can be triggered by this entity or its descendants. This set does not include alarms that are defined on descendants of this entity.

Required privileges: System.View

Source

pub async fn disabled_method(&self) -> Result<Option<Vec<String>>>

List of operations that are disabled, given the current runtime state of the entity.

For example, a power-on operation always fails if a virtual machine is already powered on. This list can be used by clients to enable or disable operations in a graphical user interface.

Note: This list is determined by the current runtime state of an entity, not by its permissions.

This list may include the following operations for a HostSystem:

  • HostSystem.EnterMaintenanceMode_Task
  • HostSystem.ExitMaintenanceMode_Task
  • HostSystem.RebootHost_Task
  • HostSystem.ShutdownHost_Task
  • HostSystem.ReconnectHost_Task
  • HostSystem.DisconnectHost_Task

This list may include the following operations for a VirtualMachine:

  • VirtualMachine.AnswerVM
  • ManagedEntity.Rename_Task
  • VirtualMachine.CloneVM_Task
  • VirtualMachine.PowerOffVM_Task
  • VirtualMachine.PowerOnVM_Task
  • VirtualMachine.SuspendVM_Task
  • VirtualMachine.ResetVM_Task
  • VirtualMachine.ReconfigVM_Task
  • VirtualMachine.RelocateVM_Task
  • VirtualMachine.MigrateVM_Task
  • VirtualMachine.CustomizeVM_Task
  • VirtualMachine.ShutdownGuest
  • VirtualMachine.StandbyGuest
  • VirtualMachine.RebootGuest
  • VirtualMachine.CreateSnapshot_Task
  • VirtualMachine.RemoveAllSnapshots_Task
  • VirtualMachine.RevertToCurrentSnapshot_Task
  • VirtualMachine.MarkAsTemplate
  • VirtualMachine.MarkAsVirtualMachine
  • VirtualMachine.ResetGuestInformation
  • VirtualMachine.MountToolsInstaller
  • VirtualMachine.UnmountToolsInstaller
  • ManagedEntity.Destroy_Task
  • VirtualMachine.UpgradeVM_Task
  • VirtualMachine.ExportVm

This list may include the following operations for a ResourcePool:

  • ResourcePool.ImportVApp
  • ResourcePool.CreateChildVM_Task
  • ResourcePool.UpdateConfig
  • Folder.CreateVM_Task
  • ManagedEntity.Destroy_Task
  • ManagedEntity.Rename_Task

This list may include the following operations for a VirtualApp:

  • ManagedEntity.Destroy_Task
  • VirtualApp.CloneVApp_Task
  • VirtualApp.unregisterVApp_Task
  • VirtualApp.ExportVApp
  • VirtualApp.PowerOnVApp_Task
  • VirtualApp.PowerOffVApp_Task
  • VirtualApp.UpdateVAppConfig

In releases after vSphere API 5.0, vSphere Servers might not generate property collector update notifications for this property. To obtain the latest value of the property, you can use PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx. If you use the PropertyCollector.WaitForUpdatesEx method, specify an empty string for the version parameter. Any other version value will not produce any property values as no updates are generated.

Source

pub async fn effective_role(&self) -> Result<Option<Vec<i32>>>

Access rights the current session has to this entity.

Required privileges: System.View

Source

pub async fn host(&self) -> Result<Option<Vec<ManagedObjectReference>>>

Hosts attached to this network.

§Returns:

Refers instances of HostSystem.

Source

pub async fn name(&self) -> Result<String>

Name of this entity, unique relative to its parent.

Any / (slash), \ (backslash), character used in this name element will be escaped. Similarly, any % (percent) character used in this name element will be escaped, unless it is used to start an escape sequence. A slash is escaped as %2F or %2f. A backslash is escaped as %5C or %5c, and a percent is escaped as %25.

Required privileges: System.View

Source

pub async fn overall_status(&self) -> Result<ManagedEntityStatusEnum>

General health of this managed entity.

The overall status of the managed entity is computed as the worst status among its alarms and the configuration issues detected on the entity. The status is reported as one of the following values:

  • red: The entity has alarms or configuration issues with a red status.
  • yellow: The entity does not have alarms or configuration issues with a red status, and has at least one with a yellow status.
  • green: The entity does not have alarms or configuration issues with a red or yellow status, and has at least one with a green status.
  • gray: All of the entity’s alarms have a gray status and the configuration status of the entity is not being monitored.

In releases after vSphere API 5.0, vSphere Servers might not generate property collector update notifications for this property. To obtain the latest value of the property, you can use PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx. If you use the PropertyCollector.WaitForUpdatesEx method, specify an empty string for the version parameter. Any other version value will not produce any property values as no updates are generated.

Source

pub async fn parent(&self) -> Result<Option<ManagedObjectReference>>

Parent of this entity.

This value is null for the root object and for VirtualMachine objects that are part of a VirtualApp.

Required privileges: System.View

§Returns:

Refers instance of ManagedEntity.

Source

pub async fn permission(&self) -> Result<Option<Vec<Permission>>>

List of permissions defined for this entity.

Source

pub async fn recent_task(&self) -> Result<Option<Vec<ManagedObjectReference>>>

The set of recent tasks operating on this managed entity.

This is a subset of TaskManager.recentTask belong to this entity. A task in this list could be in one of the four states: pending, running, success or error.

This property can be used to deduce intermediate power states for a virtual machine entity. For example, if the current powerState is “poweredOn” and there is a running task performing the “suspend” operation, then the virtual machine’s intermediate state might be described as “suspending.”

Most tasks (such as power operations) obtain exclusive access to the virtual machine, so it is unusual for this list to contain more than one running task. One exception, however, is the task of cloning a virtual machine. In releases after vSphere API 5.0, vSphere Servers might not generate property collector update notifications for this property. To obtain the latest value of the property, you can use PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx. If you use the PropertyCollector.WaitForUpdatesEx method, specify an empty string for the version parameter. Any other version value will not produce any property values as no updates are generated.

§Returns:

Refers instances of Task.

Source

pub async fn summary(&self) -> Result<Box<dyn NetworkSummaryTrait>>

Properties of a network.

Source

pub async fn tag(&self) -> Result<Option<Vec<Tag>>>

The set of tags associated with this managed entity.

Experimental. Subject to change.

Required privileges: System.View

Source

pub async fn triggered_alarm_state(&self) -> Result<Option<Vec<AlarmState>>>

A set of alarm states for alarms triggered by this entity or by its descendants.

Triggered alarms are propagated up the inventory hierarchy so that a user can readily tell when a descendant has triggered an alarm. In releases after vSphere API 5.0, vSphere Servers might not generate property collector update notifications for this property. To obtain the latest value of the property, you can use PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx. If you use the PropertyCollector.WaitForUpdatesEx method, specify an empty string for the version parameter. Any other version value will not produce any property values as no updates are generated.

Required privileges: System.View

Source

pub async fn value(&self) -> Result<Option<Vec<Box<dyn CustomFieldValueTrait>>>>

List of custom field values.

Each value uses a key to associate an instance of a CustomFieldStringValue with a custom field definition.

Required privileges: System.View

Source

pub async fn vm(&self) -> Result<Option<Vec<ManagedObjectReference>>>

Virtual machines using this network.

§Returns:

Refers instances of VirtualMachine.

Trait Implementations§

Source§

impl Clone for Network

Source§

fn clone(&self) -> Network

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any_ref<'a>(&'a self) -> &'a (dyn Any + 'static)

Cast a reference to Any trait.

Source§

fn as_any_box(self: Box<T>) -> Box<dyn Any>

Cast to a boxed reference to Any trait.

Source§

fn type_id(&self) -> TypeId

Get the underlying type identifier.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<To, T> CastInto<To> for T
where To: CastFrom<T> + ?Sized, T: 'static + ?Sized,

Source§

fn into_ref<'a>(&'a self) -> Option<&'a To>

Casts a reference to a trait object. If the cast fails, std::option::Option::None is returned.
Source§

fn into_box(self: Box<T>) -> Result<Box<To>, Box<dyn Any>>

Casts a boxed trait object to another trait object. If the cast fails, the original boxed trait object is returned in std::result::Result::Err.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,