@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.AppProfile)) { return super.equals(obj); } com.google.bigtable.admin.v2.AppProfile other = (com.google.bigtable.admin.v2.AppProfile) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getEtag().equals(other.getEtag()); result = result && getDescription().equals(other.getDescription()); result = result && getRoutingPolicyCase().equals(other.getRoutingPolicyCase()); if (!result) return false; switch (routingPolicyCase_) { case 5: result = result && getMultiClusterRoutingUseAny().equals(other.getMultiClusterRoutingUseAny()); break; case 6: result = result && getSingleClusterRouting().equals(other.getSingleClusterRouting()); break; case 0: default: } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public com.google.bigtable.admin.v2.AppProfile getDefaultInstanceForType() { return com.google.bigtable.admin.v2.AppProfile.getDefaultInstance(); }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
private AppProfile(@Nonnull com.google.bigtable.admin.v2.AppProfile proto) { Preconditions.checkNotNull(proto); Preconditions.checkArgument( proto.hasSingleClusterRouting() || proto.hasMultiClusterRoutingUseAny(), "AppProfile must have a routing policy"); Preconditions.checkArgument(!proto.getName().isEmpty(), "AppProfile must have a name"); this.proto = proto; }
/** * * * <pre> * Optional long form description of the use case for this AppProfile. * </pre> * * <code>string description = 3;</code> */ public Builder clearDescription() { description_ = getDefaultInstance().getDescription(); onChanged(); return this; } /**
/** * * * <pre> * (`OutputOnly`) * The unique name of the app profile. Values are of the form * `projects/<project>/instances/<instance>/appProfiles/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + ETAG_FIELD_NUMBER; hash = (53 * hash) + getEtag().hashCode(); hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getDescription().hashCode(); switch (routingPolicyCase_) { case 5: hash = (37 * hash) + MULTI_CLUSTER_ROUTING_USE_ANY_FIELD_NUMBER; hash = (53 * hash) + getMultiClusterRoutingUseAny().hashCode(); break; case 6: hash = (37 * hash) + SINGLE_CLUSTER_ROUTING_FIELD_NUMBER; hash = (53 * hash) + getSingleClusterRouting().hashCode(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** Gets the routing policy for all read/write requests which use this app profile. */ @SuppressWarnings("WeakerAccess") public RoutingPolicy getPolicy() { if (proto.hasMultiClusterRoutingUseAny()) { return MultiClusterRoutingPolicy.of(); } else if (proto.hasSingleClusterRouting()) { return new SingleClusterRoutingPolicy(proto.getSingleClusterRouting()); } else { // Should never happen because the constructor verifies that one must exist. throw new VerifyException(); } }
/** Gets long form description of the use case for this AppProfile. */ @SuppressWarnings("WeakerAccess") public String getDescription() { return proto.getDescription(); }
@Test public void testUpdateExisting() { com.google.bigtable.admin.v2.AppProfile existingProto = com.google.bigtable.admin.v2.AppProfile.newBuilder() .setName("projects/my-project/instances/my-instance/appProfiles/my-profile") .setEtag("my-etag") .setDescription("description") .setMultiClusterRoutingUseAny(MultiClusterRoutingUseAny.getDefaultInstance()) .build(); AppProfile existingWrapper = AppProfile.fromProto(existingProto); UpdateAppProfileRequest updateWrapper = UpdateAppProfileRequest.of(existingWrapper).setDescription("new description"); assertThat(updateWrapper.toProto("my-project")) .isEqualTo( com.google.bigtable.admin.v2.UpdateAppProfileRequest.newBuilder() .setAppProfile(existingProto.toBuilder().setDescription("new description")) .setUpdateMask(FieldMask.newBuilder().addPaths("description")) .build()); } }
@Override public Map<String, String> extract(UpdateAppProfileRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put( "app_profile.name", String.valueOf(request.getAppProfile().getName())); return params.build(); } })
public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); }
/** * * * <pre> * Strongly validated etag for optimistic concurrency control. Preserve the * value returned from `GetAppProfile` when calling `UpdateAppProfile` to * fail the request if there has been a modification in the mean time. The * `update_mask` of the request need not include `etag` for this protection * to apply. * See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and * [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more * details. * </pre> * * <code>string etag = 2;</code> */ public Builder clearEtag() { etag_ = getDefaultInstance().getEtag(); onChanged(); return this; } /**
@Test public void testMultiClusterRouting() { CreateAppProfileRequest wrapper = CreateAppProfileRequest.of("my-instance", "my-profile") .setRoutingPolicy(MultiClusterRoutingPolicy.of()); assertThat(wrapper.toProto("my-project").getAppProfile().getMultiClusterRoutingUseAny()) .isEqualTo(MultiClusterRoutingUseAny.getDefaultInstance()); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.CreateAppProfileRequest)) { return super.equals(obj); } com.google.bigtable.admin.v2.CreateAppProfileRequest other = (com.google.bigtable.admin.v2.CreateAppProfileRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && getAppProfileId().equals(other.getAppProfileId()); result = result && (hasAppProfile() == other.hasAppProfile()); if (hasAppProfile()) { result = result && getAppProfile().equals(other.getAppProfile()); } result = result && (getIgnoreWarnings() == other.getIgnoreWarnings()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public com.google.bigtable.admin.v2.AppProfile buildPartial() { com.google.bigtable.admin.v2.AppProfile result = new com.google.bigtable.admin.v2.AppProfile(this); result.name_ = name_; result.etag_ = etag_; result.description_ = description_; if (routingPolicyCase_ == 5) { if (multiClusterRoutingUseAnyBuilder_ == null) { result.routingPolicy_ = routingPolicy_; } else { result.routingPolicy_ = multiClusterRoutingUseAnyBuilder_.build(); } } if (routingPolicyCase_ == 6) { if (singleClusterRoutingBuilder_ == null) { result.routingPolicy_ = routingPolicy_; } else { result.routingPolicy_ = singleClusterRoutingBuilder_.build(); } } result.routingPolicyCase_ = routingPolicyCase_; onBuilt(); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + ETAG_FIELD_NUMBER; hash = (53 * hash) + getEtag().hashCode(); hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getDescription().hashCode(); switch (routingPolicyCase_) { case 5: hash = (37 * hash) + MULTI_CLUSTER_ROUTING_USE_ANY_FIELD_NUMBER; hash = (53 * hash) + getMultiClusterRoutingUseAny().hashCode(); break; case 6: hash = (37 * hash) + SINGLE_CLUSTER_ROUTING_FIELD_NUMBER; hash = (53 * hash) + getSingleClusterRouting().hashCode(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Optional long form description of the use case for this AppProfile. * </pre> * * <code>string description = 3;</code> */ public Builder clearDescription() { description_ = getDefaultInstance().getDescription(); onChanged(); return this; } /**