def CreateIndexMessage(messages, index):
  """Creates a message for the given index.

  Args:
    messages: The Cloud Firestore messages module.
    index: The index ArgDict.
  Returns:
    GoogleFirestoreAdminV1beta2Index
  """
  # Currently all indexes are COLLECTION-scoped
  query_scope = (messages.GoogleFirestoreAdminV1beta2Index.
                 QueryScopeValueValuesEnum.COLLECTION)
  # Since this is a single-field index there will only be 1 field
  index_fields = [messages.GoogleFirestoreAdminV1beta2IndexField(
      arrayConfig=index.get('array-config'),
      order=index.get('order'))]

  return messages.GoogleFirestoreAdminV1beta2Index(
      queryScope=query_scope,
      fields=index_fields)