Class DefaultTaskRef
- java.lang.Object
-
- com.snowflake.connectors.common.task.DefaultTaskRef
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
alterSchedule(String schedule)
Changes schedule of referenced task.void
alterScheduleIfExists(String schedule)
Changes schedule of referenced task if it exists.void
alterWarehouse(String warehouse)
Changes warehouse of referenced task.void
alterWarehouseIfExists(String warehouse)
Changes warehouse of referenced task if it exists.boolean
checkIfExists()
void
drop()
Removes referenced task from the database.void
dropIfExists()
Removes referenced task from the database if it exists.void
execute()
Executes immediately the referenced task.TaskProperties
fetch()
Fetches properties containing base information about the referenced task.void
grantMonitorPrivilegeToRole(String role)
Grants monitor privilege to given application role.ObjectName
name()
void
resume()
Resumes suspended referenced task.void
resumeIfExists()
Resumes suspended referenced task if it exists.void
suspend()
Suspends running referenced task.void
suspendIfExists()
Suspends running referenced task if it exists.
-
-
-
Method Detail
-
name
public ObjectName name()
-
execute
public void execute()
Description copied from interface:TaskRef
Executes immediately the referenced task.Throws
SnowflakeSQLException
if task does not exist or not authorized.
-
checkIfExists
public boolean checkIfExists()
- Specified by:
checkIfExists
in interfaceTaskRef
- Returns:
- true if task can be matched with a task existing in Snowflake database, otherwise false
-
resume
public void resume()
Description copied from interface:TaskRef
Resumes suspended referenced task.If the task is already resumed - the operation is ignored.
Throws
SnowflakeSQLException
if task does not exist or not authorized.
-
resumeIfExists
public void resumeIfExists()
Description copied from interface:TaskRef
Resumes suspended referenced task if it exists.If the task is already resumed - the operation is ignored.
Throws
SnowflakeSQLException
not authorized.- Specified by:
resumeIfExists
in interfaceTaskRef
-
suspend
public void suspend()
Description copied from interface:TaskRef
Suspends running referenced task.If the task is already suspended - the operation is ignored.
Throws
SnowflakeSQLException
if task does not exist or not authorized.
-
suspendIfExists
public void suspendIfExists()
Description copied from interface:TaskRef
Suspends running referenced task if it exists.If the task is already suspended - the operation is ignored.
Throws
SnowflakeSQLException
if not authorized.- Specified by:
suspendIfExists
in interfaceTaskRef
-
drop
public void drop()
Description copied from interface:TaskRef
Removes referenced task from the database.Current execution of the task is finished before the task is dropped.
Throws
SnowflakeSQLException
if task does not exist or not authorized.
-
dropIfExists
public void dropIfExists()
Description copied from interface:TaskRef
Removes referenced task from the database if it exists.Current execution of the task is finished before the task is dropped.
Throws
SnowflakeSQLException
if task does not exist or not authorized.- Specified by:
dropIfExists
in interfaceTaskRef
-
alterSchedule
public void alterSchedule(String schedule)
Description copied from interface:TaskRef
Changes schedule of referenced task.Throws
SnowflakeSQLException
if task does not exist, not authorized, or schedule is invalid.- Specified by:
alterSchedule
in interfaceTaskRef
- Parameters:
schedule
- interval or cron expression which will be set
-
alterScheduleIfExists
public void alterScheduleIfExists(String schedule)
Description copied from interface:TaskRef
Changes schedule of referenced task if it exists.Throws
SnowflakeSQLException
if task does not exist, not authorized, or schedule is invalid.- Specified by:
alterScheduleIfExists
in interfaceTaskRef
- Parameters:
schedule
- interval or cron expression which will be set
-
alterWarehouse
public void alterWarehouse(String warehouse)
Description copied from interface:TaskRef
Changes warehouse of referenced task.Throws
SnowflakeSQLException
if task does not exist, not authorized, or warehouse name is invalid.- Specified by:
alterWarehouse
in interfaceTaskRef
- Parameters:
warehouse
- warehouse name which will be set
-
alterWarehouseIfExists
public void alterWarehouseIfExists(String warehouse)
Description copied from interface:TaskRef
Changes warehouse of referenced task if it exists.Throws
SnowflakeSQLException
if task does not exist, not authorized, or warehouse name is invalid.- Specified by:
alterWarehouseIfExists
in interfaceTaskRef
- Parameters:
warehouse
- warehouse name which will be set
-
grantMonitorPrivilegeToRole
public void grantMonitorPrivilegeToRole(String role)
Description copied from interface:TaskRef
Grants monitor privilege to given application role.Throws
SnowflakeSQLException
if task does not exist, not authorized, or role is invalid.- Specified by:
grantMonitorPrivilegeToRole
in interfaceTaskRef
- Parameters:
role
- role which will be granted monitor privilege
-
fetch
public TaskProperties fetch()
Description copied from interface:TaskRef
Fetches properties containing base information about the referenced task.Throws
SnowflakeSQLException
if task does not exist or not authorized.
-
-