Class: Google::Cloud::Bigtable::AppProfile
- Inherits:
-
Object
- Object
- Google::Cloud::Bigtable::AppProfile
- Defined in:
- lib/google/cloud/bigtable/app_profile.rb,
lib/google/cloud/bigtable/app_profile/job.rb,
lib/google/cloud/bigtable/app_profile/list.rb
Overview
AppProfile
A configuration object describing how Cloud Bigtable should treat traffic from a particular end user application.
Defined Under Namespace
Class Method Summary collapse
-
.multi_cluster_routing ⇒ Google::Cloud::Bigtable::MultiClusterRoutingUseAny
Creates an instance of the multi cluster routing policy.
-
.single_cluster_routing(cluster_id, allow_transactional_writes: false) ⇒ Google::Cloud::Bigtable::SingleClusterRouting
Creates an instance of the single cluster routing policy.
Instance Method Summary collapse
-
#delete(ignore_warnings: false) ⇒ Boolean
Deletes the app profile.
-
#description ⇒ String
Description of the app profile.
-
#description=(text) ⇒ Object
Sets the description of the app profile.
-
#etag ⇒ String
Etag for optimistic concurrency control.
-
#instance_id ⇒ String
The unique identifier for the instance to which the app profile belongs.
-
#multi_cluster_routing ⇒ Google::Cloud::Bigtable::MultiClusterRoutingUseAny?
Gets the multi-cluster routing policy, if present.
-
#name ⇒ String
The unique identifier for the app profile.
-
#path ⇒ String
The full path for the app profile resource.
-
#project_id ⇒ String
The unique identifier for the project to which the app profile belongs.
-
#reload! ⇒ Google::Cloud::Bigtable::AppProfile
Reloads the app profile data.
-
#routing_policy ⇒ Google::Cloud::Bigtable::RoutingPolicy
Gets the routing policy for all read/write requests that use the app profile.
-
#routing_policy=(policy) ⇒ Object
Sets the routing policy for the app profile.
-
#save(ignore_warnings: false) ⇒ Google::Cloud::Bigtable::AppProfile::Job
(also: #update)
Updates the app profile.
-
#single_cluster_routing ⇒ Google::Cloud::Bigtable::SingleClusterRouting?
Gets the single cluster routing policy, if present.
Class Method Details
.multi_cluster_routing ⇒ Google::Cloud::Bigtable::MultiClusterRoutingUseAny
Creates an instance of the multi cluster routing policy.
Read/write requests may be routed to any cluster in the instance and will fail over to another cluster in the event of transient errors or delays. Choosing this option sacrifices read-your-writes consistency to improve availability.
373 374 375 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 373 def self.multi_cluster_routing Google::Cloud::Bigtable::MultiClusterRoutingUseAny.new end |
.single_cluster_routing(cluster_id, allow_transactional_writes: false) ⇒ Google::Cloud::Bigtable::SingleClusterRouting
Creates an instance of the single cluster routing policy.
Unconditionally routes all read/write requests to a specific cluster. This option preserves read-your-writes consistency but does not improve availability.
412 413 414 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 412 def self.single_cluster_routing cluster_id, allow_transactional_writes: false Google::Cloud::Bigtable::SingleClusterRouting.new cluster_id, allow_transactional_writes end |
Instance Method Details
#delete(ignore_warnings: false) ⇒ Boolean
Deletes the app profile.
265 266 267 268 269 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 265 def delete ignore_warnings: false ensure_service! service.delete_app_profile instance_id, name, ignore_warnings: ignore_warnings true end |
#description ⇒ String
Description of the app profile.
114 115 116 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 114 def description @grpc.description end |
#description=(text) ⇒ Object
Sets the description of the app profile.
123 124 125 126 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 123 def description= text @grpc.description = text @changed_fields["description"] = "description" end |
#etag ⇒ String
Etag for optimistic concurrency control.
105 106 107 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 105 def etag @grpc.etag end |
#instance_id ⇒ String
The unique identifier for the instance to which the app profile belongs.
77 78 79 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 77 def instance_id @grpc.name.split("/")[3] end |
#multi_cluster_routing ⇒ Google::Cloud::Bigtable::MultiClusterRoutingUseAny?
Gets the multi-cluster routing policy, if present.
133 134 135 136 137 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 133 def multi_cluster_routing return nil unless @grpc.multi_cluster_routing_use_any Google::Cloud::Bigtable::MultiClusterRoutingUseAny.new end |
#name ⇒ String
The unique identifier for the app profile.
86 87 88 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 86 def name @grpc.name.split("/")[5] end |
#path ⇒ String
The full path for the app profile resource. Values are of the form:
projects/<project_id>/instances/<instance_id>/appProfiles/<app_profile_name>
.
96 97 98 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 96 def path @grpc.name end |
#project_id ⇒ String
The unique identifier for the project to which the app profile belongs.
68 69 70 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 68 def project_id @grpc.name.split("/")[1] end |
#reload! ⇒ Google::Cloud::Bigtable::AppProfile
Reloads the app profile data.
342 343 344 345 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 342 def reload! @grpc = service.get_app_profile instance_id, name self end |
#routing_policy ⇒ Google::Cloud::Bigtable::RoutingPolicy
Gets the routing policy for all read/write requests that use the app profile.
Routing Policies:
- MultiClusterRoutingUseAny - Read/write requests may be routed to any cluster in the instance and will fail over to another cluster in the event of transient errors or delays. Choosing this option sacrifices read-your-writes consistency to improve availability.
- SingleClusterRouting - Unconditionally
routes all read/write requests to a specific cluster. This option
preserves read-your-writes consistency but does not improve
availability. Value contains
cluster_id
and optional fieldallow_transactional_writes
.
239 240 241 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 239 def routing_policy single_cluster_routing || multi_cluster_routing end |
#routing_policy=(policy) ⇒ Object
Sets the routing policy for the app profile.
194 195 196 197 198 199 200 201 202 203 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 194 def routing_policy= policy routing_policy_grpc = policy.to_grpc if routing_policy_grpc.is_a? Google::Cloud::Bigtable::Admin::V2::AppProfile::SingleClusterRouting @grpc.single_cluster_routing = routing_policy_grpc @changed_fields["routing_policy"] = "single_cluster_routing" else @grpc.multi_cluster_routing_use_any = routing_policy_grpc @changed_fields["routing_policy"] = "multi_cluster_routing_use_any" end end |
#save(ignore_warnings: false) ⇒ Google::Cloud::Bigtable::AppProfile::Job Also known as: update
Updates the app profile.
328 329 330 331 332 333 334 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 328 def save ignore_warnings: false ensure_service! update_mask = Google::Protobuf::FieldMask.new paths: @changed_fields.values grpc = service.update_app_profile @grpc, update_mask, ignore_warnings: ignore_warnings @changed_fields.clear AppProfile::Job.from_grpc grpc, service end |
#single_cluster_routing ⇒ Google::Cloud::Bigtable::SingleClusterRouting?
Gets the single cluster routing policy, if present.
144 145 146 147 148 149 150 151 |
# File 'lib/google/cloud/bigtable/app_profile.rb', line 144 def single_cluster_routing return nil unless @grpc.single_cluster_routing Google::Cloud::Bigtable::SingleClusterRouting.new( @grpc.single_cluster_routing.cluster_id, @grpc.single_cluster_routing.allow_transactional_writes ) end |