2.13.2 (latest) 2.13.1 2.12.3 2.11.1 2.10.2 2.9.1 2.8.0 2.7.1 2.6.5 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

```ruby
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

```ruby
def self.multi_cluster_routing() -> Google::Cloud::Bigtable::MultiClusterRoutingUseAny
```
Creates an instance of the multi cluster routing policy.


<br />

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.
**Returns**

- ([Google::Cloud::Bigtable::MultiClusterRoutingUseAny](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-MultiClusterRoutingUseAny.md.txt))
**Example**

```ruby
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

```ruby
def self.single_cluster_routing(cluster_id, allow_transactional_writes: false) -> Google::Cloud::Bigtable::SingleClusterRouting
```
Creates an instance of the single cluster routing policy.


<br />

Unconditionally routes all read/write requests to a specific cluster.
This option preserves read-your-writes consistency but does not
improve availability.
**Parameters**

- **cluster_id** (String) --- The cluster to which read/write requests should be routed.
- **allow_transactional_writes** (Boolean) *(defaults to: false)* --- If true, `CheckAndMutateRow` and `ReadModifyWriteRow` requests 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.
**Returns**

- ([Google::Cloud::Bigtable::SingleClusterRouting](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-SingleClusterRouting.md.txt))
**Example**

```ruby
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

```ruby
def delete(ignore_warnings: false) -> Boolean
```
Deletes the app profile.
**Parameter**

- **ignore_warnings** (Boolean) *(defaults to: false)* --- Default value is false. If true, ignore safety checks when deleting the app profile.
**Returns**

- (Boolean) --- Returns `true` if the app profile was deleted.
**Example**

```ruby
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

```ruby
def description() -> String
```
Description of the app profile.
**Returns**

- (String)

### #description=

```ruby
def description=(text)
```
Sets the description of the app profile.
**Parameter**

- **text** (String) --- Description text

### #etag

```ruby
def etag() -> String
```
Etag for optimistic concurrency control.
**Returns**

- (String)

### #instance_id

```ruby
def instance_id() -> String
```
The unique identifier for the instance to which the app profile belongs.
**Returns**

- (String)

### #multi_cluster_routing

```ruby
def multi_cluster_routing() -> Google::Cloud::Bigtable::MultiClusterRoutingUseAny, nil
```
Gets the multi-cluster routing policy, if present.
**Returns**

- ([Google::Cloud::Bigtable::MultiClusterRoutingUseAny](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-MultiClusterRoutingUseAny.md.txt), nil)

### #name

```ruby
def name() -> String
```
The unique identifier for the app profile.
**Returns**

- (String)

### #path

```ruby
def 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>`.
**Returns**

- (String)

### #project_id

```ruby
def project_id() -> String
```
The unique identifier for the project to which the app profile belongs.
**Returns**

- (String)

### #reload!

```ruby
def reload!() -> Google::Cloud::Bigtable::AppProfile
```
Reloads the app profile data.
**Returns**

- ([Google::Cloud::Bigtable::AppProfile](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-AppProfile.md.txt))

### #routing_policy

```ruby
def routing_policy() -> Google::Cloud::Bigtable::RoutingPolicy
```
Gets the routing policy for all read/write requests that use the app
profile.

Routing Policies:

- [MultiClusterRoutingUseAny](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-MultiClusterRoutingUseAny.md.txt "Google::Cloud::Bigtable::MultiClusterRoutingUseAny (class)") - 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-SingleClusterRouting.md.txt "Google::Cloud::Bigtable::SingleClusterRouting (class)") - 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 field `allow_transactional_writes`.
**Returns**

- ([Google::Cloud::Bigtable::RoutingPolicy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-RoutingPolicy.md.txt))
**Example**

```ruby
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=

```ruby
def routing_policy=(policy)
```
Sets the routing policy for the app profile.
**Parameter**

- **policy** ([Google::Cloud::Bigtable::RoutingPolicy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-RoutingPolicy.md.txt)) ---

  The routing policy for all read/write requests that use this app profile. A value must be explicitly set.

  Routing Policies:
  - [MultiClusterRoutingUseAny](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-MultiClusterRoutingUseAny.md.txt "Google::Cloud::Bigtable::MultiClusterRoutingUseAny (class)") - 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-SingleClusterRouting.md.txt "Google::Cloud::Bigtable::SingleClusterRouting (class)") - 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 field `allow_transactional_writes`.
**Examples**

Set multi cluster routing policy.

```ruby
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.

```ruby
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

```ruby
def save(ignore_warnings: false) -> Google::Cloud::Bigtable::AppProfile::Job
```
**Aliases**

- [#update](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-AppProfile.md.txt#Google__Cloud__Bigtable__AppProfile_update_instance_)
Updates the app profile.
**Parameter**

- **ignore_warnings** (Boolean) *(defaults to: false)* --- Default value is false. If true, ignore safety checks when updating the app profile.
**Returns**

- ([Google::Cloud::Bigtable::AppProfile::Job](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-AppProfile-Job.md.txt))
**Examples**

```ruby
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.

```ruby
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

```ruby
def single_cluster_routing() -> Google::Cloud::Bigtable::SingleClusterRouting, nil
```
Gets the single cluster routing policy, if present.
**Returns**

- ([Google::Cloud::Bigtable::SingleClusterRouting](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-SingleClusterRouting.md.txt), nil)

### #update

```ruby
def update(ignore_warnings: false) -> Google::Cloud::Bigtable::AppProfile::Job
```
**Alias Of** : [#save](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-AppProfile.md.txt#Google__Cloud__Bigtable__AppProfile_save_instance_) Updates the app profile.
**Parameter**

- **ignore_warnings** (Boolean) *(defaults to: false)* --- Default value is false. If true, ignore safety checks when updating the app profile.
**Returns**

- ([Google::Cloud::Bigtable::AppProfile::Job](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-AppProfile-Job.md.txt))
**Examples**

```ruby
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.

```ruby
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
```