public static List<String> toStringList(List<LocationName> values) { List<String> list = new ArrayList<String>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
public static String format(String project, String location) { return newBuilder().setProject(project).setLocation(location).build().toString(); }
/** * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. * * <p>Sample code: * * <pre><code> * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) { * // doThingsWith(element); * } * } * </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/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListKeyRingsPagedResponse listKeyRings(LocationName parent) { ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listKeyRings(request); }
/** * 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, 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(LocationName parent, String keyRingId, KeyRing keyRing) { CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setKeyRingId(keyRingId) .setKeyRing(keyRing) .build(); return createKeyRing(request); }
if (ex.getStatus().getCode() == Status.Code.NOT_FOUND) { String keyRingParent = LocationName.of(projectId, location).toString(); CreateKeyRingRequest createKeyRingRequest = CreateKeyRingRequest.newBuilder()
public static List<String> toStringList(List<LocationName> values) { List<String> list = new ArrayList<String>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
public static String format(String project, String location) { return newBuilder().setProject(project).setLocation(location).build().toString(); }
/** * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. * * <p>Sample code: * * <pre><code> * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) { * // doThingsWith(element); * } * } * </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/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListKeyRingsPagedResponse listKeyRings(LocationName parent) { ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listKeyRings(request); }
/** * 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, 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(LocationName parent, String keyRingId, KeyRing keyRing) { CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setKeyRingId(keyRingId) .setKeyRing(keyRing) .build(); return createKeyRing(request); }