class_docstr: Sets up an Amazon SageMaker Collection.
docstr: Deletes a list of Collections.
  
  Args:
      collections (List[str]): A list of Collections to delete.
          Only deletes a Collection if it is empty.
docstr_tok: ["Deletes","a","list","of","Collections",".","Args",":","collections","(","List","[","str","]",")",":","A","list","of","Collections","to","delete",".","Only","deletes","a","Collection","if","it","is","empty","."]
code: def delete(self, collections: List[str]):
      """Deletes a list of Collections.
  
      Args:
          collections (List[str]): A list of Collections to delete.
              Only deletes a Collection if it is empty.
      """
  
      if len(collections) > 10:
          raise ValueError("Can delete upto 10 collections at a time")
  
      delete_collection_failures = []
      deleted_collection = []
      collection_filter = [
          {
              "Name": "resource-type",
              "Values": [
                  "AWS::ResourceGroups::Group",
                  "AWS::SageMaker::ModelPackageGroup",
              ],
          },
      ]
  
      # loops over the list of collection and deletes one at a time.
      for collection in collections:
          try:
              collection_details = (
                  self.sagemaker_session.list_group_resources(
                      group=collection, filters=collection_filter
                  )
              )
          except ClientError as e:
              self._check_access_error(err=e)
              delete_collection_failures.append(
                  {
                      "collection": collection,
                      "message": e.response["Error"]["Message"],
                  }
              )
              continue
          if (
              collection_details.get("Resources")
              and len(collection_details["Resources"]) > 0
          ):
              delete_collection_failures.append(
                  {
                      "collection": collection,
                      "message": "Validation error: Collection not empty",
                  }
              )
          else:
              try:
                  self.sagemaker_session.delete_resource_group(
                      group=collection
                  )
                  deleted_collection.append(collection)
              except ClientError as e:
                  self._check_access_error(err=e)
                  delete_collection_failures.append(
                      {
                          "collection": collection,
                          "message": e.response["Error"]["Message"],
                      }
                  )
      return {
          "deleted_collections": deleted_collection,
          "delete_collection_failures": delete_collection_failures,
      }
  
imports: from __future__ import absolute_import
  import json
  import time
  from typing import List
  from botocore.exceptions import ClientError
  from sagemaker.session import Session
label_desc: Use image node_id 6 for calling the Collection obj's underlying member method code with example usage: obj.delete(collections) and returns: dict