@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.kms.v1.CreateKeyRingRequest)) { return super.equals(obj); } com.google.cloud.kms.v1.CreateKeyRingRequest other = (com.google.cloud.kms.v1.CreateKeyRingRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && getKeyRingId().equals(other.getKeyRingId()); result = result && (hasKeyRing() == other.hasKeyRing()); if (hasKeyRing()) { result = result && getKeyRing().equals(other.getKeyRing()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * * * <pre> * Required. The resource name of the location associated with the * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getParentBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); } if (!getKeyRingIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, keyRingId_); } if (keyRing_ != null) { output.writeMessage(3, getKeyRing()); } unknownFields.writeTo(output); }
@Test @SuppressWarnings("all") public void createKeyRingTest() { KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); KeyRing expectedResponse = KeyRing.newBuilder().setName(name.toString()).build(); mockKeyManagementService.addResponse(expectedResponse); LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); String keyRingId = "keyRingId-2056646742"; KeyRing keyRing = KeyRing.newBuilder().build(); KeyRing actualResponse = client.createKeyRing(parent, keyRingId, keyRing); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockKeyManagementService.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateKeyRingRequest actualRequest = (CreateKeyRingRequest) actualRequests.get(0); Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertEquals(keyRingId, actualRequest.getKeyRingId()); Assert.assertEquals(keyRing, actualRequest.getKeyRing()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * * * <pre> * Required. It must be unique within a location and match the regular * expression `[a-zA-Z0-9_-]{1,63}` * </pre> * * <code>string key_ring_id = 2;</code> */ public Builder clearKeyRingId() { keyRingId_ = getDefaultInstance().getKeyRingId(); onChanged(); return this; } /**
@Override public Map<String, String> extract(CreateKeyRingRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("parent", String.valueOf(request.getParent())); return params.build(); } })
@java.lang.Override public com.google.cloud.kms.v1.CreateKeyRingRequest getDefaultInstanceForType() { return com.google.cloud.kms.v1.CreateKeyRingRequest.getDefaultInstance(); }
/** * * * <pre> * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. * </pre> * * <code>.google.cloud.kms.v1.KeyRing key_ring = 3;</code> */ public com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingOrBuilder() { return getKeyRing(); }
@java.lang.Override public com.google.cloud.kms.v1.CreateKeyRingRequest buildPartial() { com.google.cloud.kms.v1.CreateKeyRingRequest result = new com.google.cloud.kms.v1.CreateKeyRingRequest(this); result.parent_ = parent_; result.keyRingId_ = keyRingId_; if (keyRingBuilder_ == null) { result.keyRing_ = keyRing_; } else { result.keyRing_ = keyRingBuilder_.build(); } onBuilt(); return result; }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getParentBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); } if (!getKeyRingIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, keyRingId_); } if (keyRing_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getKeyRing()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
/** * * * <pre> * Required. It must be unique within a location and match the regular * expression `[a-zA-Z0-9_-]{1,63}` * </pre> * * <code>string key_ring_id = 2;</code> */ public Builder clearKeyRingId() { keyRingId_ = getDefaultInstance().getKeyRingId(); onChanged(); return this; } /**
@Override public Map<String, String> extract(CreateKeyRingRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("parent", String.valueOf(request.getParent())); return params.build(); } })
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.kms.v1.CreateKeyRingRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
/** * * * <pre> * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. * </pre> * * <code>.google.cloud.kms.v1.KeyRing key_ring = 3;</code> */ public com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingOrBuilder() { return getKeyRing(); }
@java.lang.Override public com.google.cloud.kms.v1.CreateKeyRingRequest buildPartial() { com.google.cloud.kms.v1.CreateKeyRingRequest result = new com.google.cloud.kms.v1.CreateKeyRingRequest(this); result.parent_ = parent_; result.keyRingId_ = keyRingId_; if (keyRingBuilder_ == null) { result.keyRing_ = keyRing_; } else { result.keyRing_ = keyRingBuilder_.build(); } onBuilt(); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); hash = (37 * hash) + KEY_RING_ID_FIELD_NUMBER; hash = (53 * hash) + getKeyRingId().hashCode(); if (hasKeyRing()) { hash = (37 * hash) + KEY_RING_FIELD_NUMBER; hash = (53 * hash) + getKeyRing().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getParentBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); } if (!getKeyRingIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, keyRingId_); } if (keyRing_ != null) { output.writeMessage(3, getKeyRing()); } unknownFields.writeTo(output); }
/** * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. * * <p>Sample code: * * <pre><code> * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * String keyRingId = ""; * KeyRing keyRing = KeyRing.newBuilder().build(); * KeyRing response = keyManagementServiceClient.createKeyRing(parent.toString(), keyRingId, keyRing); * } * </code></pre> * * @param parent Required. The resource name of the location associated with the * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. * @param keyRingId Required. It must be unique within a location and match the regular expression * `[a-zA-Z0-9_-]{1,63}` * @param keyRing A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final KeyRing createKeyRing(String parent, String keyRingId, KeyRing keyRing) { CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder() .setParent(parent) .setKeyRingId(keyRingId) .setKeyRing(keyRing) .build(); return createKeyRing(request); }
/** * * * <pre> * Required. The resource name of the location associated with the * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**