diff --git a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java
index c3ffaea1ea26..f1a877c145f5 100644
--- a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java
+++ b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java
@@ -106,6 +106,20 @@
* DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * DeviceManagerSettings deviceManagerSettings =
+ * DeviceManagerSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * DeviceManagerSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
diff --git a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java
index ff603de02a4d..85fb689154e4 100644
--- a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java
+++ b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java
@@ -24,6 +24,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -211,11 +212,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return DeviceManagerStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return DeviceManagerStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return DeviceManagerStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return DeviceManagerStubSettings.defaultTransportChannelProvider();
}
@@ -225,11 +233,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return DeviceManagerStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -267,6 +281,11 @@ private static Builder createDefault() {
return new Builder(DeviceManagerStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(DeviceManagerStubSettings.newHttpJsonBuilder());
+ }
+
public DeviceManagerStubSettings.Builder getStubSettingsBuilder() {
return ((DeviceManagerStubSettings.Builder) getStubSettings());
}
diff --git a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java
index 8bb5b5225d3f..008ea98c719f 100644
--- a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java
+++ b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java
@@ -28,6 +28,9 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
@@ -391,6 +394,11 @@ public DeviceManagerStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcDeviceManagerStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonDeviceManagerStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -423,18 +431,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(DeviceManagerStubSettings.class))
@@ -442,11 +457,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(DeviceManagerStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return DeviceManagerStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -694,6 +728,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.createDeviceRegistrySettings()
diff --git a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerCallableFactory.java b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerCallableFactory.java
new file mode 100644
index 000000000000..58d6577e08af
--- /dev/null
+++ b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * 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.iot.v1.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the DeviceManager service API.
+ *
+ *
This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonDeviceManagerCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerStub.java b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerStub.java
new file mode 100644
index 000000000000..1506c3f92888
--- /dev/null
+++ b/java-iot/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerStub.java
@@ -0,0 +1,1248 @@
+/*
+ * 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.iot.v1.stub;
+
+import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse;
+import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.iot.v1.BindDeviceToGatewayRequest;
+import com.google.cloud.iot.v1.BindDeviceToGatewayResponse;
+import com.google.cloud.iot.v1.CreateDeviceRegistryRequest;
+import com.google.cloud.iot.v1.CreateDeviceRequest;
+import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest;
+import com.google.cloud.iot.v1.DeleteDeviceRequest;
+import com.google.cloud.iot.v1.Device;
+import com.google.cloud.iot.v1.DeviceConfig;
+import com.google.cloud.iot.v1.DeviceRegistry;
+import com.google.cloud.iot.v1.GetDeviceRegistryRequest;
+import com.google.cloud.iot.v1.GetDeviceRequest;
+import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest;
+import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse;
+import com.google.cloud.iot.v1.ListDeviceRegistriesRequest;
+import com.google.cloud.iot.v1.ListDeviceRegistriesResponse;
+import com.google.cloud.iot.v1.ListDeviceStatesRequest;
+import com.google.cloud.iot.v1.ListDeviceStatesResponse;
+import com.google.cloud.iot.v1.ListDevicesRequest;
+import com.google.cloud.iot.v1.ListDevicesResponse;
+import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest;
+import com.google.cloud.iot.v1.SendCommandToDeviceRequest;
+import com.google.cloud.iot.v1.SendCommandToDeviceResponse;
+import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest;
+import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse;
+import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest;
+import com.google.cloud.iot.v1.UpdateDeviceRequest;
+import com.google.iam.v1.GetIamPolicyRequest;
+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.Empty;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the DeviceManager service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonDeviceManagerStub extends DeviceManagerStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor
+ createDeviceRegistryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/CreateDeviceRegistry")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/registries",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("deviceRegistry", request.getDeviceRegistry()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(DeviceRegistry.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getDeviceRegistryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetDeviceRegistry")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(DeviceRegistry.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateDeviceRegistryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/UpdateDeviceRegistry")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{deviceRegistry.name=projects/*/locations/*/registries/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields,
+ "deviceRegistry.name",
+ request.getDeviceRegistry().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("deviceRegistry", request.getDeviceRegistry()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(DeviceRegistry.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteDeviceRegistryMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/DeleteDeviceRegistry")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Empty.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ ListDeviceRegistriesRequest, ListDeviceRegistriesResponse>
+ listDeviceRegistriesMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceRegistries")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/registries",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListDeviceRegistriesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ createDeviceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/CreateDevice")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/registries/*}/devices",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("device", request.getDevice()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Device.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getDeviceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetDevice")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*/devices/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "fieldMask", request.getFieldMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Device.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateDeviceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/UpdateDevice")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{device.name=projects/*/locations/*/registries/*/devices/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "device.name", request.getDevice().getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{device.name=projects/*/locations/*/registries/*/groups/*/devices/*}")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create().toBody("device", request.getDevice()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Device.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteDeviceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/DeleteDevice")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*/devices/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Empty.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listDevicesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDevices")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/registries/*}/devices",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{parent=projects/*/locations/*/registries/*/groups/*}/devices")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "deviceIds", request.getDeviceIdsList());
+ serializer.putQueryParam(
+ fields, "deviceNumIds", request.getDeviceNumIdsList());
+ serializer.putQueryParam(fields, "fieldMask", request.getFieldMask());
+ serializer.putQueryParam(
+ fields, "gatewayListOptions", request.getGatewayListOptions());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListDevicesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ modifyCloudToDeviceConfigMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/ModifyCloudToDeviceConfig")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:modifyCloudToDeviceConfig")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearName().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(DeviceConfig.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ ListDeviceConfigVersionsRequest, ListDeviceConfigVersionsResponse>
+ listDeviceConfigVersionsMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceConfigVersions")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/configVersions")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(
+ fields, "numVersions", request.getNumVersions());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListDeviceConfigVersionsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listDeviceStatesMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceStates")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*/devices/*}/states",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/states")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "numStates", request.getNumStates());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListDeviceStatesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ setIamPolicyMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/SetIamPolicy")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:setIamPolicy")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearResource().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Policy.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getIamPolicyMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetIamPolicy")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:getIamPolicy")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearResource().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Policy.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ testIamPermissionsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/TestIamPermissions")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "resource", request.getResource());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:testIamPermissions")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearResource().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ sendCommandToDeviceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/SendCommandToDevice")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/registries/*/devices/*}:sendCommandToDevice",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:sendCommandToDevice")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearName().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(SendCommandToDeviceResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ bindDeviceToGatewayMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/BindDeviceToGateway")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/registries/*}:bindDeviceToGateway",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:bindDeviceToGateway")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearParent().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(BindDeviceToGatewayResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor<
+ UnbindDeviceFromGatewayRequest, UnbindDeviceFromGatewayResponse>
+ unbindDeviceFromGatewayMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.iot.v1.DeviceManager/UnbindDeviceFromGateway")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/registries/*}:unbindDeviceFromGateway",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setAdditionalPaths(
+ "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:unbindDeviceFromGateway")
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearParent().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(UnbindDeviceFromGatewayResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable
+ createDeviceRegistryCallable;
+ private final UnaryCallable getDeviceRegistryCallable;
+ private final UnaryCallable
+ updateDeviceRegistryCallable;
+ private final UnaryCallable deleteDeviceRegistryCallable;
+ private final UnaryCallable
+ listDeviceRegistriesCallable;
+ private final UnaryCallable
+ listDeviceRegistriesPagedCallable;
+ private final UnaryCallable createDeviceCallable;
+ private final UnaryCallable getDeviceCallable;
+ private final UnaryCallable updateDeviceCallable;
+ private final UnaryCallable deleteDeviceCallable;
+ private final UnaryCallable listDevicesCallable;
+ private final UnaryCallable
+ listDevicesPagedCallable;
+ private final UnaryCallable
+ modifyCloudToDeviceConfigCallable;
+ private final UnaryCallable
+ listDeviceConfigVersionsCallable;
+ private final UnaryCallable
+ listDeviceStatesCallable;
+ private final UnaryCallable setIamPolicyCallable;
+ private final UnaryCallable getIamPolicyCallable;
+ private final UnaryCallable
+ testIamPermissionsCallable;
+ private final UnaryCallable
+ sendCommandToDeviceCallable;
+ private final UnaryCallable
+ bindDeviceToGatewayCallable;
+ private final UnaryCallable
+ unbindDeviceFromGatewayCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonDeviceManagerStub create(DeviceManagerStubSettings settings)
+ throws IOException {
+ return new HttpJsonDeviceManagerStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonDeviceManagerStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonDeviceManagerStub(
+ DeviceManagerStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonDeviceManagerStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonDeviceManagerStub(
+ DeviceManagerStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonDeviceManagerStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonDeviceManagerStub(
+ DeviceManagerStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonDeviceManagerCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonDeviceManagerStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonDeviceManagerStub(
+ DeviceManagerStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+
+ HttpJsonCallSettings
+ createDeviceRegistryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createDeviceRegistryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ getDeviceRegistryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getDeviceRegistryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ updateDeviceRegistryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateDeviceRegistryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteDeviceRegistryTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteDeviceRegistryMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ listDeviceRegistriesTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(listDeviceRegistriesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings createDeviceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createDeviceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getDeviceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getDeviceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings updateDeviceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateDeviceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteDeviceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteDeviceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listDevicesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listDevicesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ modifyCloudToDeviceConfigTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(modifyCloudToDeviceConfigMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ listDeviceConfigVersionsTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(listDeviceConfigVersionsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ listDeviceStatesTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listDeviceStatesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings setIamPolicyTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(setIamPolicyMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getIamPolicyTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getIamPolicyMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ testIamPermissionsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(testIamPermissionsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ sendCommandToDeviceTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(sendCommandToDeviceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ bindDeviceToGatewayTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(bindDeviceToGatewayMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ unbindDeviceFromGatewayTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(unbindDeviceFromGatewayMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.createDeviceRegistryCallable =
+ callableFactory.createUnaryCallable(
+ createDeviceRegistryTransportSettings,
+ settings.createDeviceRegistrySettings(),
+ clientContext);
+ this.getDeviceRegistryCallable =
+ callableFactory.createUnaryCallable(
+ getDeviceRegistryTransportSettings,
+ settings.getDeviceRegistrySettings(),
+ clientContext);
+ this.updateDeviceRegistryCallable =
+ callableFactory.createUnaryCallable(
+ updateDeviceRegistryTransportSettings,
+ settings.updateDeviceRegistrySettings(),
+ clientContext);
+ this.deleteDeviceRegistryCallable =
+ callableFactory.createUnaryCallable(
+ deleteDeviceRegistryTransportSettings,
+ settings.deleteDeviceRegistrySettings(),
+ clientContext);
+ this.listDeviceRegistriesCallable =
+ callableFactory.createUnaryCallable(
+ listDeviceRegistriesTransportSettings,
+ settings.listDeviceRegistriesSettings(),
+ clientContext);
+ this.listDeviceRegistriesPagedCallable =
+ callableFactory.createPagedCallable(
+ listDeviceRegistriesTransportSettings,
+ settings.listDeviceRegistriesSettings(),
+ clientContext);
+ this.createDeviceCallable =
+ callableFactory.createUnaryCallable(
+ createDeviceTransportSettings, settings.createDeviceSettings(), clientContext);
+ this.getDeviceCallable =
+ callableFactory.createUnaryCallable(
+ getDeviceTransportSettings, settings.getDeviceSettings(), clientContext);
+ this.updateDeviceCallable =
+ callableFactory.createUnaryCallable(
+ updateDeviceTransportSettings, settings.updateDeviceSettings(), clientContext);
+ this.deleteDeviceCallable =
+ callableFactory.createUnaryCallable(
+ deleteDeviceTransportSettings, settings.deleteDeviceSettings(), clientContext);
+ this.listDevicesCallable =
+ callableFactory.createUnaryCallable(
+ listDevicesTransportSettings, settings.listDevicesSettings(), clientContext);
+ this.listDevicesPagedCallable =
+ callableFactory.createPagedCallable(
+ listDevicesTransportSettings, settings.listDevicesSettings(), clientContext);
+ this.modifyCloudToDeviceConfigCallable =
+ callableFactory.createUnaryCallable(
+ modifyCloudToDeviceConfigTransportSettings,
+ settings.modifyCloudToDeviceConfigSettings(),
+ clientContext);
+ this.listDeviceConfigVersionsCallable =
+ callableFactory.createUnaryCallable(
+ listDeviceConfigVersionsTransportSettings,
+ settings.listDeviceConfigVersionsSettings(),
+ clientContext);
+ this.listDeviceStatesCallable =
+ callableFactory.createUnaryCallable(
+ listDeviceStatesTransportSettings, settings.listDeviceStatesSettings(), clientContext);
+ this.setIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext);
+ this.getIamPolicyCallable =
+ callableFactory.createUnaryCallable(
+ getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
+ this.testIamPermissionsCallable =
+ callableFactory.createUnaryCallable(
+ testIamPermissionsTransportSettings,
+ settings.testIamPermissionsSettings(),
+ clientContext);
+ this.sendCommandToDeviceCallable =
+ callableFactory.createUnaryCallable(
+ sendCommandToDeviceTransportSettings,
+ settings.sendCommandToDeviceSettings(),
+ clientContext);
+ this.bindDeviceToGatewayCallable =
+ callableFactory.createUnaryCallable(
+ bindDeviceToGatewayTransportSettings,
+ settings.bindDeviceToGatewaySettings(),
+ clientContext);
+ this.unbindDeviceFromGatewayCallable =
+ callableFactory.createUnaryCallable(
+ unbindDeviceFromGatewayTransportSettings,
+ settings.unbindDeviceFromGatewaySettings(),
+ clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(createDeviceRegistryMethodDescriptor);
+ methodDescriptors.add(getDeviceRegistryMethodDescriptor);
+ methodDescriptors.add(updateDeviceRegistryMethodDescriptor);
+ methodDescriptors.add(deleteDeviceRegistryMethodDescriptor);
+ methodDescriptors.add(listDeviceRegistriesMethodDescriptor);
+ methodDescriptors.add(createDeviceMethodDescriptor);
+ methodDescriptors.add(getDeviceMethodDescriptor);
+ methodDescriptors.add(updateDeviceMethodDescriptor);
+ methodDescriptors.add(deleteDeviceMethodDescriptor);
+ methodDescriptors.add(listDevicesMethodDescriptor);
+ methodDescriptors.add(modifyCloudToDeviceConfigMethodDescriptor);
+ methodDescriptors.add(listDeviceConfigVersionsMethodDescriptor);
+ methodDescriptors.add(listDeviceStatesMethodDescriptor);
+ methodDescriptors.add(setIamPolicyMethodDescriptor);
+ methodDescriptors.add(getIamPolicyMethodDescriptor);
+ methodDescriptors.add(testIamPermissionsMethodDescriptor);
+ methodDescriptors.add(sendCommandToDeviceMethodDescriptor);
+ methodDescriptors.add(bindDeviceToGatewayMethodDescriptor);
+ methodDescriptors.add(unbindDeviceFromGatewayMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ @Override
+ public UnaryCallable createDeviceRegistryCallable() {
+ return createDeviceRegistryCallable;
+ }
+
+ @Override
+ public UnaryCallable getDeviceRegistryCallable() {
+ return getDeviceRegistryCallable;
+ }
+
+ @Override
+ public UnaryCallable updateDeviceRegistryCallable() {
+ return updateDeviceRegistryCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteDeviceRegistryCallable() {
+ return deleteDeviceRegistryCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listDeviceRegistriesCallable() {
+ return listDeviceRegistriesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listDeviceRegistriesPagedCallable() {
+ return listDeviceRegistriesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable createDeviceCallable() {
+ return createDeviceCallable;
+ }
+
+ @Override
+ public UnaryCallable getDeviceCallable() {
+ return getDeviceCallable;
+ }
+
+ @Override
+ public UnaryCallable updateDeviceCallable() {
+ return updateDeviceCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteDeviceCallable() {
+ return deleteDeviceCallable;
+ }
+
+ @Override
+ public UnaryCallable listDevicesCallable() {
+ return listDevicesCallable;
+ }
+
+ @Override
+ public UnaryCallable listDevicesPagedCallable() {
+ return listDevicesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ modifyCloudToDeviceConfigCallable() {
+ return modifyCloudToDeviceConfigCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listDeviceConfigVersionsCallable() {
+ return listDeviceConfigVersionsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listDeviceStatesCallable() {
+ return listDeviceStatesCallable;
+ }
+
+ @Override
+ public UnaryCallable setIamPolicyCallable() {
+ return setIamPolicyCallable;
+ }
+
+ @Override
+ public UnaryCallable getIamPolicyCallable() {
+ return getIamPolicyCallable;
+ }
+
+ @Override
+ public UnaryCallable