def create_datastore()

in movie_search_metadata/demo_app/_vais_setup.py [0:0]


def create_datastore(project_id, location, datastore_id):
    client_options = (
        ClientOptions(api_endpoint=f'{location}-discoveryengine.googleapis.com')
        if location != 'global'
        else None
    )
    client = discoveryengine.DataStoreServiceClient(client_options=client_options)
    
    parent = client.collection_path(
        project=project_id,
        location=location,
        collection='default_collection',
    )

    data_store = discoveryengine.DataStore(
        display_name='Movie search datastore',
        industry_vertical=discoveryengine.IndustryVertical.GENERIC,
        solution_types=[discoveryengine.SolutionType.SOLUTION_TYPE_SEARCH],
        content_config=discoveryengine.DataStore.ContentConfig.CONTENT_REQUIRED,
    )

    request = discoveryengine.CreateDataStoreRequest(
        parent=parent,
        data_store_id=datastore_id,
        data_store=data_store,
    )

    operation = client.create_data_store(request=request)
    print(f'Waiting for operation to complete: {operation.operation.name}')
    response = operation.result()

    return response