google-cloud-bigtable 0.1.0

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 (88) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +10 -0
  3. data/LICENSE +201 -0
  4. data/README.md +65 -0
  5. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +139 -0
  6. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +85 -0
  7. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +137 -0
  8. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +117 -0
  9. data/lib/google/bigtable/admin/v2/common_pb.rb +24 -0
  10. data/lib/google/bigtable/admin/v2/instance_pb.rb +72 -0
  11. data/lib/google/bigtable/admin/v2/table_pb.rb +88 -0
  12. data/lib/google/bigtable/v2/bigtable_pb.rb +109 -0
  13. data/lib/google/bigtable/v2/bigtable_services_pb.rb +67 -0
  14. data/lib/google/bigtable/v2/data_pb.rb +155 -0
  15. data/lib/google/cloud/bigtable/admin/credentials.rb +26 -0
  16. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +1417 -0
  17. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +123 -0
  18. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1079 -0
  19. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +109 -0
  20. data/lib/google/cloud/bigtable/admin/v2/credentials.rb +50 -0
  21. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +279 -0
  22. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +353 -0
  23. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +194 -0
  24. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +209 -0
  25. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +62 -0
  26. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +127 -0
  27. data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +92 -0
  28. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +124 -0
  29. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +90 -0
  30. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +28 -0
  31. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +223 -0
  32. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +106 -0
  33. data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +83 -0
  34. data/lib/google/cloud/bigtable/admin/v2.rb +200 -0
  35. data/lib/google/cloud/bigtable/admin.rb +196 -0
  36. data/lib/google/cloud/bigtable/app_profile/job.rb +102 -0
  37. data/lib/google/cloud/bigtable/app_profile/list.rb +159 -0
  38. data/lib/google/cloud/bigtable/app_profile.rb +373 -0
  39. data/lib/google/cloud/bigtable/chunk_processor.rb +253 -0
  40. data/lib/google/cloud/bigtable/cluster/job.rb +92 -0
  41. data/lib/google/cloud/bigtable/cluster/list.rb +169 -0
  42. data/lib/google/cloud/bigtable/cluster.rb +264 -0
  43. data/lib/google/cloud/bigtable/column_family.rb +280 -0
  44. data/lib/google/cloud/bigtable/column_range.rb +186 -0
  45. data/lib/google/cloud/bigtable/convert.rb +75 -0
  46. data/lib/google/cloud/bigtable/credentials.rb +24 -0
  47. data/lib/google/cloud/bigtable/errors.rb +35 -0
  48. data/lib/google/cloud/bigtable/gc_rule.rb +215 -0
  49. data/lib/google/cloud/bigtable/instance/cluster_map.rb +70 -0
  50. data/lib/google/cloud/bigtable/instance/job.rb +97 -0
  51. data/lib/google/cloud/bigtable/instance/list.rb +159 -0
  52. data/lib/google/cloud/bigtable/instance.rb +921 -0
  53. data/lib/google/cloud/bigtable/longrunning_job.rb +105 -0
  54. data/lib/google/cloud/bigtable/mutation_entry.rb +244 -0
  55. data/lib/google/cloud/bigtable/mutation_operations.rb +338 -0
  56. data/lib/google/cloud/bigtable/policy.rb +163 -0
  57. data/lib/google/cloud/bigtable/project.rb +580 -0
  58. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +129 -0
  59. data/lib/google/cloud/bigtable/read_operations.rb +345 -0
  60. data/lib/google/cloud/bigtable/row.rb +125 -0
  61. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +539 -0
  62. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +108 -0
  63. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +570 -0
  64. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +273 -0
  65. data/lib/google/cloud/bigtable/row_filter.rb +593 -0
  66. data/lib/google/cloud/bigtable/row_range.rb +174 -0
  67. data/lib/google/cloud/bigtable/rows_mutator.rb +120 -0
  68. data/lib/google/cloud/bigtable/rows_reader.rb +196 -0
  69. data/lib/google/cloud/bigtable/sample_row_key.rb +82 -0
  70. data/lib/google/cloud/bigtable/service.rb +817 -0
  71. data/lib/google/cloud/bigtable/table/cluster_state.rb +93 -0
  72. data/lib/google/cloud/bigtable/table/column_family_map.rb +68 -0
  73. data/lib/google/cloud/bigtable/table/list.rb +147 -0
  74. data/lib/google/cloud/bigtable/table.rb +676 -0
  75. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +579 -0
  76. data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +65 -0
  77. data/lib/google/cloud/bigtable/v2/credentials.rb +45 -0
  78. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +286 -0
  79. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +492 -0
  80. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +124 -0
  81. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +89 -0
  82. data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +83 -0
  83. data/lib/google/cloud/bigtable/v2.rb +132 -0
  84. data/lib/google/cloud/bigtable/value_range.rb +175 -0
  85. data/lib/google/cloud/bigtable/version.rb +22 -0
  86. data/lib/google/cloud/bigtable.rb +223 -0
  87. data/lib/google-cloud-bigtable.rb +167 -0
  88. metadata +283 -0
