com.vmware.vcenter.vm.guest package

Submodules

com.vmware.vcenter.vm.guest.filesystem_client module

The com.vmware.vcenter.vm.guest.filesystem_client module provides classes for dealing with the filesystem of the guest operating system.

class com.vmware.vcenter.vm.guest.filesystem_client.Directories(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Directories class provides methods to manage directories in the guest filesystem. This class was added in vSphere API 7.0.2.0.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

create(vm, credentials, path, create_parents=None)

Creates a directory in the guest operating system.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the directory to be created.

  • create_parents (bool or None) – Whether any parent directories should be created. If any failure occurs, some parent directories could be left behind. If None parent directories are not created.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if path already exists.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path does not exist and create_parents is not set. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be created because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

create_temporary(vm, credentials, prefix, suffix, parent_path=None)

Creates a temporary directory.

Creates a new unique temporary directory for the user to use as needed. The guest operating system may clean up the directory after a guest specific amount of time if parent_path is not set, or the user can remove the directory when no longer needed.

The new directory name will be created in a guest-specific format using prefix, a guest generated string and suffix in parent_path.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • prefix (str) – The prefix to be given to the new temporary directory.

  • suffix (str) – The suffix to be given to the new temporary directory.

  • parent_path (str or None) – The complete path to the directory in which to create the new directory. Directory If None a guest-specific default will be used.

Return type

str

Returns

The absolute path of the temporary directory that is created.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if parent_path is not a directory. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if parent_path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if parent_path is set and does not exist. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if parent_path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if a file cannot be created because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

delete(vm, credentials, path, recursive=None)

Deletes a directory in the guest operating system.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the directory to be deleted.

  • recursive (bool or None) – If true, all files and subdirectories are also deleted. If false, the directory must be empty for the operation to succeed. If None, any directory content is not deleted.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is not a directory. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ResourceInUse if path has content and recursive is None.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be deleted because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

move(vm, credentials, path, new_path)

Renames a directory in the guest.

Renames the directory, or copies and deletes the old contents as required by the underlying filsystem.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the directory to be moved.

  • new_path (str) – The complete path to where the directory is moved or its new name. It cannot be a path to an existing directory or an existing file.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if new_path already exists.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is not a directory. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if new_path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotFound if the parent directory of new_path does not exist. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if a path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if a path cannot be renamed or moved because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

class com.vmware.vcenter.vm.guest.filesystem_client.ErrorReason(string)

Bases: vmware.vapi.bindings.enum.Enum

The ErrorReason class defines the reasons a file or directory operation failed. This enumeration was added in vSphere API 7.0.2.0.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the ErrorReason instance.

DIRECTORY_NOT_EMPTY = ErrorReason(string='DIRECTORY_NOT_EMPTY')

Directory not empty. This class attribute was added in vSphere API 7.0.2.0.

FILE_NOT_FOUND = ErrorReason(string='FILE_NOT_FOUND')

The file is not found. This class attribute was added in vSphere API 7.0.2.0.

FILE_TOO_LARGE = ErrorReason(string='FILE_TOO_LARGE')

The file is too large. This class attribute was added in vSphere API 7.0.2.0.

NOT_A_DIRECTORY = ErrorReason(string='NOT_A_DIRECTORY')

The argument is not a directory. This class attribute was added in vSphere API 7.0.2.0.

NOT_A_FILE = ErrorReason(string='NOT_A_FILE')

An argument is not a file. This class attribute was added in vSphere API 7.0.2.0.

NO_DISK_SPACE = ErrorReason(string='NO_DISK_SPACE')

There is insufficent disk space. This class attribute was added in vSphere API 7.0.2.0.

PATH_TOO_LONG = ErrorReason(string='PATH_TOO_LONG')

The file path is too long. This class attribute was added in vSphere API 7.0.2.0.

class com.vmware.vcenter.vm.guest.filesystem_client.FileErrorDetails(reason=None, file_path=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The FileErrorDetails class describes additional error information for file and directory operations. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • reason (ErrorReason) – The reason for the error. This attribute was added in vSphere API 7.0.2.0.

  • file_path (str) – The file path associated with the error. This attribute was added in vSphere API 7.0.2.0.

class com.vmware.vcenter.vm.guest.filesystem_client.Files(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Files class provides methods to manage the files in the guest filesystem. This class was added in vSphere API 7.0.2.0.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class FileAttributesInfo(last_modified=None, last_accessed=None, symlink_target=None, filesystem_family=None, win_attributes=None, posix_attributes=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.FileAttributesInfo class describes the attributes of a file in a guest operating system. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • last_modified (datetime.datetime) – The date and time the file was last modified. This attribute was added in vSphere API 7.0.2.0.

  • last_accessed (datetime.datetime) – The date and time the file was last accessed. This attribute was added in vSphere API 7.0.2.0.

  • symlink_target (str or None) – The target for the file if it’s a symbolic link. This is currently only set for Posix guest operating systems, but may be supported in the future on Windows guest operating systems that support symbolic links. This attribute was added in vSphere API 7.0.2.0. Set if the file is a symbolic link.

  • filesystem_family (Files.FilesystemFamily) – The type of guest filesystem. This attribute was added in vSphere API 7.0.2.0.

  • win_attributes (Files.WindowsFileAttributesInfo) – Windows-specific file information. This attribute was added in vSphere API 7.0.2.0. This attribute is optional and it is only relevant when the value of filesystemFamily is Files.FilesystemFamily.WINDOWS.

  • posix_attributes (Files.PosixFileAttributesInfo) – Posix-specific file information. This attribute was added in vSphere API 7.0.2.0. This attribute is optional and it is only relevant when the value of filesystemFamily is Files.FilesystemFamily.POSIX.

class FileAttributesUpdateSpec(last_modified=None, last_accessed=None, windows=None, posix=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

File attributes used for updating an existing file with Files.update(). This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • last_modified (datetime.datetime or None) – The date and time the file was last modified. This attribute was added in vSphere API 7.0.2.0. If None the value will not be changed.

  • last_accessed (datetime.datetime or None) – The date and time the file was last accessed. This attribute was added in vSphere API 7.0.2.0. If None the value will not be changed.

  • windows (Files.WindowsFileAttributesUpdateSpec or None) – Windows-specific file update information. This attribute was added in vSphere API 7.0.2.0. Set if the guest operating system is Windows.

  • posix (Files.PosixFileAttributesUpdateSpec or None) – Posix-specific file update information. This attribute was added in vSphere API 7.0.2.0. Set if the guest operating system is Posix.

class FilesystemFamily(string)

Bases: vmware.vapi.bindings.enum.Enum

The Files.FilesystemFamily class defines the types of guest operating fllesystem. This enumeration was added in vSphere API 7.0.2.0.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the FilesystemFamily instance.

POSIX = FilesystemFamily(string='POSIX')

Linux, Solaris, etc. This class attribute was added in vSphere API 7.0.2.0.

WINDOWS = FilesystemFamily(string='WINDOWS')

The guest OS is a Windows variant. This class attribute was added in vSphere API 7.0.2.0.

class FilterSpec(match_pattern=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.FilterSpec class contains information used to filter the results when listing files (see Files.list()). This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters

match_pattern (str or None) – The perl-compatible regular expression used to filter the returned files. This attribute was added in vSphere API 7.0.2.0. If None the pattern ‘.*’ (match everything) is used.

class Info(type=None, size=None, attributes=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.Info class describes a file or directory in the guest operating system. Returned by Files.get(). This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • type (Files.Type) – The type of file. This attribute was added in vSphere API 7.0.2.0.

  • size (long) – The file size in bytes. This attribute was added in vSphere API 7.0.2.0.

  • attributes (Files.FileAttributesInfo) – Attributes of a file. This attribute was added in vSphere API 7.0.2.0.

class IterationSpec(size=None, index=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.IterationSpec class contains attributes used to break results into pages when listing files. See Files.list()). This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • size (long or None) – Specifies the maximum number of results to return. This attribute was added in vSphere API 7.0.2.0. If None information about at most 50 files will be returned.

  • index (long or None) – Which result to start the list with. If this value exceeds the number of results, an empty list will be returned. This attribute was added in vSphere API 7.0.2.0. If None, the start of the list of files will be returned.

class LastIterationStatus(string)

Bases: vmware.vapi.bindings.enum.Enum

The last status for the iterator. A field of this type is returned as part of the result and indicates to the caller of the API whether it can continue to make requests for more data. The last status only reports on the state of the iteration at the time data was last returned. As a result, it not does guarantee if the next call will succeed in getting more data or not. Failures to retrieve results will be returned as Error responses. These last statuses are only returned when the iterator is operating as expected. This enumeration was added in vSphere API 7.0.2.0.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the LastIterationStatus instance.

END_OF_DATA = LastIterationStatus(string='END_OF_DATA')

Iterator has finished iterating through its inventory. There are currently no more entities to return and the caller can terminate iteration. If the iterator returned some data, the marker may be set to allow the iterator to continue from where it left off when additional data does become available. This value is used to indicate that all available data has been returned by the iterator. This class attribute was added in vSphere API 7.0.2.0.

READY = LastIterationStatus(string='READY')

Iterator has more data pending and is ready to provide it. The caller can request the next page of data at any time. The number of results returned may be less than the requested size. In other words, the iterator may not fill the page. The iterator has returned at least 1 result. This class attribute was added in vSphere API 7.0.2.0.

class ListResult(files=None, total=None, start_index=None, end_index=None, status=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.ListResult class describes the results of a Files.list() method. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • files (list of Files.Summary) – A list of Files.Summary classes containing information for all the matching files. This attribute was added in vSphere API 7.0.2.0.

  • total (long) – The total number of results from the Files.list(). This is a hint to the user of the iterator regarding how many items are available to be retrieved. The total could change if the inventory of items are being changed. This attribute was added in vSphere API 7.0.2.0.

  • start_index (long or None) – Positional index into the logical item list of the first item returned in the list of results. The first item in the logical item list has an index of 0. This is a hint to the user of the iterator regarding the logical position in the iteration. For example, this can be used to display to the user which page of the iteration is being shown. The total could change if the inventory of items are being changed. This attribute was added in vSphere API 7.0.2.0. If None no items were returned.

  • end_index (long or None) – Positional index into the logical item list of the last item returned in the list of results. The first item in the logical item list has an index of 0. This is a hint to the user of the iterator regarding the logical position in the iteration. For example, this can be used to display to the user which page of the iteration is being shown. The total could change if the inventory of items are being changed. This attribute was added in vSphere API 7.0.2.0. If None no items were returned.

  • status (Files.LastIterationStatus) – The last status for the iterator that indicates whether any more results can be expected if the caller continues to make requests for more data using the iterator. This attribute was added in vSphere API 7.0.2.0.

class PosixFileAttributesInfo(owner=None, group=None, permissions=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.PosixFileAttributesInfo class describes information about file attributes specific to Posix Guest operating systems. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • owner (long) – The owner ID. This attribute was added in vSphere API 7.0.2.0.

  • group (long) – The group ID. This attribute was added in vSphere API 7.0.2.0.

  • permissions (str) – The file permissions in chmod(2) format. This attribute is presented as octal. This attribute was added in vSphere API 7.0.2.0.

class PosixFileAttributesUpdateSpec(owner_id=None, group_id=None, permissions=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.PosixFileAttributesUpdateSpec class describes attributes that can be changed for a Posix file. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • owner_id (long or None) – The owner ID. This attribute was added in vSphere API 7.0.2.0. If None the value will not be changed.

  • group_id (long or None) – The group ID. This attribute was added in vSphere API 7.0.2.0. If None the value will not be changed.

  • permissions (str or None) – The file permissions in chmod(2) format. This attribute is interpreted as octal. This attribute was added in vSphere API 7.0.2.0. If None the value will not be changed.

class Summary(filename=None, type=None, size=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.Summary class describes a file or directory in the guest operating system returned by a Files.list() method. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • filename (str) – The name of the file or directory with any leading directories removed. This attribute was added in vSphere API 7.0.2.0.

  • type (Files.Type) – The type of file. This attribute was added in vSphere API 7.0.2.0.

  • size (long) – The file size in bytes. This attribute was added in vSphere API 7.0.2.0.

class Type(string)

Bases: vmware.vapi.bindings.enum.Enum

The Files.Type class defines the valid types of files. This enumeration was added in vSphere API 7.0.2.0.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the Type instance.

DIRECTORY = Type(string='DIRECTORY')

directory. This class attribute was added in vSphere API 7.0.2.0.

FILE = Type(string='FILE')

normal file. This class attribute was added in vSphere API 7.0.2.0.

symbolic link. This class attribute was added in vSphere API 7.0.2.0.

class WindowsFileAttributesInfo(hidden=None, read_only=None, created=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The {\@name WindowsFileAttributesInfo) class describes file attributes specific to Windows Guest operating systems. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • hidden (bool) – The file is hidden. This attribute was added in vSphere API 7.0.2.0.

  • read_only (bool) – The file is read-only. This attribute was added in vSphere API 7.0.2.0.

  • created (datetime.datetime) – The date and time the file was created. This attribute was added in vSphere API 7.0.2.0.

class WindowsFileAttributesUpdateSpec(hidden=None, read_only=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Files.WindowsFileAttributesUpdateSpec class describes attributes that can be changed for a Windows file. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • hidden (bool or None) – The file is hidden. This attribute was added in vSphere API 7.0.2.0. If {term unset} the value will not be changed.

  • read_only (bool or None) – The file is read-only. This attribute was added in vSphere API 7.0.2.0. If {term unset} the value will not be changed.

create_temporary(vm, credentials, prefix, suffix, parent_path=None)

Creates a temporary file.

Creates a new unique temporary file for the user to use as needed. The user is responsible for removing it when it is no longer needed.

The new file name will be created in a guest-specific format using prefix, a guest generated string and suffix in parent_path.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • prefix (str) – The prefix to be given to the new temporary file.

  • suffix (str) – The suffix to be given to the new temporary file.

  • parent_path (str or None) – The complete path to the directory in which to create the file. Directory to use if specified, otherwise a guest-specific default will be used.

Return type

str

Returns

The absolute path of the temporary file that is created.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if parent_path is set and is not a directory. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if parent_path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if parent_path is set and does not exist. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if parent_path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if a file cannot be created because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

delete(vm, credentials, path)

Deletes a file in the guest operating system

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the file or symbolic link to be deleted.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is not a file. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be deleted because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

get(vm, credentials, path)

Returns information about a file or directory in the guest.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the file.

Return type

Files.Info

Returns

Files.Info object containing information for the file.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be listed because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Query.

list(vm, credentials, path, iteration=None, filter=None)

Returns information about files and directories in the guest.

Files are returned in operating system-specific (inode) order. If the directory is modified between queries, missing or duplicate results can occur.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the directory or file to query.

  • iteration (Files.IterationSpec or None) – The specification of a page of results to be retrieved. If None, the first page will be retrieved.

  • filter (Files.FilterSpec or None) – Specification to match files for which information should be returned. If None, the behavior is the equivalent to a Files.FilterSpec with all attributes None which means all filenames match the filter.

Return type

Files.ListResult

Returns

A Files.ListResult object containing information for all the matching files in filter and the total number of files that can be returned.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument If {\@param.iteration} contains invalid data.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument If filter contains an invalid regular expression.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be listed because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Query.

move(vm, credentials, path, new_path, overwrite=None)

Renames a file in the guest.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the original file or symbolic link to be moved.

  • new_path (str) – The complete path to the new file. It cannot be a path to an existing directory.

  • overwrite (bool or None) – If true, the destination file is overwritten. If None, the destination file is not overwritten.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if the new_path already exists and overwrite is false.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is not a file. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if new_path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path does not exist. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotFound if the parent directory of new_path does not exist. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if a path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if a path cannot be renamed because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

update(vm, credentials, path, file_attributes)

Changes the file attributes of a specified file or directory inside the guest.

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication data.

  • path (str) – The complete path to the file or directory to be changed in the guest. If the file points to an symbolic link, then the attributes of the target file are changed.

  • file_attributes (Files.FileAttributesUpdateSpec) – Specifies the different file attributes of the guest file to be changed. See Files.FileAttributesUpdateSpec.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if file_attributes does not apply to the guest operating system.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is not a file. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if path is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if path is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if path cannot be updated because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

class com.vmware.vcenter.vm.guest.filesystem_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance

class com.vmware.vcenter.vm.guest.filesystem_client.Transfers(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Transfers class provides methods to copy files into and out of the guest file system. This class was added in vSphere API 7.0.2.0.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class CreateSpec(path=None, attributes=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Transfers.CreateSpec class describes the details of a file transfer operation. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • path (str) – The complete destination path in the guest to transfer the file to or from the client. It cannot be a path to a directory or a symbolic link. This attribute was added in vSphere API 7.0.2.0.

  • attributes (Transfers.FileCreationAttributes or None) – Details about the file to be transferred into the guest. This attribute was added in vSphere API 7.0.2.0. Must be set if the file is being transferred to the guest. Must not be set if the file is being transferred from the guest.

class FileCreationAttributes(size=None, overwrite=None, last_modified=None, last_accessed=None, windows=None, posix=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Transfers.FileCreationAttributes class describes file attributes used when transferring a file into the guest. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • size (long) – The size in bytes of the file to be transferred into the guest. This attribute was added in vSphere API 7.0.2.0.

  • overwrite (bool or None) – Whether an existing file should be overwritten. This attribute was added in vSphere API 7.0.2.0. If None any existing file will not be overwritten.

  • last_modified (datetime.datetime or None) – The date and time the file was last modified. This attribute was added in vSphere API 7.0.2.0. If None the value will be the time when the file is transferred into the guest.

  • last_accessed (datetime.datetime or None) – The date and time the file was last accessed. This attribute was added in vSphere API 7.0.2.0. If None the value will be the time when the file is transferred into the guest.

  • windows (Transfers.WindowsFileAttributesCreateSpec or None) – Windows-specific file creation information. This attribute was added in vSphere API 7.0.2.0. If None, the behavior is equivalent to a Transfers.WindowsFileAttributesCreateSpec with all attributes None which means the defaults are used. May only be set if the guest operating system is Windows.

  • posix (Transfers.PosixFileAttributesCreateSpec or None) – Posix-specific file creation information. This attribute was added in vSphere API 7.0.2.0. If None, the behavior is equivalent to a Transfers.PosixFileAttributesCreateSpec with all attributes None which means the defaults are used. May only be set if the guest operating system is Posix.

class PosixFileAttributesCreateSpec(owner_id=None, group_id=None, permissions=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Transfers.PosixFileAttributesCreateSpec class describes creation information about file attributes specific to Posix guest operating systems. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • owner_id (long or None) – The owner ID. If this property is not specified when passing a Transfers.PosixFileAttributesCreateSpec object to Transfers.create(), the default value will be the owner Id of the user who invoked the file transfer operation. This attribute was added in vSphere API 7.0.2.0. Defaults to uid of user invoking the operation.

  • group_id (long or None) – The group ID. If this property is not specified when passing a Transfers.PosixFileAttributesCreateSpec object to Transfers.create(), the default value will be the group Id of the user who invoked the file transfer operation. This attribute was added in vSphere API 7.0.2.0. Defaults to gid of user invoking the operation.

  • permissions (str or None) – The file permissions in chmod(2) format. If this property is not specified when passing a Transfers.PosixFileAttributesCreateSpec object to Transfers.create(), the file will be created with 0644 permissions. This attribute is interpreted as octal. This attribute was added in vSphere API 7.0.2.0. Defaults to 0644.

class WindowsFileAttributesCreateSpec(hidden=None, read_only=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Transfers.WindowsFileAttributesCreateSpec class describes creation information about file attributes specific to Windows guest operating systems. This class was added in vSphere API 7.0.2.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • hidden (bool or None) – The file is hidden. This attribute was added in vSphere API 7.0.2.0. If None the file will not be hidden.

  • read_only (bool or None) – The file is read-only. This attribute was added in vSphere API 7.0.2.0. If None the file will be writeable.

create(vm, credentials, spec)

Initiates an operation to transfer a file to or from the guest.

If the power state of the Virtual Machine is changed when the file transfer is in progress, or the Virtual Machine is migrated, then the transfer operation is aborted.

When transferring a file into the guest and overwriting an existing file, the old file attributes are not preserved.

In order to ensure a secure connection to the host when transferring a file using HTTPS, the X.509 certificate for the host must be used to authenticate the remote end of the connection. The certificate of the host that the virtual machine is running on can be retrieved using the following fields: XXX insert link to certificate in Host config XXX

. This method was added in vSphere API 7.0.2.0.

Parameters
  • vm (str) – Virtual Machine to perform the operation on. The parameter must be an identifier for the resource type: VirtualMachine.

  • credentials (com.vmware.vcenter.vm.guest_client.Credentials) – The guest authentication credentials.

  • spec (Transfers.CreateSpec) – A specification of the type of file transfer and any applicable attibutes.

Return type

str

Returns

The URL to which the user has to send an HTTP request. The URL will become invalid once a successful request is sent. If the file is being transferred from the guest, an HTTP GET should be used. If the file is being transferred to the guest, HTTP PUT should be used. The URL is valid only for 10 minutes from the time it is generated. The URL becomes invalid whenever the virtual machine is powered off, suspended, unregistered or migrated to a new host. The host part of the URL is returned as * if the hostname to be used is the name of the server to which the call was made. For example, if the call is made to esx-svr-1.domain1.com, and the file is available for download from https://esx-svr-1.domain1.com/guestFile?id=1&token=1234, the URL returned may be {\@literal aHR0cHM6Ly8mIzQyOy9ndWVzdEZpbGU/aWQ9MSZ0b2tlbj0xMjM0}. The client replaces the asterisk with the server name on which it invoked the call.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if Transfers.CreateSpec.path in spec exists and Transfers.FileCreationAttributes.overwrite is false when transferring a file to the guest.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if Transfers.CreateSpec.path in spec is not a file. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if Transfers.CreateSpec.path in spec is too long. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the virtual machine is not running.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.NotFound if Transfers.CreateSpec.path in spec is not found. The value of com.vmware.vapi.std.errors_client.Error.data will contain all the attributes defined in the FileErrorDetails providing additional information about the failure.

Raise

com.vmware.vapi.std.errors_client.ResourceBusy if the virtual machine is busy.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if the VMware Tools is not running.

Raise

com.vmware.vapi.std.errors_client.UnableToAllocateResource if is insuffcient space for the new file when transferring a file to the guest.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the credentials object was not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if Transfers.CreateSpec.path in spec cannot be accessed.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if Transfers.CreateSpec.path in spec cannot be copied because the guest authentication will not allow the operation.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is not supported by the VMware Tools in the guest OS.

Raise

com.vmware.vapi.std.errors_client.Unsupported if the operation is disabled by the VMware Tools in the guest OS.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource VirtualMachine referenced by the parameter vm requires VirtualMachine.GuestOperations.Modify.

com.vmware.vcenter.vm.guest.networking_client module

The com.vmware.vcenter.vm.guest.networking_client module provides classes for dealing with the guest operating system networking.

class com.vmware.vcenter.vm.guest.networking_client.Interfaces(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Interfaces class provides methods for retrieving guest operating system network interface information. This class was added in vSphere API 7.0.0.0.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class Info(dns_values=None, mac_address=None, dns=None, ip=None, wins_servers=None, nic=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Interfaces.Info class describes a virtual network adapter configured in the guest operating system. This class was added in vSphere API 7.0.0.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • dns_values (com.vmware.vcenter.vm.guest_client.DnsAssignedValues or None) – Client DNS values. Data assigned by DNS. This attribute was added in vSphere API 7.0.0.0. If None no DNS assigned value exists.

  • mac_address (str or None) – MAC address of the adapter. This attribute was added in vSphere API 7.0.0.0. If None then not supported by the Guest OS.

  • dns (com.vmware.vcenter.vm.guest_client.DnsConfigInfo or None) – DNS configuration of the adapter. See com.vmware.vcenter.vm.guest_client.Networking.Info.dns for system wide settings. This attribute was added in vSphere API 7.0.0.0. If None then not assigned by the Guest OS.

  • ip (Interfaces.IpConfigInfo or None) – IP configuration settings of the adapter. This attribute was added in vSphere API 7.0.0.0. If None then not supported by the Guest OS.

  • wins_servers (list of str or None) – The IP addresses of any WINS name servers for the adapter. This attribute was added in vSphere API 7.0.0.0. If None then not supported by the Guest OS.

  • nic (str or None) – Link to the corresponding virtual device. This attribute was added in vSphere API 7.0.0.0. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Ethernet. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Ethernet. If None then the interface is not backed by a virtual device.

class IpAddressInfo(ip_address=None, prefix_length=None, origin=None, state=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Interfaces.IpAddressInfo class describes a specific IP Address. This class was added in vSphere API 7.0.0.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • ip_address (str) – IPv4 address is specified using dotted decimal notation. For example, “192.0.2.1”. IPv6 addresses are 128-bit addresses specified using eight fields of up to four hexadecimal digits. A colon separates each field (:). For example, 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of the symbol ‘::’ to represent multiple 16-bit groups of contiguous 0’s only once in an address as described in RFC 2373. This attribute was added in vSphere API 7.0.0.0.

  • prefix_length (long) – Denotes the length of a generic Internet network address prefix. Prefix length: the valid range of values is 0-32 for IPv4, and 0-128 for IPv6. A value of n corresponds to an IP address mask that has n contiguous 1-bits from the most significant bit (MSB), with all other bits set to 0. A value of zero is valid only if the calling context defines it. This attribute was added in vSphere API 7.0.0.0.

  • origin (Interfaces.IpAddressOrigin or None) – How this address was configured. This attribute was added in vSphere API 7.0.0.0. If None the data was not available.

  • state (Interfaces.IpAddressStatus) – The state of this ipAddress. This attribute was added in vSphere API 7.0.0.0.

class IpAddressOrigin(string)

Bases: vmware.vapi.bindings.enum.Enum

The Interfaces.IpAddressOrigin class specifies how an IP address was obtained for an interface. See RFC 4293 IpAddressOriginTC. This enumeration was added in vSphere API 7.0.0.0.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the IpAddressOrigin instance.

DHCP = IpAddressOrigin(string='DHCP')

The address is configured through dhcp. This class attribute was added in vSphere API 7.0.0.0.

LINKLAYER = IpAddressOrigin(string='LINKLAYER')

The address is obtained through stateless autoconfiguration (autoconf). See RFC 4862, IPv6 Stateless Address Autoconfiguration. This class attribute was added in vSphere API 7.0.0.0.

MANUAL = IpAddressOrigin(string='MANUAL')

The address is configured manually. This class attribute was added in vSphere API 7.0.0.0.

OTHER = IpAddressOrigin(string='OTHER')

Any other type of address configuration other than the below mentioned ones will fall under this category. For e.g., automatic address configuration for the link local address falls under this type. This class attribute was added in vSphere API 7.0.0.0.

RANDOM = IpAddressOrigin(string='RANDOM')

The address is chosen by the system at random e.g., an IPv4 address within 169.254/16, or an RFC 3041 privacy address. This class attribute was added in vSphere API 7.0.0.0.

class IpAddressStatus(string)

Bases: vmware.vapi.bindings.enum.Enum

The Interfaces.IpAddressStatus class defines the present status of an address on an interface. See RFC 4293 IpAddressStatusTC. This enumeration was added in vSphere API 7.0.0.0.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the IpAddressStatus instance.

DEPRECATED = IpAddressStatus(string='DEPRECATED')

Indicates that this is a valid but deprecated address that should no longer be used as a source address. This class attribute was added in vSphere API 7.0.0.0.

DUPLICATE = IpAddressStatus(string='DUPLICATE')

Indicates the address has been determined to be non-unique on the link, this address will not be reachable. This class attribute was added in vSphere API 7.0.0.0.

INACCESSIBLE = IpAddressStatus(string='INACCESSIBLE')

Indicates that the address is not accessible because interface is not operational. This class attribute was added in vSphere API 7.0.0.0.

INVALID = IpAddressStatus(string='INVALID')

Indicates that this isn’t a valid address. This class attribute was added in vSphere API 7.0.0.0.

PREFERRED = IpAddressStatus(string='PREFERRED')

Indicates that this is a valid address. This class attribute was added in vSphere API 7.0.0.0.

TENTATIVE = IpAddressStatus(string='TENTATIVE')

Indicates that the uniqueness of the address on the link is presently being verified. This class attribute was added in vSphere API 7.0.0.0.

UNKNOWN = IpAddressStatus(string='UNKNOWN')

Indicates that the status cannot be determined. This class attribute was added in vSphere API 7.0.0.0.

class IpConfigInfo(ip_addresses=None, dhcp=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Interfaces.IpConfigInfo class describes the protocol version independent address reporting data object for network interfaces. This class was added in vSphere API 7.0.0.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
list(vm)

Returns information about the networking interfaces in the guest operating system. This method was added in vSphere API 7.0.0.0.

Parameters

vm (str) – Virtual machine ID The parameter must be an identifier for the resource type: VirtualMachine.

Return type

list of Interfaces.Info

Returns

Information about the interfaces configured in the guest operating system. Interfaces are ordered in a guest operating system specific determined order.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if VMware Tools is not running.

class com.vmware.vcenter.vm.guest.networking_client.Routes(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Routes class provides methods for retrieving guest operating system network routing information. This class was added in vSphere API 7.0.0.0.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class Info(network=None, prefix_length=None, gateway_address=None, interface_index=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Routes.Info class describes an individual host, network or default destination network reachable through a gateway. This class was added in vSphere API 7.0.0.0.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • network (str) – IP Address of the destination IP network. IPv4 address is specified using dotted decimal notation. For example, “192.0.2.1”. IPv6 addresses are 128-bit specified using as eight fields of up to four hexadecimal digits. A colon separates each field (:). For example, 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of symbol ‘::’ to represent multiple 16-bit groups of contiguous 0’s only once in an address as described in RFC 2373. This attribute was added in vSphere API 7.0.0.0.

  • prefix_length (long) – The prefix length. For IPv4 the value range is 0-32. For IPv6 prefixLength is a decimal value range 0-128. The property represents the number of contiguous, higher-order bits of the address that make up the network portion of the IP address. This attribute was added in vSphere API 7.0.0.0.

  • gateway_address (str or None) – Where to send the packets for this route. Unicast IP Address of the next hop router. IPv4 address is specified using dotted decimal notation. For example, “192.0.2.1”. IPv6 addresses are 128-bit specified using as eight fields of up to four hexadecimal digits. A colon separates each field (:). For example, 2001:DB8:101::230:6eff:fe04:d9ff. The address can also consist of symbol ‘::’ to represent multiple 16-bit groups of contiguous 0’s only once in an address as described in RFC 2373. This attribute was added in vSphere API 7.0.0.0. If None no gateway is set for the route.

  • interface_index (long or None) – The network interface associated with this route. This is an index into the result of Interfaces.list() The index refers to the relative position of an element in a list. For example, an index of 0 refers to the first element in the list while an index of 1 refers to the second element. This attribute was added in vSphere API 7.0.0.0. If None the route is not associated with a network interface.

list(vm)

Returns information about network routing in the guest operating system. This method was added in vSphere API 7.0.0.0.

Parameters

vm (str) – Virtual machine ID The parameter must be an identifier for the resource type: VirtualMachine.

Return type

list of Routes.Info

Returns

Information about the network routes configured in the guest operating system.

Raise

com.vmware.vapi.std.errors_client.Error if the system reports an error while responding to the request.

Raise

com.vmware.vapi.std.errors_client.NotFound if the virtual machine is not found.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

Raise

com.vmware.vapi.std.errors_client.ServiceUnavailable if VMware Tools is not running.

class com.vmware.vcenter.vm.guest.networking_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance