示例#1
0
 def create_published_library(self, client_token, cl_name, publish_info, ds_id):
     """Creates publish library back up by vCenter data store (as is)"""
     library_model = LibraryModel()
     library_model.id = client_token
     library_model.name = cl_name
     library_model.description = self.lib_description
     library_model.type = library_model.LibraryType.LOCAL
     library_model.publish_info = publish_info
     storage_backings = []
     storage_backing = StorageBacking(type=StorageBacking.Type.DATASTORE, datastore_id=ds_id)
     storage_backings.append(storage_backing)
     library_model.storage_backings = storage_backings
     library_id = self.local_library_service.create(create_spec=library_model, client_token=client_token)
     library = self.local_library_service.get(library_id)
     return library
    def create_published_library(self, pub_lib_name):
        pub_info = PublishInfo()
        pub_info.published = True
        # VMTX sync needs the authentication to be turned off
        pub_info.authentication_method = PublishInfo.AuthenticationMethod.NONE
        pub_spec = LibraryModel()
        pub_spec.name = pub_lib_name
        pub_spec.description = "Sample Published library"
        pub_spec.publish_info = pub_info
        pub_spec.type = pub_spec.LibraryType.LOCAL
        pub_spec.storage_backings = self.storage_backings

        pub_lib_id = self.client.local_library_service.create(
            create_spec=pub_spec, client_token=generate_random_uuid())
        print("Published library created, id: {0}".format(pub_lib_id))

        pub_lib = self.client.library_service.get(pub_lib_id)
        return pub_lib
示例#3
0
    def create_published_library(self, storage_backings):
        # Build the authenticated publish info.
        # Note: The username will be 'vcsp'.
        pub_info = PublishInfo()
        pub_info.published = True
        pub_info.authentication_method = PublishInfo.AuthenticationMethod.BASIC
        pub_info.password = self.DEMO_PASSWORD

        # Build the specification for the published library to be created
        pub_spec = LibraryModel()
        pub_spec.name = self.pub_lib_name
        pub_spec.description = "Published library backed by VC datastore"
        pub_spec.publish_info = pub_info
        pub_spec.type = pub_spec.LibraryType.LOCAL
        pub_spec.storage_backings = storage_backings

        pub_lib_id = self.client.local_library_service.create(
            create_spec=pub_spec, client_token=generate_random_uuid())

        return pub_lib_id