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
impl HostProfileManager
pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self
Sourcepub async fn apply_entities_config_task(
&self,
apply_config_specs: Option<&[ApplyHostProfileConfigurationSpec]>,
) -> Result<ManagedObjectReference>
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.
Sourcepub async fn apply_host_config_task(
&self,
host: &ManagedObjectReference,
config_spec: &HostConfigSpec,
user_input: Option<&[ProfileDeferredPolicyOptionParameter]>,
) -> Result<ManagedObjectReference>
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.
Sourcepub async fn check_answer_file_status_task(
&self,
host: &[ManagedObjectReference],
) -> Result<ManagedObjectReference>
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.
Sourcepub 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>
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.
Sourcepub async fn create_default_profile(
&self,
profile_type: &str,
profile_type_name: Option<&str>,
profile: Option<&ManagedObjectReference>,
) -> Result<Box<dyn ApplyProfileTrait>>
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
CreateDefaultProfilemethod. - 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.
Sourcepub async fn create_profile(
&self,
create_spec: &dyn ProfileCreateSpecTrait,
) -> Result<ManagedObjectReference>
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.
Sourcepub async fn export_answer_file_task(
&self,
host: &ManagedObjectReference,
) -> Result<ManagedObjectReference>
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.
Sourcepub async fn find_associated_profile(
&self,
entity: &ManagedObjectReference,
) -> Result<Option<Vec<ManagedObjectReference>>>
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.
Sourcepub async fn generate_config_task_list(
&self,
config_spec: &HostConfigSpec,
host: &ManagedObjectReference,
) -> Result<HostProfileManagerConfigTaskList>
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.
Sourcepub async fn generate_host_config_task_spec_task(
&self,
hosts_info: Option<&[StructuredCustomizations]>,
) -> Result<ManagedObjectReference>
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.
Sourcepub async fn generate_host_profile_task_list_task(
&self,
config_spec: &HostConfigSpec,
host: &ManagedObjectReference,
) -> Result<ManagedObjectReference>
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.
Sourcepub async fn query_answer_file_status(
&self,
host: &[ManagedObjectReference],
) -> Result<Option<Vec<AnswerFileStatusResult>>>
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.
Sourcepub async fn query_policy_metadata(
&self,
policy_name: Option<&[String]>,
profile: Option<&ManagedObjectReference>,
) -> Result<Option<Vec<ProfilePolicyMetadata>>>
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.
Sourcepub async fn query_host_profile_metadata(
&self,
profile_name: Option<&[String]>,
profile: Option<&ManagedObjectReference>,
) -> Result<Option<Vec<ProfileMetadata>>>
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.
Sourcepub async fn query_profile_structure(
&self,
profile: Option<&ManagedObjectReference>,
) -> Result<ProfileProfileStructure>
pub async fn query_profile_structure( &self, profile: Option<&ManagedObjectReference>, ) -> Result<ProfileProfileStructure>
Sourcepub async fn retrieve_answer_file(
&self,
host: &ManagedObjectReference,
) -> Result<Option<AnswerFile>>
pub async fn retrieve_answer_file( &self, host: &ManagedObjectReference, ) -> Result<Option<AnswerFile>>
Sourcepub async fn retrieve_answer_file_for_profile(
&self,
host: &ManagedObjectReference,
apply_profile: &HostApplyProfile,
) -> Result<Option<AnswerFile>>
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.
Sourcepub async fn retrieve_host_customizations(
&self,
hosts: Option<&[ManagedObjectReference]>,
) -> Result<Option<Vec<StructuredCustomizations>>>
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.
Sourcepub async fn retrieve_host_customizations_for_profile(
&self,
hosts: Option<&[ManagedObjectReference]>,
apply_profile: &HostApplyProfile,
) -> Result<Option<Vec<StructuredCustomizations>>>
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.
Sourcepub async fn update_answer_file_task(
&self,
host: &ManagedObjectReference,
config_spec: &dyn AnswerFileCreateSpecTrait,
) -> Result<ManagedObjectReference>
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.
Sourcepub 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>
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.
Trait Implementations§
Source§impl Clone for HostProfileManager
impl Clone for HostProfileManager
Source§fn clone(&self) -> HostProfileManager
fn clone(&self) -> HostProfileManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more