Skip to content

Commit

Permalink
feat: Automated regeneration of BigQueryReservation client (#11196)
Browse files Browse the repository at this point in the history
Auto-created at 2024-03-24 13:11:00 +0000 using the toys pull request generator.
  • Loading branch information
yoshi-code-bot authored Mar 24, 2024
1 parent 160a91e commit 41659ef
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/big_query_reservation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Install this package from [Hex](https://hex.pm) by adding

```elixir
def deps do
[{:google_api_big_query_reservation, "~> 0.17"}]
[{:google_api_big_query_reservation, "~> 0.18"}]
end
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,78 @@ defmodule GoogleApi.BigQueryReservation.V1.Api.Projects do
|> Response.decode(opts ++ [struct: %GoogleApi.BigQueryReservation.V1.Model.Empty{}])
end

@doc """
Failover a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
## Parameters
* `connection` (*type:* `GoogleApi.BigQueryReservation.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. Resource name of the reservation to failover. E.g., `projects/myproject/locations/US/reservations/team1-prod`
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:"$.xgafv"` (*type:* `String.t`) - V1 error format.
* `:access_token` (*type:* `String.t`) - OAuth access token.
* `:alt` (*type:* `String.t`) - Data format for response.
* `:callback` (*type:* `String.t`) - JSONP
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
* `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart").
* `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart").
* `:body` (*type:* `GoogleApi.BigQueryReservation.V1.Model.FailoverReservationRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.BigQueryReservation.V1.Model.Reservation{}}` on success
* `{:error, info}` on failure
"""
@spec bigqueryreservation_projects_locations_reservations_failover_reservation(
Tesla.Env.client(),
String.t(),
keyword(),
keyword()
) ::
{:ok, GoogleApi.BigQueryReservation.V1.Model.Reservation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def bigqueryreservation_projects_locations_reservations_failover_reservation(
connection,
name,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:"$.xgafv" => :query,
:access_token => :query,
:alt => :query,
:callback => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:uploadType => :query,
:upload_protocol => :query,
:body => :body
}

request =
Request.new()
|> Request.method(:post)
|> Request.url("/v1/{+name}:failoverReservation", %{
"name" => URI.encode(name, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)

connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.BigQueryReservation.V1.Model.Reservation{}])
end

@doc """
Returns information about the reservation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule GoogleApi.BigQueryReservation.V1 do
API client metadata for GoogleApi.BigQueryReservation.V1.
"""

@discovery_revision "20240306"
@discovery_revision "20240321"

def discovery_revision(), do: @discovery_revision
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2019 Google LLC
#
# 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.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BigQueryReservation.V1.Model.FailoverReservationRequest do
@moduledoc """
The request for ReservationService.FailoverReservation.
## Attributes
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{}
end

defimpl Poison.Decoder, for: GoogleApi.BigQueryReservation.V1.Model.FailoverReservationRequest do
def decode(value, options) do
GoogleApi.BigQueryReservation.V1.Model.FailoverReservationRequest.decode(value, options)
end
end

defimpl Poison.Encoder, for: GoogleApi.BigQueryReservation.V1.Model.FailoverReservationRequest do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ defmodule GoogleApi.BigQueryReservation.V1.Model.Reservation do
* `ignoreIdleSlots` (*type:* `boolean()`, *default:* `nil`) - If false, any query or pipeline job using this reservation will use idle slots from other reservations within the same admin project. If true, a query or pipeline job using this reservation will execute with the slot capacity specified in the slot_capacity field at most.
* `multiRegionAuxiliary` (*type:* `boolean()`, *default:* `nil`) - Applicable only for reservations located within one of the BigQuery multi-regions (US or EU). If set to true, this reservation is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this reservation is placed in the organization's default region. NOTE: this is a preview feature. Project must be allow-listed in order to set this field.
* `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the reservation, e.g., `projects/*/locations/*/reservations/team1-prod`. The reservation_id must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters.
* `originalPrimaryLocation` (*type:* `String.t`, *default:* `nil`) - Optional. The original primary location of the reservation which is set only during its creation and remains unchanged afterwards. It can be used by the customer to answer questions about disaster recovery billing. The field is output only for customers and should not be specified, however, the google.api.field_behavior is not set to OUTPUT_ONLY since these fields are set in rerouted requests sent across regions.
* `primaryLocation` (*type:* `String.t`, *default:* `nil`) - Optional. The primary location of the reservation. The field is only meaningful for reservation used for cross region disaster recovery. The field is output only for customers and should not be specified, however, the google.api.field_behavior is not set to OUTPUT_ONLY since these fields are set in rerouted requests sent across regions.
* `secondaryLocation` (*type:* `String.t`, *default:* `nil`) - Optional. The secondary location of the reservation which is used for cross region disaster recovery purposes. Customer can set this in create/update reservation calls to create a failover reservation or convert a non-failover reservation to a failover reservation.
* `slotCapacity` (*type:* `String.t`, *default:* `nil`) - Baseline slots available to this reservation. A slot is a unit of computational power in BigQuery, and serves as the unit of parallelism. Queries using this reservation might use more slots during runtime if ignore_idle_slots is set to false, or autoscaling is enabled. If edition is EDITION_UNSPECIFIED and total slot_capacity of the reservation and its siblings exceeds the total slot_count of all capacity commitments, the request will fail with `google.rpc.Code.RESOURCE_EXHAUSTED`. If edition is any value but EDITION_UNSPECIFIED, then the above requirement is not needed. The total slot_capacity of the reservation and its siblings may exceed the total slot_count of capacity commitments. In that case, the exceeding slots will be charged with the autoscale SKU. You can increase the number of baseline slots in a reservation every few minutes. If you want to decrease your baseline slots, you are limited to once an hour if you have recently changed your baseline slot capacity and your baseline slots exceed your committed slots. Otherwise, you can decrease your baseline slots every few minutes.
* `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Last update time of the reservation.
"""
Expand All @@ -42,6 +45,9 @@ defmodule GoogleApi.BigQueryReservation.V1.Model.Reservation do
:ignoreIdleSlots => boolean() | nil,
:multiRegionAuxiliary => boolean() | nil,
:name => String.t() | nil,
:originalPrimaryLocation => String.t() | nil,
:primaryLocation => String.t() | nil,
:secondaryLocation => String.t() | nil,
:slotCapacity => String.t() | nil,
:updateTime => DateTime.t() | nil
}
Expand All @@ -53,6 +59,9 @@ defmodule GoogleApi.BigQueryReservation.V1.Model.Reservation do
field(:ignoreIdleSlots)
field(:multiRegionAuxiliary)
field(:name)
field(:originalPrimaryLocation)
field(:primaryLocation)
field(:secondaryLocation)
field(:slotCapacity)
field(:updateTime, as: DateTime)
end
Expand Down
2 changes: 1 addition & 1 deletion clients/big_query_reservation/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
defmodule GoogleApi.BigQueryReservation.Mixfile do
use Mix.Project

@version "0.17.0"
@version "0.18.0"

def project() do
[
Expand Down

0 comments on commit 41659ef

Please sign in to comment.