google-cloud-spanner 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google-cloud-spanner.rb +5 -4
  3. data/lib/google/cloud/spanner.rb +2 -346
  4. data/lib/google/cloud/spanner/admin/database.rb +39 -3
  5. data/lib/google/cloud/spanner/admin/database/credentials.rb +5 -9
  6. data/lib/google/cloud/spanner/admin/database/v1.rb +69 -28
  7. data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +46 -0
  8. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +111 -53
  9. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +63 -0
  10. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +8 -19
  11. data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +93 -0
  12. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +15 -9
  13. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +29 -0
  14. data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +2 -1
  15. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +2 -12
  16. data/lib/google/cloud/spanner/admin/instance.rb +39 -3
  17. data/lib/google/cloud/spanner/admin/instance/credentials.rb +5 -9
  18. data/lib/google/cloud/spanner/admin/instance/v1.rb +69 -28
  19. data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +46 -0
  20. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +63 -0
  21. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +8 -19
  22. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +93 -0
  23. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +15 -9
  24. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +29 -0
  25. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +8 -1
  26. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +2 -1
  27. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +2 -12
  28. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +125 -58
  29. data/lib/google/cloud/spanner/database/job.rb +1 -0
  30. data/lib/google/cloud/spanner/instance/job.rb +1 -0
  31. data/lib/google/cloud/spanner/v1/credentials.rb +1 -0
  32. data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +1 -0
  33. data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +1 -0
  34. data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +1 -0
  35. data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +9 -6
  36. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +1 -0
  37. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +1 -0
  38. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +1 -0
  39. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +1 -0
  40. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +1 -0
  41. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +1 -0
  42. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +1 -0
  43. data/lib/google/cloud/spanner/v1/spanner_client.rb +28 -26
  44. data/lib/google/cloud/spanner/version.rb +1 -1
  45. data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +1 -1
  46. data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +3 -2
  47. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +1 -1
  48. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +3 -2
  49. data/lib/google/spanner/v1/keys_pb.rb +1 -0
  50. data/lib/google/spanner/v1/mutation_pb.rb +1 -0
  51. data/lib/google/spanner/v1/query_plan_pb.rb +1 -0
  52. data/lib/google/spanner/v1/result_set_pb.rb +1 -0
  53. data/lib/google/spanner/v1/spanner_pb.rb +1 -0
  54. data/lib/google/spanner/v1/spanner_services_pb.rb +1 -0
  55. data/lib/google/spanner/v1/transaction_pb.rb +1 -0
  56. data/lib/google/spanner/v1/type_pb.rb +1 -0
  57. metadata +14 -8
  58. data/lib/google/cloud/spanner/admin/database/v1/doc/overview.rb +0 -58
  59. data/lib/google/cloud/spanner/admin/instance/v1/doc/overview.rb +0 -58
@@ -0,0 +1,63 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Iam
18
+ module V1
19
+ # Request message for +SetIamPolicy+ method.
20
+ # @!attribute [rw] resource
21
+ # @return [String]
22
+ # REQUIRED: The resource for which the policy is being specified.
23
+ # +resource+ is usually specified as a path. For example, a Project
24
+ # resource is specified as +projects/\\{project}+.
25
+ # @!attribute [rw] policy
26
+ # @return [Google::Iam::V1::Policy]
27
+ # REQUIRED: The complete policy to be applied to the +resource+. The size of
28
+ # the policy is limited to a few 10s of KB. An empty policy is a
29
+ # valid policy but certain Cloud Platform services (such as Projects)
30
+ # might reject them.
31
+ class SetIamPolicyRequest; end
32
+
33
+ # Request message for +GetIamPolicy+ method.
34
+ # @!attribute [rw] resource
35
+ # @return [String]
36
+ # REQUIRED: The resource for which the policy is being requested.
37
+ # +resource+ is usually specified as a path. For example, a Project
38
+ # resource is specified as +projects/\\{project}+.
39
+ class GetIamPolicyRequest; end
40
+
41
+ # Request message for +TestIamPermissions+ method.
42
+ # @!attribute [rw] resource
43
+ # @return [String]
44
+ # REQUIRED: The resource for which the policy detail is being requested.
45
+ # +resource+ is usually specified as a path. For example, a Project
46
+ # resource is specified as +projects/\\{project}+.
47
+ # @!attribute [rw] permissions
48
+ # @return [Array<String>]
49
+ # The set of permissions to check for the +resource+. Permissions with
50
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
51
+ # information see
52
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
53
+ class TestIamPermissionsRequest; end
54
+
55
+ # Response message for +TestIamPermissions+ method.
56
+ # @!attribute [rw] permissions
57
+ # @return [Array<String>]
58
+ # A subset of +TestPermissionsRequest.permissions+ that the caller is
59
+ # allowed.
60
+ class TestIamPermissionsResponse; end
61
+ end
62
+ end
63
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module Google
16
17
  module Iam
