Skip to main content

HostProfileManager

Struct HostProfileManager 

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

The HostProfileManager provides access to a list of HostProfiles and it defines methods to manipulate profiles and AnswerFiles.

Implementations§

Source§

impl HostProfileManager

Source

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

Source

pub async fn apply_entities_config_task( &self, apply_config_specs: Option<&[ApplyHostProfileConfigurationSpec]>, ) -> Result<ManagedObjectReference>

The task for applying host configuration on a list of hosts.

This is the batch version of applyHostConfiguration. The implementation of this method will: When a host is in a DRS cluster but doesn’t satisfy the state requirement such as that the host is not in the required maintenance mode, this method uses DRS feature to put the host into maintenance mode. This method will apply a host profile to a stateful host or stateless host; or apply a host profile to a stateless host by reboot. After a host is reboot, a check compliance is done to update the latest compliance status.

§Parameters:
§apply_config_specs

An array of ApplyHostProfileConfigurationSpec objects. Each applyConfigSpecs object contains the data objects required to remediate a host. The API caller should expand a cluster to all its hosts for the purpose of providing the required data object for configuration apply of each host.

§Returns:

This method returns a Task object with which to monitor the operation. If the task is successful, the Task.Task.info.TaskInfo.result property is an array of ApplyHostProfileConfigurationResult objects. Each ApplyHostProfileConfigurationResult is for each host in the provided host list.

Refers instance of Task.

Source

pub async fn apply_host_config_task( &self, host: &ManagedObjectReference, config_spec: &HostConfigSpec, user_input: Option<&[ProfileDeferredPolicyOptionParameter]>, ) -> Result<ManagedObjectReference>

Apply the configuration to the host.

If you specify any user input, the configuration will be saved in the AnswerFile associated with the host. If there is no answer file, the Profile Engine will create one.

§Parameters:
§host

Host to be updated. User must have sufficient credentials and privileges to satisfy the contents of the configSpec.

Refers instance of HostSystem.

§config_spec

Set of configuration changes to be applied to the host. The changes are returned by the HostProfile.HostProfile.ExecuteHostProfile method in the ProfileExecuteResult.ProfileExecuteResult.configSpec property.

§user_input

Additional host-specific data to be applied to the host. This data is the complete list of deferred parameters verified by the HostProfile.HostProfile.ExecuteHostProfile method, contained in the ProfileExecuteResult object returned by the method.

§Returns:

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

Refers instance of Task.

§Errors:

InvalidState: if the host is not in maintenance mode and the configuration specification requires it.

HostConfigFailed: if the ESX Server cannot apply the configuration changes.

Source

pub async fn check_answer_file_status_task( &self, host: &[ManagedObjectReference], ) -> Result<ManagedObjectReference>

Check the validity of the answer files for the specified hosts.

The Profile Engine uses the profile associated with a host to check the answer file.

Required privileges: System.View

§Parameters:
§host

Set of hosts for which the answer file status will be checked.

Refers instances of HostSystem.

§Returns:

This method returns a Task object with which to monitor the operation. If the task is successful, the Task.Task.info.TaskInfo.result property contains a list of AnswerFileStatusResult objects.

Refers instance of Task.

Source

pub async fn composite_host_profile_task( &self, source: &ManagedObjectReference, targets: Option<&[ManagedObjectReference]>, to_be_merged: Option<&HostApplyProfile>, to_be_replaced_with: Option<&HostApplyProfile>, to_be_deleted: Option<&HostApplyProfile>, enable_status_to_be_copied: Option<&HostApplyProfile>, ) -> Result<ManagedObjectReference>

Composes (merge, replace, delete, disable) the selected configurations into the target host profiles.

Required privileges: Profile.Edit

§Parameters:
§source

Refers instance of Profile.

§targets

Refers instances of Profile.

§to_be_merged
§to_be_replaced_with
§to_be_deleted
§enable_status_to_be_copied
§Returns:

This method will returns a Task object with which to monitor the operation. The Task.Task.info.TaskInfo.result will contain a HostProfileManagerCompositionResult object containing the status of the operation, and details about any composition errors. The definitions of all the parameters are same as those in HostProfileManager.ValidateHostProfileComposition_Task.

Refers instance of Task.

Source

