Example #1
0
    def __init__(self, config):
        # properties for find operation
        find_input_type = type.StructType('operation-input', {
            'networks': type.ListType(type.IdType()),
        })
        find_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),

        }
        find_input_validator_list = [
        ]
        find_output_validator_list = [
        ]

        operations = {
            'find': {
                'input_type': find_input_type,
                'output_type': type.MapType(type.IdType(), type.OptionalType(type.ReferenceType(sys.modules[__name__], 'Network.Info'))),
                'errors': find_error_dict,
                'input_validator_list': find_input_validator_list,
                'output_validator_list': find_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(self, iface_name='com.vmware.vcenter.inventory.network',
                                  config=config,
                                  operations=operations)
Example #2
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'vm': type.IdType(resource_types='VirtualMachine'),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/vm/{vm}/guest/local-filesystem',
            path_variables={
                'vm': 'vm',
            },
            query_parameters={})

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.MapType(
                    type.StringType(),
                    type.ReferenceType(__name__, 'LocalFilesystem.Info')),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.vm.guest.local_filesystem',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'filter': type.ReferenceType(__name__, 'VM.FilterSpec'),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.invalid_argument':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
            'com.vmware.vapi.std.errors.service_unavailable':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),
            'com.vmware.vapi.std.errors.unsupported':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unsupported'),
            'com.vmware.vapi.std.errors.unable_to_allocate_resource':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),

        }
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
        ]
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/storage/policies/compliance/vm',
            path_variables={
            },
            query_parameters={
            }
        )

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.MapType(type.IdType(), type.ReferenceType(__name__, 'VM.Info')),
                'errors': list_error_dict,
                'input_value_validator_list': list_input_value_validator_list,
                'output_validator_list': list_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vcenter.storage.policies.compliance.VM',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #4
0
    def __init__(self, config):
        # properties for post operation
        post_input_type = type.StructType('operation-input', {
            'org': type.StringType(),
            'sddc_state': type.OptionalType(type.ReferenceType('com.vmware.vmc.model_client', 'SddcStateRequest')),
        })
        post_error_dict = {
            'com.vmware.vapi.std.errors.unauthenticated':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthenticated'),
            'com.vmware.vapi.std.errors.invalid_request':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidRequest'),
            'com.vmware.vapi.std.errors.unauthorized':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Unauthorized'),

        }
        post_input_value_validator_list = [
        ]
        post_output_validator_list = [
        ]
        post_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/vmc/api/orgs/{org}/tbrs/reservation',
            request_body_parameter='sddc_state',
            path_variables={
                'org': 'org',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'post': {
                'input_type': post_input_type,
                'output_type': type.MapType(type.StringType(), type.ListType(type.ReferenceType('com.vmware.vmc.model_client', 'ReservationWindow'))),
                'errors': post_error_dict,
                'input_value_validator_list': post_input_value_validator_list,
                'output_validator_list': post_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'post': post_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vmc.orgs.tbrs.reservation',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Example #5
0
    def __init__(self, config):
        # properties for find operation
        find_input_type = type.StructType('operation-input', {
            'networks': type.ListType(type.IdType()),
        })
        find_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        find_input_value_validator_list = [
        ]
        find_output_validator_list = [
        ]
        find_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/inventory/network',
            path_variables={
            },
            query_parameters={
                'networks': 'networks',
            },
            dispatch_parameters={
            },
            header_parameters={
            },
            dispatch_header_parameters={
            }
        )

        operations = {
            'find': {
                'input_type': find_input_type,
                'output_type': type.MapType(type.IdType(), type.OptionalType(type.ReferenceType(__name__, 'Network.Info'))),
                'errors': find_error_dict,
                'input_value_validator_list': find_input_value_validator_list,
                'output_validator_list': find_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'find': find_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vcenter.inventory.network',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #6
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'filter':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Details.FilterSpec')),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/recovery/backup/job/details',
            path_variables={},
            query_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.MapType(type.IdType(),
                             type.ReferenceType(__name__, 'Details.Info')),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.recovery.backup.job.details',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #7
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {})
        get_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/support-bundle/components',
            path_variables={},
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.MapType(type.StringType(),
                             type.ListType(type.StringType())),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.support_bundle.components',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
    def __init__(self, config):
        # properties for find operation
        find_input_type = type.StructType(
            'operation-input', {
                'networks': type.ListType(type.IdType()),
            })
        find_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        find_input_value_validator_list = []
        find_output_validator_list = []
        find_rest_metadata = None

        operations = {
            'find': {
                'input_type':
                find_input_type,
                'output_type':
                type.MapType(
                    type.IdType(),
                    type.OptionalType(
                        type.ReferenceType(__name__, 'Network.Info'))),
                'errors':
                find_error_dict,
                'input_value_validator_list':
                find_input_value_validator_list,
                'output_validator_list':
                find_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'find': find_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.inventory.network',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #9
0
class Compliance(VapiInterface):
    """
    The Compliance class provides methods that return the compliance status of
    virtual machine entities(virtual machine home directory and virtual disks)
    that specify storage policy requirements. This class was added in vSphere
    API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.storage.policy.compliance'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _ComplianceStub)

    class Status(Enum):
        """
        The ``Compliance.Status`` class defines the storage compliance status of a
        virtual machine and its applicable entities. This enumeration was added in
        vSphere API 6.7.

        .. 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 :ref:`enumerated
            type description page <enumeration_description>`.
        """
        COMPLIANT = None
        """
        Entity is in compliance. This class attribute was added in vSphere API 6.7.

        """
        NON_COMPLIANT = None
        """
        Entity is out of compliance. This class attribute was added in vSphere API
        6.7.

        """
        UNKNOWN_COMPLIANCE = None
        """
        Compliance status of the entity is not known. This class attribute was
        added in vSphere API 6.7.

        """
        NOT_APPLICABLE = None
        """
        Compliance computation is not applicable for this entity because it does
        not have any storage requirements that apply to the datastore on which it
        is placed. This class attribute was added in vSphere API 6.7.

        """
        OUT_OF_DATE = None
        """
        The Compliance status becomes out-of-date when the profile associated with
        the entity is edited but not applied. The compliance status remains
        out-of-date until the edited policy is applied to the entity. This class
        attribute was added in vSphere API 6.7.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`Status` instance.
            """
            Enum.__init__(string)

    Status._set_values([
        Status('COMPLIANT'),
        Status('NON_COMPLIANT'),
        Status('UNKNOWN_COMPLIANCE'),
        Status('NOT_APPLICABLE'),
        Status('OUT_OF_DATE'),
    ])
    Status._set_binding_type(
        type.EnumType('com.vmware.vcenter.vm.storage.policy.compliance.status',
                      Status))

    class VmComplianceInfo(VapiStruct):
        """
        The ``Compliance.VmComplianceInfo`` class contains information about
        storage policy compliance associated with a virtual machine. This class was
        added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            status=None,
            check_time=None,
            policy=None,
            failure_cause=None,
        ):
            """
            :type  status: :class:`Compliance.Status`
            :param status: Status of the compliance operation. This attribute was added in
                vSphere API 6.7.
            :type  check_time: :class:`datetime.datetime`
            :param check_time: Date and time of the most recent compliance check. This attribute
                was added in vSphere API 6.7.
            :type  policy: :class:`str` or ``None``
            :param policy: Identifier of the storage policy associated with the virtual
                machine. This attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.StoragePolicy``. 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.StoragePolicy``.
                If None SPBM is unable to retrieve or determine the associated
                policy, :attr:`Compliance.VmComplianceInfo.failure_cause` is set in
                such casses.
            :type  failure_cause: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param failure_cause: The exception that caused the compliance check to fail. There can
                be more than one cause, since a policy can contain capabilities
                from multiple providers. If empty, it implies no failures while
                retrieving compliance. This attribute was added in vSphere API 6.7.
            """
            self.status = status
            self.check_time = check_time
            self.policy = policy
            self.failure_cause = failure_cause
            VapiStruct.__init__(self)

    VmComplianceInfo._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.storage.policy.compliance.vm_compliance_info',
            {
                'status':
                type.ReferenceType(__name__, 'Compliance.Status'),
                'check_time':
                type.DateTimeType(),
                'policy':
                type.OptionalType(type.IdType()),
                'failure_cause':
                type.ListType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
            }, VmComplianceInfo, False, None))

    class Info(VapiStruct):
        """
        The ``Compliance.Info`` class contains information about the storage policy
        compliance of a virtual machine, including information about it's home
        directory and/or it's virtual disks. This class was added in vSphere API
        6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            overall_compliance=None,
            vm_home=None,
            disks=None,
        ):
            """
            :type  overall_compliance: :class:`Compliance.Status`
            :param overall_compliance: The overall compliance status of the virtual machine and all it's
                entities. This attribute was added in vSphere API 6.7.
            :type  vm_home: :class:`Compliance.VmComplianceInfo` or ``None``
            :param vm_home: The storage policy compliance information
                :class:`Compliance.VmComplianceInfo` for the virtual machine's home
                directory. This attribute was added in vSphere API 6.7.
                If None the virtual machine home directory has no storage policy
                association.
            :type  disks: :class:`dict` of :class:`str` and :class:`Compliance.VmComplianceInfo`
            :param disks: The compliance information :class:`Compliance.VmComplianceInfo` for
                the virtual machine's virtual disks that are currently associated
                with a storage policy. This attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the key in
                the attribute :class:`dict` must be an identifier for the resource
                type: ``com.vmware.vcenter.vm.hardware.Disk``. When methods return
                a value of this class as a return value, the key in the attribute
                :class:`dict` will be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
            """
            self.overall_compliance = overall_compliance
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.storage.policy.compliance.info', {
                'overall_compliance':
                type.ReferenceType(__name__, 'Compliance.Status'),
                'vm_home':
                type.OptionalType(
                    type.ReferenceType(__name__,
                                       'Compliance.VmComplianceInfo')),
                'disks':
                type.MapType(
                    type.IdType(),
                    type.ReferenceType(__name__,
                                       'Compliance.VmComplianceInfo')),
            }, Info, False, None))

    class CheckSpec(VapiStruct):
        """
        The ``Compliance.CheckSpec`` class contains attributes used to specify the
        entities on which the storage policy compliance check is to be invoked.
        This class was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            vm_home=None,
            disks=None,
        ):
            """
            :type  vm_home: :class:`bool`
            :param vm_home: Invoke compliance check on the virtual machine home directory if
                set to true. This attribute was added in vSphere API 6.7.
            :type  disks: :class:`set` of :class:`str` or ``None``
            :param disks: Identifiers of the virtual machine's virtual disks for which
                compliance should be checked. This attribute was added in vSphere
                API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``. When methods return a
                value of this class as a return value, the attribute will contain
                identifiers for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
                If None or empty, compliance check is invoked on all the associated
                disks.
            """
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    CheckSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.vm.storage.policy.compliance.check_spec', {
                'vm_home': type.BooleanType(),
                'disks': type.OptionalType(type.SetType(type.IdType())),
            }, CheckSpec, False, None))

    def get(
        self,
        vm,
    ):
        """
        Returns the cached storage policy compliance information of a virtual
        machine. This method was added in vSphere API 6.7.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :rtype: :class:`Compliance.Info` or ``None``
        :return: Virtual machine storage policy compliance Info
            :class:`Compliance.Info`.
            If None, neither the virtual machine home directory nor any of it's
            virtual disks are associated with a storage policy.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user cannot be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have the required privileges.
        """
        return self._invoke('get', {
            'vm': vm,
        })

    def check(
        self,
        vm,
        check_spec=None,
    ):
        """
        Returns the storage policy Compliance :class:`Compliance.Info` of a
        virtual machine after explicitly re-computing compliance check. This
        method was added in vSphere API 6.7.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :type  check_spec: :class:`Compliance.CheckSpec` or ``None``
        :param check_spec: Parameter specifies the entities on which storage policy compliance
            check is to be invoked. The storage compliance Info
            :class:`Compliance.Info` is returned.
            If None, the behavior is equivalent to a
            :class:`Compliance.CheckSpec` with CheckSpec#vmHome set to true and
            CheckSpec#disks populated with all disks attached to the virtual
            machine.
        :rtype: :class:`Compliance.Info` or ``None``
        :return: Virtual machine storage policy compliance ``Compliance.Info`` class
            .
            If None, neither the virtual machine home directory nor any of it's
            virtual disks are associated with a storage policy.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service necessary to
            complete the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user cannot be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have the required privileges.
        """
        return self._invoke('check', {
            'vm': vm,
            'check_spec': check_spec,
        })
        self,
        settings=None,
    ):
        """
        :type  settings: :class:`dict` of :class:`str` and :class:`str`
        :param settings: 
        """
        self.settings = settings
        VapiStruct.__init__(self)