17
18
  module V1
@@ -85,17 +86,17 @@ module Google
85
86
  # * +allAuthenticatedUsers+: A special identifier that represents anyone
86
87
  # who is authenticated with a Google account or a service account.
87
88
  #
88
- # * +user:{emailid}+: An email address that represents a specific Google
89
+ # * +user:\\{emailid}+: An email address that represents a specific Google
89
90
  # account. For example, +alice@gmail.com+ or +joe@example.com+.
90
91
  #
91
92
  #
92
- # * +serviceAccount:{emailid}+: An email address that represents a service
93
+ # * +serviceAccount:\\{emailid}+: An email address that represents a service
93
94
  # account. For example, +my-other-app@appspot.gserviceaccount.com+.
94
95
  #
95
- # * +group:{emailid}+: An email address that represents a Google group.
96
+ # * +group:\\{emailid}+: An email address that represents a Google group.
96
97
  # For example, +admins@example.com+.
97
98
  #
98
- # * +domain:{domain}+: A Google Apps domain name that represents all the
99
+ # * +domain:\\{domain}+: A Google Apps domain name that represents all the
99
100
  # users of that domain. For example, +google.com+ or +example.com+.
100
101
  class Binding; end
101
102
 
@@ -121,19 +122,7 @@ module Google
121
122
  # A single identity requesting access for a Cloud Platform resource.
122
123
  # Follows the same format of Binding.members.
123
124
  # Required
124
- class BindingDelta
125
- # The type of action performed on a Binding in a policy.
126
- module Action
127
- # Unspecified.
128
- ACTION_UNSPECIFIED = 0
129
-
130
- # Addition of a Binding.
131
- ADD = 1
132
-
133
- # Removal of a Binding.
134
- REMOVE = 2
135
- end
136
- end
125
+ class BindingDelta; end
137
126
  end
138
127
  end