pub async fn create_default_profile( &self, profile_type: &str, profile_type_name: Option<&str>, profile: Option<&ManagedObjectReference>, ) -> Result<Box<dyn ApplyProfileTrait>>

Create a default subprofile of a given type (for example, a VirtualSwitchProfile).

After you create the subprofile, you can add it to a configuration specification and update the host profile:

  • Call the CreateDefaultProfile method.
  • Create a HostProfileCompleteConfigSpec object.
  • Copy the existing profile from the host configuration information (HostProfile.Profile.config.HostProfileConfigInfo.applyProfile) to the configuration specification.
  • Add the new subprofile to the configuration specification. For example, if you create a VirtualSwitchProfile, you would add it to the list of virtual switches in the network profile for the configuration specification (NetworkProfile.NetworkProfile.vswitch[]).
  • Call HostProfile.HostProfile.UpdateHostProfile to save the new subprofile.

Required privileges: System.View

§Parameters:
§profile_type

Type of profile to create. The profile types are system-defined (ApplyProfile.ApplyProfile.profileTypeName).

§profile_type_name

If specified, the method returns a profile object containing data for the named profile. The type name does not have to be system-defined. A user-defined profile can include various dynamically-defined profiles.

§profile

Base profile used during the operation.

Refers instance of Profile.

§Returns:

Derived subprofile of type profileType.

Source

pub async fn create_profile( &self, create_spec: &dyn ProfileCreateSpecTrait, ) -> Result<ManagedObjectReference>

Create a profile from the specified CreateSpec.

Required privileges: Profile.Create

§Parameters:
§create_spec

Specification for the profile being created. Usually a derived class CreateSpec can be used to create the Profile.

§Returns:

Profile created from the specified createSpec.

Refers instance of Profile.

§Errors:

DuplicateName: If a profile with the specified name already exists.

InvalidProfileReferenceHost: if the specified reference host is incompatible or no reference host has been specified.

Source

pub async fn export_answer_file_task( &self, host: &ManagedObjectReference, ) -> Result<ManagedObjectReference>

Export a host’s answer file into a serialized form.

The method returns a string that contains only the list of user input options. See AnswerFile.AnswerFile.userInput.

Required privileges: Profile.Export

§Parameters:
§host

Host with which the answer file is associated.

Refers instance of HostSystem.

§Returns:

This method returns a Task object with which to monitor the operation. If the task is successful, the Task.Task.info.TaskInfo.result property is a string that contains a serialized form of the answer file.

Refers instance of Task.

Source

pub async fn find_associated_profile( &self, entity: &ManagedObjectReference, ) -> Result<Option<Vec<ManagedObjectReference>>>

Get the profile(s) to which this entity is associated.

The list of profiles will only include profiles known to this profileManager.

Required privileges: System.View

§Parameters:
§entity

Entity for which profile is being looked up.

Refers instance of ManagedEntity.

§Returns:

Refers instances of Profile.

Source

pub async fn generate_config_task_list( &self, config_spec: &HostConfigSpec, host: &ManagedObjectReference, ) -> Result<HostProfileManagerConfigTaskList>

Deprecated as of vSphere API 6.0 use HostProfileManager.GenerateHostProfileTaskList_Task.

Generate a list of configuration tasks that will be performed on the host during HostProfile application.

Required privileges: System.View

§Parameters:
§config_spec

ConfigSpec which was proposed by HostProfile.ExecuteHostProfile method.

§host

Host on which the HostProfile application needs to be carried out.

Refers instance of HostSystem.

§Returns:

List of Configuration tasks.

Source

pub async fn generate_host_config_task_spec_task( &self, hosts_info: Option<&[StructuredCustomizations]>, ) -> Result<ManagedObjectReference>

This method generates ApplyHostProfileConfigurationSpec data object for each host which can be passed as input to HostProfileManager.ApplyEntitiesConfig_Task to configure that host.

For each host, this method goes through two stages, HostProfile.ExecuteHostProfile stage HostProfileManager.GenerateHostProfileTaskList_Task stage. If the HostProfile.ExecuteHostProfile stage completes successfully then the method invokes the HostProfileManager.GenerateHostProfileTaskList_Task stage to generate the list of configuration tasks that are needed to configure the host. This method will return a task to monitor the progress of the operation.

Required privileges: System.View

§Parameters:
§hosts_info

