Class CreateResourceHandler
- java.lang.Object
-
- com.snowflake.connectors.application.ingestion.create.CreateResourceHandler
-
public class CreateResourceHandler extends Object
Handler for the ingestion resource creation process. A new instance of the handler must be created usingthe builder
.For more information about the resource creation process see
createResource
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CreateResourceHandlerBuilder
builder(Session session)
Returns a new instance ofCreateResourceHandlerBuilder
.static Variant
createResource(Session session, String name, Variant resourceId, Variant ingestionConfigurations, String id, boolean enabled, Variant resourceMetadata)
Default handler method for thePUBLIC.CREATE_RESOURCE
procedure.ConnectorResponse
createResource(String id, String name, boolean enabled, Variant resourceId, Variant resourceMetadata, Variant ingestionConfigurations)
Executes the main logic of the handler, with logging usingwithExceptionLogging
.
-
-
-
Method Detail
-
createResource
public static Variant createResource(Session session, String name, Variant resourceId, Variant ingestionConfigurations, String id, boolean enabled, Variant resourceMetadata)
Default handler method for thePUBLIC.CREATE_RESOURCE
procedure.- Parameters:
session
- Snowpark session objectname
- resource nameresourceId
- properties which identify the resource in the source systemingestionConfigurations
- resource ingestion configurationsid
- resource ingestion definition idenabled
- should the ingestion for the resource be enabledresourceMetadata
- additional resource metadata- Returns:
- a variant representing the
ConnectorResponse
returned bycreateResource
-
createResource
public ConnectorResponse createResource(String id, String name, boolean enabled, Variant resourceId, Variant resourceMetadata, Variant ingestionConfigurations)
Executes the main logic of the handler, with logging usingwithExceptionLogging
.The resource creation process consists of:
- initial validation - whether a resource with given id already exists and whether the provided resource has a valid structure
CreateResourceValidator.validate(VariantResource)
PreCreateResourceCallback.execute(VariantResource)
- persisting a new resource ingestion definition
- persisting a new ingestion process for each ingestion configuration, if the
enabled
parameter is true PostCreateResourceCallback.execute(String)
- Parameters:
id
- resource ingestion definition idname
- resource nameenabled
- should the ingestion for the resource be enabledresourceId
- properties which identify the resource in the source systemresourceMetadata
- additional resource metadataingestionConfigurations
- resource ingestion configurations- Returns:
- a response with the code
OK
if the execution was successful, otherwise a response with an error code and an error message
-
builder
public static CreateResourceHandlerBuilder builder(Session session)
Returns a new instance ofCreateResourceHandlerBuilder
.- Parameters:
session
- Snowpark session object- Returns:
- a new builder instance
-
-