diff --git a/clients/big_query_reservation/README.md b/clients/big_query_reservation/README.md index 4ddba985d1..50b446e54b 100644 --- a/clients/big_query_reservation/README.md +++ b/clients/big_query_reservation/README.md @@ -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 ``` diff --git a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/api/projects.ex b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/api/projects.ex index 5236abe89d..38ef08d791 100644 --- a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/api/projects.ex +++ b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/api/projects.ex @@ -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. diff --git a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/metadata.ex b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/metadata.ex index 3333bad36e..e48b34e5c6 100644 --- a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/metadata.ex +++ b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/metadata.ex @@ -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 diff --git a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/failover_reservation_request.ex b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/failover_reservation_request.ex new file mode 100644 index 0000000000..ad00bd69ff --- /dev/null +++ b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/failover_reservation_request.ex @@ -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 diff --git a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/reservation.ex b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/reservation.ex index e76f4a72d2..fef4e9912e 100644 --- a/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/reservation.ex +++ b/clients/big_query_reservation/lib/google_api/big_query_reservation/v1/model/reservation.ex @@ -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. """ @@ -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 } @@ -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 diff --git a/clients/big_query_reservation/mix.exs b/clients/big_query_reservation/mix.exs index 82ca7bfae6..d6f3bae0da 100644 --- a/clients/big_query_reservation/mix.exs +++ b/clients/big_query_reservation/mix.exs @@ -18,7 +18,7 @@ defmodule GoogleApi.BigQueryReservation.Mixfile do use Mix.Project - @version "0.17.0" + @version "0.18.0" def project() do [