List of host data for which configuration task list needs to be generated. The StructuredCustomizations.customizations value should be provided only if the host customization data for that host is invalid. If this property is not provided, the API will use the host customization data stored in VC and generate task list.

§Returns:

This method returns a Task object with which to monitor the operation. If the task is successful, the Task.Task.info.TaskInfo.result property is a ApplyHostProfileConfigurationSpec object.

Refers instance of Task.

Source

pub async fn generate_host_profile_task_list_task( &self, config_spec: &HostConfigSpec, host: &ManagedObjectReference, ) -> Result<ManagedObjectReference>

Generate a list of configuration tasks that will be performed on the host during HostProfile application.

This differs from the HostProfileManager.GenerateConfigTaskList method in that it returns a task to monitor the progress of the operation.

Required privileges: System.View

§Parameters:
§config_spec

ConfigSpec which was proposed by HostProfile.ExecuteHostProfile method.

§host

Host on which the HostProfile application needs to be carried out.

Refers instance of HostSystem.

§Returns:

This method returns a Task object with which to monitor the operation. If the task is successful, the Task.Task.info.TaskInfo.result property is a HostProfileManagerConfigTaskList object.

Refers instance of Task.

Source

pub async fn query_answer_file_status( &self, host: &[ManagedObjectReference], ) -> Result<Option<Vec<AnswerFileStatusResult>>>

Returns the status of the answer files associated with specified hosts.

This method returns the most recent status determined by HostProfileManager.CheckAnswerFileStatus_Task. See HostProfileManagerAnswerFileStatus_enum for valid values.

Required privileges: System.View

§Parameters:
§host

The hosts the answer file is associated with.

Refers instances of HostSystem.

§Returns:

List of answer file status objects.

Source

pub async fn query_policy_metadata( &self, policy_name: Option<&[String]>, profile: Option<&ManagedObjectReference>, ) -> Result<Option<Vec<ProfilePolicyMetadata>>>

Get the Metadata information for the policyNames.

PolicyNames are available with the defaultProfile obtained by invoking the method createDefaultProfile.

Required privileges: System.View

§Parameters:
§policy_name

Retrieve metadata for the specified policyNames. If policyName is not specified, metadata for all policies will be returned.

§profile

Base profile whose context needs to be used during the operation

Refers instance of Profile.

§Returns:

The metadata information for the policy.

Source

pub async fn query_host_profile_metadata( &self, profile_name: Option<&[String]>, profile: Option<&ManagedObjectReference>, ) -> Result<Option<Vec<ProfileMetadata>>>

Retrieve the metadata for a set of profiles.

Required privileges: System.View

§Parameters:
§profile_name

Names of the profiles for which metadata is requested. If not set, the method returns metadata for all the profiles.

§profile

Base profile whose context needs to be used during the operation

Refers instance of Profile.

§Returns:

List of profile metadata objects.

Source

pub async fn query_profile_structure( &self, profile: Option<&ManagedObjectReference>, ) -> Result<ProfileProfileStructure>

Get information about the structure of the profile.

Required privileges: System.View

§Parameters:
§profile

Base profile whose context needs to be used during the operation

Refers instance of Profile.

§Returns:

The profile structure.

Source

pub async fn retrieve_answer_file( &self, host: &ManagedObjectReference, ) -> Result<Option<AnswerFile>>

Returns the answer file associated with a particular host.

§Parameters:
§host

Host with which the answer file is associated.

Required privileges: Profile.Edit

Refers instance of HostSystem.

§Returns:

Answer file object will be returned if it exists.

Source

pub async fn retrieve_answer_file_for_profile( &self, host: &ManagedObjectReference, apply_profile: &HostApplyProfile, ) -> Result<Option<AnswerFile>>

Returns the answer file associated with a particular host, augmented with whatever answer file values are required for the supplied host profile.

§Parameters:
§host

Host with which the answer file is associated.

Required privileges: Profile.Edit

Refers instance of HostSystem.

§apply_profile

Profile configuration used to generate answer file

§Returns:

Answer file object will be returned.

Source

pub async fn retrieve_host_customizations( &self, hosts: Option<&[ManagedObjectReference]>, ) -> Result<Option<Vec<StructuredCustomizations>>>

This is the batch version of vim.profile.host.ProfileManager@retrieveAnswerFile.

Returns a map that contains the hosts and their answer file data objects.

§Parameters:
§hosts

