com.google.api.services.bigquery.model.Routine Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.bigquery.model;
/**
* A user-defined function or a stored procedure.
*
* This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the BigQuery API. For a detailed explanation see:
* https://developers.google.com/api-client-library/java/google-http-java-client/json
*
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class Routine extends com.google.api.client.json.GenericJson {
/**
* Optional.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List arguments;
static {
// hack to force ProGuard to consider Argument used, since otherwise it would be stripped out
// see https://github.com/google/google-api-java-client/issues/543
com.google.api.client.util.Data.nullOf(Argument.class);
}
/**
* Output only. The time when this routine was created, in milliseconds since the epoch.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key @com.google.api.client.json.JsonString
private java.lang.Long creationTime;
/**
* Optional. If set to `DATA_MASKING`, the function is validated and made available as a masking
* function. For more information, see [Create custom masking
* routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String dataGovernanceType;
/**
* Required. The body of the routine. For functions, this is the expression in the AS clause. If
* language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the
* function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string)
* as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with
* linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example,
* for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING
* LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are
* replaced with linebreaks.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String definitionBody;
/**
* Optional. The description of the routine, if defined.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String description;
/**
* Optional. The determinism level of the JavaScript UDF, if defined.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String determinismLevel;
/**
* Output only. A hash of this resource.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String etag;
/**
* Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT
* libraries.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List importedLibraries;
/**
* Optional. Defaults to "SQL" if remote_function_options field is absent, not set otherwise.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String language;
/**
* Output only. The time when this routine was last modified, in milliseconds since the epoch.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key @com.google.api.client.json.JsonString
private java.lang.Long lastModifiedTime;
/**
* Optional. Remote function specific options.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private RemoteFunctionOptions remoteFunctionOptions;
/**
* Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return
* table type is inferred from definition_body at query time in each query that references this
* routine. If present, then the columns in the evaluated table result will be cast to match the
* column types specified in return table type, at query time.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private StandardSqlTableType returnTableType;
/**
* Optional if language = "SQL"; required otherwise. Cannot be set if routine_type =
* "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query
* time in each query that references this routine. If present, then the evaluated result will be
* cast to the specified returned type at query time. For example, for the functions created with
* the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x +
* y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x
* FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for
* `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time).
* Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS
* (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at
* query time, while the return type of `Decrement` remains FLOAT64.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private StandardSqlDataType returnType;
/**
* Required. Reference describing the ID of this routine.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private RoutineReference routineReference;
/**
* Required. The type of routine.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String routineType;
/**
* Optional. The security mode of the routine, if defined. If not defined, the security mode is
* automatically determined from the routine's configuration.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String securityMode;
/**
* Optional. Spark specific options.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private SparkOptions sparkOptions;
/**
* Optional. Use this option to catch many common errors. Error checking is not exhaustive, and
* successfully creating a procedure doesn't guarantee that the procedure will successfully
* execute at runtime. If `strictMode` is set to `TRUE`, the procedure body is further checked for
* errors such as non-existent tables or columns. The `CREATE PROCEDURE` statement fails if the
* body fails any of these checks. If `strictMode` is set to `FALSE`, the procedure body is
* checked only for syntax. For procedures that invoke themselves recursively, specify
* `strictMode=FALSE` to avoid non-existent procedure errors during validation. Default value is
* `TRUE`.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Boolean strictMode;
/**
* Optional.
* @return value or {@code null} for none
*/
public java.util.List getArguments() {
return arguments;
}
/**
* Optional.
* @param arguments arguments or {@code null} for none
*/
public Routine setArguments(java.util.List arguments) {
this.arguments = arguments;
return this;
}
/**
* Output only. The time when this routine was created, in milliseconds since the epoch.
* @return value or {@code null} for none
*/
public java.lang.Long getCreationTime() {
return creationTime;
}
/**
* Output only. The time when this routine was created, in milliseconds since the epoch.
* @param creationTime creationTime or {@code null} for none
*/
public Routine setCreationTime(java.lang.Long creationTime) {
this.creationTime = creationTime;
return this;
}
/**
* Optional. If set to `DATA_MASKING`, the function is validated and made available as a masking
* function. For more information, see [Create custom masking
* routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
* @return value or {@code null} for none
*/
public java.lang.String getDataGovernanceType() {
return dataGovernanceType;
}
/**
* Optional. If set to `DATA_MASKING`, the function is validated and made available as a masking
* function. For more information, see [Create custom masking
* routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
* @param dataGovernanceType dataGovernanceType or {@code null} for none
*/
public Routine setDataGovernanceType(java.lang.String dataGovernanceType) {
this.dataGovernanceType = dataGovernanceType;
return this;
}
/**
* Required. The body of the routine. For functions, this is the expression in the AS clause. If
* language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the
* function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string)
* as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with
* linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example,
* for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING
* LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are
* replaced with linebreaks.
* @return value or {@code null} for none
*/
public java.lang.String getDefinitionBody() {
return definitionBody;
}
/**
* Required. The body of the routine. For functions, this is the expression in the AS clause. If
* language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the
* function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string)
* as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with
* linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example,
* for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING
* LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are
* replaced with linebreaks.
* @param definitionBody definitionBody or {@code null} for none
*/
public Routine setDefinitionBody(java.lang.String definitionBody) {
this.definitionBody = definitionBody;
return this;
}
/**
* Optional. The description of the routine, if defined.
* @return value or {@code null} for none
*/
public java.lang.String getDescription() {
return description;
}
/**
* Optional. The description of the routine, if defined.
* @param description description or {@code null} for none
*/
public Routine setDescription(java.lang.String description) {
this.description = description;
return this;
}
/**
* Optional. The determinism level of the JavaScript UDF, if defined.
* @return value or {@code null} for none
*/
public java.lang.String getDeterminismLevel() {
return determinismLevel;
}
/**
* Optional. The determinism level of the JavaScript UDF, if defined.
* @param determinismLevel determinismLevel or {@code null} for none
*/
public Routine setDeterminismLevel(java.lang.String determinismLevel) {
this.determinismLevel = determinismLevel;
return this;
}
/**
* Output only. A hash of this resource.
* @return value or {@code null} for none
*/
public java.lang.String getEtag() {
return etag;
}
/**
* Output only. A hash of this resource.
* @param etag etag or {@code null} for none
*/
public Routine setEtag(java.lang.String etag) {
this.etag = etag;
return this;
}
/**
* Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT
* libraries.
* @return value or {@code null} for none
*/
public java.util.List getImportedLibraries() {
return importedLibraries;
}
/**
* Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT
* libraries.
* @param importedLibraries importedLibraries or {@code null} for none
*/
public Routine setImportedLibraries(java.util.List importedLibraries) {
this.importedLibraries = importedLibraries;
return this;
}
/**
* Optional. Defaults to "SQL" if remote_function_options field is absent, not set otherwise.
* @return value or {@code null} for none
*/
public java.lang.String getLanguage() {
return language;
}
/**
* Optional. Defaults to "SQL" if remote_function_options field is absent, not set otherwise.
* @param language language or {@code null} for none
*/
public Routine setLanguage(java.lang.String language) {
this.language = language;
return this;
}
/**
* Output only. The time when this routine was last modified, in milliseconds since the epoch.
* @return value or {@code null} for none
*/
public java.lang.Long getLastModifiedTime() {
return lastModifiedTime;
}
/**
* Output only. The time when this routine was last modified, in milliseconds since the epoch.
* @param lastModifiedTime lastModifiedTime or {@code null} for none
*/
public Routine setLastModifiedTime(java.lang.Long lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
return this;
}
/**
* Optional. Remote function specific options.
* @return value or {@code null} for none
*/
public RemoteFunctionOptions getRemoteFunctionOptions() {
return remoteFunctionOptions;
}
/**
* Optional. Remote function specific options.
* @param remoteFunctionOptions remoteFunctionOptions or {@code null} for none
*/
public Routine setRemoteFunctionOptions(RemoteFunctionOptions remoteFunctionOptions) {
this.remoteFunctionOptions = remoteFunctionOptions;
return this;
}
/**
* Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return
* table type is inferred from definition_body at query time in each query that references this
* routine. If present, then the columns in the evaluated table result will be cast to match the
* column types specified in return table type, at query time.
* @return value or {@code null} for none
*/
public StandardSqlTableType getReturnTableType() {
return returnTableType;
}
/**
* Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return
* table type is inferred from definition_body at query time in each query that references this
* routine. If present, then the columns in the evaluated table result will be cast to match the
* column types specified in return table type, at query time.
* @param returnTableType returnTableType or {@code null} for none
*/
public Routine setReturnTableType(StandardSqlTableType returnTableType) {
this.returnTableType = returnTableType;
return this;
}
/**
* Optional if language = "SQL"; required otherwise. Cannot be set if routine_type =
* "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query
* time in each query that references this routine. If present, then the evaluated result will be
* cast to the specified returned type at query time. For example, for the functions created with
* the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x +
* y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x
* FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for
* `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time).
* Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS
* (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at
* query time, while the return type of `Decrement` remains FLOAT64.
* @return value or {@code null} for none
*/
public StandardSqlDataType getReturnType() {
return returnType;
}
/**
* Optional if language = "SQL"; required otherwise. Cannot be set if routine_type =
* "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query
* time in each query that references this routine. If present, then the evaluated result will be
* cast to the specified returned type at query time. For example, for the functions created with
* the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x +
* y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x
* FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for
* `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time).
* Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS
* (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at
* query time, while the return type of `Decrement` remains FLOAT64.
* @param returnType returnType or {@code null} for none
*/
public Routine setReturnType(StandardSqlDataType returnType) {
this.returnType = returnType;
return this;
}
/**
* Required. Reference describing the ID of this routine.
* @return value or {@code null} for none
*/
public RoutineReference getRoutineReference() {
return routineReference;
}
/**
* Required. Reference describing the ID of this routine.
* @param routineReference routineReference or {@code null} for none
*/
public Routine setRoutineReference(RoutineReference routineReference) {
this.routineReference = routineReference;
return this;
}
/**
* Required. The type of routine.
* @return value or {@code null} for none
*/
public java.lang.String getRoutineType() {
return routineType;
}
/**
* Required. The type of routine.
* @param routineType routineType or {@code null} for none
*/
public Routine setRoutineType(java.lang.String routineType) {
this.routineType = routineType;
return this;
}
/**
* Optional. The security mode of the routine, if defined. If not defined, the security mode is
* automatically determined from the routine's configuration.
* @return value or {@code null} for none
*/
public java.lang.String getSecurityMode() {
return securityMode;
}
/**
* Optional. The security mode of the routine, if defined. If not defined, the security mode is
* automatically determined from the routine's configuration.
* @param securityMode securityMode or {@code null} for none
*/
public Routine setSecurityMode(java.lang.String securityMode) {
this.securityMode = securityMode;
return this;
}
/**
* Optional. Spark specific options.
* @return value or {@code null} for none
*/
public SparkOptions getSparkOptions() {
return sparkOptions;
}
/**
* Optional. Spark specific options.
* @param sparkOptions sparkOptions or {@code null} for none
*/
public Routine setSparkOptions(SparkOptions sparkOptions) {
this.sparkOptions = sparkOptions;
return this;
}
/**
* Optional. Use this option to catch many common errors. Error checking is not exhaustive, and
* successfully creating a procedure doesn't guarantee that the procedure will successfully
* execute at runtime. If `strictMode` is set to `TRUE`, the procedure body is further checked for
* errors such as non-existent tables or columns. The `CREATE PROCEDURE` statement fails if the
* body fails any of these checks. If `strictMode` is set to `FALSE`, the procedure body is
* checked only for syntax. For procedures that invoke themselves recursively, specify
* `strictMode=FALSE` to avoid non-existent procedure errors during validation. Default value is
* `TRUE`.
* @return value or {@code null} for none
*/
public java.lang.Boolean getStrictMode() {
return strictMode;
}
/**
* Optional. Use this option to catch many common errors. Error checking is not exhaustive, and
* successfully creating a procedure doesn't guarantee that the procedure will successfully
* execute at runtime. If `strictMode` is set to `TRUE`, the procedure body is further checked for
* errors such as non-existent tables or columns. The `CREATE PROCEDURE` statement fails if the
* body fails any of these checks. If `strictMode` is set to `FALSE`, the procedure body is
* checked only for syntax. For procedures that invoke themselves recursively, specify
* `strictMode=FALSE` to avoid non-existent procedure errors during validation. Default value is
* `TRUE`.
* @param strictMode strictMode or {@code null} for none
*/
public Routine setStrictMode(java.lang.Boolean strictMode) {
this.strictMode = strictMode;
return this;
}
@Override
public Routine set(String fieldName, Object value) {
return (Routine) super.set(fieldName, value);
}
@Override
public Routine clone() {
return (Routine) super.clone();
}
}