Settings._set_binding_type(
    type.StructType(
        'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.settings',
        {
            'settings': type.MapType(type.StringType(), type.StringType()),
        }, Settings, False, None))


class StubFactory(StubFactoryBase):
    _attrs = {
        'cluster':
        'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.cluster_client.StubFactory',
        'datacenter':
        'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.datacenter_client.StubFactory',
        'datastore':
        'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.datastore_client.StubFactory',
        'folder':
        'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.folder_client.StubFactory',
        'host':
        'com.vmware.appliance.vcenter.settings.v1.config.components.inventory.host_client.StubFactory',
Example #11
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'host': type.IdType(resource_types='HostSystem'),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/esx/hosts/{host}/software/installed-components',
            path_variables={
                'host': 'host',
            },
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.MapType(
                    type.IdType(),
                    type.ReferenceType(
                        __name__,
                        'InstalledComponents.InstalledComponentInfo')),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.esx.hosts.software.installed_components',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #12
0
        VapiStruct.__init__(self)


LocalizableMessage._set_binding_type(
    type.StructType(
        'com.vmware.vapi.std.localizable_message', {
            'id':
            type.StringType(),
            'default_message':
            type.StringType(),
            'args':
            type.ListType(type.StringType()),
            'params':
            type.OptionalType(
                type.MapType(type.StringType(),
                             type.ReferenceType(__name__,
                                                'LocalizationParam'))),
            'localized':
            type.OptionalType(type.StringType()),
        }, LocalizableMessage, False, None))


class LocalizationParam(VapiStruct):
    """
    This class holds a single message parameter and formatting settings for it.
    The class has fields for :class:`str`, :class:`int`,
    :class:`decimal.Decimal`, date time and nested messages. Only one will be
    used depending on the type of data sent. For date, :class:`decimal.Decimal`
    and :class:`int` it is possible to set additional formatting details.
    **Warning:** This class is part of a new feature in development. It may be
    changed at any time and may not have all supported functionality
    def __init__(self, config):
        # properties for start operation
        start_input_type = type.StructType('operation-input', {
            'service': type.IdType(resource_types='com.vmware.appliance.vmon.Service'),
        })
        start_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
            'com.vmware.vapi.std.errors.timed_out':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'TimedOut'),
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),

        }
        start_input_value_validator_list = [
        ]
        start_output_validator_list = [
        ]
        start_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/vmon/service/{id}/start',
            path_variables={
                'service': 'id',
            },
            query_parameters={
            }
        )

        # properties for stop operation
        stop_input_type = type.StructType('operation-input', {
            'service': type.IdType(resource_types='com.vmware.appliance.vmon.Service'),
        })
        stop_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),

        }
        stop_input_value_validator_list = [
        ]
        stop_output_validator_list = [
        ]
        stop_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/vmon/service/{id}/stop',
            path_variables={
                'service': 'id',
            },
            query_parameters={
            }
        )

        # properties for restart operation
        restart_input_type = type.StructType('operation-input', {
            'service': type.IdType(resource_types='com.vmware.appliance.vmon.Service'),
        })
        restart_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
            'com.vmware.vapi.std.errors.timed_out':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'TimedOut'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),

        }
        restart_input_value_validator_list = [
        ]
        restart_output_validator_list = [
        ]
        restart_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/vmon/service/{id}/restart',
            path_variables={
                'service': 'id',
            },
            query_parameters={
            }
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'service': type.IdType(resource_types='com.vmware.appliance.vmon.Service'),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/vmon/service/{id}',
            path_variables={
                'service': 'id',
            },
            query_parameters={
            }
        )

        # properties for update operation
        update_input_type = type.StructType('operation-input', {
            'service': type.IdType(resource_types='com.vmware.appliance.vmon.Service'),
            'spec': type.ReferenceType(__name__, 'Service.UpdateSpec'),
        })
        update_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotAllowedInCurrentState'),

        }
        update_input_value_validator_list = [
        ]
        update_output_validator_list = [
        ]
        update_rest_metadata = OperationRestMetadata(
            http_method='PATCH',
            url_template='/appliance/vmon/service/{id}',
            path_variables={
                'service': 'id',
            },
            query_parameters={
            }
        )

        # properties for list_details operation
        list_details_input_type = type.StructType('operation-input', {})
        list_details_error_dict = {
            'com.vmware.vapi.std.errors.error':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),

        }
        list_details_input_value_validator_list = [
        ]
        list_details_output_validator_list = [
        ]
        list_details_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/vmon/service',
            path_variables={
            },
            query_parameters={
            }
        )

        operations = {
            'start': {
                'input_type': start_input_type,
                'output_type': type.VoidType(),
                'errors': start_error_dict,
                'input_value_validator_list': start_input_value_validator_list,
                'output_validator_list': start_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'stop': {
                'input_type': stop_input_type,
                'output_type': type.VoidType(),
                'errors': stop_error_dict,
                'input_value_validator_list': stop_input_value_validator_list,
                'output_validator_list': stop_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'restart': {
                'input_type': restart_input_type,
                'output_type': type.VoidType(),
                'errors': restart_error_dict,
                'input_value_validator_list': restart_input_value_validator_list,
                'output_validator_list': restart_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__, 'Service.Info'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'update': {
                'input_type': update_input_type,
                'output_type': type.VoidType(),
                'errors': update_error_dict,
                'input_value_validator_list': update_input_value_validator_list,
                'output_validator_list': update_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'list_details': {
                'input_type': list_details_input_type,
                'output_type': type.MapType(type.IdType(), type.ReferenceType(__name__, 'Service.Info')),
                'errors': list_details_error_dict,
                'input_value_validator_list': list_details_input_value_validator_list,
                'output_validator_list': list_details_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'start': start_rest_metadata,
            'stop': stop_rest_metadata,
            'restart': restart_rest_metadata,
            'get': get_rest_metadata,
            'update': update_rest_metadata,
            'list_details': list_details_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.appliance.vmon.service',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #14
0
            When clients pass a value of this class as a parameter, the key in
            the attribute :class:`dict` must be an identifier for the resource
            type: ``com.vmware.vapi.package``. When methods return a value of
            this class as a return value, the key in the attribute
            :class:`dict` will be an identifier for the resource type:
            ``com.vmware.vapi.package``.
        """
        self.packages = packages
        VapiStruct.__init__(self)


ComponentInfo._set_binding_type(
    type.StructType(
        'com.vmware.vapi.metadata.routing.component_info', {
            'packages':
            type.MapType(type.IdType(),
                         type.ReferenceType(__name__, 'PackageInfo')),
        }, ComponentInfo, False, None))


class OperationInfo(VapiStruct):
    """
    Information about a vAPI operation that contains routing information. For
    an explanation of containment within operations, see null
    **Note:** This class is restricted for **VMware internal use only**.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
    def __init__(
        self,
Example #15
0
    def __init__(self, config):
        # properties for upgrade operation
        upgrade_input_type = type.StructType(
            'operation-input', {
                'cluster':
                type.IdType(resource_types='ClusterComputeResource'),
                'spec': type.ReferenceType(__name__, 'Clusters.UpgradeSpec'),
            })
        upgrade_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.unsupported':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unsupported'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
        }
        upgrade_input_value_validator_list = []
        upgrade_output_validator_list = []
        upgrade_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template=
            '/vcenter/namespace-management/software/clusters/{cluster}',
            request_body_parameter='spec',
            path_variables={
                'cluster': 'cluster',
            },
            query_parameters={},
            dispatch_parameters={
                'action': 'upgrade',
            },
            header_parameters={},
            dispatch_header_parameters={})

        # properties for upgrade_multiple operation
        upgrade_multiple_input_type = type.StructType(
            'operation-input', {
                'specs':
                type.MapType(
                    type.IdType(),
                    type.ReferenceType(__name__, 'Clusters.UpgradeSpec')),
            })
        upgrade_multiple_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
        }
        upgrade_multiple_input_value_validator_list = []
        upgrade_multiple_output_validator_list = []
        upgrade_multiple_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/vcenter/namespace-management/software/clusters',
            request_body_parameter='specs',
            path_variables={},
            query_parameters={},
            dispatch_parameters={
                'action': 'upgradeMultiple',
            },
            header_parameters={},
            dispatch_header_parameters={})

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'cluster':
            type.IdType(resource_types='ClusterComputeResource'),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/vcenter/namespace-management/software/clusters/{cluster}',
            path_variables={
                'cluster': 'cluster',
            },
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/namespace-management/software/clusters',
            path_variables={},
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'upgrade': {
                'input_type': upgrade_input_type,
                'output_type': type.VoidType(),
                'errors': upgrade_error_dict,
                'input_value_validator_list':
                upgrade_input_value_validator_list,
                'output_validator_list': upgrade_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'upgrade_multiple': {
                'input_type':
                upgrade_multiple_input_type,
                'output_type':
                type.MapType(type.IdType(),
                             type.ReferenceType(__name__, 'Clusters.Result')),
                'errors':
                upgrade_multiple_error_dict,
                'input_value_validator_list':
                upgrade_multiple_input_value_validator_list,
                'output_validator_list':
                upgrade_multiple_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__, 'Clusters.Info'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(type.ReferenceType(__name__,
                                                 'Clusters.Summary')),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'upgrade': upgrade_rest_metadata,
            'upgrade_multiple': upgrade_multiple_rest_metadata,
            'get': get_rest_metadata,
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name=
            'com.vmware.vcenter.namespace_management.software.clusters',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #16
0
            the attribute :class:`dict` must be an identifier for the resource
            type: ``com.vmware.vapi.package``. When methods return a value of
            this class as a return value, the key in the attribute
            :class:`dict` will be an identifier for the resource type:
            ``com.vmware.vapi.package``.
        """
        self.packages = packages
        VapiStruct.__init__(self)


ComponentInfo._set_binding_type(
    type.StructType(
        'com.vmware.vapi.metadata.privilege.component_info', {
            'packages':
            type.MapType(
                type.IdType(),
                type.ReferenceType(sys.modules[__name__], 'PackageInfo')),
        }, ComponentInfo, False, None))


class OperationInfo(VapiStruct):
    """
    The ``OperationInfo`` class contains privilege information of an operation
    element. 
    
    For an explanation of containment within operation elements, see
    :class:`com.vmware.vapi.metadata.privilege.service_client.Operation`.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/system/storage',
            path_variables={},
            query_parameters={})

        # properties for resize operation
        resize_input_type = type.StructType('operation-input', {})
        resize_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        resize_input_value_validator_list = []
        resize_output_validator_list = []
        resize_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/system/storage/resize',
            path_variables={},
            query_parameters={})

        # properties for resize_ex operation
        resize_ex_input_type = type.StructType('operation-input', {})
        resize_ex_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        resize_ex_input_value_validator_list = []
        resize_ex_output_validator_list = []
        resize_ex_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/system/storage?action=resize-ex',
            path_variables={},
            query_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(__name__, 'Storage.StorageMapping')),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'resize': {
                'input_type': resize_input_type,
                'output_type': type.VoidType(),
                'errors': resize_error_dict,
                'input_value_validator_list':
                resize_input_value_validator_list,
                'output_validator_list': resize_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'resize_ex': {
                'input_type':
                resize_ex_input_type,
                'output_type':
                type.MapType(
                    type.StringType(),
                    type.ReferenceType(__name__, 'Storage.StorageChange')),
                'errors':
                resize_ex_error_dict,
                'input_value_validator_list':
                resize_ex_input_value_validator_list,
                'output_validator_list':
                resize_ex_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
        }
        rest_metadata = {
            'list': list_rest_metadata,
            'resize': resize_rest_metadata,
            'resize_ex': resize_ex_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.system.storage',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
class VM(VapiInterface):
    """
    The ``VM`` class provides methods related to query virtual machines of
    given compliance statuses. This class was added in vSphere API 6.7
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _VMStub)

    class Status(Enum):
        """
        The {\\\\@Status} class defines he valid compliance status values for a
        virtual machine or virtual disk. This enumeration was added in vSphere API
        6.7

        .. 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 :ref:`enumerated
            type description page <enumeration_description>`.
        """
        COMPLIANT = None
        """
        The virtual machine or virtual disk is in compliance. This class attribute
        was added in vSphere API 6.7

        """
        NON_COMPLIANT = None
        """
        The virtual machine or virtual disk is in not in compliance. This class
        attribute was added in vSphere API 6.7

        """
        UNKNOWN_COMPLIANCE = None
        """
        Compliance status of the virtual machine or virtual disk is not known. This
        class attribute was added in vSphere API 6.7

        """
        NOT_APPLICABLE = None
        """
        Compliance computation is not applicable for this virtual machine or disk
        because it does not have any storage requirement that apply to the
        object-based datastore on which the entity is placed. This class attribute
        was added in vSphere API 6.7

        """
        OUT_OF_DATE = None
        """
        Compliance status becomes out of date when the profile associated with the
        virtual machine or disk is edited and not applied. The compliance status
        will remain out of date until the latest policy is applied. This class
        attribute was added in vSphere API 6.7

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`Status` instance.
            """
            Enum.__init__(string)

    Status._set_values([
        Status('COMPLIANT'),
        Status('NON_COMPLIANT'),
        Status('UNKNOWN_COMPLIANCE'),
        Status('NOT_APPLICABLE'),
        Status('OUT_OF_DATE'),
    ])
    Status._set_binding_type(
        type.EnumType(
            'com.vmware.vcenter.storage.policies.compliance.VM.status',
            Status))

    class Info(VapiStruct):
        """
        Provides the compliance details of a virtual machine and its associated
        entities which match the given compliance statuses. This class was added in
        vSphere API 6.7

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            vm_home=None,
            disks=None,
        ):
            """
            :type  vm_home: :class:`VM.Status` or ``None``
            :param vm_home: Compliance status of the virtual machine home. This attribute was
                added in vSphere API 6.7
                If None or empty, virtual machine home is not associated with a
                storage policy.
            :type  disks: :class:`dict` of :class:`str` and :class:`VM.Status`
            :param disks: A Map of virtual disks and their compliance status If empty, the
                virtual machine does not have any disks or its disks are not
                associated with a storage policy. This attribute was added in
                vSphere API 6.7
                When clients pass a value of this class as a parameter, the key in
                the attribute :class:`dict` must be an identifier for the resource
                type: ``com.vmware.vcenter.vm.hardware.Disk``. When methods return
                a value of this class as a return value, the key in the attribute
                :class:`dict` will be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
            """
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.VM.info', {
                'vm_home':
                type.OptionalType(type.ReferenceType(__name__, 'VM.Status')),
                'disks':
                type.MapType(type.IdType(),
                             type.ReferenceType(__name__, 'VM.Status')),
            }, Info, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``VM.FilterSpec`` class contains Status used to filter the results when
        listing virtual machines (see :func:`VM.list`). This class was added in
        vSphere API 6.7

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            status=None,
            vms=None,
        ):
            """
            :type  status: :class:`set` of :class:`VM.Status`
            :param status: Compliance Status that a virtual machine must have to match the
                filter. Atleast one status must be specified. This attribute was
                added in vSphere API 6.7
            :type  vms: :class:`set` of :class:`str` or ``None``
            :param vms: Identifiers of virtual machines that can match the filter. This
                attribute was added in vSphere API 6.7
                When clients pass a value of this class as a parameter, the
                attribute must contain identifiers for the resource type:
                ``VirtualMachine``. When methods return a value of this class as a
                return value, the attribute will contain identifiers for the
                resource type: ``VirtualMachine``.
                If None or empty, virtual machines with any identifier matches the
                filter
            """
            self.status = status
            self.vms = vms
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.VM.filter_spec', {
                'status': type.SetType(
                    type.ReferenceType(__name__, 'VM.Status')),
                'vms': type.OptionalType(type.SetType(type.IdType())),
            }, FilterSpec, False, None))

    def list(
        self,
        filter,
    ):
        """
        Returns compliance information about at most 1000 virtual machines
        matching the filter :class:`VM.FilterSpec`. If there are no virtual
        machines matching the :class:`VM.FilterSpec` an empty List is returned.
        Virtual machines without storage policy association are not returned.
        This method was added in vSphere API 6.7

        :type  filter: :class:`VM.FilterSpec`
        :param filter: compliance status of matching virtual machines for which
            information should be returned.
        :rtype: :class:`dict` of :class:`str` and :class:`VM.Info`
        :return: compliance information about virtual machines matching the filter
            :class:`VM.FilterSpec`.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``VirtualMachine``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the :attr:`VM.FilterSpec.status` attribute contains a value that
            is not supported by the server.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have the required privileges.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unsupported` 
            if the API is invoked against vCenter Server version is less than
            6.5
        :raise: :class:`com.vmware.vapi.std.errors_client.UnableToAllocateResource` 
            If more than 1000 results match the :class:`VM.FilterSpec`
        """
        return self._invoke('list', {
            'filter': filter,
        })
Example #19
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'task':
                type.IdType(resource_types='com.vmware.cis.task'),
                'spec':
                type.OptionalType(type.ReferenceType(__name__,
                                                     'Tasks.GetSpec')),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.resource_inaccessible':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ResourceInaccessible'),
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/cis/tasks/{task}',
            path_variables={
                'task': 'task',
            },
            query_parameters={})

        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'filter_spec':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Tasks.FilterSpec')),
                'result_spec':
                type.OptionalType(type.ReferenceType(__name__,
                                                     'Tasks.GetSpec')),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
            'com.vmware.vapi.std.errors.resource_inaccessible':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ResourceInaccessible'),
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(http_method='GET',
                                                   url_template='/cis/tasks',
                                                   path_variables={},
                                                   query_parameters={})

        # properties for cancel operation
        cancel_input_type = type.StructType(
            'operation-input', {
                'task': type.IdType(resource_types='com.vmware.cis.task'),
            })
        cancel_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotAllowedInCurrentState'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.resource_inaccessible':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ResourceInaccessible'),
            'com.vmware.vapi.std.errors.service_unavailable':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'ServiceUnavailable'),
            'com.vmware.vapi.std.errors.unauthenticated':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthenticated'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.unsupported':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unsupported'),
        }
        cancel_input_value_validator_list = []
        cancel_output_validator_list = []
        cancel_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/cis/tasks/{task}',
            path_variables={
                'task': 'task',
            },
            query_parameters={})

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType('com.vmware.cis.task_client', 'Info'),
                'errors':
                get_error_dict,
                'input_value_validator_list':
                get_input_value_validator_list,
                'output_validator_list':
                get_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.MapType(
                    type.IdType(),
                    type.ReferenceType('com.vmware.cis.task_client', 'Info')),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'cancel': {
                'input_type': cancel_input_type,
                'output_type': type.VoidType(),
                'errors': cancel_error_dict,
                'input_value_validator_list':
                cancel_input_value_validator_list,
                'output_validator_list': cancel_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'get': get_rest_metadata,
            'list': list_rest_metadata,
            'cancel': cancel_rest_metadata,
        }
        ApiInterfaceStub.__init__(self,
                                  iface_name='com.vmware.cis.tasks',
                                  config=config,
                                  operations=operations,
                                  rest_metadata=rest_metadata,
                                  is_vapi_rest=True)
class Software(VapiInterface):
    """
    The ``Software`` class provides methods to control whether the cluster is
    managed with a single software specification.
    """

    _VAPI_SERVICE_ID = 'com.vmware.esx.settings.clusters.enablement.software'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _SoftwareStub)
        self._VAPI_OPERATION_IDS = {}
        self._VAPI_OPERATION_IDS.update({'check_task': 'check$task'})
        self._VAPI_OPERATION_IDS.update({'enable_task': 'enable$task'})

    class CheckType(Enum):
        """
        The ``Software.CheckType`` class contains various checks to identify the
        possibility to enable the feature that manages the cluster with a single
        software specification.

        .. 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 :ref:`enumerated
            type description page <enumeration_description>`.
        """
        SOFTWARE = None
        """
        Perform host software check. This check is to report standalone VIBs (VIBs
        which are not part of any component) and the features on the given cluster
        that cannot coexist with the feature which manages the cluster with a
        single software specification.

        """
        VERSION = None
        """
        Perform host version check. This feature does not support hosts with
        version less than XYZ.

        """
        STATELESSNESS = None
        """
        Perform host statelessness check. This feature does not support stateless
        hosts.

        """
        VUM_REMEDIATION = None
        """
        Perform VUM active remediation check.

        """
        SOFTWARE_SPECIFICATION_EXISTENCE = None
        """
        Perform cluster's software specification existence check.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`CheckType` instance.
            """
            Enum.__init__(string)

    CheckType._set_values([
        CheckType('SOFTWARE'),
        CheckType('VERSION'),
        CheckType('STATELESSNESS'),
        CheckType('VUM_REMEDIATION'),
        CheckType('SOFTWARE_SPECIFICATION_EXISTENCE'),
    ])
    CheckType._set_binding_type(
        type.EnumType(
            'com.vmware.esx.settings.clusters.enablement.software.check_type',
            CheckType))

    class Info(VapiStruct):
        """
        The ``Software.Info`` class contains information describing whether the
        feature is enabled.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            enabled=None,
        ):
            """
            :type  enabled: :class:`bool`
            :param enabled: Status of the feature enablement True if feature is enabled, false
                otherwise
            """
            self.enabled = enabled
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.clusters.enablement.software.info', {
                'enabled': type.BooleanType(),
            }, Info, False, None))

    class CheckSpec(VapiStruct):
        """
        The ``Software.CheckSpec`` class contains information describing what
        checks should be performed.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            checks_to_skip=None,
        ):
            """
            :type  checks_to_skip: :class:`set` of :class:`Software.CheckType`
            :param checks_to_skip: Specifies the checks that should be skipped. If the :class:`set` is
                empty, all checks will be performed.
            """
            self.checks_to_skip = checks_to_skip
            VapiStruct.__init__(self)

    CheckSpec._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.clusters.enablement.software.check_spec',
            {
                'checks_to_skip':
                type.SetType(type.ReferenceType(__name__,
                                                'Software.CheckType')),
            }, CheckSpec, False, None))

    class CheckResult(VapiStruct):
        """
        The ``Software.CheckResult`` class contains information that describes the
        results of the checks.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            notifications=None,
        ):
            """
            :type  notifications: :class:`dict` of :class:`Software.CheckType` and :class:`com.vmware.esx.settings_client.Notifications`
            :param notifications: Notifications containing check results grouped by
                :class:`Software.CheckType` type.
            """
            self.notifications = notifications
            VapiStruct.__init__(self)

    CheckResult._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.clusters.enablement.software.check_result',
            {
                'notifications':
                type.MapType(
                    type.ReferenceType(__name__, 'Software.CheckType'),
                    type.ReferenceType('com.vmware.esx.settings_client',
                                       'Notifications')),
            }, CheckResult, False, None))

    class EnableSpec(VapiStruct):
        """
        The ``Software.EnableSpec`` class contains information describing checks
        that should be skipped during enablement. Currently only
        :attr:`Software.CheckType.SOFTWARE` check can be skipped.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            skip_software_check=None,
        ):
            """
            :type  skip_software_check: :class:`bool`
            :param skip_software_check: Skip :attr:`Software.CheckType.SOFTWARE` check during feature
                enablement.
            """
            self.skip_software_check = skip_software_check
            VapiStruct.__init__(self)

    EnableSpec._set_binding_type(
        type.StructType(
            'com.vmware.esx.settings.clusters.enablement.software.enable_spec',
            {
                'skip_software_check': type.BooleanType(),
            }, EnableSpec, False, None))

    def get(
        self,
        cluster,
    ):
        """
        Returns whether the given cluster is managed with a single software
        specification.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :rtype: :class:`Software.Info`
        :return: Information about the feature enablement.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is unknown internal error. The accompanying error message
            will give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no cluster associated with ``cluster`` in the system.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``VcIntegrity.lifecycleSettings.Read``.
            * The resource ``ClusterComputeResource`` referenced by the
              parameter ``cluster`` requires
              ``VcIntegrity.lifecycleSettings.Read``.
        """
        return self._invoke('get', {
            'cluster': cluster,
        })

    def check_task(
        self,
        cluster,
        spec=None,
    ):
        """
        Checks the possibility to manage the cluster with a single software
        specification.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`Software.CheckSpec` or ``None``
        :param spec: Check specification.
            If None, all checks are performed.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If there is some unknown error. The accompanying error message will
            give more details about the failure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            If the feature is already enabled for the given cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no cluster associated with ``cluster`` in the system.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        """
        task_id = self._invoke('check$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ReferenceType(__name__, 'Software.CheckResult'))
        return task_instance

    def enable_task(
        self,
        cluster,
        spec=None,
    ):
        """
        Enables the feature which manages the cluster with a single software
        specification.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`Software.EnableSpec` or ``None``
        :param spec: Enablement specification.
            If None, all checks are performed.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If feature enablement failed for the given cluster. The value of
            the data attribute of
            :class:`com.vmware.vapi.std.errors_client.Error` will be a class
            that contains all the attributes defined in
            :class:`Software.CheckResult`.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            If the feature is already enabled for the given cluster.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If there is no cluster associated with ``cluster`` in the system
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            If the service is not available.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        """
        task_id = self._invoke('enable$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc, type.VoidType())
        return task_instance
Example #21
0
        """
        self.version = version
        self.display_name = display_name
        self.components = components
        VapiStruct.__init__(self)


SolutionInfo._set_binding_type(
    type.StructType(
        'com.vmware.esx.hosts.solution_info', {
            'version':
            type.StringType(),
            'display_name':
            type.StringType(),
            'components':
            type.MapType(type.IdType(),
                         type.ReferenceType(__name__, 'ComponentInfo')),
        }, SolutionInfo, False, None))


class BaseImageInfo(VapiStruct):
    """
    The ``BaseImageInfo`` class contains attributes that describe a specific
    ESX base-image.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
    def __init__(
        self,
        version=None,
            type: ``HostSystem``. When methods return a value of this class as
            a return value, the key in the attribute :class:`dict` will be an
            identifier for the resource type: ``HostSystem``.
        """
        self.host_results = host_results
        self.host_status = host_status
        VapiStruct.__init__(self)


CheckComplianceResult._set_binding_type(
    type.StructType(
        'com.vmware.esx.settings.clusters.configuration.check_compliance_result',
        {
            'host_results':
            type.MapType(
                type.IdType(),
                type.ReferenceType(__name__, 'HostCheckComplianceResult')),
            'host_status':
            type.MapType(type.IdType(),
                         type.ReferenceType(__name__, 'HostStatus')),
        }, CheckComplianceResult, False, None))


class ValidationError(VapiStruct):
    """
    The ``ValidationError`` class contains attributes that describes a
    validation error in the configuration.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
            
            For an explanation of privilege information containment within
            package elements, see :class:`Package`.
            When clients pass a value of this class as a parameter, the key in
            the attribute :class:`dict` must be an identifier for the resource
            type: ``com.vmware.vapi.package``. When methods return a value of
            this class as a return value, the key in the attribute
            :class:`dict` will be an identifier for the resource type:
            ``com.vmware.vapi.package``.
        """
        self.packages = packages
        VapiStruct.__init__(self)

ComponentInfo._set_binding_type(type.StructType(
    'com.vmware.vapi.metadata.privilege.component_info', {
        'packages': type.MapType(type.IdType(), type.ReferenceType(__name__, 'PackageInfo')),
    },
    ComponentInfo,
    False,
    None))



class OperationInfo(VapiStruct):
    """
    The ``OperationInfo`` class contains privilege information of an operation
    element. 
    
    For an explanation of containment within operation elements, see
    :class:`com.vmware.vapi.metadata.privilege.service_client.Operation`.
Example #24
0
        """
        self.version = version
        self.display_name = display_name
        self.components = components
        VapiStruct.__init__(self)


SolutionInfo._set_binding_type(
    type.StructType(
        'com.vmware.esx.hosts.solution_info', {
            'version':
            type.StringType(),
            'display_name':
            type.StringType(),
            'components':
            type.MapType(type.IdType(),
                         type.ReferenceType(__name__, 'ComponentInfo')),
        }, SolutionInfo, False, None))


class BaseImageInfo(VapiStruct):
    """
    The ``BaseImageInfo`` class contains attributes that describe a specific
    ESX base-image in the software solution.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
    def __init__(
        self,
        version=None,
Example #25
0
class Compliance(VapiInterface):
    """
    The Compliance class provides methods related to all the associated
    entities of given compliance statuses. This class was added in vSphere API
    6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.storage.policies.compliance'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _ComplianceStub)
        self._VAPI_OPERATION_IDS = {}

    class Status(Enum):
        """
        This enumeration defines the set of status values for a compliance
        operation. This enumeration was added in vSphere API 6.7.

        .. 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 :ref:`enumerated
            type description page <enumeration_description>`.
        """
        COMPLIANT = None
        """
        Entity is in compliance. This class attribute was added in vSphere API 6.7.

        """
        NON_COMPLIANT = None
        """
        Entity is out of compliance. This class attribute was added in vSphere API
        6.7.

        """
        UNKNOWN = None
        """
        Compliance status of the entity is not known. This class attribute was
        added in vSphere API 6.7.

        """
        NOT_APPLICABLE = None
        """
        Compliance computation is not applicable for this entity because it does
        not have any storage requirement that apply to the object-based datastore
        on which the entity is placed. This class attribute was added in vSphere
        API 6.7.

        """
        OUT_OF_DATE = None
        """
        Compliance status becomes out of date when the profile associated with the
        entity is edited and not applied. The compliance status will remain out of
        date until the latest policy is applied to the entity. This class attribute
        was added in vSphere API 6.7.

        """
        def __init__(self, string):
            """
            :type  string: :class:`str`
            :param string: String value for the :class:`Status` instance.
            """
            Enum.__init__(string)

    Status._set_values([
        Status('COMPLIANT'),
        Status('NON_COMPLIANT'),
        Status('UNKNOWN'),
        Status('NOT_APPLICABLE'),
        Status('OUT_OF_DATE'),
    ])
    Status._set_binding_type(
        type.EnumType('com.vmware.vcenter.storage.policies.compliance.status',
                      Status))

    class Summary(VapiStruct):
        """
        Provides the details of a virtual machine and its associated entities which
        match the given compliance statuses. This class was added in vSphere API
        6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            vm=None,
            vm_home=None,
            disks=None,
        ):
            """
            :type  vm: :class:`str`
            :param vm: Identifier of virtual machine. This attribute was added in vSphere
                API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``VirtualMachine``. When methods return a value of this class as a
                return value, the attribute will be an identifier for the resource
                type: ``VirtualMachine``.
            :type  vm_home: :class:`Compliance.Status` or ``None``
            :param vm_home: Compliance status of the virtual machine home. This attribute was
                added in vSphere API 6.7.
                If None or empty, vmHome is not associated with a storage policy.
            :type  disks: (:class:`dict` of :class:`str` and :class:`Compliance.Status`) or ``None``
            :param disks: List of the virtual hard disk. This attribute was added in vSphere
                API 6.7.
                When clients pass a value of this class as a parameter, the key in
                the attribute :class:`dict` must be an identifier for the resource
                type: ``com.vmware.vcenter.vm.hardware.Disk``. When methods return
                a value of this class as a return value, the key in the attribute
                :class:`dict` will be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
                If None or empty, virtual machine entity does not have any disks or
                its disks are not associated with a storage policy.
            """
            self.vm = vm
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.summary', {
                'vm':
                type.IdType(resource_types='VirtualMachine'),
                'vm_home':
                type.OptionalType(
                    type.ReferenceType(__name__, 'Compliance.Status')),
                'disks':
                type.OptionalType(
                    type.MapType(
                        type.IdType(),
                        type.ReferenceType(__name__, 'Compliance.Status'))),
            }, Summary, False, None))

    class FilterSpec(VapiStruct):
        """
        The ``Compliance.FilterSpec`` class contains complianceStatus used to
        filter the results when listing entities (see :func:`Compliance.list`).
        This class was added in vSphere API 6.7.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            status=None,
        ):
            """
            :type  status: :class:`set` of :class:`Compliance.Status`
            :param status: Compliance Status that a virtual machine must have to match the
                filter. This attribute was added in vSphere API 6.7.
            """
            self.status = status
            VapiStruct.__init__(self)

    FilterSpec._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.storage.policies.compliance.filter_spec', {
                'status':
                type.SetType(type.ReferenceType(__name__,
                                                'Compliance.Status')),
            }, FilterSpec, False, None))

    def list(
        self,
        filter,
    ):
        """
        Returns compliance information about entities matching the filter
        :class:`Compliance.FilterSpec`. Entities without storage policy
        association are not returned. This method was added in vSphere API 6.7.

        :type  filter: :class:`Compliance.FilterSpec`
        :param filter: compliance status of matching entities for which information should
            be returned.
        :rtype: :class:`list` of :class:`Compliance.Summary`
        :return: compliance information about entities matching the filter
            :class:`Compliance.FilterSpec`.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the :attr:`Compliance.FilterSpec.status` attribute contains a
            value that is not supported by the server.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user doesn't have the required privileges.
        """
        return self._invoke('list', {
            'filter': filter,
        })
    def __init__(self, config):
        # properties for test operation
        test_input_type = type.StructType(
            'operation-input', {
                'host': type.StringType(),
                'protocol': type.StringType(),
                'config': type.ReferenceType(__name__, 'Proxy.Config'),
            })
        test_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        test_input_value_validator_list = []
        test_output_validator_list = []
        test_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/networking/proxy/{protocol}?action=test',
            path_variables={
                'protocol': 'protocol',
            },
            query_parameters={})

        # properties for set operation
        set_input_type = type.StructType(
            'operation-input', {
                'protocol': type.StringType(),
                'config': type.ReferenceType(__name__, 'Proxy.Config'),
            })
        set_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        set_input_value_validator_list = []
        set_output_validator_list = []
        set_rest_metadata = OperationRestMetadata(
            http_method='PUT',
            url_template='/appliance/networking/proxy/{protocol}',
            path_variables={
                'protocol': 'protocol',
            },
            query_parameters={})

        # properties for delete operation
        delete_input_type = type.StructType('operation-input', {
            'protocol': type.StringType(),
        })
        delete_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        delete_input_value_validator_list = []
        delete_output_validator_list = []
        delete_rest_metadata = OperationRestMetadata(
            http_method='DELETE',
            url_template='/appliance/networking/proxy/{protocol}',
            path_variables={
                'protocol': 'protocol',
            },
            query_parameters={})

        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/networking/proxy',
            path_variables={},
            query_parameters={})

        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'protocol': type.StringType(),
        })
        get_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/networking/proxy/{protocol}',
            path_variables={
                'protocol': 'protocol',
            },
            query_parameters={})

        operations = {
            'test': {
                'input_type': test_input_type,
                'output_type': type.ReferenceType(__name__,
                                                  'Proxy.TestResult'),
                'errors': test_error_dict,
                'input_value_validator_list': test_input_value_validator_list,
                'output_validator_list': test_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'set': {
                'input_type': set_input_type,
                'output_type': type.VoidType(),
                'errors': set_error_dict,
                'input_value_validator_list': set_input_value_validator_list,
                'output_validator_list': set_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'delete': {
                'input_type': delete_input_type,
                'output_type': type.VoidType(),
                'errors': delete_error_dict,
                'input_value_validator_list':
                delete_input_value_validator_list,
                'output_validator_list': delete_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.MapType(type.ReferenceType(__name__, 'Proxy.Protocol'),
                             type.ReferenceType(__name__, 'Proxy.Config')),
                'errors':
                list_error_dict,
                'input_value_validator_list':
                list_input_value_validator_list,
                'output_validator_list':
                list_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__, 'Proxy.Config'),
                'errors': get_error_dict,
                'input_value_validator_list': get_input_value_validator_list,
                'output_validator_list': get_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'test': test_rest_metadata,
            'set': set_rest_metadata,
            'delete': delete_rest_metadata,
            'list': list_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.networking.proxy',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Example #27
0
class Operation(VapiInterface):
    """
    The :class:`Operation` service provides operations to retrieve information
    about the operations present in a vAPI service.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _OperationStub)

    class DataDefinition(VapiStruct):
        """
        The :class:`Operation.DataDefinition` structure describes a vAPI data type.

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

        _validator_list = [
            UnionValidator(
                'type', {
                    'OPTIONAL': [('element_definition', True)],
                    'LIST': [('element_definition', True)],
                    'STRUCTURE': [('name', True), ('fields', True)],
                    'STRUCTURE_REF': [('name', True)],
                    'ERROR': [('name', True), ('fields', True)],
                    'BINARY': [],
                    'BOOLEAN': [],
                    'DOUBLE': [],
                    'DYNAMIC_STRUCTURE': [],
                    'ANY_ERROR': [],
                    'LONG': [],
                    'OPAQUE': [],
                    'SECRET': [],
                    'STRING': [],
                    'VOID': [],
                }),
        ]

        def __init__(
            self,
            type=None,
            element_definition=None,
            name=None,
            fields=None,
        ):
            """
            :type  type: :class:`Operation.DataDefinition.DataType`
            :param type: Data type of the value.
            :type  element_definition: :class:`Operation.DataDefinition`
            :param element_definition: Contains the element definition for generic data types like List
                and Optional.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of
                :attr:`Operation.DataDefinition.DataType.OPTIONAL` or
                :attr:`Operation.DataDefinition.DataType.LIST`.
            :type  name: :class:`str`
            :param name: Fully qualified name of the structure.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of
                :attr:`Operation.DataDefinition.DataType.STRUCTURE`,
                :attr:`Operation.DataDefinition.DataType.STRUCTURE_REF`, or
                :attr:`Operation.DataDefinition.DataType.ERROR`.
            :type  fields: :class:`dict` of :class:`str` and :class:`Operation.DataDefinition`
            :param fields: Fields of the structure type. The key of the map is the canonical
                name of the field and the value is the
                :class:`Operation.DataDefinition` for the field. The order of the
                structure fields defined in IDL is not maintained by the
                :class:`Operation` service.
                This attribute is optional and it is only relevant when the value
                of ``type`` is one of
                :attr:`Operation.DataDefinition.DataType.STRUCTURE` or
                :attr:`Operation.DataDefinition.DataType.ERROR`.
            """
            self.type = type
            self.element_definition = element_definition
            self.name = name
            self.fields = fields
            VapiStruct.__init__(self)

        class DataType(Enum):
            """
            The :class:`Operation.DataDefinition.DataType` enumeration provides values
            representing the data types supported by the vAPI infrastructure.

            .. 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 :ref:`enumerated
                type description page <enumeration_description>`.
            """
            BINARY = None
            """
            Indicates the value is a binary type.

            """
            BOOLEAN = None
            """
            Indicates the value is a boolean type. The possible values are True and
            False equivalent of the language used to invoke this operation.

            """
            DOUBLE = None
            """
            Indicates the value is a double type. It is a 64 bit floating point number.

            """
            DYNAMIC_STRUCTURE = None
            """
            Indicates the value is a dynamic structure. This means, any data of type
            :attr:`Operation.DataDefinition.DataType.STRUCTURE` can be used.

            """
            ERROR = None
            """
            Indicates the value is a specific error type.

            """
            ANY_ERROR = None
            """
            Indicates the value is arbitrary error type. This means, any data of type
            :attr:`Operation.DataDefinition.DataType.ERROR` can be used.

            """
            LIST = None
            """
            Indicates the value is a list data type. Any value of this type can have
            zero or more elements in the list.

            """
            LONG = None
            """
            Indicates the value is a long data type. It is a 64 bit signed integer
            number.

            """
            OPAQUE = None
            """
            Indicates the value is an opaque type. This means, data of any
            :class:`Operation.DataDefinition.DataType` can be used.

            """
            OPTIONAL = None
            """
            Indicates the value is an optional data type. Any value of this type can be
            null.

            """
            SECRET = None
            """
            Indicates the value is a secret data type. This is used for sensitive
            information. The server will not log any data of this type and if possible
            wipe the data from the memory after usage.

            """
            STRING = None
            """
            Indicates the value is a string data type. This is a unicode string.

            """
            STRUCTURE = None
            """
            Indicates the value is a structure data type. A structure has string
            identifier and a set of fields with corresponding values.

            """
            STRUCTURE_REF = None
            """
            Indicates the value is a structure reference. This is used to break
            circular dependencies in the type references. This just has a string
            identifier of the structure. Clients have to maintain a list of structures
            already visited and use that to resolve this reference.

            """
            VOID = None
            """
            Indicates the value is a void data type.

            """
            def __init__(self, string):
                """
                :type  string: :class:`str`
                :param string: String value for the :class:`DataType` instance.
                """
                Enum.__init__(string)

        DataType._set_values([
            DataType('BINARY'),
            DataType('BOOLEAN'),
            DataType('DOUBLE'),
            DataType('DYNAMIC_STRUCTURE'),
            DataType('ERROR'),
            DataType('ANY_ERROR'),
            DataType('LIST'),
            DataType('LONG'),
            DataType('OPAQUE'),
            DataType('OPTIONAL'),
            DataType('SECRET'),
            DataType('STRING'),
            DataType('STRUCTURE'),
            DataType('STRUCTURE_REF'),
            DataType('VOID'),
        ])
        DataType._set_binding_type(
            type.EnumType(
                'com.vmware.vapi.std.introspection.operation.data_definition.data_type',
                DataType))

    DataDefinition._set_binding_type(
        type.StructType(
            'com.vmware.vapi.std.introspection.operation.data_definition', {
                'type':
                type.ReferenceType(sys.modules[__name__],
                                   'Operation.DataDefinition.DataType'),
                'element_definition':
                type.OptionalType(
                    type.ReferenceType(sys.modules[__name__],
                                       'Operation.DataDefinition')),
                'name':
                type.OptionalType(type.StringType()),
                'fields':
                type.OptionalType(
                    type.MapType(
                        type.StringType(),
                        type.ReferenceType(sys.modules[__name__],
                                           'Operation.DataDefinition'))),
            }, DataDefinition, False, None))

    class Info(VapiStruct):
        """
        Information about a vAPI operation.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            input_definition=None,
            output_definition=None,
            error_definitions=None,
        ):
            """
            :type  input_definition: :class:`Operation.DataDefinition`
            :param input_definition: :class:`Operation.DataDefinition` describing the operation input. 
                
                The :attr:`Operation.DataDefinition.type` of this field will be
                :attr:`Operation.DataDefinition.DataType.STRUCTURE`. The keys of
                :attr:`Operation.DataDefinition.fields` are the names of the
                operation parameters, and the values of
                :attr:`Operation.DataDefinition.fields` describe the type of the
                operation parameters.
            :type  output_definition: :class:`Operation.DataDefinition`
            :param output_definition: :class:`Operation.DataDefinition` describing the operation output.
            :type  error_definitions: :class:`list` of :class:`Operation.DataDefinition`
            :param error_definitions: List of :class:`Operation.DataDefinition` describing the errors
                that the operation might report. 
                
                The :attr:`Operation.DataDefinition.type` of every element in this
                list will be :attr:`Operation.DataDefinition.DataType.ERROR`.
            """
            self.input_definition = input_definition
            self.output_definition = output_definition
            self.error_definitions = error_definitions
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vapi.std.introspection.operation.info', {
                'input_definition':
                type.ReferenceType(sys.modules[__name__],
                                   'Operation.DataDefinition'),
                'output_definition':
                type.ReferenceType(sys.modules[__name__],
                                   'Operation.DataDefinition'),
                'error_definitions':
                type.ListType(
                    type.ReferenceType(sys.modules[__name__],
                                       'Operation.DataDefinition')),
            }, Info, False, None))

    def list(
        self,
        service_id,
    ):
        """
        Returns the set of operation identifiers for a given vAPI service.

        :type  service_id: :class:`str`
        :param service_id: service identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.service``.
        :rtype: :class:`set` of :class:`str`
        :return: set of operation identifiers for a given vAPI service.
            The return value will contain identifiers for the resource type:
            ``com.vmware.vapi.operation``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the service identifier does not exist.
        """
        return self._invoke('list', {
            'service_id': service_id,
        })

    def get(
        self,
        service_id,
        operation_id,
    ):
        """
        Returns the :class:`Operation.Info` for a given vAPI operation.

        :type  service_id: :class:`str`
        :param service_id: service identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.service``.
        :type  operation_id: :class:`str`
        :param operation_id: operation identifier.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vapi.operation``.
        :rtype: :class:`Operation.Info`
        :return: :class:`Operation.Info` for a given vAPI operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the operation identifier does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the service identifier does not exist.
        """
        return self._invoke('get', {
            'service_id': service_id,
            'operation_id': operation_id,
        })
class Policy(VapiInterface):
    """
    The ``Policy`` class provides methods to configure the storage policies
    associated with the virtual machine home and/or its virtual disks. This
    class was added in vSphere API 6.7.
    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.vm.storage.policy'
    """
    Identifier of the service in canonical form.
    """
    def __init__(self, config):
        """
        :type  config: :class:`vmware.vapi.bindings.stub.StubConfiguration`
        :param config: Configuration to be used for creating the stub.
        """
        VapiInterface.__init__(self, config, _PolicyStub)

    class VmHomePolicySpec(VapiStruct):
        """
        The ``Policy.VmHomePolicySpec`` class provides a specification for the
        storage policy to be associated with the virtual machine home's directory.
        This class was added in vSphere API 6.7.

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

        _validator_list = [
            UnionValidator(
                'type',
                {
                    'USE_SPECIFIED_POLICY' : [('policy', True)],
                    'USE_DEFAULT_POLICY' : [],
                }
            ),
        ]



        def __init__(self,
                     type=None,
                     policy=None,
                    ):
            """
            :type  type: :class:`Policy.VmHomePolicySpec.PolicyType`
            :param type: Policy type to be used while performing update operation on the
                virtual machine home's directory. This attribute was added in
                vSphere API 6.7.
            :type  policy: :class:`str`
            :param policy: Storage Policy identification. This attribute was added in vSphere
                API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.StoragePolicy``. 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.StoragePolicy``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is
                :attr:`Policy.VmHomePolicySpec.PolicyType.USE_SPECIFIED_POLICY`.
            """
            self.type = type
            self.policy = policy
            VapiStruct.__init__(self)


        class PolicyType(Enum):
            """
            The ``Policy.VmHomePolicySpec.PolicyType`` class defines the choices for
            how to specify the policy to be associated with the virtual machine home's
            directory. This enumeration was added in vSphere API 6.7.

            .. 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 :ref:`enumerated
                type description page <enumeration_description>`.
            """
            USE_SPECIFIED_POLICY = None
            """
            Use the specified policy (see :attr:`Policy.VmHomePolicySpec.policy`). This
            class attribute was added in vSphere API 6.7.

            """
            USE_DEFAULT_POLICY = None
            """
            Use the default storage policy of the datastore. This class attribute was
            added in vSphere API 6.7.

            """

            def __init__(self, string):
                """
                :type  string: :class:`str`
                :param string: String value for the :class:`PolicyType` instance.
                """
                Enum.__init__(string)

        PolicyType._set_values([
            PolicyType('USE_SPECIFIED_POLICY'),
            PolicyType('USE_DEFAULT_POLICY'),
        ])
        PolicyType._set_binding_type(type.EnumType(
            'com.vmware.vcenter.vm.storage.policy.vm_home_policy_spec.policy_type',
            PolicyType))

    VmHomePolicySpec._set_binding_type(type.StructType(
        'com.vmware.vcenter.vm.storage.policy.vm_home_policy_spec', {
            'type': type.ReferenceType(__name__, 'Policy.VmHomePolicySpec.PolicyType'),
            'policy': type.OptionalType(type.IdType()),
        },
        VmHomePolicySpec,
        False,
        None))


    class DiskPolicySpec(VapiStruct):
        """
        The ``Policy.DiskPolicySpec`` class provides a specification for the
        storage policy to be associated with the virtual disks. This class was
        added in vSphere API 6.7.

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

        _validator_list = [
            UnionValidator(
                'type',
                {
                    'USE_SPECIFIED_POLICY' : [('policy', True)],
                    'USE_DEFAULT_POLICY' : [],
                }
            ),
        ]



        def __init__(self,
                     type=None,
                     policy=None,
                    ):
            """
            :type  type: :class:`Policy.DiskPolicySpec.PolicyType`
            :param type: Policy type to be used while performing update operation on the
                virtual disks. This attribute was added in vSphere API 6.7.
            :type  policy: :class:`str`
            :param policy: Storage Policy identification. This attribute was added in vSphere
                API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.StoragePolicy``. 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.StoragePolicy``.
                This attribute is optional and it is only relevant when the value
                of ``type`` is
                :attr:`Policy.DiskPolicySpec.PolicyType.USE_SPECIFIED_POLICY`.
            """
            self.type = type
            self.policy = policy
            VapiStruct.__init__(self)


        class PolicyType(Enum):
            """
            The ``Policy.DiskPolicySpec`` class defines the choices for how to specify
            the policy to be associated with a virtual disk. This enumeration was added
            in vSphere API 6.7.

            .. 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 :ref:`enumerated
                type description page <enumeration_description>`.
            """
            USE_SPECIFIED_POLICY = None
            """
            Use the specified policy (see :attr:`Policy.DiskPolicySpec.policy`). This
            class attribute was added in vSphere API 6.7.

            """
            USE_DEFAULT_POLICY = None
            """
            Use the default storage policy of the datastore. This class attribute was
            added in vSphere API 6.7.

            """

            def __init__(self, string):
                """
                :type  string: :class:`str`
                :param string: String value for the :class:`PolicyType` instance.
                """
                Enum.__init__(string)

        PolicyType._set_values([
            PolicyType('USE_SPECIFIED_POLICY'),
            PolicyType('USE_DEFAULT_POLICY'),
        ])
        PolicyType._set_binding_type(type.EnumType(
            'com.vmware.vcenter.vm.storage.policy.disk_policy_spec.policy_type',
            PolicyType))

    DiskPolicySpec._set_binding_type(type.StructType(
        'com.vmware.vcenter.vm.storage.policy.disk_policy_spec', {
            'type': type.ReferenceType(__name__, 'Policy.DiskPolicySpec.PolicyType'),
            'policy': type.OptionalType(type.IdType()),
        },
        DiskPolicySpec,
        False,
        None))


    class UpdateSpec(VapiStruct):
        """
        The ``Policy.UpdateSpec`` class describes the updates to be made to the
        storage policies associated with the virtual machine home and/or its
        virtual disks. This class was added in vSphere API 6.7.

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




        def __init__(self,
                     vm_home=None,
                     disks=None,
                    ):
            """
            :type  vm_home: :class:`Policy.VmHomePolicySpec` or ``None``
            :param vm_home: Storage policy to be used when reconfiguring the virtual machine
                home. This attribute was added in vSphere API 6.7.
                if None the current storage policy is retained.
            :type  disks: (:class:`dict` of :class:`str` and :class:`Policy.DiskPolicySpec`) or ``None``
            :param disks: Storage policy or policies to be used when reconfiguring virtual
                machine diks. This attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the key in
                the attribute :class:`dict` must be an identifier for the resource
                type: ``com.vmware.vcenter.vm.hardware.Disk``. When methods return
                a value of this class as a return value, the key in the attribute
                :class:`dict` will be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
                if None the current storage policy is retained.
            """
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)


    UpdateSpec._set_binding_type(type.StructType(
        'com.vmware.vcenter.vm.storage.policy.update_spec', {
            'vm_home': type.OptionalType(type.ReferenceType(__name__, 'Policy.VmHomePolicySpec')),
            'disks': type.OptionalType(type.MapType(type.IdType(), type.ReferenceType(__name__, 'Policy.DiskPolicySpec'))),
        },
        UpdateSpec,
        False,
        None))


    class Info(VapiStruct):
        """
        The ``Policy.Info`` class contains information about the storage policies
        associated with virtual machine's home directory and virtual hard disks.
        This class was added in vSphere API 6.7.

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




        def __init__(self,
                     vm_home=None,
                     disks=None,
                    ):
            """
            :type  vm_home: :class:`str` or ``None``
            :param vm_home: Storage Policy associated with virtual machine home. This attribute
                was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.StoragePolicy``. 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.StoragePolicy``.
                IfNone, the virtual machine's home directory doesn't have any
                storage policy.
            :type  disks: :class:`dict` of :class:`str` and :class:`str`
            :param disks: Storage policies associated with virtual disks. The values in this
                :class:`dict` are storage policy identifiers. They will be
                identifiers for the resource type:com.vmware.vcenter.StoragePolicy
                If the :class:`dict` is empty, the virtual machine does not have
                any disks or its disks are not associated with a storage policy.
                This attribute was added in vSphere API 6.7.
                When clients pass a value of this class as a parameter, the key in
                the attribute :class:`dict` must be an identifier for the resource
                type: ``com.vmware.vcenter.vm.hardware.Disk``. When methods return
                a value of this class as a return value, the key in the attribute
                :class:`dict` will be an identifier for the resource type:
                ``com.vmware.vcenter.vm.hardware.Disk``.
            """
            self.vm_home = vm_home
            self.disks = disks
            VapiStruct.__init__(self)


    Info._set_binding_type(type.StructType(
        'com.vmware.vcenter.vm.storage.policy.info', {
            'vm_home': type.OptionalType(type.IdType()),
            'disks': type.MapType(type.IdType(), type.StringType()),
        },
        Info,
        False,
        None))



    def update(self,
               vm,
               spec,
               ):
        """
        Updates the storage policy configuration of a virtual machine and/or
        its associated virtual hard disks. This method was added in vSphere API
        6.7.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier.
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :type  spec: :class:`Policy.UpdateSpec`
        :param spec: Storage Policy Specification for updating the virtual machine and
            virtual disks.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user doesn't have the required priveleges.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the storage policy specified is invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceBusy` 
            if the virtual machine or disk is busy performing another
            operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` 
            if the virtual machine or disk's configuration state cannot be
            accessed.
        """
        return self._invoke('update',
                            {
                            'vm': vm,
                            'spec': spec,
                            })

    def get(self,
            vm,
            ):
        """
        Returns Information about Storage Policy associated with a virtual
        machine's home directory and/or its virtual hard disks. This method was
        added in vSphere API 6.7.

        :type  vm: :class:`str`
        :param vm: Virtual machine identifier
            The parameter must be an identifier for the resource type:
            ``VirtualMachine``.
        :rtype: :class:`Policy.Info`
        :return: Overview of Storage Policy associated with a virtual machine's home
            directory and/or its associated virtual hard disks.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if the system reports an error while responding to the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.ResourceInaccessible` 
            if the virtual machine's configuration state cannot be accessed.
        :raise: :class:`com.vmware.vapi.std.errors_client.ServiceUnavailable` 
            if the system is unable to communicate with a service to complete
            the request.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the user does not have the required privileges.
        """
        return self._invoke('get',
                            {
                            'vm': vm,
                            })
Example #29
0
    def __init__(self, config):
        # properties for start operation
        start_input_type = type.StructType(
            'operation-input', {
                'service':
                type.IdType(
                    resource_types='com.vmware.appliance.vmon.Service'),
            })
        start_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType(com.vmware.vapi.std.errors_client,
                               'NotAllowedInCurrentState'),
            'com.vmware.vapi.std.errors.timed_out':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'TimedOut'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
        }
        start_input_validator_list = []
        start_output_validator_list = []

        # properties for stop operation
        stop_input_type = type.StructType(
            'operation-input', {
                'service':
                type.IdType(
                    resource_types='com.vmware.appliance.vmon.Service'),
            })
        stop_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType(com.vmware.vapi.std.errors_client,
                               'NotAllowedInCurrentState'),
        }
        stop_input_validator_list = []
        stop_output_validator_list = []

        # properties for restart operation
        restart_input_type = type.StructType(
            'operation-input', {
                'service':
                type.IdType(
                    resource_types='com.vmware.appliance.vmon.Service'),
            })
        restart_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
            'com.vmware.vapi.std.errors.timed_out':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'TimedOut'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType(com.vmware.vapi.std.errors_client,
                               'NotAllowedInCurrentState'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
        }
        restart_input_validator_list = []
        restart_output_validator_list = []

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'service':
                type.IdType(
                    resource_types='com.vmware.appliance.vmon.Service'),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
        }
        get_input_validator_list = []
        get_output_validator_list = []

        # properties for update operation
        update_input_type = type.StructType(
            'operation-input', {
                'service':
                type.IdType(
                    resource_types='com.vmware.appliance.vmon.Service'),
                'spec':
                type.ReferenceType(sys.modules[__name__],
                                   'Service.UpdateSpec'),
            })
        update_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType(com.vmware.vapi.std.errors_client,
                               'NotAllowedInCurrentState'),
        }
        update_input_validator_list = []
        update_output_validator_list = []

        # properties for list_details operation
        list_details_input_type = type.StructType('operation-input', {})
        list_details_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
        }
        list_details_input_validator_list = []
        list_details_output_validator_list = []

        operations = {
            'start': {
                'input_type': start_input_type,
                'output_type': type.VoidType(),
                'errors': start_error_dict,
                'input_validator_list': start_input_validator_list,
                'output_validator_list': start_output_validator_list,
            },
            'stop': {
                'input_type': stop_input_type,
                'output_type': type.VoidType(),
                'errors': stop_error_dict,
                'input_validator_list': stop_input_validator_list,
                'output_validator_list': stop_output_validator_list,
            },
            'restart': {
                'input_type': restart_input_type,
                'output_type': type.VoidType(),
                'errors': restart_error_dict,
                'input_validator_list': restart_input_validator_list,
                'output_validator_list': restart_output_validator_list,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType(sys.modules[__name__], 'Service.Info'),
                'errors':
                get_error_dict,
                'input_validator_list':
                get_input_validator_list,
                'output_validator_list':
                get_output_validator_list,
            },
            'update': {
                'input_type': update_input_type,
                'output_type': type.VoidType(),
                'errors': update_error_dict,
                'input_validator_list': update_input_validator_list,
                'output_validator_list': update_output_validator_list,
            },
            'list_details': {
                'input_type':
                list_details_input_type,
                'output_type':
                type.MapType(
                    type.IdType(),
                    type.ReferenceType(sys.modules[__name__], 'Service.Info')),
                'errors':
                list_details_error_dict,
                'input_validator_list':
                list_details_input_validator_list,
                'output_validator_list':
                list_details_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.vmon.service',
            config=config,
            operations=operations)
            :class:`dict` is the identifier of the component and the value is
            the aggregated :class:`ComponentInfo`.
            When clients pass a value of this class as a parameter, the key in
            the attribute :class:`dict` must be an identifier for the resource
            type: ``com.vmware.vapi.component``. When methods return a value of
            this class as a return value, the key in the attribute
            :class:`dict` will be an identifier for the resource type:
            ``com.vmware.vapi.component``.
        """
        self.version = version
        self.metadata = metadata
        VapiStruct.__init__(self)


MetadataInfo._set_binding_type(
    type.StructType(
        'com.vmware.vapi.metadata_info', {
            'version':
            type.StringType(),
            'metadata':
            type.MapType(type.IdType(),
                         type.ReferenceType(__name__, 'ComponentInfo')),
        }, MetadataInfo, False, None))


class StubFactory(StubFactoryBase):
    _attrs = {
        'metadata': 'com.vmware.vapi.metadata_client.StubFactory',
        'std': 'com.vmware.vapi.std_client.StubFactory',
    }