public Builder mergeFrom(com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest other) { if (other == com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.getVersionToUpdate() != 0L) { setVersionToUpdate(other.getVersionToUpdate()); } if (other.getBinaryData() != com.google.protobuf.ByteString.EMPTY) { setBinaryData(other.getBinaryData()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest buildPartial() { com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest result = new com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest(this); result.name_ = name_; result.versionToUpdate_ = versionToUpdate_; result.binaryData_ = binaryData_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest)) { return super.equals(obj); } com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest other = (com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && (getVersionToUpdate() == other.getVersionToUpdate()); result = result && getBinaryData().equals(other.getBinaryData()); result = result && unknownFields.equals(other.unknownFields); 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) + VERSION_TO_UPDATE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getVersionToUpdate()); hash = (37 * hash) + BINARY_DATA_FIELD_NUMBER; hash = (53 * hash) + getBinaryData().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The configuration data for the device. * </pre> * * <code>bytes binary_data = 3;</code> */ public Builder clearBinaryData() { binaryData_ = getDefaultInstance().getBinaryData(); onChanged(); return this; }
/** * * * <pre> * The name of the device. For example, * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@Test @SuppressWarnings("all") public void modifyCloudToDeviceConfigTest() { long version = 351608024L; ByteString binaryData2 = ByteString.copyFromUtf8("-37"); DeviceConfig expectedResponse = DeviceConfig.newBuilder().setVersion(version).setBinaryData(binaryData2).build(); mockDeviceManager.addResponse(expectedResponse); DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); ByteString binaryData = ByteString.copyFromUtf8("40"); DeviceConfig actualResponse = client.modifyCloudToDeviceConfig(name, binaryData); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockDeviceManager.getRequests(); Assert.assertEquals(1, actualRequests.size()); ModifyCloudToDeviceConfigRequest actualRequest = (ModifyCloudToDeviceConfigRequest) actualRequests.get(0); Assert.assertEquals(name, DeviceName.parse(actualRequest.getName())); Assert.assertEquals(binaryData, actualRequest.getBinaryData()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Map<String, String> extract(ModifyCloudToDeviceConfigRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } })
@java.lang.Override public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest getDefaultInstanceForType() { return com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.getDefaultInstance(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (versionToUpdate_ != 0L) { output.writeInt64(2, versionToUpdate_); } if (!binaryData_.isEmpty()) { output.writeBytes(3, binaryData_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest build() { com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } 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) + VERSION_TO_UPDATE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getVersionToUpdate()); hash = (37 * hash) + BINARY_DATA_FIELD_NUMBER; hash = (53 * hash) + getBinaryData().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest)) { return super.equals(obj); } com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest other = (com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && (getVersionToUpdate() == other.getVersionToUpdate()); result = result && getBinaryData().equals(other.getBinaryData()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The name of the device. For example, * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** * * * <pre> * The configuration data for the device. * </pre> * * <code>bytes binary_data = 3;</code> */ public Builder clearBinaryData() { binaryData_ = getDefaultInstance().getBinaryData(); onChanged(); return this; }
io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (versionToUpdate_ != 0L) { size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, versionToUpdate_); } if (!binaryData_.isEmpty()) { size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, binaryData_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest build() { com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
public Builder mergeFrom(com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest other) { if (other == com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.getVersionToUpdate() != 0L) { setVersionToUpdate(other.getVersionToUpdate()); } if (other.getBinaryData() != com.google.protobuf.ByteString.EMPTY) { setBinaryData(other.getBinaryData()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }