Exemplo n.º 1
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {}
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = None

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.ListType(type.IdType()),
                '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.vapi.metadata.metamodel.service.hidden',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 2
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)
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType('operation-input', {
            'org': type.StringType(),
            'sddc': type.StringType(),
        })
        get_error_dict = {
            '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.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template=
            '/vmc/draas/api/orgs/{org}/sddcs/{sddc}/site-recovery/vr-site-issues',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType('com.vmware.vmc.draas.model_client',
                                       'HmsSiteIssueInfo')),
                '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.vmc.draas.vr_site_issues',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Exemplo n.º 4
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'service_id': type.IdType(resource_types='com.vmware.vapi.service'),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'NotFound'),

        }
        list_input_value_validator_list = [
        ]
        list_output_validator_list = [
        ]
        list_rest_metadata = None

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

        }
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
        ]
        get_rest_metadata = None

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.ListType(type.IdType()),
                '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('com.vmware.vapi.metadata.routing_client', 'OperationInfo'),
                '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 = {
            'list': list_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vapi.metadata.routing.service.operation',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 5
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'filter':
            type.ReferenceType(__name__, 'Compliance.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'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/storage/policies/entities/compliance',
            path_variables={},
            query_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(__name__, 'Compliance.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 = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.storage.policies.compliance',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 6
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'filter':
                type.OptionalType(
                    type.ReferenceType(__name__, 'BaseImages.FilterSpec')),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType('com.vmware.vapi.std.errors_client', 'Error'),
            '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/settings/depot-content/base-images',
            path_variables={},
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(__name__, 'BaseImages.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 = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.esx.settings.depot_content.base_images',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 7
0
    def __init__(self, config):
        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'org': type.StringType(),
                'sddc': type.OptionalType(type.StringType()),
            })
        get_error_dict = {
            '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='/vmc/api/orgs/{org}/account-link/sddc-connections',
            path_variables={
                'org': 'org',
            },
            query_parameters={
                'sddc': 'sddc',
            },
            content_type='application/json')

        operations = {
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType('com.vmware.vmc.model_client',
                                       'AwsSddcConnection')),
                '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.vmc.orgs.account_link.sddc_connections',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
    def list_task(
        self,
        cluster,
        provider,
        spec=None,
    ):
        """
        Return the remote server certificates. 
        
        Contacts the configured key servers and attempts to retrieve their
        certificates. These certificates might not yet be trusted. 
        
        If the returned certificates are to be considered trustworthy, then it
        must be added to the list of trusted server certificates by adding to
        the certificates returned by :func:`TrustedPeerCertificates.get` and
        invoking :func:`TrustedPeerCertificates.update` with the updated
        :class:`list` of certificates.. This method was added in vSphere API
        7.0.0.0.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  provider: :class:`str`
        :param provider: Identifier of the provider.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider``.
        :type  spec: :class:`CurrentPeerCertificates.FilterSpec` or ``None``
        :param spec: Filter spec.
            If None, the behavior is equivalent to a
            :class:`CurrentPeerCertificates.FilterSpec` with all attributes
            None
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            If the cluster or provider id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the cluster or provider is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            For any other error.
        """
        task_id = self._invoke('list$task', {
            'cluster': cluster,
            'provider': provider,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ListType(
                type.ReferenceType(__name__,
                                   'CurrentPeerCertificates.Summary')))
        return task_instance
Exemplo n.º 9
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'service_id':
            type.IdType(resource_types='com.vmware.vapi.service'),
        })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'NotFound'),
        }
        list_input_validator_list = []
        list_output_validator_list = []

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

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.ListType(type.IdType()),
                'errors': list_error_dict,
                'input_validator_list': list_input_validator_list,
                'output_validator_list': list_output_validator_list,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType(com.vmware.vapi.metadata.metamodel_client,
                                   'OperationInfo'),
                'errors':
                get_error_dict,
                'input_validator_list':
                get_input_validator_list,
                'output_validator_list':
                get_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vapi.metadata.metamodel.service.operation',
            config=config,
            operations=operations)
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {
            'org': type.StringType(),
        })
        list_error_dict = {
            '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.internal_server_error':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InternalServerError'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vmc/api/orgs/{org}/subscriptions/products',
            path_variables={
                'org': 'org',
            },
            query_parameters={},
            content_type='application/json')

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType('com.vmware.vmc.model_client',
                                       'SubscriptionProducts')),
                '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.vmc.orgs.subscriptions.products',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=False)
Exemplo n.º 11
0
    def __init__(self, config):
        # properties for test operation
        test_input_type = type.StructType(
            'operation-input', {
                'servers': type.ListType(type.StringType()),
            })
        test_error_dict = {
            'com.vmware.vapi.std.errors.error':
            type.ReferenceType(com.vmware.vapi.std.errors_client, 'Error'),
        }
        test_input_validator_list = []
        test_output_validator_list = []

        # 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_validator_list = []
        get_output_validator_list = []

        operations = {
            'test': {
                'input_type':
                test_input_type,
                'output_type':
                type.ReferenceType(sys.modules[__name__],
                                   'Ntp.TestStatusInfo'),
                'errors':
                test_error_dict,
                'input_validator_list':
                test_input_validator_list,
                'output_validator_list':
                test_output_validator_list,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType(sys.modules[__name__], 'Ntp.NTPConfig'),
                'errors':
                get_error_dict,
                'input_validator_list':
                get_input_validator_list,
                'output_validator_list':
                get_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.techpreview.ntp',
            config=config,
            operations=operations)
    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'),
            '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/settings/hardware-support/managers',
            path_variables={},
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(__name__,
                                       'Managers.HardwareSupportManagerInfo')),
                '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.settings.hardware_support.managers',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 13
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'vm': type.IdType(resource_types='VirtualMachine'),
            })
        list_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'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vcenter/vm/{vm}/guest/networking/routes',
            path_variables={
                'vm': 'vm',
            },
            query_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(type.ReferenceType(__name__, 'Routes.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.vm.guest.networking.routes',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 14
0
    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_validator_list = []
        list_output_validator_list = []

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'id':
                type.IdType(
                    resource_types='com.vmware.appliance.recovery.backup.parts'
                ),
            })
        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 = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(sys.modules[__name__], 'Parts.Part')),
                'errors':
                list_error_dict,
                'input_validator_list':
                list_input_validator_list,
                'output_validator_list':
                list_output_validator_list,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.IntegerType(),
                'errors': get_error_dict,
                'input_validator_list': get_input_validator_list,
                'output_validator_list': get_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.recovery.backup.parts',
            config=config,
            operations=operations)
    def __init__(self, config):
        # properties for get_storage_specs operation
        get_storage_specs_input_type = type.StructType('operation-input', {
            'org': type.StringType(),
            'sddc': type.StringType(),
            'cluster': type.StringType(),
            'esx': type.StringType(),
        })
        get_storage_specs_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'),

        }
        get_storage_specs_input_value_validator_list = [
        ]
        get_storage_specs_output_validator_list = [
        ]
        get_storage_specs_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/vmc/api/orgs/{org}/sddcs/{sddc}/clusters/{cluster}/esxs/{esx}/storage-spec',
            path_variables={
                'org': 'org',
                'sddc': 'sddc',
                'cluster': 'cluster',
                'esx': 'esx',
            },
            query_parameters={
            },
            content_type='application/json'
        )

        operations = {
            'get_storage_specs': {
                'input_type': get_storage_specs_input_type,
                'output_type': type.ListType(type.ReferenceType('com.vmware.vmc.model_client', 'VsanDiskgroupMapping')),
                'errors': get_storage_specs_error_dict,
                'input_value_validator_list': get_storage_specs_input_value_validator_list,
                'output_validator_list': get_storage_specs_output_validator_list,
                'task_type': TaskType.NONE,
            },
        }
        rest_metadata = {
            'get_storage_specs': get_storage_specs_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.vmc.orgs.sddcs.clusters.esxs.storage_spec',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=False)
Exemplo n.º 16
0
    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'),
            '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='/vcenter/namespaces-user/namespaces',
            path_variables={},
            query_parameters={},
            dispatch_parameters={},
            header_parameters={},
            dispatch_header_parameters={})

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(type.ReferenceType(__name__,
                                                 'Instances.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 = {
            'list': list_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vcenter.namespaces.user.instances',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
Exemplo n.º 17
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)
Exemplo n.º 18
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)
Exemplo n.º 19
0
    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_validator_list = []
        list_output_validator_list = []

        # 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_validator_list = []
        resize_output_validator_list = []

        operations = {
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(
                    type.ReferenceType(sys.modules[__name__],
                                       'Storage.StorageMapping')),
                'errors':
                list_error_dict,
                'input_validator_list':
                list_input_validator_list,
                'output_validator_list':
                list_output_validator_list,
            },
            'resize': {
                'input_type': resize_input_type,
                'output_type': type.VoidType(),
                'errors': resize_error_dict,
                'input_validator_list': resize_input_validator_list,
                'output_validator_list': resize_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.appliance.system.storage',
            config=config,
            operations=operations)
Exemplo n.º 20
0
    def __init__(self, config):
        # properties for list operation
        list_input_type = type.StructType('operation-input', {})
        list_error_dict = {}
        list_input_validator_list = []
        list_output_validator_list = []

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

        operations = {
            'list': {
                'input_type': list_input_type,
                'output_type': type.ListType(type.IdType()),
                'errors': list_error_dict,
                'input_validator_list': list_input_validator_list,
                'output_validator_list': list_output_validator_list,
            },
            'get': {
                'input_type':
                get_input_type,
                'output_type':
                type.ReferenceType(sys.modules[__name__], 'PackageInfo'),
                'errors':
                get_error_dict,
                'input_validator_list':
                get_input_validator_list,
                'output_validator_list':
                get_output_validator_list,
            },
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.vapi.metadata.privilege.package',
            config=config,
            operations=operations)
