Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

fix: update gapic-generator-java with mock service generation fixes #249

Merged
merged 2 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
Expand Down Expand Up @@ -199,6 +200,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public final com.google.longrunning.OperationsClient getOperationsClient() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.location.MockLocations;
import com.google.common.collect.Lists;
import com.google.iam.v1.AuditConfig;
import com.google.iam.v1.Binding;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.GetPolicyOptions;
import com.google.iam.v1.MockIAMPolicy;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.iam.v1;
package com.google.cloud.gkehub.v1beta1;

import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.testing.MockGrpcService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
* limitations under the License.
*/

package com.google.iam.v1;
package com.google.cloud.gkehub.v1beta1;

import com.google.api.core.BetaApi;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.IAMPolicyGrpc.IAMPolicyImplBase;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.google.cloud.location;
package com.google.cloud.gkehub.v1beta1;

import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.testing.MockGrpcService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
* limitations under the License.
*/

package com.google.cloud.location;
package com.google.cloud.gkehub.v1beta1;

import com.google.api.core.BetaApi;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.location.LocationsGrpc.LocationsImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.gkehub.v1alpha2.samples;

// [START gkehub_v1alpha2_generated_gkehubclient_create_setcredentialsprovider_sync]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.cloud.gkehub.v1alpha2.GkeHubClient;
import com.google.cloud.gkehub.v1alpha2.GkeHubSettings;
import com.google.cloud.gkehub.v1alpha2.myCredentials;

public class SyncCreateSetCredentialsProvider {

public static void main(String[] args) throws Exception {
syncCreateSetCredentialsProvider();
}

public static void syncCreateSetCredentialsProvider() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
GkeHubSettings gkeHubSettings =
GkeHubSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
}
}
// [END gkehub_v1alpha2_generated_gkehubclient_create_setcredentialsprovider_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.gkehub.v1alpha2.samples;

// [START gkehub_v1alpha2_generated_gkehubclient_create_setcredentialsprovider1_sync]
import com.google.cloud.gkehub.v1alpha2.GkeHubClient;
import com.google.cloud.gkehub.v1alpha2.GkeHubSettings;

public class SyncCreateSetCredentialsProvider1 {

public static void main(String[] args) throws Exception {
syncCreateSetCredentialsProvider1();
}

public static void syncCreateSetCredentialsProvider1() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
GkeHubSettings gkeHubSettings =
GkeHubSettings.newBuilder()
.setTransportChannelProvider(
GkeHubSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
}
}
// [END gkehub_v1alpha2_generated_gkehubclient_create_setcredentialsprovider1_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.gkehub.v1alpha2.samples;

// [START gkehub_v1alpha2_generated_gkehubclient_create_setendpoint_sync]
import com.google.cloud.gkehub.v1alpha2.GkeHubClient;
import com.google.cloud.gkehub.v1alpha2.GkeHubSettings;
import com.google.cloud.gkehub.v1alpha2.myEndpoint;

public class SyncCreateSetEndpoint {

public static void main(String[] args) throws Exception {
syncCreateSetEndpoint();
}

public static void syncCreateSetEndpoint() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
GkeHubSettings gkeHubSettings = GkeHubSettings.newBuilder().setEndpoint(myEndpoint).build();
GkeHubClient gkeHubClient = GkeHubClient.create(gkeHubSettings);
}
}
// [END gkehub_v1alpha2_generated_gkehubclient_create_setendpoint_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.gkehub.v1alpha2.samples;

// [START gkehub_v1alpha2_generated_gkehubclient_createmembership_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.gkehub.v1alpha2.CreateMembershipRequest;
import com.google.cloud.gkehub.v1alpha2.GkeHubClient;
import com.google.cloud.gkehub.v1alpha2.LocationName;
import com.google.cloud.gkehub.v1alpha2.Membership;
import com.google.longrunning.Operation;

public class AsyncCreateMembership {

public static void main(String[] args) throws Exception {
asyncCreateMembership();
}

public static void asyncCreateMembership() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
CreateMembershipRequest request =
CreateMembershipRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setMembershipId("membershipId517665681")
.setResource(Membership.newBuilder().build())
.build();
ApiFuture<Operation> future = gkeHubClient.createMembershipCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
}
}
// [END gkehub_v1alpha2_generated_gkehubclient_createmembership_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.gkehub.v1alpha2.samples;

// [START gkehub_v1alpha2_generated_gkehubclient_createmembership_lro_async]
import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.gkehub.v1alpha2.CreateMembershipRequest;
import com.google.cloud.gkehub.v1alpha2.GkeHubClient;
import com.google.cloud.gkehub.v1alpha2.LocationName;
import com.google.cloud.gkehub.v1alpha2.Membership;
import com.google.cloud.gkehub.v1alpha2.OperationMetadata;

public class AsyncCreateMembershipLRO {

public static void main(String[] args) throws Exception {
asyncCreateMembershipLRO();
}

public static void asyncCreateMembershipLRO() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
CreateMembershipRequest request =
CreateMembershipRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setMembershipId("membershipId517665681")
.setResource(Membership.newBuilder().build())
.build();
OperationFuture<Membership, OperationMetadata> future =
gkeHubClient.createMembershipOperationCallable().futureCall(request);
// Do something.
Membership response = future.get();
}
}
}
// [END gkehub_v1alpha2_generated_gkehubclient_createmembership_lro_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.gkehub.v1alpha2.samples;

// [START gkehub_v1alpha2_generated_gkehubclient_createmembership_sync]
import com.google.cloud.gkehub.v1alpha2.CreateMembershipRequest;
import com.google.cloud.gkehub.v1alpha2.GkeHubClient;
import com.google.cloud.gkehub.v1alpha2.LocationName;
import com.google.cloud.gkehub.v1alpha2.Membership;

public class SyncCreateMembership {

public static void main(String[] args) throws Exception {
syncCreateMembership();
}

public static void syncCreateMembership() throws Exception {
// This snippet has been automatically generated for illustrative purposes only.
// It may require modifications to work in your environment.
try (GkeHubClient gkeHubClient = GkeHubClient.create()) {
CreateMembershipRequest request =
CreateMembershipRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setMembershipId("membershipId517665681")
.setResource(Membership.newBuilder().build())
.build();
Membership response = gkeHubClient.createMembershipAsync(request).get();
}
}
}
// [END gkehub_v1alpha2_generated_gkehubclient_createmembership_sync]
Loading