139
- end
128
+ end
@@ -0,0 +1,93 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Longrunning
18
+ # This resource represents a long-running operation that is the result of a
19
+ # network API call.
20
+ # @!attribute [rw] name
21
+ # @return [String]
22
+ # The server-assigned name, which is only unique within the same service that
23
+ # originally returns it. If you use the default HTTP mapping, the
24
+ # +name+ should have the format of +operations/some/unique/name+.
25
+ # @!attribute [rw] metadata
26
+ # @return [Google::Protobuf::Any]
27
+ # Service-specific metadata associated with the operation. It typically
28
+ # contains progress information and common metadata such as create time.
29
+ # Some services might not provide such metadata. Any method that returns a
30
+ # long-running operation should document the metadata type, if any.
31
+ # @!attribute [rw] done
32
+ # @return [true, false]
33
+ # If the value is +false+, it means the operation is still in progress.
34
+ # If true, the operation is completed, and either +error+ or +response+ is
35
+ # available.
36
+ # @!attribute [rw] error
37
+ # @return [Google::Rpc::Status]
38
+ # The error result of the operation in case of failure or cancellation.
39
+ # @!attribute [rw] response
40
+ # @return [Google::Protobuf::Any]
41
+ # The normal response of the operation in case of success. If the original
42
+ # method returns no data on success, such as +Delete+, the response is
43
+ # +google.protobuf.Empty+. If the original method is standard
44
+ # +Get+/+Create+/+Update+, the response should be the resource. For other
45
+ # methods, the response should have the type +XxxResponse+, where +Xxx+
46
+ # is the original method name. For example, if the original method name
47
+ # is +TakeSnapshot()+, the inferred response type is
48
+ # +TakeSnapshotResponse+.
49
+ class Operation; end
50
+
51
+ # The request message for {Google::Longrunning::Operations::GetOperation Operations::GetOperation}.
52
+ # @!attribute [rw] name
53
+ # @return [String]
54
+ # The name of the operation resource.
55
+ class GetOperationRequest; end
56
+
57
+ # The request message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
58
+ # @!attribute [rw] name
59
+ # @return [String]
60
+ # The name of the operation collection.
61
+ # @!attribute [rw] filter
62
+ # @return [String]
63
+ # The standard list filter.
64
+ # @!attribute [rw] page_size
65
+ # @return [Integer]
66
+ # The standard list page size.
67
+ # @!attribute [rw] page_token
68
+ # @return [String]
69
+ # The standard list page token.
70
+ class ListOperationsRequest; end
71
+
72
+ # The response message for {Google::Longrunning::Operations::ListOperations Operations::ListOperations}.
73
+ # @!attribute [rw] operations
74
+ # @return [Array<Google::Longrunning::Operation>]
75
+ # A list of operations that matches the specified filter in the request.
76
+ # @!attribute [rw] next_page_token
77
+ # @return [String]
78
+ # The standard List next-page token.
79
+ class ListOperationsResponse; end
80
+
81
+ # The request message for {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}.
82
+ # @!attribute [rw] name
83
+ # @return [String]
84
+ # The name of the operation resource to be cancelled.
85
+ class CancelOperationRequest; end
86
+
87
+ # The request message for {Google::Longrunning::Operations::DeleteOperation Operations::DeleteOperation}.
88
+ # @!attribute [rw] name
89
+ # @return [String]
90
+ # The name of the operation resource to be deleted.
91
+ class DeleteOperationRequest; end
92
+ end
93
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module Google
16
17
  module Protobuf
17
18
  # +Any+ contains an arbitrary serialized protocol buffer message along with a
@@ -95,17 +96,18 @@ module Google
95
96
  # }
96
97
  # @!attribute [rw] type_url
97
98
  # @return [String]
98
- # A URL/resource name whose content describes the type of the
99
- # serialized protocol buffer message.
99
+ # A URL/resource name that uniquely identifies the type of the serialized
100
+ # protocol buffer message. The last segment of the URL's path must represent
101
+ # the fully qualified name of the type (as in
102
+ # +path/google.protobuf.Duration+). The name should be in a canonical form
103
+ # (e.g., leading "." is not accepted).
100
104
  #
101
- # For URLs which use the scheme +http+, +https+, or no scheme, the
102
- # following restrictions and interpretations apply:
105
+ # In practice, teams usually precompile into the binary all types that they
106
+ # expect it to use in the context of Any. However, for URLs which use the
107
+ # scheme +http+, +https+, or no scheme, one can optionally set up a type
108
+ # server that maps type URLs to message definitions as follows:
103
109
  #
104
110
  # * If no scheme is provided, +https+ is assumed.
105
- # * The last segment of the URL's path must represent the fully
106
- # qualified name of the type (as in +path/google.protobuf.Duration+).
107
- # The name should be in a canonical form (e.g., leading "." is
108
- # not accepted).
109
111
  # * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
110
112
  # value in binary format, or produce an error.
111
113
  # * Applications are allowed to cache lookup results based on the
@@ -114,6 +116,10 @@ module Google
114
116
  # on changes to types. (Use versioned type names to manage
115
117
  # breaking changes.)
116
118
  #
119
+ # Note: this functionality is not currently available in the official
120
+ # protobuf release, and it is not used for type URLs beginning with
121
+ # type.googleapis.com.
122
+ #
117
123
  # Schemes other than +http+, +https+ (or the empty scheme) might be
118
124
  # used with implementation specific semantics.
119
125
  # @!attribute [rw] value