Exemplo n.º 21
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)
Exemplo n.º 23
0
    def list_task(
        self,
        cluster,
        spec=None,
    ):
        """
        Return a list of trusted ESX base images. This method was added in
        vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The id of the cluster on which the operation will be executed.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`BaseImages.FilterSpec` or ``None``
        :param spec: The search specification.
            if {\\\\@term.unset} return all information.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the cluster id is empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the cluster is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the caller is not authenticated.
        """
        task_id = self._invoke('list$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ListType(type.ReferenceType(__name__, 'BaseImages.Summary')))
        return task_instance
Exemplo n.º 24
0
    def list_task(
        self,
        cluster,
        spec=None,
    ):
        """
        Lists all policies configured on a specific cluster. This method was
        added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: The ID of the Trust Authority Cluster on which the profile is
            configured.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  spec: :class:`ConsumerPrincipals.FilterSpec` or ``None``
        :param spec: A FilterSpec specifying the profiles to be listed.
            If {\\\\@term.unset} return all policies.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is a generic error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no profile configured with that ID.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        """
        task_id = self._invoke('list$task', {
            'cluster': cluster,
            'spec': spec,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(
            task_id, task_svc,
            type.ListType(
                type.ReferenceType(__name__, 'ConsumerPrincipals.Summary')))
        return task_instance
    def __init__(self, config):
        # properties for validate operation
        validate_input_type = type.StructType(
            'operation-input', {
                'update_session_id':
                type.IdType(resource_types=
                            'com.vmware.content.library.item.UpdateSession'),
            })
        validate_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'),
        }
        validate_input_value_validator_list = []
        validate_output_validator_list = []
        validate_rest_metadata = None

        # properties for add operation
        add_input_type = type.StructType(
            'operation-input', {
                'update_session_id':
                type.IdType(resource_types=
                            'com.vmware.content.library.item.UpdateSession'),
                'file_spec':
                type.ReferenceType(__name__, 'File.AddSpec'),
            })
        add_error_dict = {
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.unauthorized':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'Unauthorized'),
            'com.vmware.vapi.std.errors.not_allowed_in_current_state':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotAllowedInCurrentState'),
        }
        add_input_value_validator_list = []
        add_output_validator_list = []
        add_rest_metadata = None

        # properties for remove operation
        remove_input_type = type.StructType(
            'operation-input', {
                'update_session_id':
                type.IdType(resource_types=
                            'com.vmware.content.library.item.UpdateSession'),
                'file_name':
                type.StringType(),
            })
        remove_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
        }
        remove_input_value_validator_list = []
        remove_output_validator_list = []
        remove_rest_metadata = None

        # properties for list operation
        list_input_type = type.StructType(
            'operation-input', {
                'update_session_id':
                type.IdType(resource_types=
                            'com.vmware.content.library.item.UpdateSession'),
            })
        list_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
        }
        list_input_value_validator_list = []
        list_output_validator_list = []
        list_rest_metadata = None

        # properties for get operation
        get_input_type = type.StructType(
            'operation-input', {
                'update_session_id':
                type.IdType(resource_types=
                            'com.vmware.content.library.item.UpdateSession'),
                'file_name':
                type.StringType(),
            })
        get_error_dict = {
            'com.vmware.vapi.std.errors.not_found':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'NotFound'),
            'com.vmware.vapi.std.errors.invalid_argument':
            type.ReferenceType('com.vmware.vapi.std.errors_client',
                               'InvalidArgument'),
        }
        get_input_value_validator_list = []
        get_output_validator_list = []
        get_rest_metadata = None

        operations = {
            'validate': {
                'input_type':
                validate_input_type,
                'output_type':
                type.ReferenceType(__name__, 'File.ValidationResult'),
                'errors':
                validate_error_dict,
                'input_value_validator_list':
                validate_input_value_validator_list,
                'output_validator_list':
                validate_output_validator_list,
                'task_type':
                TaskType.NONE,
            },
            'add': {
                'input_type': add_input_type,
                'output_type': type.ReferenceType(__name__, 'File.Info'),
                'errors': add_error_dict,
                'input_value_validator_list': add_input_value_validator_list,
                'output_validator_list': add_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'remove': {
                'input_type': remove_input_type,
                'output_type': type.VoidType(),
                'errors': remove_error_dict,
                'input_value_validator_list':
                remove_input_value_validator_list,
                'output_validator_list': remove_output_validator_list,
                'task_type': TaskType.NONE,
            },
            'list': {
                'input_type':
                list_input_type,
                'output_type':
                type.ListType(type.ReferenceType(__name__, 'File.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,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ReferenceType(__name__, 'File.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 = {
            'validate': validate_rest_metadata,
            'add': add_rest_metadata,
            'remove': remove_rest_metadata,
            'list': list_rest_metadata,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self,
            iface_name='com.vmware.content.library.item.updatesession.file',
            config=config,
            operations=operations,
            rest_metadata=rest_metadata,
            is_vapi_rest=True)
class File(VapiInterface):
    """
    The ``File`` class provides methods for accessing files within an update
    session. 
    
    After an update session is created against a library item, the ``File``
    class can be used to make changes to the underlying library item metadata
    as well as the content of the files. The following changes can be made: 
    
    * deleting an existing file within the library item. This deletes both the
      metadata and the content.
    * updating an existing file with new content.
    * adding a new file to the library item.
    
     
    
    The above changes are not applied or visible until the session is
    completed. See
    :class:`com.vmware.content.library.item_client.UpdateSession`.
    """

    _VAPI_SERVICE_ID = 'com.vmware.content.library.item.updatesession.file'
    """
    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, _FileStub)

    class SourceType(Enum):
        """
        The ``File.SourceType`` class defines how the file content is retrieved.

        .. 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>`.
        """
        NONE = None
        """
        No source type has been requested.

        """
        PUSH = None
        """
        The client is uploading content using HTTP(S) PUT requests.

        """
        PULL = None
        """
        The server is pulling content from a URL. The URL scheme can be ``http``,
        ``https``, ``file``, or ``ds``.

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

    SourceType._set_values([
        SourceType('NONE'),
        SourceType('PUSH'),
        SourceType('PULL'),
    ])
    SourceType._set_binding_type(
        type.EnumType(
            'com.vmware.content.library.item.updatesession.file.source_type',
            SourceType))

    class AddSpec(VapiStruct):
        """
        The ``File.AddSpec`` class describes the properties of the file to be
        uploaded.

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

        _validator_list = [
            UnionValidator('source_type', {
                'PULL': [('source_endpoint', True)],
                'NONE': [],
                'PUSH': [],
            }),
        ]

        def __init__(
            self,
            name=None,
            source_type=None,
            source_endpoint=None,
            size=None,
            checksum_info=None,
        ):
            """
            :type  name: :class:`str`
            :param name: The name of the file being uploaded.
            :type  source_type: :class:`File.SourceType`
            :param source_type: The source type (NONE, PUSH, PULL) from which the file content will
                be retrieved.
            :type  source_endpoint: :class:`com.vmware.content.library.item_client.TransferEndpoint`
            :param source_endpoint: Location from which the Content Library Service will fetch the
                file, rather than requiring a client to upload the file.
                This attribute is optional and it is only relevant when the value
                of ``sourceType`` is :attr:`File.SourceType.PULL`.
            :type  size: :class:`long` or ``None``
            :param size: The file size, in bytes.
                If None, the server will not verify it received the correct size.
            :type  checksum_info: :class:`com.vmware.content.library.item_client.File.ChecksumInfo` or ``None``
            :param checksum_info: The checksum of the file. If specified, the server will verify the
                checksum once the file is received. If there is a mismatch, the
                upload will fail. For ova files, this value should not be set.
                If None, the server will not verify the checksum.
            """
            self.name = name
            self.source_type = source_type
            self.source_endpoint = source_endpoint
            self.size = size
            self.checksum_info = checksum_info
            VapiStruct.__init__(self)

    AddSpec._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.add_spec', {
                'name':
                type.StringType(),
                'source_type':
                type.ReferenceType(__name__, 'File.SourceType'),
                'source_endpoint':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'TransferEndpoint')),
                'size':
                type.OptionalType(type.IntegerType()),
                'checksum_info':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'File.ChecksumInfo')),
            }, AddSpec, False, None))

    class Info(VapiStruct):
        """
        The ``File.Info`` class defines the uploaded file.

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

        _validator_list = [
            UnionValidator(
                'source_type', {
                    'PULL': [('source_endpoint', True)],
                    'PUSH': [('upload_endpoint', True)],
                    'NONE': [],
                }),
        ]

        def __init__(
            self,
            name=None,
            source_type=None,
            size=None,
            checksum_info=None,
            source_endpoint=None,
            upload_endpoint=None,
            bytes_transferred=None,
            status=None,
            error_message=None,
            keep_in_storage=None,
        ):
            """
            :type  name: :class:`str`
            :param name: The name of the file.
            :type  source_type: :class:`File.SourceType`
            :param source_type: The source type (NONE, PUSH, PULL) from which the file is being
                retrieved. This may be :attr:`File.SourceType.NONE` if the file is
                not being changed.
            :type  size: :class:`long` or ``None``
            :param size: The file size, in bytes as received by the server. This attribute
                is guaranteed to be set when the server has completely received the
                file.
                This attribute won't be set until the file status is
                :attr:`com.vmware.content.library.item_client.TransferStatus.READY`.
            :type  checksum_info: :class:`com.vmware.content.library.item_client.File.ChecksumInfo` or ``None``
            :param checksum_info: The checksum information of the file received by the server.
                If None, the server does not verify the checksum.
            :type  source_endpoint: :class:`com.vmware.content.library.item_client.TransferEndpoint`
            :param source_endpoint: A source endpoint from which to retrieve the file.
                This attribute is optional and it is only relevant when the value
                of ``sourceType`` is :attr:`File.SourceType.PULL`.
            :type  upload_endpoint: :class:`com.vmware.content.library.item_client.TransferEndpoint`
            :param upload_endpoint: An upload endpoint to which the client can push the content.
                This attribute is optional and it is only relevant when the value
                of ``sourceType`` is :attr:`File.SourceType.PUSH`.
            :type  bytes_transferred: :class:`long`
            :param bytes_transferred: The number of bytes of this file that have been received by the
                server.
            :type  status: :class:`com.vmware.content.library.item_client.TransferStatus`
            :param status: The transfer status (WAITING_FOR_TRANSFER, TRANSFERRING, READY,
                VALIDATING, ERROR) of this file.
            :type  error_message: :class:`com.vmware.vapi.std_client.LocalizableMessage` or ``None``
            :param error_message: Details about the transfer error.
                An error message is set if the status is
                :attr:`com.vmware.content.library.item_client.TransferStatus.ERROR`.
            :type  keep_in_storage: :class:`bool` or ``None``
            :param keep_in_storage: Whether or not the file will be kept in storage upon update session
                completion. The flag is true for most files, and false for metadata
                files such as manifest and certificate file of update session with
                library item type OVF. Any file with
                :attr:`File.Info.keep_in_storage` set to false will not show up in
                the list of files returned from
                :func:`com.vmware.content.library.item_client.File.list` upon
                update session completion. This attribute was added in vSphere API
                6.8.
                If None, the file will be kept in storage upon update session
                completion.
            """
            self.name = name
            self.source_type = source_type
            self.size = size
            self.checksum_info = checksum_info
            self.source_endpoint = source_endpoint
            self.upload_endpoint = upload_endpoint
            self.bytes_transferred = bytes_transferred
            self.status = status
            self.error_message = error_message
            self.keep_in_storage = keep_in_storage
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.info', {
                'name':
                type.StringType(),
                'source_type':
                type.ReferenceType(__name__, 'File.SourceType'),
                'size':
                type.OptionalType(type.IntegerType()),
                'checksum_info':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'File.ChecksumInfo')),
                'source_endpoint':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'TransferEndpoint')),
                'upload_endpoint':
                type.OptionalType(
                    type.ReferenceType(
                        'com.vmware.content.library.item_client',
                        'TransferEndpoint')),
                'bytes_transferred':
                type.IntegerType(),
                'status':
                type.ReferenceType('com.vmware.content.library.item_client',
                                   'TransferStatus'),
                'error_message':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vapi.std_client',
                                       'LocalizableMessage')),
                'keep_in_storage':
                type.OptionalType(type.BooleanType()),
            }, Info, False, None))

    class ValidationError(VapiStruct):
        """
        The ``File.ValidationError`` class defines the validation error of a file
        in the session.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            name=None,
            error_message=None,
        ):
            """
            :type  name: :class:`str`
            :param name: The name of the file.
            :type  error_message: :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param error_message: A message indicating why the file was considered invalid.
            """
            self.name = name
            self.error_message = error_message
            VapiStruct.__init__(self)

    ValidationError._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.validation_error',
            {
                'name':
                type.StringType(),
                'error_message':
                type.ReferenceType('com.vmware.vapi.std_client',
                                   'LocalizableMessage'),
            }, ValidationError, False, None))

    class ValidationResult(VapiStruct):
        """
        The ``File.ValidationResult`` class defines the result of validating the
        files in the session.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            has_errors=None,
            missing_files=None,
            invalid_files=None,
        ):
            """
            :type  has_errors: :class:`bool`
            :param has_errors: Whether the validation was succesful or not. In case of errors, the
                :attr:`File.ValidationResult.missing_files` and
                :attr:`File.ValidationResult.invalid_files` will contain at least
                one entry.
            :type  missing_files: :class:`set` of :class:`str`
            :param missing_files: A :class:`set` containing the names of the files that are required
                but the client hasn't added.
            :type  invalid_files: :class:`list` of :class:`File.ValidationError`
            :param invalid_files: A :class:`list` containing the files that have been identified as
                invalid and details about the error.
            """
            self.has_errors = has_errors
            self.missing_files = missing_files
            self.invalid_files = invalid_files
            VapiStruct.__init__(self)

    ValidationResult._set_binding_type(
        type.StructType(
            'com.vmware.content.library.item.updatesession.file.validation_result',
            {
                'has_errors':
                type.BooleanType(),
                'missing_files':
                type.SetType(type.StringType()),
                'invalid_files':
                type.ListType(
                    type.ReferenceType(__name__, 'File.ValidationError')),
            }, ValidationResult, False, None))

    def validate(
        self,
        update_session_id,
    ):
        """
        Validates the files in the update session with the referenced
        identifier and ensures all necessary files are received. In the case
        where a file is missing, this method will return its name in the
        :attr:`File.ValidationResult.missing_files` set. The user can add the
        missing files and try re-validating. For other type of errors,
        :attr:`File.ValidationResult.invalid_files` will contain the list of
        invalid files.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session to validate.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :rtype: :class:`File.ValidationResult`
        :return: A validation result containing missing files or invalid files and
            the reason why they are invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if no update session with the given identifier exists.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the update session is not in the
            :attr:`com.vmware.content.library.item_client.UpdateSessionModel.State.ACTIVE`
            state, or if some of the files that will be uploaded by the client
            aren't received correctly.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('validate', {
            'update_session_id': update_session_id,
        })

    def add(
        self,
        update_session_id,
        file_spec,
    ):
        """
        Requests file content to be changed (either created, or updated).
        Depending on the source type of the file, this method will either
        return an upload endpoint where the client can push the content, or the
        server will pull from the provided source endpoint. If a file with the
        same name already exists in this session, this method will be used to
        update the content of the existing file. 
        
        When importing a file directly from storage, where the source endpoint
        is a file or datastore URI, you will need to have the
        ContentLibrary.ReadStorage privilege on the library item. If the file
        is located in the same directory as the library storage backing folder,
        the server will move the file instead of copying it, thereby allowing
        instantaneous import of files for efficient backup and restore
        scenarios. In all other cases, a copy is performed rather than a move.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session to be modified.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :type  file_spec: :class:`File.AddSpec`
        :param file_spec: Specification for the file that needs to be added or updated. This
            includes whether the client wants to push the content or have the
            server pull it.
        :rtype: :class:`File.Info`
        :return: An :class:`File.Info` class containing upload links as well as
            server side state tracking the transfer of the file.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
             if the ``file_spec`` is invalid.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized` 
            if the caller doesn't have ContentLibrary.ReadStorage privilege on
            the library item of the update session and source type
            :attr:`File.SourceType.PULL` is requested for a file or datastore
            source endpoint (that is, not HTTP or HTTPs based endpoint).
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the content of the library item associated with the update
            session has been deleted from the storage backings (see null)
            associated with it.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if metadata files such as manifest and certificate file are added
            after the OVF descriptor file. This is applicable to update
            sessions with library item type OVF only. This error was added in
            vSphere 6.8.0.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('add', {
            'update_session_id': update_session_id,
            'file_spec': file_spec,
        })

    def remove(
        self,
        update_session_id,
        file_name,
    ):
        """
        Requests a file to be removed. The file will only be effectively
        removed when the update session is completed.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :type  file_name: :class:`str`
        :param file_name:  Name of the file to be removed.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the file doesn't exist in the library item associated with the
            update session.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('remove', {
            'update_session_id': update_session_id,
            'file_name': file_name,
        })

    def list(
        self,
        update_session_id,
    ):
        """
        Lists all files in the library item associated with the update session.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :rtype: :class:`list` of :class:`File.Info`
        :return: The :class:`list` of the files in the library item associated with
            the update session. This :class:`list` may be empty if the caller
            has removed all the files as part of this session (in which case
            completing the update session will result in an empty library
            item).
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('list', {
            'update_session_id': update_session_id,
        })

    def get(
        self,
        update_session_id,
        file_name,
    ):
        """
        Retrieves information about a specific file in the snapshot of the
        library item at the time when the update session was created.

        :type  update_session_id: :class:`str`
        :param update_session_id:  Identifier of the update session.
            The parameter must be an identifier for the resource type:
            ``com.vmware.content.library.item.UpdateSession``.
        :type  file_name: :class:`str`
        :param file_name:  Name of the file.
        :rtype: :class:`File.Info`
        :return: Information about the file.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
             if the update session doesn't exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            if the file doesn't exist in the library item associated with the
            update session.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthorized`
            if you do not have all of the privileges described as follows: 
            
            * Method execution requires ``System.Anonymous``.
        """
        return self._invoke('get', {
            'update_session_id': update_session_id,
            'file_name': file_name,
        })
    State._set_binding_type(
        type.EnumType(
            'com.vmware.content.library.item.updatesession.preview_info.state',
            State))


PreviewInfo._set_binding_type(
    type.StructType(
        'com.vmware.content.library.item.updatesession.preview_info', {
            'state':
            type.ReferenceType(__name__, 'PreviewInfo.State'),
            'certificate_info':
            type.OptionalType(type.ReferenceType(__name__, 'CertificateInfo')),
            'warnings':
            type.OptionalType(
                type.ListType(
                    type.ReferenceType(__name__, 'PreviewWarningInfo'))),
        }, PreviewInfo, False, None))


class PreviewWarningInfo(VapiStruct):
    """
    The ``PreviewWarningInfo`` class provides information about the warnings
    which are raised during the update session preview. This class was added in
    vSphere API 6.8.

    .. tip::
        The arguments are used to initialize data attributes with the same
        names.
    """
    def __init__(
        self,
Exemplo n.º 28
0
    def __init__(self, config):
        # properties for test operation
        test_input_type = type.StructType('operation-input', {
            'send_test_message': type.OptionalType(type.BooleanType()),
        })
        test_error_dict = {}
        test_input_value_validator_list = [
        ]
        test_output_validator_list = [
        ]
        test_rest_metadata = OperationRestMetadata(
            http_method='POST',
            url_template='/appliance/logging/forwarding?action=test',
            path_variables={
            },
            query_parameters={
            }
        )

        # properties for set operation
        set_input_type = type.StructType('operation-input', {
            'cfg_list': type.ListType(type.ReferenceType(__name__, 'Forwarding.Config')),
        })
        set_error_dict = {
            'com.vmware.vapi.std.errors.invalid_argument':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'InvalidArgument'),
            'com.vmware.vapi.std.errors.unable_to_allocate_resource':
                type.ReferenceType('com.vmware.vapi.std.errors_client', 'UnableToAllocateResource'),
            '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/logging/forwarding',
            path_variables={
            },
            query_parameters={
            }
        )

        # properties for get operation
        get_input_type = type.StructType('operation-input', {})
        get_error_dict = {}
        get_input_value_validator_list = [
        ]
        get_output_validator_list = [
        ]
        get_rest_metadata = OperationRestMetadata(
            http_method='GET',
            url_template='/appliance/logging/forwarding',
            path_variables={
            },
            query_parameters={
            }
        )

        operations = {
            'test': {
                'input_type': test_input_type,
                'output_type': type.ListType(type.ReferenceType(__name__, 'Forwarding.ConnectionStatus')),
                '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,
            },
            'get': {
                'input_type': get_input_type,
                'output_type': type.ListType(type.ReferenceType(__name__, 'Forwarding.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,
            'get': get_rest_metadata,
        }
        ApiInterfaceStub.__init__(
            self, iface_name='com.vmware.appliance.logging.forwarding',
            config=config, operations=operations, rest_metadata=rest_metadata,
            is_vapi_rest=True)
class Service(VapiInterface):
    """
    The ``Service`` class provides methods to manage a single/set of services
    that are managed by vMon.
    """

    _VAPI_SERVICE_ID = 'com.vmware.appliance.vmon.service'
    """
    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, _ServiceStub)

    class StartupType(Enum):
        """
        The ``Service.StartupType`` class defines valid Startup Type for services
        managed by vMon.

        .. 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>`.
        """
        MANUAL = None
        """
        Service Startup type is Manual, thus issuing an explicit start on the
        service will start it.

        """
        AUTOMATIC = None
        """
        Service Startup type is Automatic, thus during starting all services or
        issuing explicit start on the service will start it.

        """
        DISABLED = None
        """
        Service Startup type is Disabled, thus it will not start unless the startup
        type changes to manual or automatic.

        """

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

    StartupType._set_values([
        StartupType('MANUAL'),
        StartupType('AUTOMATIC'),
        StartupType('DISABLED'),
    ])
    StartupType._set_binding_type(type.EnumType(
        'com.vmware.appliance.vmon.service.startup_type',
        StartupType))


    class State(Enum):
        """
        The ``Service.State`` class defines valid Run State for services.

        .. 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>`.
        """
        STARTING = None
        """
        Service Run State is Starting, it is still not functional

        """
        STOPPING = None
        """
        Service Run State is Stopping, it is not functional

        """
        STARTED = None
        """
        Service Run State is Started, it is fully functional

        """
        STOPPED = None
        """
        Service Run State is Stopped

        """

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

    State._set_values([
        State('STARTING'),
        State('STOPPING'),
        State('STARTED'),
        State('STOPPED'),
    ])
    State._set_binding_type(type.EnumType(
        'com.vmware.appliance.vmon.service.state',
        State))


    class Health(Enum):
        """
        The ``Service.Health`` class defines the possible values for health of a
        service.

        .. 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>`.
        """
        DEGRADED = None
        """
        Service is in degraded state, it is not functional.

        """
        HEALTHY = None
        """
        Service is in a healthy state and is fully functional.

        """
        HEALTHY_WITH_WARNINGS = None
        """
        Service is healthy with warnings.

        """

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

    Health._set_values([
        Health('DEGRADED'),
        Health('HEALTHY'),
        Health('HEALTHY_WITH_WARNINGS'),
    ])
    Health._set_binding_type(type.EnumType(
        'com.vmware.appliance.vmon.service.health',
        Health))


    class Info(VapiStruct):
        """
        The ``Service.Info`` class contains information about a service.

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

        _validator_list = [
            UnionValidator(
                'state',
                {
                    'STARTED' : [('health', True), ('health_messages', True)],
                    'STARTING' : [],
                    'STOPPING' : [],
                    'STOPPED' : [],
                }
            ),
        ]



        def __init__(self,
                     name_key=None,
                     description_key=None,
                     startup_type=None,
                     state=None,
                     health=None,
                     health_messages=None,
                    ):
            """
            :type  name_key: :class:`str`
            :param name_key: Service name key. Can be used to lookup resource bundle
            :type  description_key: :class:`str`
            :param description_key: Service description key. Can be used to lookup resource bundle
            :type  startup_type: :class:`Service.StartupType`
            :param startup_type: Startup Type.
            :type  state: :class:`Service.State`
            :param state: Running State.
            :type  health: :class:`Service.Health`
            :param health: Health of service.
                This attribute is optional and it is only relevant when the value
                of ``state`` is :attr:`Service.State.STARTED`.
            :type  health_messages: :class:`list` of :class:`com.vmware.vapi.std_client.LocalizableMessage`
            :param health_messages: Localizable messages associated with the health of the service
                This attribute is optional and it is only relevant when the value
                of ``state`` is :attr:`Service.State.STARTED`.
            """
            self.name_key = name_key
            self.description_key = description_key
            self.startup_type = startup_type
            self.state = state
            self.health = health
            self.health_messages = health_messages
            VapiStruct.__init__(self)


    Info._set_binding_type(type.StructType(
        'com.vmware.appliance.vmon.service.info', {
            'name_key': type.StringType(),
            'description_key': type.StringType(),
            'startup_type': type.ReferenceType(__name__, 'Service.StartupType'),
            'state': type.ReferenceType(__name__, 'Service.State'),
            'health': type.OptionalType(type.ReferenceType(__name__, 'Service.Health')),
            'health_messages': type.OptionalType(type.ListType(type.ReferenceType('com.vmware.vapi.std_client', 'LocalizableMessage'))),
        },
        Info,
        False,
        None))


    class UpdateSpec(VapiStruct):
        """
        The ``Service.UpdateSpec`` class describes the changes to be made to the
        configuration of the service.

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




        def __init__(self,
                     startup_type=None,
                    ):
            """
            :type  startup_type: :class:`Service.StartupType` or ``None``
            :param startup_type: Startup Type
                If unspecified, leaves value unchanged.
            """
            self.startup_type = startup_type
            VapiStruct.__init__(self)


    UpdateSpec._set_binding_type(type.StructType(
        'com.vmware.appliance.vmon.service.update_spec', {
            'startup_type': type.OptionalType(type.ReferenceType(__name__, 'Service.StartupType')),
        },
        UpdateSpec,
        False,
        None))



    def start(self,
              service,
              ):
        """
        Starts a service

        :type  service: :class:`str`
        :param service: identifier of the service to start
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a stop or restart operation is in progress, the start operation
            will not be allowed.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if start operation is issued on a service which has startup type
            :attr:`Service.StartupType.DISABLED`.
        :raise: :class:`com.vmware.vapi.std.errors_client.TimedOut` 
            if any timeout occurs during the execution of the start operation.
            Timeout occurs when the service takes longer than StartTimeout to
            start.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        """
        return self._invoke('start',
                            {
                            'service': service,
                            })

    def stop(self,
             service,
             ):
        """
        Stops a service

        :type  service: :class:`str`
        :param service: identifier of the service to stop
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a stop operation is in progress, issuing another stop operation
            will lead to this error.
        """
        return self._invoke('stop',
                            {
                            'service': service,
                            })

    def restart(self,
                service,
                ):
        """
        Restarts a service

        :type  service: :class:`str`
        :param service: identifier of the service to restart
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.TimedOut` 
            if any timeout occurs during the execution of the restart
            operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a stop or start operation is in progress, issuing a restart
            operation will lead to this error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if a restart operation is issued on a service which has startup
            type :attr:`Service.StartupType.DISABLED`
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        """
        return self._invoke('restart',
                            {
                            'service': service,
                            })

    def get(self,
            service,
            ):
        """
        Returns the state of a service.

        :type  service: :class:`str`
        :param service: identifier of the service whose state is being queried.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :rtype: :class:`Service.Info`
        :return: Service Info structure.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        """
        return self._invoke('get',
                            {
                            'service': service,
                            })

    def update(self,
               service,
               spec,
               ):
        """
        Updates the properties of a service.

        :type  service: :class:`str`
        :param service: identifier of the service whose properties are being updated.
            The parameter must be an identifier for the resource type:
            ``com.vmware.appliance.vmon.Service``.
        :type  spec: :class:`Service.UpdateSpec`
        :param spec: Service Update specification.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if the service associated with ``service`` does not exist.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any other error occurs during the execution of the operation.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if the operation is denied in the current state of the service. If
            a start, stop or restart operation is in progress, update operation
            will fail with this error.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotAllowedInCurrentState` 
            if a request to set the :attr:`Service.UpdateSpec.startup_type`
            attribute of ``spec`` to :attr:`Service.StartupType.DISABLED` comes
            in for a service that is not in :attr:`Service.State.STOPPED`
            state.
        """
        return self._invoke('update',
                            {
                            'service': service,
                            'spec': spec,
                            })

    def list_details(self):
        """
        Lists details of services managed by vMon.


        :rtype: :class:`dict` of :class:`str` and :class:`Service.Info`
        :return: Map of service identifiers to service Info structures.
            The key in the return value :class:`dict` will be an identifier for
            the resource type: ``com.vmware.appliance.vmon.Service``.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if any error occurs during the execution of the operation.
        """
        return self._invoke('list_details', None)
Exemplo n.º 30
0
class Pending(VapiInterface):
    """
    The ``Pending`` class provides method for listing pending minor or major
    updates of vCenter Server.
    """
    RESOURCE_TYPE = "com.vmware.vcenter.lcm.update.pending"
    """
    Resource type for pending update

    """

    _VAPI_SERVICE_ID = 'com.vmware.vcenter.lcm.update.pending'
    """
    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, _PendingStub)
        self._VAPI_OPERATION_IDS = {}

    class SeverityType(Enum):
        """
        Level of severity for applying a given patch or update.

        .. 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>`.
        """
        CRITICAL = None
        """
        Vulnerabilities that can be exploited by an unauthenticated attacker from
        the Internet or those that break the guest/host Operating System isolation.

        """
        IMPORTANT = None
        """
        Vulnerabilities that are not rated critical but whose exploitation results
        in the complete compromise of confidentiality and/or integrity of user data
        and/or processing resources through user assistance or by authenticated
        attackers.

        """
        MODERATE = None
        """
        Vulnerabilities where the ability to exploit is mitigated to a significant
        degree by configuration or difficulty of exploitation, but in certain
        deployment scenarios could still lead to the compromise of confidentiality,
        integrity, or availability of user data and/or processing resources.

        """
        LOW = None
        """
        All other issues that may or maynot have a security impact. Vulnerabilities
        where exploitation is believed to be extremely difficult, or where
        successful exploitation would have minimal impact.

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

    SeverityType._set_values([
        SeverityType('CRITICAL'),
        SeverityType('IMPORTANT'),
        SeverityType('MODERATE'),
        SeverityType('LOW'),
    ])
    SeverityType._set_binding_type(
        type.EnumType('com.vmware.vcenter.lcm.update.pending.severity_type',
                      SeverityType))

    class Category(Enum):
        """
        The ``Pending.Category`` class defines the type of payload this release has
        on top of previous release

        .. 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>`.
        """
        SECURITY = None
        """
        Fixes vulnerabilities, doesn't change functionality

        """
        FIX = None
        """
        Fixes bugs/vulnerabilities, doesn't change functionality

        """
        UPDATE = None
        """
        Changes product functionality

        """
        UPGRADE = None
        """
        Introduces new features, significantly changes product functionality

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

    Category._set_values([
        Category('SECURITY'),
        Category('FIX'),
        Category('UPDATE'),
        Category('UPGRADE'),
    ])
    Category._set_binding_type(
        type.EnumType('com.vmware.vcenter.lcm.update.pending.category',
                      Category))

    class UpdateType(Enum):
        """
        The ``Pending.UpdateType`` class defines update type

        .. 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>`.
        """
        PATCH = None
        """
        Fixes bugs/vulnerabilities, doesn't change functionality

        """
        UPDATE = None
        """
        Changes product functionality

        """
        UPGRADE = None
        """
        Introduces new features, significantly changes product functionality

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

    UpdateType._set_values([
        UpdateType('PATCH'),
        UpdateType('UPDATE'),
        UpdateType('UPGRADE'),
    ])
    UpdateType._set_binding_type(
        type.EnumType('com.vmware.vcenter.lcm.update.pending.update_type',
                      UpdateType))

    class Summary(VapiStruct):
        """
        The ``Pending.Summary`` class contains basic information about the vCenter
        patch/update/upgrade

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

        _canonical_to_pep_names = {
            'execute_URL': 'execute_url',
        }

        def __init__(
            self,
            pending_update=None,
            version=None,
            release_date=None,
            severity=None,
            build=None,
            update_type=None,
            category=None,
            reboot_required=None,
            execute_url=None,
            release_notes=None,
        ):
            """
            :type  pending_update: :class:`str`
            :param pending_update: Identifier of the given vSphere update
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.lcm.update.pending``. 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.lcm.update.pending``.
            :type  version: :class:`str`
            :param version: Version of the vSphere update or patch
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the vSphere update or patch
            :type  severity: :class:`Pending.SeverityType`
            :param severity: Severity of the issues fixed in the vSphere update or patch
            :type  build: :class:`str`
            :param build: Build number of the vCenter Release
            :type  update_type: :class:`Pending.UpdateType`
            :param update_type: Type of the Release based on the current vCenter version
            :type  category: :class:`Pending.Category`
            :param category: Category of the release based on features bundled on top of
                previous release
            :type  reboot_required: :class:`bool`
            :param reboot_required: Flag to suggest a reboot after the release is applied
            :type  execute_url: :class:`str`
            :param execute_url: VAMI or ISO URL for update or upgrade execute phase redirection
            :type  release_notes: :class:`list` of :class:`str`
            :param release_notes: List of URI pointing to patch or update release notes
            """
            self.pending_update = pending_update
            self.version = version
            self.release_date = release_date
            self.severity = severity
            self.build = build
            self.update_type = update_type
            self.category = category
            self.reboot_required = reboot_required
            self.execute_url = execute_url
            self.release_notes = release_notes
            VapiStruct.__init__(self)

    Summary._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.pending.summary', {
                'pending_update':
                type.IdType(
                    resource_types='com.vmware.vcenter.lcm.update.pending'),
                'version':
                type.StringType(),
                'release_date':
                type.DateTimeType(),
                'severity':
                type.ReferenceType(__name__, 'Pending.SeverityType'),
                'build':
                type.StringType(),
                'update_type':
                type.ReferenceType(__name__, 'Pending.UpdateType'),
                'category':
                type.ReferenceType(__name__, 'Pending.Category'),
                'reboot_required':
                type.BooleanType(),
                'execute_URL':
                type.URIType(),
                'release_notes':
                type.ListType(type.URIType()),
            }, Summary, False, None))

    class ListResult(VapiStruct):
        """
        The ``Pending.ListResult`` class contains information about the pending
        patch/updates for the given vCenter server.

        .. tip::
            The arguments are used to initialize data attributes with the same
            names.
        """
        def __init__(
            self,
            last_check_time=None,
            update_count=None,
            upgrade_count=None,
            updates=None,
            issues=None,
        ):
            """
            :type  last_check_time: :class:`datetime.datetime`
            :param last_check_time: Time when the software depo was last checked.
            :type  update_count: :class:`long` or ``None``
            :param update_count: Number of pending updates
                Only :class:`set` if there are available updates
            :type  upgrade_count: :class:`long` or ``None``
            :param upgrade_count: Number of pending upgrades
                Only :class:`set` if there are available upgrades
            :type  updates: :class:`list` of :class:`Pending.Summary`
            :param updates: List of pending update details
            :type  issues: :class:`com.vmware.vcenter.lcm_client.Notifications` or ``None``
            :param issues: Lists of issues encountered during pending updates retrieval.
                :class:`set` if any issues encountered.
            """
            self.last_check_time = last_check_time
            self.update_count = update_count
            self.upgrade_count = upgrade_count
            self.updates = updates
            self.issues = issues
            VapiStruct.__init__(self)

    ListResult._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.pending.list_result', {
                'last_check_time':
                type.DateTimeType(),
                'update_count':
                type.OptionalType(type.IntegerType()),
                'upgrade_count':
                type.OptionalType(type.IntegerType()),
                'updates':
                type.ListType(type.ReferenceType(__name__, 'Pending.Summary')),
                'issues':
                type.OptionalType(
                    type.ReferenceType('com.vmware.vcenter.lcm_client',
                                       'Notifications')),
            }, ListResult, False, None))

    class Info(VapiStruct):
        """
        The ``Pending.Info`` class contains detailed information about the vCenter
        patch/update.

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

        _canonical_to_pep_names = {
            'execute_URL': 'execute_url',
        }

        def __init__(
            self,
            description=None,
            pending_update=None,
            version=None,
            release_date=None,
            severity=None,
            build=None,
            update_type=None,
            category=None,
            reboot_required=None,
            execute_url=None,
            release_notes=None,
        ):
            """
            :type  description: :class:`str`
            :param description: Description of the vSphere update
            :type  pending_update: :class:`str`
            :param pending_update: Identifier of the given vSphere update
                When clients pass a value of this class as a parameter, the
                attribute must be an identifier for the resource type:
                ``com.vmware.vcenter.lcm.update.pending``. 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.lcm.update.pending``.
            :type  version: :class:`str`
            :param version: Version of the vSphere update or patch
            :type  release_date: :class:`datetime.datetime`
            :param release_date: Release date of the vSphere update or patch
            :type  severity: :class:`Pending.SeverityType`
            :param severity: Severity of the issues fixed in the vSphere update or patch
            :type  build: :class:`str`
            :param build: Build number of the vCenter Release
            :type  update_type: :class:`Pending.UpdateType`
            :param update_type: Type of the Release based on the current vCenter version
            :type  category: :class:`Pending.Category`
            :param category: Category of the release based on features bundled on top of
                previous release
            :type  reboot_required: :class:`bool`
            :param reboot_required: Flag to suggest a reboot after the release is applied
            :type  execute_url: :class:`str`
            :param execute_url: VAMI or ISO URL for update or upgrade execute phase redirection
            :type  release_notes: :class:`list` of :class:`str`
            :param release_notes: List of URI pointing to patch or update release notes
            """
            self.description = description
            self.pending_update = pending_update
            self.version = version
            self.release_date = release_date
            self.severity = severity
            self.build = build
            self.update_type = update_type
            self.category = category
            self.reboot_required = reboot_required
            self.execute_url = execute_url
            self.release_notes = release_notes
            VapiStruct.__init__(self)

    Info._set_binding_type(
        type.StructType(
            'com.vmware.vcenter.lcm.update.pending.info', {
                'description':
                type.StringType(),
                'pending_update':
                type.IdType(
                    resource_types='com.vmware.vcenter.lcm.update.pending'),
                'version':
                type.StringType(),
                'release_date':
                type.DateTimeType(),
                'severity':
                type.ReferenceType(__name__, 'Pending.SeverityType'),
                'build':
                type.StringType(),
                'update_type':
                type.ReferenceType(__name__, 'Pending.UpdateType'),
                'category':
                type.ReferenceType(__name__, 'Pending.Category'),
                'reboot_required':
                type.BooleanType(),
                'execute_URL':
                type.URIType(),
                'release_notes':
                type.ListType(type.URIType()),
            }, Info, False, None))

    def list(self):
        """
        Lists all available minor and major updates.


        :rtype: :class:`Pending.ListResult`
        :return: Information about the pending patch/updates for the given vCenter
            server
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is some unknown internal error. The accompanying error
            message will give more details about the error.
        """
        return self._invoke('list', None)

    def get(
        self,
        version,
    ):
        """
        Gets detailed update information.

        :type  version: :class:`str`
        :param version: A version identified the update
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.lcm.update.pending``.
        :rtype: :class:`Pending.Info`
        :return: A detailed information about the particular vCenter patch/update
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            if the user can not be authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            if there is no pending update assosiated with the ``version`` in
            the system.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            if there is some unknown internal error. The accompanying error
            message will give more details about the error.
        """
        return self._invoke('get', {
            'version': version,
        })