def create_ingestion( dataset_name: Optional[str] = None, dataset_id: Optional[str] = None, ingestion_id: Optional[str] = None, account_id: Optional[str] = None, boto3_session: Optional[boto3.Session] = None, ) -> str: """Create and starts a new SPICE ingestion on a dataset. Note ---- You must pass ``dataset_name`` OR ``dataset_id`` argument. Parameters ---------- dataset_name : str, optional Dataset name. dataset_id : str, optional Dataset ID. ingestion_id : str, optional Ingestion ID. account_id : str, optional If None, the account ID will be inferred from your boto3 session. boto3_session : boto3.Session(), optional Boto3 Session. The default boto3 session will be used if boto3_session receive None. Returns ------- str Ingestion ID Examples -------- >>> import awswrangler as wr >>> status = wr.quicksight.create_ingestion("my_dataset") """ session: boto3.Session = _utils.ensure_session(session=boto3_session) if account_id is None: account_id = sts.get_account_id(boto3_session=session) if (dataset_name is None) and (dataset_id is None): raise exceptions.InvalidArgument( "You must pass a not None dataset_name or dataset_id argument." ) # pragma: no cover if (dataset_id is None) and (dataset_name is not None): dataset_id = get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session) if ingestion_id is None: ingestion_id = uuid.uuid4().hex client: boto3.client = _utils.client(service_name="quicksight", session=session) response: Dict[str, Any] = client.create_ingestion(DataSetId=dataset_id, IngestionId=ingestion_id, AwsAccountId=account_id) return response["IngestionId"]
def describe_ingestion( ingestion_id: str, dataset_name: Optional[str] = None, dataset_id: Optional[str] = None, account_id: Optional[str] = None, boto3_session: Optional[boto3.Session] = None, ) -> Dict[str, Any]: """Describe a QuickSight ingestion by ID. Note ---- You must pass a not None value for ``dataset_name`` or ``dataset_id`` argument. Parameters ---------- ingestion_id : str Ingestion ID. dataset_name : str, optional Dataset name. dataset_id : str, optional Dataset ID. account_id : str, optional If None, the account ID will be inferred from your boto3 session. boto3_session : boto3.Session(), optional Boto3 Session. The default boto3 session will be used if boto3_session receive None. Returns ------- Dict[str, Any] Ingestion Description. Examples -------- >>> import awswrangler as wr >>> description = wr.quicksight.describe_dataset(ingestion_id="...", dataset_name="...") """ if (dataset_name is None) and (dataset_id is None): raise exceptions.InvalidArgument( "You must pass a not None name or dataset_id argument.") session: boto3.Session = _utils.ensure_session(session=boto3_session) if account_id is None: account_id = sts.get_account_id(boto3_session=session) if (dataset_id is None) and (dataset_name is not None): dataset_id = get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session) client: boto3.client = _utils.client(service_name="quicksight", session=session) return cast( Dict[str, Any], client.describe_ingestion(IngestionId=ingestion_id, AwsAccountId=account_id, DataSetId=dataset_id)["Ingestion"], )
def cancel_ingestion( ingestion_id: str = None, dataset_name: Optional[str] = None, dataset_id: Optional[str] = None, account_id: Optional[str] = None, boto3_session: Optional[boto3.Session] = None, ) -> None: """Cancel an ongoing ingestion of data into SPICE. Note ---- You must pass a not None value for ``dataset_name`` or ``dataset_id`` argument. Parameters ---------- ingestion_id : str Ingestion ID. dataset_name : str, optional Dataset name. dataset_id : str, optional Dataset ID. account_id : str, optional If None, the account ID will be inferred from your boto3 session. boto3_session : boto3.Session(), optional Boto3 Session. The default boto3 session will be used if boto3_session receive None. Returns ------- None None. Examples -------- >>> import awswrangler as wr >>> wr.quicksight.cancel_ingestion(ingestion_id="...", dataset_name="...") """ if (dataset_name is None) and (dataset_id is None): raise exceptions.InvalidArgument( "You must pass a not None name or dataset_id argument.") session: boto3.Session = _utils.ensure_session(session=boto3_session) if account_id is None: account_id = sts.get_account_id(boto3_session=session) if (dataset_id is None) and (dataset_name is not None): dataset_id = get_dataset_id(name=dataset_name, account_id=account_id, boto3_session=session) client: boto3.client = _utils.client(service_name="quicksight", session=session) client.cancel_ingestion(IngestionId=ingestion_id, AwsAccountId=account_id, DataSetId=dataset_id)
def delete_dataset( name: Optional[str] = None, dataset_id: Optional[str] = None, account_id: Optional[str] = None, boto3_session: Optional[boto3.Session] = None, ) -> None: """Delete a dataset. Note ---- You must pass a not None ``name`` or ``dataset_id`` argument. Parameters ---------- name : str, optional Dashboard name. dataset_id : str, optional The ID for the dataset. account_id : str, optional If None, the account ID will be inferred from your boto3 session. boto3_session : boto3.Session(), optional Boto3 Session. The default boto3 session will be used if boto3_session receive None. Returns ------- None None. Examples -------- >>> import awswrangler as wr >>> wr.quicksight.delete_dataset(name="...") """ if (name is None) and (dataset_id is None): raise exceptions.InvalidArgument( "You must pass a not None name or dataset_id argument." ) # pragma: no cover session: boto3.Session = _utils.ensure_session(session=boto3_session) if (dataset_id is None) and (name is not None): dataset_id = get_dataset_id(name=name, account_id=account_id, boto3_session=session) # pragma: no cover args: Dict[str, Any] = { "func_name": "delete_data_set", "account_id": account_id, "boto3_session": session, "DataSetId": dataset_id, } _delete(**args)