@@ -0,0 +1,29 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Protobuf
18
+ # A generic empty message that you can re-use to avoid defining duplicated
19
+ # empty messages in your APIs. A typical example is to use it as the request
20
+ # or the response type of an API method. For instance:
21
+ #
22
+ # service Foo {
23
+ # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
+ # }
25
+ #
26
+ # The JSON representation for +Empty+ is empty JSON object +{}+.
27
+ class Empty; end
28
+ end
29
+ end
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module Google
16
17
  module Rpc
17
18
  # The +Status+ type defines a logical error model that is suitable for different
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,21 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  module Google
16
17
  module Spanner
17
18
  module Admin
18
19
  module Database
19
- ##
20
- # # Cloud Spanner Database Admin API Contents
21
- #
22
- # | Class | Description |
23
- # | ----- | ----------- |
24
- # | [DatabaseAdminClient][] | |
25
- # | [Data Types][] | Data types for Google::Cloud::Spanner::Admin::Database::V1 |
26
- #
27
- # [DatabaseAdminClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-spanner-admin-database/latest/google/spanner/admin/database/v1/databaseadminclient
28
- # [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-spanner-admin-database/latest/google/spanner/admin/database/v1/datatypes
29
- #
30
20
  module V1
31
21
  # A Cloud Spanner database.
32
22
  # @!attribute [rw] name
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require "google/gax"
16
17
  require "pathname"
17
18
 
@@ -34,17 +35,47 @@ module Google
34
35
  #
35
36
  # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
37
  # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
- # 3. [Enable the Cloud Spanner Instance Admin API.](https://console.cloud.google.com/apis/api/spanner-admin-instance)
38
+ # 3. [Enable the Cloud Spanner Instance Admin API.](https://console.cloud.google.com/apis/library/spanner.googleapis.com)
38
39
  # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
39
40
  #
41
+ # ### Installation
42
+ # ```
43
+ # $ gem install google-cloud-spanner
44
+ # ```
45
+ #
40
46
  # ### Next Steps
41
47
  # - Read the [Cloud Spanner Instance Admin API Product documentation][Product Documentation]
42
48
  # to learn more about the product and see How-to Guides.
43
49
  # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
44
50
  # to see the full list of Cloud APIs that we cover.
45
51
  #
46
- # [Product Documentation]: https://cloud.google.com/spanner-admin-instance
52
+ # [Product Documentation]: https://cloud.google.com/spanner
53
+ #
54
+ # ## Enabling Logging
55
+ #
56
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
57
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
58
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
59
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
60
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
61
+ #
62
+ # Configuring a Ruby stdlib logger:
63
+ #
64
+ # ```ruby
65
+ # require "logger"
66
+ #
67
+ # module MyLogger
68
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
69
+ # def logger
70
+ # LOGGER
71
+ # end
72
+ # end
47
73
  #
74
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
75
+ # module GRPC
76
+ # extend MyLogger
77
+ # end
78
+ # ```
48
79
  #
49
80
  module Instance
50
81
  # rubocop:enable LineLength
@@ -108,6 +139,11 @@ module Google
108
139
  # or the specified config is missing data points.
109
140
  # @param timeout [Numeric]
110
141
  # The default timeout, in seconds, for calls made through this client.
142
+ # @param metadata [Hash]
143
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
144
+ # @param exception_transformer [Proc]
145
+ # An optional proc that intercepts any exceptions raised during an API call to inject
146
+ # custom error handling.
111
147
  def self.new(*args, version: :v1, **kwargs)
112
148
  unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
113
149
  raise "The version: #{version} is not available. The available versions " \
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require "googleauth"
16
17
 
17
18
  module Google
@@ -19,15 +20,10 @@ module Google
19
20
  module Spanner
20
21
  module Admin
21
22
  module Instance
22
- class Credentials < Google::Auth::Credentials
23
- SCOPE = [
24
- "https://www.googleapis.com/auth/cloud-platform",
25
- "https://www.googleapis.com/auth/spanner.admin"
26
- ].freeze
27
- PATH_ENV_VARS = %w(SPANNER_ADMIN_INSTANCE_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE)
28
- JSON_ENV_VARS = %w(SPANNER_ADMIN_INSTANCE_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON GCLOUD_KEYFILE_JSON)
29
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
30
- end
23
+ ##
24
+ # @deprecated Use version-specific credentials classes
25
+ #
26
+ Credentials = Google::Cloud::Spanner::Admin::Instance::V1::Credentials
31
27
  end
