Reference documentation and code samples for the Cloud Bigtable API class Google::Cloud::Bigtable::AppProfile.
AppProfile
A configuration object describing how Cloud Bigtable should treat traffic from a particular end user application.
Inherits
- Object
Example
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" # Update app_profile.description = "User data instance app profile" app_profile.routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing job = app_profile.save job.wait_until_done! # Delete app_profile.delete
Methods
.multi_cluster_routing
def self.multi_cluster_routing() -> Google::Cloud::Bigtable::MultiClusterRoutingUseAnyCreates 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.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing app_profile = instance.create_app_profile( "my-app-profile", routing_policy, description: "App profile for user data instance" ) puts app_profile.routing_policy
.single_cluster_routing
def self.single_cluster_routing(cluster_id, allow_transactional_writes: false) -> Google::Cloud::Bigtable::SingleClusterRoutingCreates 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.
- cluster_id (String) — The cluster to which read/write requests should be routed.
-
allow_transactional_writes (Boolean) (defaults to: false) — If true,
CheckAndMutateRowandReadModifyWriteRowrequests are allowed by this app profile. It is unsafe to send these requests to the same table/row/column in multiple clusters. Default value is false.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing( "my-cluster", allow_transactional_writes: true ) app_profile = instance.create_app_profile( "my-app-profile", routing_policy, description: "App profile for user data instance" ) puts app_profile.routing_policy
#delete
def delete(ignore_warnings: false) -> BooleanDeletes the app profile.
- ignore_warnings (Boolean) (defaults to: false) — Default value is false. If true, ignore safety checks when deleting the app profile.
-
(Boolean) — Returns
trueif the app profile was deleted.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" app_profile.delete ignore_warnings: true # Ignore warnings. # OR : Not ignoring warnings app_profile.delete
#description
def description() -> StringDescription of the app profile.
- (String)
#description=
def description=(text)Sets the description of the app profile.
- text (String) — Description text
#etag
def etag() -> StringEtag for optimistic concurrency control.
- (String)
#instance_id
def instance_id() -> StringThe unique identifier for the instance to which the app profile belongs.
- (String)
#multi_cluster_routing
def multi_cluster_routing() -> Google::Cloud::Bigtable::MultiClusterRoutingUseAny, nilGets the multi-cluster routing policy, if present.
#name
def name() -> StringThe unique identifier for the app profile.
- (String)
#path
def path() -> StringThe full path for the app profile resource. Values are of the form:
projects/<project_id>/instances/<instance_id>/appProfiles/<app_profile_name>.
- (String)
#project_id
def project_id() -> StringThe unique identifier for the project to which the app profile belongs.
- (String)
#reload!
def reload!() -> Google::Cloud::Bigtable::AppProfileReloads the app profile data.
#routing_policy
def routing_policy() -> Google::Cloud::Bigtable::RoutingPolicyGets 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_idand optional fieldallow_transactional_writes.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing app_profile = instance.create_app_profile( "my-app-profile", routing_policy, description: "App profile for user data instance" ) puts app_profile.routing_policy
#routing_policy=
def routing_policy=(policy)Sets the routing policy for the app profile.
-
policy (Google::Cloud::Bigtable::RoutingPolicy) —
The routing policy for all read/write requests that use this app profile. A value must be explicitly set.
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_idand optional fieldallow_transactional_writes.
Set multi cluster routing policy.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing app_profile.routing_policy = routing_policy
Set single cluster routing policy.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing( "my-cluster", allow_transactional_writes: true ) app_profile.routing_policy = routing_policy
#save
def save(ignore_warnings: false) -> Google::Cloud::Bigtable::AppProfile::JobUpdates the app profile.
- ignore_warnings (Boolean) (defaults to: false) — Default value is false. If true, ignore safety checks when updating the app profile.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" app_profile.description = "User data instance app profile" app_profile.routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing job = app_profile.save job.wait_until_done! if job.error? puts job.error else puts "App profile successfully updated." app_profile = job.app_profile end
Update with single cluster routing.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" app_profile.description = "User data instance app profile" routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing( "my-cluster", allow_transactional_writes: true ) app_profile.routing_policy = routing_policy job = app_profile.save job.done? #=> false job.reload! job.done? #=> true if job.error? puts job.error else app_profile = job.app_profile puts app_profile.name end
#single_cluster_routing
def single_cluster_routing() -> Google::Cloud::Bigtable::SingleClusterRouting, nilGets the single cluster routing policy, if present.
#update
def update(ignore_warnings: false) -> Google::Cloud::Bigtable::AppProfile::JobUpdates the app profile.
- ignore_warnings (Boolean) (defaults to: false) — Default value is false. If true, ignore safety checks when updating the app profile.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" app_profile.description = "User data instance app profile" app_profile.routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing job = app_profile.save job.wait_until_done! if job.error? puts job.error else puts "App profile successfully updated." app_profile = job.app_profile end
Update with single cluster routing.
require "google/cloud/bigtable" bigtable = Google::Cloud::Bigtable.new instance = bigtable.instance "my-instance" app_profile = instance.app_profile "my-app-profile" app_profile.description = "User data instance app profile" routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing( "my-cluster", allow_transactional_writes: true ) app_profile.routing_policy = routing_policy job = app_profile.save job.done? #=> false job.reload! job.done? #=> true if job.error? puts job.error else app_profile = job.app_profile puts app_profile.name end