Source code for com.vmware.appliance.techpreview.services_client

# -*- coding: utf-8 -*-
# Copyright 2016 VMware, Inc.  All rights reserved.

# vAPI stub file for package



__author__ = 'VMware, Inc.'
__docformat__ = 'restructuredtext en'

import sys

from vmware.vapi.bindings import type
from vmware.vapi.bindings.converter import TypeConverter
from vmware.vapi.bindings.enum import Enum
from vmware.vapi.bindings.error import VapiError
from vmware.vapi.bindings.struct import VapiStruct
from vmware.vapi.bindings.stub import VapiInterface, ApiInterfaceStub
from vmware.vapi.bindings.common import raise_core_exception
from import UnionValidator, HasFieldsOfValidator
from vmware.vapi.exception import CoreException
import com.vmware.vapi.std.errors_client

[docs]class Status(VapiInterface): """ ``Status`` class provides methods Get status of a 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, _StatusStub)
[docs] class ServiceStatus(Enum): """ ``Status.ServiceStatus`` class Defines service status .. 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>`. """ down = None """ Service is not running. """ up = None """ Service is running. """ def __init__(self, string): """ :type string: :class:`str` :param string: String value for the :class:`ServiceStatus` instance. """ Enum.__init__(string)
ServiceStatus._set_values([ ServiceStatus('down'), ServiceStatus('up'), ]) ServiceStatus._set_binding_type(type.EnumType( '', ServiceStatus))
[docs] def get(self, name, timeout, ): """ Get status of a service. :type name: :class:`str` :param name: Name of a service. :type timeout: :class:`long` :param timeout: Timeout in seconds. Zero (0) means no timeout. :rtype: :class:`Status.ServiceStatus` :return: Status of the service. :raise: :class:`com.vmware.vapi.std.errors_client.Error` Generic error """ return self._invoke('get', { 'name': name, 'timeout': timeout, })
class _StatusStub(ApiInterfaceStub): def __init__(self, config): # properties for get operation get_input_type = type.StructType('operation-input', { 'name': type.StringType(), 'timeout': type.IntegerType(), }) get_error_dict = { 'com.vmware.vapi.std.errors.error': type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'), } get_input_validator_list = [ ] get_output_validator_list = [ ] operations = { 'get': { 'input_type': get_input_type, 'output_type': type.ReferenceType(sys.modules[__name__], 'Status.ServiceStatus'), 'errors': get_error_dict, 'input_validator_list': get_input_validator_list, 'output_validator_list': get_output_validator_list, }, } ApiInterfaceStub.__init__(self, iface_name='', config=config, operations=operations)