Hosts with which the answer files are associated.

Required privileges: Profile.Edit

Refers instances of HostSystem.

§Returns:

A map that contains the hosts and their answer files.

Source

pub async fn retrieve_host_customizations_for_profile( &self, hosts: Option<&[ManagedObjectReference]>, apply_profile: &HostApplyProfile, ) -> Result<Option<Vec<StructuredCustomizations>>>

This is the batch version of vim.profile.host.ProfileManager@retrieveAnswerFileForProfile.

Returns a map that contains the hosts and their answer files associated with these hosts, augmented with whatever answer file values are required for the supplied host profile.

§Parameters:
§hosts

Hosts with which the answer files are associated.

Required privileges: Profile.Edit

Refers instances of HostSystem.

§apply_profile

Profile configuration used to generate answer file

§Returns:

A map contains the hosts and their answer files.

Source

pub async fn update_answer_file_task( &self, host: &ManagedObjectReference, config_spec: &dyn AnswerFileCreateSpecTrait, ) -> Result<ManagedObjectReference>

Update the AnswerFile for the specified host.

If there is no answer file associated with the host, the Profile Engine uses the answer file configuration specification to create a new one.

Required privileges: Profile.Edit

§Parameters:
§host

Host with which the answer file is associated.

Refers instance of HostSystem.

§config_spec

Host-specific configuration data. If the configuration specification does not contain any host-specific user input (configSpec.AnswerFileOptionsCreateSpec.userInput), the method does not perform any operation on the answer file.

§Returns:

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

Refers instance of Task.

§Errors:

AnswerFileUpdateFailed: If the answer file could not be updated.

InvalidArgument: If the input parameters are incorrect.

Source

pub async fn validate_host_profile_composition_task( &self, source: &ManagedObjectReference, targets: Option<&[ManagedObjectReference]>, to_be_merged: Option<&HostApplyProfile>, to_replace_with: Option<&HostApplyProfile>, to_be_deleted: Option<&HostApplyProfile>, enable_status_to_be_copied: Option<&HostApplyProfile>, error_only: Option<bool>, ) -> Result<ManagedObjectReference>

Validates the proposed host profile composition.

Required privileges: Profile.Edit

§Parameters:
§source

The source host profile of the configurations for composition.

Refers instance of Profile.

§targets

The array of target host profiles that the configurations composite into.

Refers instances of Profile.

§to_be_merged

A HostApplyProfile object contains the sub profiles that will be merged from the source to the target host profiles, and all the ancestors of these sub profiles. For singleton sub profile, it will be added into a target host profile if it doesn’t exist in the target; otherwise, it replaces the one in the target. The member variable ApplyProfile.toBeMerged of these sub profiles should have a value of true. The member variables ApplyProfile.toBeMerged ApplyProfile.toReplaceWith, ApplyProfile.toBeDeleted of the ancestors should have a value of false.

§to_replace_with

A HostApplyProfile object contains the sub profiles that will be used to replace the array in the target host profiles, and all the ancestors of these sub profiles. Similar to above except that the member variable ApplyProfile.toReplaceWith is turned on.

§to_be_deleted

A HostApplyProfile object contains the sub profiles that will be deleted from the source and the target host profiles, and all the ancestors of these sub profiles. Similar to above except that the member variable ApplyProfile.toBeDeleted is turned on.

§enable_status_to_be_copied

A HostApplyProfile object contains the sub profiles that the member variable ApplyProfile.enabled will be copied from the source host profile to all the target host profiles, and all the ancestors of these sub profiles. The member variable ApplyProfile.copyEnableStatus of these sub profiles is turned on. The member variable ApplyProfile.copyEnableStatus of the ApplyProfile.copyEnableStatus of the ancestors should have a value of false.

§error_only

Indicates that the validation result for each target don’t contain the source-target difference.

§Returns:

This method will returns a Task object with which to monitor the operation. The Task.Task.info.TaskInfo.result will contain a HostProfileManagerCompositionValidationResult object containing the status of the operation, any validation errors and the validation results.

Refers instance of Task.

Source

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

A list of profiles known to this ProfileManager.

Required privileges: Profile.View

§Returns:

Refers instances of Profile.

Trait Implementations§

Source§

impl Clone for HostProfileManager

Source§

fn clone(&self) -> HostProfileManager

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,