Skip to content

Commit

Permalink
feat: Automated regeneration of Spanner client (#11224)
Browse files Browse the repository at this point in the history
Auto-created at 2024-03-29 13:06:31 +0000 using the toys pull request generator.
  • Loading branch information
yoshi-code-bot authored Mar 29, 2024
1 parent 80780ed commit a2ff5be
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/spanner/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_spanner, "~> 0.38"}]
[{:google_api_spanner, "~> 0.39"}]
end
```

Expand Down
62 changes: 62 additions & 0 deletions clients/spanner/lib/google_api/spanner/v1/api/projects.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,68 @@ defmodule GoogleApi.Spanner.V1.Api.Projects do
|> Response.decode(opts ++ [struct: %GoogleApi.Spanner.V1.Model.ListInstancesResponse{}])
end

@doc """
Moves the instance to the target instance config. The returned long-running operation can be used to track the progress of moving the instance. `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of the following criteria: * Has an ongoing move to a different instance config * Has backups * Has an ongoing update * Is under free trial * Contains any CMEK-enabled databases While the operation is pending: * All other attempts to modify the instance, including changes to its compute capacity, are rejected. * The following database and backup admin operations are rejected: * DatabaseAdmin.CreateDatabase, * DatabaseAdmin.UpdateDatabaseDdl (Disabled if default_leader is specified in the request.) * DatabaseAdmin.RestoreDatabase * DatabaseAdmin.CreateBackup * DatabaseAdmin.CopyBackup * Both the source and target instance configs are subject to hourly compute and storage charges. * The instance may experience higher read-write latencies and a higher transaction abort rate. However, moving an instance does not cause any downtime. The returned long-running operation will have a name of the format `/operations/` and can be used to track the move instance operation. The metadata field type is MoveInstanceMetadata. The response field type is Instance, if successful. Cancelling the operation sets its metadata's cancel_time. Cancellation is not immediate since it involves moving any data previously moved to target instance config back to the original instance config. The same operation can be used to track the progress of the cancellation. Upon successful completion of the cancellation, the operation terminates with CANCELLED status. Upon completion(if not cancelled) of the returned operation: * Instance would be successfully moved to the target instance config. * You are billed for compute and storage in target instance config. Authorization requires `spanner.instances.update` permission on the resource instance. For more details, please see [documentation](https://cloud.google.com/spanner/docs/move-instance).
## Parameters
* `connection` (*type:* `GoogleApi.Spanner.V1.Connection.t`) - Connection to server
* `name` (*type:* `String.t`) - Required. The instance to move. Values are of the form `projects//instances/`.
* `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.Spanner.V1.Model.MoveInstanceRequest.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Spanner.V1.Model.Operation{}}` on success
* `{:error, info}` on failure
"""
@spec spanner_projects_instances_move(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Spanner.V1.Model.Operation.t()}
| {:ok, Tesla.Env.t()}
| {:ok, list()}
| {:error, any()}
def spanner_projects_instances_move(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}:move", %{
"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.Spanner.V1.Model.Operation{}])
end

@doc """
Updates an instance, and begins allocating or releasing resources as requested. The returned long-running operation can be used to track the progress of updating the instance. If the named instance does not exist, returns `NOT_FOUND`. Immediately upon completion of this request: * For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level. Until completion of the returned operation: * Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a `CANCELLED` status. * All other attempts to modify the instance are rejected. * Reading the instance via the API continues to give the pre-request resource levels. Upon completion of the returned operation: * Billing begins for all successfully-allocated resources (some types may have lower than the requested levels). * All newly-reserved resources are available for serving the instance's tables. * The instance's new resource levels are readable via the API. The returned long-running operation will have a name of the format `/operations/` and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful. Authorization requires `spanner.instances.update` permission on the resource name.
Expand Down
2 changes: 1 addition & 1 deletion clients/spanner/lib/google_api/spanner/v1/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule GoogleApi.Spanner.V1 do
API client metadata for GoogleApi.Spanner.V1.
"""

@discovery_revision "20240315"
@discovery_revision "20240320"

def discovery_revision(), do: @discovery_revision
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.Spanner.V1.Model.MoveInstanceRequest do
@moduledoc """
The request for MoveInstance.
## Attributes
* `targetConfig` (*type:* `String.t`, *default:* `nil`) - Required. The target instance config for the instance to move. Values are of the form `projects//instanceConfigs/`.
"""

use GoogleApi.Gax.ModelBase

@type t :: %__MODULE__{
:targetConfig => String.t() | nil
}

field(:targetConfig)
end

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

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.MoveInstanceRequest do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
2 changes: 1 addition & 1 deletion clients/spanner/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
defmodule GoogleApi.Spanner.Mixfile do
use Mix.Project

@version "0.38.0"
@version "0.39.0"

def project() do
[
Expand Down

0 comments on commit a2ff5be

Please sign in to comment.