google_cloud_bigquery/http/
types.rs

1use std::collections::HashMap;
2
3#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
4#[serde(rename_all = "camelCase")]
5pub struct StandardSqlDataType {
6    /// Required. The top level type of this field. Can be any GoogleSQL data type (e.g., "INT64", "DATE", "ARRAY").
7    pub type_kind: TypeKind,
8}
9#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
10#[serde(rename_all = "camelCase")]
11pub struct StandardSqlStructType {
12    pub fields: Vec<StandardSqlField>,
13}
14
15#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
16#[serde(rename_all = "camelCase")]
17pub struct StandardSqlField {
18    /// Optional. The name of this field.
19    /// Can be absent for struct fields.
20    pub name: Option<String>,
21    /// Optional. The type of this parameter.
22    /// Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
23    #[serde(rename(serialize = "type", deserialize = "type"))]
24    pub field_type: Option<StandardSqlDataType>,
25}
26
27#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug)]
28#[serde(rename_all = "camelCase")]
29pub enum StandardSqlDataSubType {
30    /// The type of the array's elements, if typeKind = "ARRAY".
31    ArrayElementType(StandardSqlDataType),
32    /// The fields of this struct, in order, if typeKind = "STRUCT".
33    StructType(StandardSqlStructType),
34}
35
36impl Default for StandardSqlDataSubType {
37    fn default() -> Self {
38        Self::ArrayElementType(StandardSqlDataType::default())
39    }
40}
41
42#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
43#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
44pub enum TypeKind {
45    #[default]
46    TypeKindUnspecified,
47    Int64,
48    Bool,
49    Float64,
50    String,
51    Bytes,
52    Timestamp,
53    Date,
54    Time,
55    Datetime,
56    Geography,
57    Numeric,
58    Bignumeric,
59    Json,
60    Array,
61    Struct,
62}
63
64#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
65#[serde(rename_all = "camelCase")]
66pub struct DataFormatOptions {
67    /// Optional. Output timestamp as usec int64. Default is false.
68    pub use_int64_timestamp: Option<bool>,
69}
70
71#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
72#[serde(untagged)]
73pub enum Collation {
74    /// '': empty string. Default to case-sensitive behavior.
75    #[default]
76    #[serde(rename = "")]
77    Default,
78    /// 'und:ci': undetermined locale, case insensitive.
79    #[serde(rename = "und:ci")]
80    UndeterminedLocaleCaseInsensitive,
81}
82
83#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
84#[serde(rename_all = "camelCase")]
85pub struct EncryptionConfiguration {
86    /// Optional. Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table.
87    /// The BigQuery Service Account associated with your project requires access to this encryption key.
88    pub kms_key_name: Option<String>,
89}
90
91#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
92#[serde(rename_all = "camelCase")]
93pub struct QueryParameter {
94    /// Optional. If unset, this is a positional parameter. Otherwise, should be unique within a query.
95    pub name: Option<String>,
96    /// Required. The type of this parameter.
97    pub parameter_type: QueryParameterType,
98    /// Required. The value of this parameter.
99    pub parameter_value: QueryParameterValue,
100}
101
102#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
103#[serde(rename_all = "camelCase")]
104pub struct QueryParameterStructType {
105    /// Optional. The name of this field.
106    pub name: Option<String>,
107    /// Required. The type of this field.
108    #[serde(rename(serialize = "type", deserialize = "type"))]
109    pub field_type: QueryParameterType,
110    /// Optional. Human-oriented description of the field.
111    pub description: Option<String>,
112}
113#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
114#[serde(rename_all = "camelCase")]
115pub struct QueryParameterType {
116    /// Required. The top level type of this field.
117    #[serde(rename(serialize = "type", deserialize = "type"))]
118    pub parameter_type: String,
119    /// Optional. The type of the array's elements, if this is an array.
120    pub array_type: Option<Box<QueryParameterType>>,
121    /// Optional. The types of the fields of this struct, in order, if this is a struct.
122    pub struct_types: Option<Vec<QueryParameterStructType>>,
123}
124
125#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
126#[serde(rename_all = "camelCase")]
127pub struct QueryParameterValue {
128    /// Optional. The value of this value, if a simple scalar type.
129    pub value: Option<String>,
130    /// Optional. The array values, if this is an array type.
131    pub array_values: Option<Vec<QueryParameterValue>>,
132    /// The struct field values.
133    /// An object containing a list of "key": value pairs.
134    /// Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }..
135    pub struct_values: Option<HashMap<String, QueryParameterValue>>,
136}
137
138/// Currently supported connection properties:
139/// A connection-level property to customize query behavior. Under JDBC, these correspond directly to connection properties passed to the DriverManager.
140/// Under ODBC, these correspond to properties in the connection string.
141/// dataset_project_id: represents the default project for datasets that are used in the query. Setting the system variable @@dataset_project_id achieves the same behavior.
142/// time_zone: represents the default timezone used to run the query.
143/// session_id: associates the query with a given session.
144/// query_label: associates the query with a given job label. If set, all subsequent queries in a script or session will have this label. For the format in which a you can specify a query label, see labels in the JobConfiguration resource type. Additional properties are allowed, but ignored. Specifying multiple connection properties with the same key returns an error.
145#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
146#[serde(rename_all = "camelCase")]
147pub struct ConnectionProperty {
148    pub key: String,
149    pub value: String,
150}
151
152#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
153#[serde(rename_all = "camelCase")]
154pub struct AuditLogConfig {
155    /// The log type that this config enables.
156    pub log_type: LogType,
157    /// Specifies the identities that do not cause logging for this type of permission.
158    /// Follows the same format of Binding.members.
159    pub exempted_members: Vec<String>,
160}
161
162#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
163#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
164pub enum LogType {
165    /// Admin reads. Example: CloudIAM getIamPolicy.
166    #[default]
167    AdminRead,
168    /// Data writes. Example: CloudSQL Users create.
169    DataWrite,
170    /// Data reads. Example: CloudSQL Users list.
171    DataRead,
172}
173
174#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
175#[serde(rename_all = "camelCase")]
176pub struct AuditConfig {
177    /// Specifies a service that will be enabled for audit logging. For example, storage.googleapis.com, cloudsql.googleapis.com.
178    /// allServices is a special value that covers all services.
179    pub service: String,
180    /// The configuration for logging of each type of permission.
181    pub audit_log_configs: Vec<AuditLogConfig>,
182}
183
184#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
185#[serde(rename_all = "camelCase")]
186pub struct GetPolicyOptions {
187    /// Optional. The maximum policy version that will be used to format the policy.
188    /// Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected.
189    /// Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset.
190    /// The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1.
191    /// To learn which resources support conditions in their IAM policies, see the IAM documentation.
192    pub requested_policy_version: Option<i32>,
193}
194
195#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
196#[serde(rename_all = "camelCase")]
197pub struct PolicyExpr {
198    /// Textual representation of an expression in Common Expression Language syntax.
199    pub expression: String,
200    /// Optional. Title for the expression, i.e. a short string describing its purpose.
201    /// This can be used e.g. in UIs which allow to enter the expression.
202    pub title: Option<String>,
203    /// Optional. Description of the expression.
204    /// This is a longer text which describes the expression, e.g. when hovered over it in a UI.
205    pub description: Option<String>,
206    /// Optional. String indicating the location of the expression for error reporting,
207    /// e.g. a file name and a position in the file.
208    pub location: Option<String>,
209}
210
211#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
212#[serde(rename_all = "camelCase")]
213pub struct Bindings {
214    /// Role that is assigned to the list of members, or principals.
215    /// For example, roles/viewer, roles/editor, or roles/owner.
216    pub role: String,
217    /// Specifies the principals requesting access for a Google Cloud resource.
218    /// members can have the following values:
219    ///
220    /// allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account.
221    /// allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation.
222    /// user:{emailid}: An email address that represents a specific Google account. For example, alice@example.com .
223    /// serviceAccount:{emailid}: An email address that represents a Google service account. For example, my-other-app@appspot.gserviceaccount.com.
224    /// serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]: An identifier for a Kubernetes service account. For example, my-project.svc.id.goog[my-namespace/my-kubernetes-sa].
225    /// group:{emailid}: An email address that represents a Google group. For example, admins@example.com.
226    /// domain:{domain}: The G Suite domain (primary) that represents all the users of that domain. For example, google.com or example.com.
227    /// deleted:user:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a user that has been recently deleted. For example, alice@example.com?uid=123456789012345678901. If the user is recovered, this value reverts to user:{emailid} and the recovered user retains the role in the binding.
228    /// deleted:serviceAccount:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901. If the service account is undeleted, this value reverts to serviceAccount:{emailid} and the undeleted service account retains the role in the binding.
229    /// deleted:group:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, admins@example.com?uid=123456789012345678901. If the group is recovered, this value reverts to group:{emailid} and the recovered group retains the role in the binding.
230    pub members: Vec<String>,
231    /// The condition that is associated with this binding.
232    ///
233    /// If the condition evaluates to true, then this binding applies to the current request.
234    ///
235    /// If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.
236    ///
237    /// To learn which resources support conditions in their IAM policies, see the IAM documentation.
238    pub condition: Option<PolicyExpr>,
239}
240
241#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
242#[serde(rename_all = "camelCase")]
243pub struct Policy {
244    /// Specifies the format of the policy.
245    ///
246    /// Valid values are 0, 1, and 3. Requests that specify an invalid value are rejected.
247    ///
248    /// Any operation that affects conditional role bindings must specify version 3. This requirement applies to the following operations:
249    ///
250    /// Getting a policy that includes a conditional role binding
251    /// Adding a conditional role binding to a policy
252    /// Changing a conditional role binding in a policy
253    /// Removing any role binding, with or without a condition, from a policy that includes conditions
254    /// Important: If you use IAM Conditions, you must include the etag field whenever you call setIamPolicy. If you omit this field, then IAM allows you to overwrite a version 3 policy with a version 1 policy, and all of the conditions in the version 3 policy are lost.
255    ///
256    /// If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset.
257    ///
258    /// To learn which resources support conditions in their IAM policies, see the IAM documentation.
259    pub version: Option<i32>,
260    /// Associates a list of members, or principals, with a role. Optionally, may specify a condition that determines how and when the bindings are applied. Each of the bindings must contain at least one principal.
261    ///
262    /// The bindings in a Policy can refer to up to 1,500 principals;
263    /// up to 250 of these principals can be Google groups.
264    /// Each occurrence of a principal counts towards these limits.
265    /// For example, if the bindings grant 50 different roles to user:alice@example.com,
266    /// and not to any other principal, then you can add another 1,450 principals to the bindings in the Policy.
267    pub bindings: Vec<Bindings>,
268    /// Specifies cloud audit logging configuration for this policy.
269    pub audit_configs: Option<AuditConfig>,
270    /// etag is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy
271    /// from overwriting each other.
272    /// It is strongly suggested that systems make use of the etag in
273    /// the read-modify-write cycle to perform policy updates in order to avoid race conditions:
274    /// An etag is returned in the response to getIamPolicy,
275    /// and systems are expected to put that etag in the request
276    /// to setIamPolicy to ensure that their change will be applied to the same version of the policy.
277    ///
278    /// Important: If you use IAM Conditions,
279    /// you must include the etag field whenever you call setIamPolicy.
280    /// If you omit this field, then IAM allows you to overwrite a version 3 policy with a version 1 policy,
281    /// and all of the conditions in the version 3 policy are lost.
282    ///
283    /// A base64-encoded string.
284    pub etag: Option<String>,
285}
286
287#[derive(Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, Debug, Default)]
288#[serde(rename_all = "camelCase")]
289pub struct ErrorProto {
290    /// A short error code that summarizes the error.
291    pub reason: Option<String>,
292    /// Specifies where the error occurred, if present.
293    pub location: Option<String>,
294    /// A human-readable description of the error.
295    pub message: Option<String>,
296}