public Builder mergeFrom(com.google.cloud.kms.v1.DecryptRequest other) { if (other == com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.getCiphertext() != com.google.protobuf.ByteString.EMPTY) { setCiphertext(other.getCiphertext()); } if (other.getAdditionalAuthenticatedData() != com.google.protobuf.ByteString.EMPTY) { setAdditionalAuthenticatedData(other.getAdditionalAuthenticatedData()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.cloud.kms.v1.DecryptRequest buildPartial() { com.google.cloud.kms.v1.DecryptRequest result = new com.google.cloud.kms.v1.DecryptRequest(this); result.name_ = name_; result.ciphertext_ = ciphertext_; result.additionalAuthenticatedData_ = additionalAuthenticatedData_; 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.kms.v1.DecryptRequest)) { return super.equals(obj); } com.google.cloud.kms.v1.DecryptRequest other = (com.google.cloud.kms.v1.DecryptRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getCiphertext().equals(other.getCiphertext()); result = result && getAdditionalAuthenticatedData().equals(other.getAdditionalAuthenticatedData()); 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) + CIPHERTEXT_FIELD_NUMBER; hash = (53 * hash) + getCiphertext().hashCode(); hash = (37 * hash) + ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER; hash = (53 * hash) + getAdditionalAuthenticatedData().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Optional data that must match the data originally supplied in * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. * </pre> * * <code>bytes additional_authenticated_data = 3;</code> */ public Builder clearAdditionalAuthenticatedData() { additionalAuthenticatedData_ = getDefaultInstance().getAdditionalAuthenticatedData(); onChanged(); return this; }
/** * * * <pre> * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. * The server will choose the appropriate version. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@Test @SuppressWarnings("all") public void decryptTest() { ByteString plaintext = ByteString.copyFromUtf8("-9"); DecryptResponse expectedResponse = DecryptResponse.newBuilder().setPlaintext(plaintext).build(); mockKeyManagementService.addResponse(expectedResponse); CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); ByteString ciphertext = ByteString.copyFromUtf8("-72"); DecryptResponse actualResponse = client.decrypt(name, ciphertext); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockKeyManagementService.getRequests(); Assert.assertEquals(1, actualRequests.size()); DecryptRequest actualRequest = (DecryptRequest) actualRequests.get(0); Assert.assertEquals(name, CryptoKeyName.parse(actualRequest.getName())); Assert.assertEquals(ciphertext, actualRequest.getCiphertext()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * * * <pre> * Required. The encrypted data originally returned in * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. * </pre> * * <code>bytes ciphertext = 2;</code> */ public Builder clearCiphertext() { ciphertext_ = getDefaultInstance().getCiphertext(); onChanged(); return this; }
@Override public Map<String, String> extract(DecryptRequest 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.kms.v1.DecryptRequest getDefaultInstanceForType() { return com.google.cloud.kms.v1.DecryptRequest.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 (!ciphertext_.isEmpty()) { output.writeBytes(2, ciphertext_); } if (!additionalAuthenticatedData_.isEmpty()) { output.writeBytes(3, additionalAuthenticatedData_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.cloud.kms.v1.DecryptRequest build() { com.google.cloud.kms.v1.DecryptRequest 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) + CIPHERTEXT_FIELD_NUMBER; hash = (53 * hash) + getCiphertext().hashCode(); hash = (37 * hash) + ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER; hash = (53 * hash) + getAdditionalAuthenticatedData().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.kms.v1.DecryptRequest)) { return super.equals(obj); } com.google.cloud.kms.v1.DecryptRequest other = (com.google.cloud.kms.v1.DecryptRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getCiphertext().equals(other.getCiphertext()); result = result && getAdditionalAuthenticatedData().equals(other.getAdditionalAuthenticatedData()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. * The server will choose the appropriate version. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** * * * <pre> * Required. The encrypted data originally returned in * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. * </pre> * * <code>bytes ciphertext = 2;</code> */ public Builder clearCiphertext() { ciphertext_ = getDefaultInstance().getCiphertext(); onChanged(); return this; }
@Override public Map<String, String> extract(DecryptRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } })
/** * * * <pre> * Optional data that must match the data originally supplied in * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. * </pre> * * <code>bytes additional_authenticated_data = 3;</code> */ public Builder clearAdditionalAuthenticatedData() { additionalAuthenticatedData_ = getDefaultInstance().getAdditionalAuthenticatedData(); onChanged(); return this; }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(