32
28
  end
33
29
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,40 +12,72 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require "google/cloud/spanner/admin/instance/v1/instance_admin_client"
17
+ require "google/spanner/admin/instance/v1/spanner_instance_admin_pb"
16
18
 
17
19
  module Google
18
20
  module Cloud
19
21
  module Spanner
20
22
  module Admin
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Cloud Spanner Instance Admin API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
25
- #
26
- # [Cloud Spanner Instance Admin API][Product Documentation]:
27
- #
28
- # - [Product Documentation][]
29
- #
30
- # ## Quick Start
31
- # In order to use this library, you first need to go through the following
32
- # steps:
33
- #
34
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
35
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
36
- # 3. [Enable the Cloud Spanner Instance Admin API.](https://console.cloud.google.com/apis/api/spanner-admin-instance)
37
- # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
38
- #
39
- # ### Next Steps
40
- # - Read the [Cloud Spanner Instance Admin API Product documentation][Product Documentation]
41
- # to learn more about the product and see How-to Guides.
42
- # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
43
- # to see the full list of Cloud APIs that we cover.
44
- #
45
- # [Product Documentation]: https://cloud.google.com/spanner-admin-instance
46
- #
47
- #
48
23
  module Instance
24
+ # rubocop:disable LineLength
25
+
26
+ ##
27
+ # # Ruby Client for Cloud Spanner Instance Admin API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
28
+ #
29
+ # [Cloud Spanner Instance Admin API][Product Documentation]:
30
+ #
31
+ # - [Product Documentation][]
32
+ #
33
+ # ## Quick Start
34
+ # In order to use this library, you first need to go through the following
35
+ # steps:
36
+ #
37
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
38
+ # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
39
+ # 3. [Enable the Cloud Spanner Instance Admin API.](https://console.cloud.google.com/apis/library/spanner.googleapis.com)
40
+ # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
41
+ #
42
+ # ### Installation
43
+ # ```
44
+ # $ gem install google-cloud-spanner
45
+ # ```
46
+ #
47
+ # ### Next Steps
48
+ # - Read the [Cloud Spanner Instance Admin API Product documentation][Product Documentation]
49
+ # to learn more about the product and see How-to Guides.
50
+ # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
51
+ # to see the full list of Cloud APIs that we cover.
52
+ #
53
+ # [Product Documentation]: https://cloud.google.com/spanner
54
+ #
55
+ # ## Enabling Logging
56
+ #
57
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
58
+ # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
59
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
60
+ # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
61
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
62
+ #
63
+ # Configuring a Ruby stdlib logger:
64
+ #
65
+ # ```ruby
66
+ # require "logger"
67
+ #
68
+ # module MyLogger
69
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
70
+ # def logger
71
+ # LOGGER
72
+ # end
73
+ # end
74
+ #
75
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
76
+ # module GRPC
77
+ # extend MyLogger
78
+ # end
79
+ # ```
80
+ #
49
81
  module V1
50
82
  # rubocop:enable LineLength
51
83
 
@@ -96,11 +128,18 @@ module Google
96
128
  # or the specified config is missing data points.
97
129
  # @param timeout [Numeric]
98
130
  # The default timeout, in seconds, for calls made through this client.
131
+ # @param metadata [Hash]
132
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
133
+ # @param exception_transformer [Proc]
134
+ # An optional proc that intercepts any exceptions raised during an API call to inject
135
+ # custom error handling.
99
136
  def self.new \
100
137
  credentials: nil,
101
138
  scopes: nil,
102
139
  client_config: nil,
103
140
  timeout: nil,
141
+ metadata: nil,
142
+ exception_transformer: nil,
104
143
  lib_name: nil,
105
144
  lib_version: nil
106
145
  kwargs = {
@@ -108,6 +147,8 @@ module Google
108
147
  scopes: scopes,
109
148
  client_config: client_config,
110
149
  timeout: timeout,
150
+ metadata: metadata,
151
+ exception_transformer: exception_transformer,
111
152
  lib_name: lib_name,
112
153
  lib_version: lib_version
113
154
  }.select { |_, v| v != nil }