google-cloud-bigquery-reservation-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Bigquery
24
+ module Reservation
25
+ module V1
26
+ module ReservationService
27
+ # Credentials for the ReservationService API.
28
+ class Credentials < ::Google::Auth::Credentials
29
+ self.scope = [
30
+ "https://www.googleapis.com/auth/bigquery",
31
+ "https://www.googleapis.com/auth/cloud-platform"
32
+ ]
33
+ self.env_vars = [
34
+ "BIGQUERY_RESERVATION_CREDENTIALS",
35
+ "BIGQUERY_RESERVATION_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS",
37
+ "GOOGLE_CLOUD_KEYFILE",
38
+ "GCLOUD_KEYFILE",
39
+ "BIGQUERY_RESERVATION_CREDENTIALS_JSON",
40
+ "BIGQUERY_RESERVATION_KEYFILE_JSON",
41
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
42
+ "GOOGLE_CLOUD_KEYFILE_JSON",
43
+ "GCLOUD_KEYFILE_JSON"
44
+ ]
45
+ self.paths = [
46
+ "~/.config/google_cloud/application_default_credentials.json"
47
+ ]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Bigquery
23
+ module Reservation
24
+ module V1
25
+ module ReservationService
26
+ # Path helper methods for the ReservationService API.
27
+ module Paths
28
+ ##
29
+ # Create a fully-qualified Assignment resource string.
30
+ #
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}`
34
+ #
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param reservation [String]
38
+ # @param assignment [String]
39
+ #
40
+ # @return [::String]
41
+ def assignment_path project:, location:, reservation:, assignment:
42
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
43
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
44
+ raise ::ArgumentError, "reservation cannot contain /" if reservation.to_s.include? "/"
45
+
46
+ "projects/#{project}/locations/#{location}/reservations/#{reservation}/assignments/#{assignment}"
47
+ end
48
+
49
+ ##
50
+ # Create a fully-qualified BiReservation resource string.
51
+ #
52
+ # The resource will be in the following format:
53
+ #
54
+ # `projects/{project}/locations/{location}/bireservation`
55
+ #
56
+ # @param project [String]
57
+ # @param location [String]
58
+ #
59
+ # @return [::String]
60
+ def bi_reservation_path project:, location:
61
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
62
+
63
+ "projects/#{project}/locations/#{location}/bireservation"
64
+ end
65
+
66
+ ##
67
+ # Create a fully-qualified CapacityCommitment resource string.
68
+ #
69
+ # The resource will be in the following format:
70
+ #
71
+ # `projects/{project}/locations/{location}/capacityCommitments/{capacity_commitment}`
72
+ #
73
+ # @param project [String]
74
+ # @param location [String]
75
+ # @param capacity_commitment [String]
76
+ #
77
+ # @return [::String]
78
+ def capacity_commitment_path project:, location:, capacity_commitment:
79
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
80
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
81
+
82
+ "projects/#{project}/locations/#{location}/capacityCommitments/#{capacity_commitment}"
83
+ end
84
+
85
+ ##
86
+ # Create a fully-qualified Location resource string.
87
+ #
88
+ # The resource will be in the following format:
89
+ #
90
+ # `projects/{project}/locations/{location}`
91
+ #
92
+ # @param project [String]
93
+ # @param location [String]
94
+ #
95
+ # @return [::String]
96
+ def location_path project:, location:
97
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
98
+
99
+ "projects/#{project}/locations/#{location}"
100
+ end
101
+
102
+ ##
103
+ # Create a fully-qualified Reservation resource string.
104
+ #
105
+ # The resource will be in the following format:
106
+ #
107
+ # `projects/{project}/locations/{location}/reservations/{reservation}`
108
+ #
109
+ # @param project [String]
110
+ # @param location [String]
111
+ # @param reservation [String]
112
+ #
113
+ # @return [::String]
114
+ def reservation_path project:, location:, reservation:
115
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
116
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
117
+
118
+ "projects/#{project}/locations/#{location}/reservations/#{reservation}"
119
+ end
120
+
121
+ extend self
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,216 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/cloud/bigquery/reservation/v1/reservation.proto for package 'google.cloud.bigquery.reservation.v1'
3
+ # Original file comments:
4
+ # Copyright 2020 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/cloud/bigquery/reservation/v1/reservation_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Bigquery
25
+ module Reservation
26
+ module V1
27
+ module ReservationService
28
+ # This API allows users to manage their flat-rate BigQuery reservations.
29
+ #
30
+ # A reservation provides computational resource guarantees, in the form of
31
+ # [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a
32
+ # unit of computational power in BigQuery, and serves as the basic unit of
33
+ # parallelism. In a scan of a multi-partitioned table, a single slot operates
34
+ # on a single partition of the table. A reservation resource exists as a child
35
+ # resource of the admin project and location, e.g.:
36
+ # `projects/myproject/locations/US/reservations/reservationName`.
37
+ #
38
+ # A capacity commitment is a way to purchase compute capacity for BigQuery jobs
39
+ # (in the form of slots) with some committed period of usage. A capacity
40
+ # commitment resource exists as a child resource of the admin project and
41
+ # location, e.g.:
42
+ # `projects/myproject/locations/US/capacityCommitments/id`.
43
+ class Service
44
+
45
+ include GRPC::GenericService
46
+
47
+ self.marshal_class_method = :encode
48
+ self.unmarshal_class_method = :decode
49
+ self.service_name = 'google.cloud.bigquery.reservation.v1.ReservationService'
50
+
51
+ # Creates a new reservation resource.
52
+ rpc :CreateReservation, CreateReservationRequest, Reservation
53
+ # Lists all the reservations for the project in the specified location.
54
+ rpc :ListReservations, ListReservationsRequest, ListReservationsResponse
55
+ # Returns information about the reservation.
56
+ rpc :GetReservation, GetReservationRequest, Reservation
57
+ # Deletes a reservation.
58
+ # Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has
59
+ # assignments.
60
+ rpc :DeleteReservation, DeleteReservationRequest, Google::Protobuf::Empty
61
+ # Updates an existing reservation resource.
62
+ rpc :UpdateReservation, UpdateReservationRequest, Reservation
63
+ # Creates a new capacity commitment resource.
64
+ rpc :CreateCapacityCommitment, CreateCapacityCommitmentRequest, CapacityCommitment
65
+ # Lists all the capacity commitments for the admin project.
66
+ rpc :ListCapacityCommitments, ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse
67
+ # Returns information about the capacity commitment.
68
+ rpc :GetCapacityCommitment, GetCapacityCommitmentRequest, CapacityCommitment
69
+ # Deletes a capacity commitment. Attempting to delete capacity commitment
70
+ # before its commitment_end_time will fail with the error code
71
+ # `google.rpc.Code.FAILED_PRECONDITION`.
72
+ rpc :DeleteCapacityCommitment, DeleteCapacityCommitmentRequest, Google::Protobuf::Empty
73
+ # Updates an existing capacity commitment.
74
+ #
75
+ # Only `plan` and `renewal_plan` fields can be updated.
76
+ #
77
+ # Plan can only be changed to a plan of a longer commitment period.
78
+ # Attempting to change to a plan with shorter commitment period will fail
79
+ # with the error code `google.rpc.Code.FAILED_PRECONDITION`.
80
+ rpc :UpdateCapacityCommitment, UpdateCapacityCommitmentRequest, CapacityCommitment
81
+ # Splits capacity commitment to two commitments of the same plan and
82
+ # `commitment_end_time`.
83
+ #
84
+ # A common use case is to enable downgrading commitments.
85
+ #
86
+ # For example, in order to downgrade from 10000 slots to 8000, you might
87
+ # split a 10000 capacity commitment into commitments of 2000 and 8000. Then,
88
+ # you would change the plan of the first one to `FLEX` and then delete it.
89
+ rpc :SplitCapacityCommitment, SplitCapacityCommitmentRequest, SplitCapacityCommitmentResponse
90
+ # Merges capacity commitments of the same plan into a single commitment.
91
+ #
92
+ # The resulting capacity commitment has the greater commitment_end_time
93
+ # out of the to-be-merged capacity commitments.
94
+ #
95
+ # Attempting to merge capacity commitments of different plan will fail
96
+ # with the error code `google.rpc.Code.FAILED_PRECONDITION`.
97
+ rpc :MergeCapacityCommitments, MergeCapacityCommitmentsRequest, CapacityCommitment
98
+ # Creates an assignment object which allows the given project to submit jobs
99
+ # of a certain type using slots from the specified reservation.
100
+ #
101
+ # Currently a
102
+ # resource (project, folder, organization) can only have one assignment per
103
+ # each (job_type, location) combination, and that reservation will be used
104
+ # for all jobs of the matching type.
105
+ #
106
+ # Different assignments can be created on different levels of the
107
+ # projects, folders or organization hierarchy. During query execution,
108
+ # the assignment is looked up at the project, folder and organization levels
109
+ # in that order. The first assignment found is applied to the query.
110
+ #
111
+ # When creating assignments, it does not matter if other assignments exist at
112
+ # higher levels.
113
+ #
114
+ # Example:
115
+ #
116
+ # * The organization `organizationA` contains two projects, `project1`
117
+ # and `project2`.
118
+ # * Assignments for all three entities (`organizationA`, `project1`, and
119
+ # `project2`) could all be created and mapped to the same or different
120
+ # reservations.
121
+ #
122
+ # Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
123
+ # 'bigquery.admin' permissions on the project using the reservation
124
+ # and the project that owns this reservation.
125
+ #
126
+ # Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment
127
+ # does not match location of the reservation.
128
+ rpc :CreateAssignment, CreateAssignmentRequest, Assignment
129
+ # Lists assignments.
130
+ #
131
+ # Only explicitly created assignments will be returned.
132
+ #
133
+ # Example:
134
+ #
135
+ # * Organization `organizationA` contains two projects, `project1` and
136
+ # `project2`.
137
+ # * Reservation `res1` exists and was created previously.
138
+ # * CreateAssignment was used previously to define the following
139
+ # associations between entities and reservations: `<organizationA, res1>`
140
+ # and `<project1, res1>`
141
+ #
142
+ # In this example, ListAssignments will just return the above two assignments
143
+ # for reservation `res1`, and no expansion/merge will happen.
144
+ #
145
+ # The wildcard "-" can be used for
146
+ # reservations in the request. In that case all assignments belongs to the
147
+ # specified project and location will be listed.
148
+ #
149
+ # **Note** "-" cannot be used for projects nor locations.
150
+ rpc :ListAssignments, ListAssignmentsRequest, ListAssignmentsResponse
151
+ # Deletes a assignment. No expansion will happen.
152
+ #
153
+ # Example:
154
+ #
155
+ # * Organization `organizationA` contains two projects, `project1` and
156
+ # `project2`.
157
+ # * Reservation `res1` exists and was created previously.
158
+ # * CreateAssignment was used previously to define the following
159
+ # associations between entities and reservations: `<organizationA, res1>`
160
+ # and `<project1, res1>`
161
+ #
162
+ # In this example, deletion of the `<organizationA, res1>` assignment won't
163
+ # affect the other assignment `<project1, res1>`. After said deletion,
164
+ # queries from `project1` will still use `res1` while queries from
165
+ # `project2` will switch to use on-demand mode.
166
+ rpc :DeleteAssignment, DeleteAssignmentRequest, Google::Protobuf::Empty
167
+ # Looks up assignments for a specified resource for a particular region.
168
+ # If the request is about a project:
169
+ #
170
+ # 1. Assignments created on the project will be returned if they exist.
171
+ # 2. Otherwise assignments created on the closest ancestor will be
172
+ # returned.
173
+ # 3. Assignments for different JobTypes will all be returned.
174
+ #
175
+ # The same logic applies if the request is about a folder.
176
+ #
177
+ # If the request is about an organization, then assignments created on the
178
+ # organization will be returned (organization doesn't have ancestors).
179
+ #
180
+ # Comparing to ListAssignments, there are some behavior
181
+ # differences:
182
+ #
183
+ # 1. permission on the assignee will be verified in this API.
184
+ # 2. Hierarchy lookup (project->folder->organization) happens in this API.
185
+ # 3. Parent here is `projects/*/locations/*`, instead of
186
+ # `projects/*/locations/*reservations/*`.
187
+ #
188
+ # **Note** "-" cannot be used for projects
189
+ # nor locations.
190
+ rpc :SearchAssignments, SearchAssignmentsRequest, SearchAssignmentsResponse
191
+ # Moves an assignment under a new reservation.
192
+ #
193
+ # This differs from removing an existing assignment and recreating a new one
194
+ # by providing a transactional change that ensures an assignee always has an
195
+ # associated reservation.
196
+ rpc :MoveAssignment, MoveAssignmentRequest, Assignment
197
+ # Retrieves a BI reservation.
198
+ rpc :GetBiReservation, GetBiReservationRequest, BiReservation
199
+ # Updates a BI reservation.
200
+ #
201
+ # Only fields specified in the `field_mask` are updated.
202
+ #
203
+ # A singleton BI reservation always exists with default size 0.
204
+ # In order to reserve BI capacity it needs to be updated to an amount
205
+ # greater than 0. In order to release BI capacity reservation size
206
+ # must be set to 0.
207
+ rpc :UpdateBiReservation, UpdateBiReservationRequest, BiReservation
208
+ end
209
+
210
+ Stub = Service.rpc_stub_class
211
+ end
212
+ end
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Bigquery
23
+ module Reservation
24
+ module V1
25
+ VERSION = "0.1.0"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ # BigQuery Reservation V1 Protocol Buffer Documentation
2
+
3
+ These files are for the YARD documentation of the generated protobuf files.
4
+ They are not intended to be required or loaded at runtime.
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Api
22
+ # An indicator of the behavior of a given field (for example, that a field
23
+ # is required in requests, or given as output but ignored as input).
24
+ # This **does not** change the behavior in protocol buffers itself; it only
25
+ # denotes the behavior and may affect how API tooling handles the field.
26
+ #
27
+ # Note: This enum **may** receive new values in the future.
28
+ module FieldBehavior
29
+ # Conventional default for enums. Do not use this.
30
+ FIELD_BEHAVIOR_UNSPECIFIED = 0
31
+
32
+ # Specifically denotes a field as optional.
33
+ # While all fields in protocol buffers are optional, this may be specified
34
+ # for emphasis if appropriate.
35
+ OPTIONAL = 1
36
+
37
+ # Denotes a field as required.
38
+ # This indicates that the field **must** be provided as part of the request,
39
+ # and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
40
+ REQUIRED = 2
41
+
42
+ # Denotes a field as output only.
43
+ # This indicates that the field is provided in responses, but including the
44
+ # field in a request does nothing (the server *must* ignore it and
45
+ # *must not* throw an error as a result of the field's presence).
46
+ OUTPUT_ONLY = 3
47
+
48
+ # Denotes a field as input only.
49
+ # This indicates that the field is provided in requests, and the
50
+ # corresponding field is not included in output.
51
+ INPUT_ONLY = 4
52
+
53
+ # Denotes a field as immutable.
54
+ # This indicates that the field may be set once in a request to create a
55
+ # resource, but may not be changed thereafter.
56
+ IMMUTABLE = 5
57
+ end
58
+ end
59
+ end