@@ -0,0 +1,124 @@
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
+ module Google
16
+ module Protobuf
17
+ # +Any+ contains an arbitrary serialized protocol buffer message along with a
18
+ # URL that describes the type of the serialized message.
19
+ #
20
+ # Protobuf library provides support to pack/unpack Any values in the form
21
+ # of utility functions or additional generated methods of the Any type.
22
+ #
23
+ # Example 1: Pack and unpack a message in C++.
24
+ #
25
+ # Foo foo = ...;
26
+ # Any any;
27
+ # any.PackFrom(foo);
28
+ # ...
29
+ # if (any.UnpackTo(&foo)) {
30
+ # ...
31
+ # }
32
+ #
33
+ # Example 2: Pack and unpack a message in Java.
34
+ #
35
+ # Foo foo = ...;
36
+ # Any any = Any.pack(foo);
37
+ # ...
38
+ # if (any.is(Foo.class)) {
39
+ # foo = any.unpack(Foo.class);
40
+ # }
41
+ #
42
+ # Example 3: Pack and unpack a message in Python.
43
+ #
44
+ # foo = Foo(...)
45
+ # any = Any()
46
+ # any.Pack(foo)
47
+ # ...
48
+ # if any.Is(Foo.DESCRIPTOR):
49
+ # any.Unpack(foo)
50
+ # ...
51
+ #
52
+ # Example 4: Pack and unpack a message in Go
53
+ #
54
+ # foo := &pb.Foo{...}
55
+ # any, err := ptypes.MarshalAny(foo)
56
+ # ...
57
+ # foo := &pb.Foo{}
58
+ # if err := ptypes.UnmarshalAny(any, foo); err != nil {
59
+ # ...
60
+ # }
61
+ #
62
+ # The pack methods provided by protobuf library will by default use
63
+ # 'type.googleapis.com/full.type.name' as the type URL and the unpack
64
+ # methods only use the fully qualified type name after the last '/'
65
+ # in the type URL, for example "foo.bar.com/x/y.z" will yield type
66
+ # name "y.z".
67
+ #
68
+ #
69
+ # = JSON
70
+ #
71
+ # The JSON representation of an +Any+ value uses the regular
72
+ # representation of the deserialized, embedded message, with an
73
+ # additional field +@type+ which contains the type URL. Example:
74
+ #
75
+ # package google.profile;
76
+ # message Person {
77
+ # string first_name = 1;
78
+ # string last_name = 2;
79
+ # }
80
+ #
81
+ # {
82
+ # "@type": "type.googleapis.com/google.profile.Person",
83
+ # "firstName": <string>,
84
+ # "lastName": <string>
85
+ # }
86
+ #
87
+ # If the embedded message type is well-known and has a custom JSON
88
+ # representation, that representation will be embedded adding a field
89
+ # +value+ which holds the custom JSON in addition to the +@type+
90
+ # field. Example (for message {Google::Protobuf::Duration}):
91
+ #
92
+ # {
93
+ # "@type": "type.googleapis.com/google.protobuf.Duration",
94
+ # "value": "1.212s"
95
+ # }
96
+ # @!attribute [rw] type_url
97
+ # @return [String]
98
+ # A URL/resource name whose content describes the type of the
99
+ # serialized protocol buffer message.
100
+ #
101
+ # For URLs which use the scheme +http+, +https+, or no scheme, the
102
+ # following restrictions and interpretations apply:
103
+ #
104
+ # * 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
+ # * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
110
+ # value in binary format, or produce an error.
111
+ # * Applications are allowed to cache lookup results based on the
112
+ # URL, or have them precompiled into a binary to avoid any
113
+ # lookup. Therefore, binary compatibility needs to be preserved
114
+ # on changes to types. (Use versioned type names to manage
115
+ # breaking changes.)
116
+ #
117
+ # Schemes other than +http+, +https+ (or the empty scheme) might be
118
+ # used with implementation specific semantics.
119
+ # @!attribute [rw] value
120
+ # @return [String]
121
+ # Must be a valid serialized protocol buffer of the above specified type.
122
+ class Any; end
123
+ end
124
+ end
@@ -0,0 +1,89 @@
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
+ module Google
16
+ module Protobuf
17
+ # Wrapper message for +double+.
18
+ #
19
+ # The JSON representation for +DoubleValue+ is JSON number.
20
+ # @!attribute [rw] value
21
+ # @return [Float]
22
+ # The double value.
23
+ class DoubleValue; end
24
+
25
+ # Wrapper message for +float+.
26
+ #
27
+ # The JSON representation for +FloatValue+ is JSON number.
28
+ # @!attribute [rw] value
29
+ # @return [Float]
30
+ # The float value.
31
+ class FloatValue; end
32
+
33
+ # Wrapper message for +int64+.
34
+ #
35
+ # The JSON representation for +Int64Value+ is JSON string.
36
+ # @!attribute [rw] value
37
+ # @return [Integer]
38
+ # The int64 value.
39
+ class Int64Value; end
40
+
41
+ # Wrapper message for +uint64+.
42
+ #
43
+ # The JSON representation for +UInt64Value+ is JSON string.
44
+ # @!attribute [rw] value
45
+ # @return [Integer]
46
+ # The uint64 value.
47
+ class UInt64Value; end
48
+
49
+ # Wrapper message for +int32+.
50
+ #
51
+ # The JSON representation for +Int32Value+ is JSON number.
52
+ # @!attribute [rw] value
53
+ # @return [Integer]
54
+ # The int32 value.
55
+ class Int32Value; end
56
+
57
+ # Wrapper message for +uint32+.
58
+ #
59
+ # The JSON representation for +UInt32Value+ is JSON number.
60
+ # @!attribute [rw] value
61
+ # @return [Integer]
62
+ # The uint32 value.
63
+ class UInt32Value; end
64
+
65
+ # Wrapper message for +bool+.
66
+ #
67
+ # The JSON representation for +BoolValue+ is JSON +true+ and +false+.
68
+ # @!attribute [rw] value
69
+ # @return [true, false]
70
+ # The bool value.
71
+ class BoolValue; end
72
+
73
+ # Wrapper message for +string+.
74
+ #
75
+ # The JSON representation for +StringValue+ is JSON string.
76
+ # @!attribute [rw] value
77
+ # @return [String]
78
+ # The string value.
79
+ class StringValue; end
80
+
81
+ # Wrapper message for +bytes+.
82
+ #
83
+ # The JSON representation for +BytesValue+ is JSON string.
84
+ # @!attribute [rw] value
85
+ # @return [String]
86
+ # The bytes value.
87
+ class BytesValue; end
88
+ end
89
+ end
@@ -0,0 +1,83 @@
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
+ module Google
16
+ module Rpc
17
+ # The +Status+ type defines a logical error model that is suitable for different
18
+ # programming environments, including REST APIs and RPC APIs. It is used by
19
+ # [gRPC](https://github.com/grpc). The error model is designed to be:
20
+ #
21
+ # * Simple to use and understand for most users
22
+ # * Flexible enough to meet unexpected needs
23
+ #
24
+ # = Overview
25
+ #
26
+ # The +Status+ message contains three pieces of data: error code, error message,
27
+ # and error details. The error code should be an enum value of
28
+ # {Google::Rpc::Code}, but it may accept additional error codes if needed. The
29
+ # error message should be a developer-facing English message that helps
30
+ # developers *understand* and *resolve* the error. If a localized user-facing
31
+ # error message is needed, put the localized message in the error details or
32
+ # localize it in the client. The optional error details may contain arbitrary
33
+ # information about the error. There is a predefined set of error detail types
34
+ # in the package +google.rpc+ that can be used for common error conditions.
35
+ #
36
+ # = Language mapping
37
+ #
38
+ # The +Status+ message is the logical representation of the error model, but it
39
+ # is not necessarily the actual wire format. When the +Status+ message is
40
+ # exposed in different client libraries and different wire protocols, it can be
41
+ # mapped differently. For example, it will likely be mapped to some exceptions
42
+ # in Java, but more likely mapped to some error codes in C.
43
+ #
44
+ # = Other uses
45
+ #
46
+ # The error model and the +Status+ message can be used in a variety of
47
+ # environments, either with or without APIs, to provide a
48
+ # consistent developer experience across different environments.
49
+ #
50
+ # Example uses of this error model include:
51
+ #
52
+ # * Partial errors. If a service needs to return partial errors to the client,
53
+ # it may embed the +Status+ in the normal response to indicate the partial
54
+ # errors.
55
+ #
56
+ # * Workflow errors. A typical workflow has multiple steps. Each step may
57
+ # have a +Status+ message for error reporting.
58
+ #
59
+ # * Batch operations. If a client uses batch request and batch response, the
60
+ # +Status+ message should be used directly inside batch response, one for
61
+ # each error sub-response.
62
+ #
63
+ # * Asynchronous operations. If an API call embeds asynchronous operation
64
+ # results in its response, the status of those operations should be
65
+ # represented directly using the +Status+ message.
66
+ #
67
+ # * Logging. If some API errors are stored in logs, the message +Status+ could
68
+ # be used directly after any stripping needed for security/privacy reasons.
69
+ # @!attribute [rw] code
70
+ # @return [Integer]
71
+ # The status code, which should be an enum value of {Google::Rpc::Code}.
72
+ # @!attribute [rw] message
73
+ # @return [String]
74
+ # A developer-facing error message, which should be in English. Any
75
+ # user-facing error message should be localized and sent in the
76
+ # {Google::Rpc::Status#details} field, or localized by the client.
77
+ # @!attribute [rw] details
78
+ # @return [Array<Google::Protobuf::Any>]
79
+ # A list of messages that carry the error details. There is a common set of
80
+ # message types for APIs to use.
81
+ class Status; end
82
+ end
83
+ end
@@ -0,0 +1,132 @@
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
+ require "google/cloud/bigtable/v2/bigtable_client"
16
+
17
+ module Google
18
+ module Cloud
19
+ module Bigtable
20
+ # rubocop:disable LineLength
21
+
22
+ ##
23
+ # # Ruby Client for Cloud Bigtable API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
24
+ #
25
+ # [Cloud Bigtable API][Product Documentation]:
26
+ # API for reading and writing the contents of Bigtables associated with a
27
+ # cloud project.
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 Bigtable API.](https://console.cloud.google.com/apis/library/bigtable.googleapis.com)
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 Bigtable 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/bigtable
46
+ #
47
+ # ## Enabling Logging
48
+ #
49
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
50
+ # 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,
51
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
52
+ # 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)
53
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
54
+ #
55
+ # Configuring a Ruby stdlib logger:
56
+ #
57
+ # ```ruby
58
+ # require "logger"
59
+ #
60
+ # module MyLogger
61
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
62
+ # def logger
63
+ # LOGGER
64
+ # end
65
+ # end
66
+ #
67
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
68
+ # module GRPC
69
+ # extend MyLogger
70
+ # end
71
+ # ```
72
+ #
73
+ module V2
74
+ # rubocop:enable LineLength
75
+
76
+ ##
77
+ # Service for reading from and writing to existing Bigtable tables.
78
+ #
79
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
80
+ # Provides the means for authenticating requests made by the client. This parameter can
81
+ # be many types.
82
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
83
+ # authenticating requests made by this client.
84
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
85
+ # credentials for this client.
86
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
87
+ # credentials for this client.
88
+ # A `GRPC::Core::Channel` will be used to make calls through.
89
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
90
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
91
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
92
+ # metadata for requests, generally, to give OAuth credentials.
93
+ # @param scopes [Array<String>]
94
+ # The OAuth scopes for this service. This parameter is ignored if
95
+ # an updater_proc is supplied.
96
+ # @param client_config [Hash]
97
+ # A Hash for call options for each method. See
98
+ # Google::Gax#construct_settings for the structure of
99
+ # this data. Falls back to the default config if not specified
100
+ # or the specified config is missing data points.
101
+ # @param timeout [Numeric]
102
+ # The default timeout, in seconds, for calls made through this client.
103
+ # @param metadata [Hash]
104
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
105
+ # @param exception_transformer [Proc]
106
+ # An optional proc that intercepts any exceptions raised during an API call to inject
107
+ # custom error handling.
108
+ def self.new \
109
+ credentials: nil,
110
+ scopes: nil,
111
+ client_config: nil,
112
+ timeout: nil,
113
+ metadata: nil,
114
+ exception_transformer: nil,
115
+ lib_name: nil,
116
+ lib_version: nil
117
+ kwargs = {
118
+ credentials: credentials,
119
+ scopes: scopes,
120
+ client_config: client_config,
121
+ timeout: timeout,
122
+ metadata: metadata,
123
+ exception_transformer: exception_transformer,
124
+ lib_name: lib_name,
125
+ lib_version: lib_version
126
+ }.select { |_, v| v != nil }
127
+ Google::Cloud::Bigtable::V2::BigtableClient.new(**kwargs)
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,175 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2018 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
+
18
+ module Google
19
+ module Cloud
20
+ module Bigtable
21
+ # # ValueRange
22
+ #
23
+ # Specifies a contiguous range of string values.
24
+ #
25
+ # * from value bound : The value at which to from the range.
26
+ # If neither field is set, interpreted as the empty string, inclusive.
27
+ # * End value bound: The value at which to end the range.
28
+ # If neither field is set, interpreted as the infinite string value, exclusive.
29
+ #
30
+ # @example
31
+ # require "google/cloud/bigtable"
32
+ #
33
+ # bigtable = Google::Cloud::Bigtable.new
34
+ # table = bigtable.table("my-instance", "my-table")
35
+ #
36
+ # # Range that includes all row keys including "value-001" to "value-005" excluding
37
+ # table.new_value_range.from("value-001").to("value-005")
38
+ #
39
+ # # Range that includes all row keys including "value-001" up to inclusive "value-010".
40
+ # table.new_value_range.from("value-001").to("value-010", inclusive: true)
41
+ #
42
+ # # Range that includes all row keys including "value-001" up until end of the row keys.
43
+ # table.new_value_range.from("value-001")
44
+ #
45
+ # # Range that includes all row keys exclusive "value-001" up until end of the row keys.
46
+ # table.new_value_range.from("value-001", inclusive: false)
47
+ #
48
+ # # Range with unbounded from and the exclusive end "value-100"
49
+ # table.new_value_range.to("value-100")
50
+ #
51
+ # # Range that includes all row keys including from and end row keys "value-001", "value-100"
52
+ # table.new_value_range.between("value-001", "value-100")
53
+ #
54
+ # # Range that includes all row keys including "value-001" up until "value-100"
55
+ # table.new_value_range.of("value-001", "value-100")
56
+ #
57
+ class ValueRange
58
+ # @private
59
+ # Create value range instance.
60
+ def initialize
61
+ @grpc = Google::Bigtable::V2::ValueRange.new
62
+ end
63
+
64
+ # Ser row range with the lower bound.
65
+ #
66
+ # @param value [String] value. Required
67
+ # @param inclusive [String] Inclusive/Exclusive lower bound.
68
+ # Default it is an inclusive lower bound.
69
+ # @return [Google::Cloud::Bigtable::ValueRange]
70
+ #
71
+ # @example Inclusive lower bound.
72
+ # require "google/cloud/bigtable"
73
+ #
74
+ # bigtable = Google::Cloud::Bigtable.new
75
+ # table = bigtable.table("my-instance", "my-table")
76
+ #
77
+ # range = table.new_value_range.from("value-001")
78
+ #
79
+ # @example Exclusive lower bound.
80
+ # require "google/cloud/bigtable"
81
+ #
82
+ # bigtable = Google::Cloud::Bigtable.new
83
+ # table = bigtable.table("my-instance", "my-table")
84
+ #
85
+ # range = table.new_value_range.from("value-001", inclusive: false)
86
+ #
87
+ def from value, inclusive: true
88
+ if inclusive
89
+ @grpc.start_value_closed = value
90
+ else
91
+ @grpc.start_value_open = value
92
+ end
93
+ self
94
+ end
95
+
96
+ # Set value range with upper bound.
97
+ #
98
+ # @param value [String] value. Required
99
+ # @param inclusive [String] Inclusive/Exclusive upper bound.
100
+ # Default it is an exclusive upper bound.
101
+ # @return [Google::Cloud::Bigtable::ValueRange]
102
+ #
103
+ # @example Inclusive upper bound.
104
+ # require "google/cloud/bigtable"
105
+ #
106
+ # bigtable = Google::Cloud::Bigtable.new
107
+ # table = bigtable.table("my-instance", "my-table")
108
+ #
109
+ # range = table.new_value_range.to("value-010", inclusive: true)
110
+ #
111
+ # @example Exclusive upper bound.
112
+ # require "google/cloud/bigtable"
113
+ #
114
+ # bigtable = Google::Cloud::Bigtable.new
115
+ # table = bigtable.table("my-instance", "my-table")
116
+ #
117
+ # range = table.new_value_range.to("value-010")
118
+ #
119
+ def to value, inclusive: false
120
+ if inclusive
121
+ @grpc.end_value_closed = value
122
+ else
123
+ @grpc.end_value_open = value
124
+ end
125
+ self
126
+ end
127
+
128
+ # Set value range with the inclusive lower and upper bound.
129
+ #
130
+ # @param from_value [String] Inclusive from value. Required
131
+ # @param to_value [String] Inclusive end value. Required
132
+ # @return [Google::Cloud::Bigtable::ValueRange]
133
+ # Range with inclusive from and end value.
134
+ #
135
+ # @example
136
+ # require "google/cloud/bigtable"
137
+ #
138
+ # bigtable = Google::Cloud::Bigtable.new
139
+ # table = bigtable.table("my-instance", "my-table")
140
+ #
141
+ # range = table.new_value_range.between("value-001", "value-010")
142
+ #
143
+ def between from_value, to_value
144
+ from(from_value).to(to_value, inclusive: true)
145
+ end
146
+
147
+ # Set value range with the inclusive lower and the exclusive upper bound.
148
+ #
149
+ # @param from_value [String] Inclusive from value
150
+ # @param to_value [String] Exclusive to value
151
+ # @return [Google::Cloud::Bigtable::ValueRange]
152
+ #
153
+ # @example
154
+ # require "google/cloud/bigtable"
155
+ #
156
+ # bigtable = Google::Cloud::Bigtable.new
157
+ # table = bigtable.table("my-instance", "my-table")
158
+ #
159
+ # range = table.new_value_range.of("value-001", "value-010")
160
+ #
161
+ def of from_value, to_value
162
+ from(from_value).to(to_value)
163
+ end
164
+
165
+ # @private
166
+ #
167
+ # @return [Google::Bigtable::V2::ValueRange]
168
+ #
169
+ def to_grpc
170
+ @grpc
171
+ end
172
+ end
173
+ end
174
+ end
175
+ end