/** * Asynchronously get the app profile by id. * * <p>Sample code: * * <pre>{@code * ApiFuture<AppProfile> appProfileFuture = client.getAppProfileAsync("my-instance", "my-app-profile"); * * AppProfile appProfile = appProfileFuture.get(); * }</pre> * * @see AppProfile */ @SuppressWarnings("WeakerAccess") public ApiFuture<AppProfile> getAppProfileAsync(String instanceId, String appProfileId) { String name = NameUtil.formatAppProfileName(projectId, instanceId, appProfileId); GetAppProfileRequest request = GetAppProfileRequest.newBuilder().setName(name.toString()).build(); return ApiFutures.transform( stub.getAppProfileCallable().futureCall(request), new ApiFunction<com.google.bigtable.admin.v2.AppProfile, AppProfile>() { @Override public AppProfile apply(com.google.bigtable.admin.v2.AppProfile proto) { return AppProfile.fromProto(proto); } }, MoreExecutors.directExecutor()); }
@java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.bigtable.admin.v2.GetAppProfileRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.bigtable.admin.v2.GetAppProfileRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
public Builder mergeFrom(com.google.bigtable.admin.v2.GetAppProfileRequest other) { if (other == com.google.bigtable.admin.v2.GetAppProfileRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * Asynchronously get the app profile by id. * * <p>Sample code: * * <pre>{@code * ApiFuture<AppProfile> appProfileFuture = client.getAppProfileAsync("my-instance", "my-app-profile"); * * AppProfile appProfile = appProfileFuture.get(); * }</pre> * * @see AppProfile */ @SuppressWarnings("WeakerAccess") public ApiFuture<AppProfile> getAppProfileAsync(String instanceId, String appProfileId) { String name = NameUtil.formatAppProfileName(projectId, instanceId, appProfileId); GetAppProfileRequest request = GetAppProfileRequest.newBuilder().setName(name.toString()).build(); return ApiFutures.transform( stub.getAppProfileCallable().futureCall(request), new ApiFunction<com.google.bigtable.admin.v2.AppProfile, AppProfile>() { @Override public AppProfile apply(com.google.bigtable.admin.v2.AppProfile proto) { return AppProfile.fromProto(proto); } }, MoreExecutors.directExecutor()); }
/** * Gets information about an app profile. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); * AppProfile response = baseBigtableInstanceAdminClient.getAppProfile(name); * } * </code></pre> * * @param name The unique name of the requested app profile. Values are of the form * `projects/<project>/instances/<instance>/appProfiles/<app_profile>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AppProfile getAppProfile(AppProfileName name) { GetAppProfileRequest request = GetAppProfileRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getAppProfile(request); }
@java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.bigtable.admin.v2.GetAppProfileRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.bigtable.admin.v2.GetAppProfileRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; }
/** * * * <pre> * The unique name of the requested app profile. Values are of the form * `projects/<project>/instances/<instance>/appProfiles/<app_profile>`. * </pre> * * <code>string name = 1;</code> */ public Builder setName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /**
/** * Gets information about an app profile. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); * AppProfile response = baseBigtableInstanceAdminClient.getAppProfile(name.toString()); * } * </code></pre> * * @param name The unique name of the requested app profile. Values are of the form * `projects/<project>/instances/<instance>/appProfiles/<app_profile>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AppProfile getAppProfile(String name) { GetAppProfileRequest request = GetAppProfileRequest.newBuilder().setName(name).build(); return getAppProfile(request); }
/** * * * <pre> * The unique name of the requested app profile. Values are of the form * `projects/<project>/instances/<instance>/appProfiles/<app_profile>`. * </pre> * * <code>string name = 1;</code> */ public Builder setNameBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; }
/** * * * <pre> * The unique name of the requested app profile. Values are of the form * `projects/<project>/instances/<instance>/appProfiles/<app_profile>`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
private Builder() { maybeForceBuilderInitialization(); }
public static Builder newBuilder(com.google.bigtable.admin.v2.GetAppProfileRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); }
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); }
@java.lang.Override public com.google.bigtable.admin.v2.GetAppProfileRequest buildPartial() { com.google.bigtable.admin.v2.GetAppProfileRequest result = new com.google.bigtable.admin.v2.GetAppProfileRequest(this); result.name_ = name_; onBuilt(); return result; }
public Builder mergeFrom(com.google.bigtable.admin.v2.GetAppProfileRequest other) { if (other == com.google.bigtable.admin.v2.GetAppProfileRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public com.google.bigtable.admin.v2.GetAppProfileRequest build() { com.google.bigtable.admin.v2.GetAppProfileRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.bigtable.admin.v2.GetAppProfileRequest) { return mergeFrom((com.google.bigtable.admin.v2.GetAppProfileRequest) other); } else { super.mergeFrom(other); return this; } }
@java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
@Test public void testGetAppProfile() { // Setup com.google.bigtable.admin.v2.GetAppProfileRequest expectedRequest = com.google.bigtable.admin.v2.GetAppProfileRequest.newBuilder() .setName(APP_PROFILE_NAME) .build(); com.google.bigtable.admin.v2.AppProfile expectedResponse = com.google.bigtable.admin.v2.AppProfile.newBuilder() .setName(APP_PROFILE_NAME) .setDescription("my description") .setMultiClusterRoutingUseAny( com.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny .getDefaultInstance()) .build(); Mockito.when(mockGetAppProfileCallable.futureCall(expectedRequest)) .thenReturn(ApiFutures.immediateFuture(expectedResponse)); // Execute AppProfile actualResult = adminClient.getAppProfile(INSTANCE_ID, APP_PROFILE_ID); // Verify assertThat(actualResult).isEqualTo(AppProfile.fromProto(expectedResponse)); }