id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
12,400
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.formatDataItemName
|
@Deprecated
public static final String formatDataItemName(String project, String dataset, String dataItem) {
return DATA_ITEM_PATH_TEMPLATE.instantiate(
"project", project,
"dataset", dataset,
"data_item", dataItem);
}
|
java
|
@Deprecated
public static final String formatDataItemName(String project, String dataset, String dataItem) {
return DATA_ITEM_PATH_TEMPLATE.instantiate(
"project", project,
"dataset", dataset,
"data_item", dataItem);
}
|
[
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatDataItemName",
"(",
"String",
"project",
",",
"String",
"dataset",
",",
"String",
"dataItem",
")",
"{",
"return",
"DATA_ITEM_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"dataset\"",
",",
"dataset",
",",
"\"data_item\"",
",",
"dataItem",
")",
";",
"}"
] |
Formats a string containing the fully-qualified path to represent a data_item resource.
@deprecated Use the {@link DataItemName} class instead.
|
[
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"data_item",
"resource",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L174-L180
|
12,401
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.formatDatasetName
|
@Deprecated
public static final String formatDatasetName(String project, String dataset) {
return DATASET_PATH_TEMPLATE.instantiate(
"project", project,
"dataset", dataset);
}
|
java
|
@Deprecated
public static final String formatDatasetName(String project, String dataset) {
return DATASET_PATH_TEMPLATE.instantiate(
"project", project,
"dataset", dataset);
}
|
[
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatDatasetName",
"(",
"String",
"project",
",",
"String",
"dataset",
")",
"{",
"return",
"DATASET_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"dataset\"",
",",
"dataset",
")",
";",
"}"
] |
Formats a string containing the fully-qualified path to represent a dataset resource.
@deprecated Use the {@link DatasetName} class instead.
|
[
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"dataset",
"resource",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L187-L192
|
12,402
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.formatExampleName
|
@Deprecated
public static final String formatExampleName(
String project, String dataset, String annotatedDataset, String example) {
return EXAMPLE_PATH_TEMPLATE.instantiate(
"project", project,
"dataset", dataset,
"annotated_dataset", annotatedDataset,
"example", example);
}
|
java
|
@Deprecated
public static final String formatExampleName(
String project, String dataset, String annotatedDataset, String example) {
return EXAMPLE_PATH_TEMPLATE.instantiate(
"project", project,
"dataset", dataset,
"annotated_dataset", annotatedDataset,
"example", example);
}
|
[
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatExampleName",
"(",
"String",
"project",
",",
"String",
"dataset",
",",
"String",
"annotatedDataset",
",",
"String",
"example",
")",
"{",
"return",
"EXAMPLE_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"dataset\"",
",",
"dataset",
",",
"\"annotated_dataset\"",
",",
"annotatedDataset",
",",
"\"example\"",
",",
"example",
")",
";",
"}"
] |
Formats a string containing the fully-qualified path to represent a example resource.
@deprecated Use the {@link ExampleName} class instead.
|
[
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"example",
"resource",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L199-L207
|
12,403
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.formatInstructionName
|
@Deprecated
public static final String formatInstructionName(String project, String instruction) {
return INSTRUCTION_PATH_TEMPLATE.instantiate(
"project", project,
"instruction", instruction);
}
|
java
|
@Deprecated
public static final String formatInstructionName(String project, String instruction) {
return INSTRUCTION_PATH_TEMPLATE.instantiate(
"project", project,
"instruction", instruction);
}
|
[
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatInstructionName",
"(",
"String",
"project",
",",
"String",
"instruction",
")",
"{",
"return",
"INSTRUCTION_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"instruction\"",
",",
"instruction",
")",
";",
"}"
] |
Formats a string containing the fully-qualified path to represent a instruction resource.
@deprecated Use the {@link InstructionName} class instead.
|
[
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"instruction",
"resource",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L214-L219
|
12,404
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.listDatasets
|
public final ListDatasetsPagedResponse listDatasets(String parent, String filter) {
PROJECT_PATH_TEMPLATE.validate(parent, "listDatasets");
ListDatasetsRequest request =
ListDatasetsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listDatasets(request);
}
|
java
|
public final ListDatasetsPagedResponse listDatasets(String parent, String filter) {
PROJECT_PATH_TEMPLATE.validate(parent, "listDatasets");
ListDatasetsRequest request =
ListDatasetsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listDatasets(request);
}
|
[
"public",
"final",
"ListDatasetsPagedResponse",
"listDatasets",
"(",
"String",
"parent",
",",
"String",
"filter",
")",
"{",
"PROJECT_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"listDatasets\"",
")",
";",
"ListDatasetsRequest",
"request",
"=",
"ListDatasetsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listDatasets",
"(",
"request",
")",
";",
"}"
] |
Lists datasets under a project. Pagination is supported.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatProjectName("[PROJECT]");
String filter = "";
for (Dataset element : dataLabelingServiceClient.listDatasets(formattedParent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. Dataset resource parent, format: projects/{project_id}
@param filter Optional. Filter on dataset is not supported at this moment.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Lists",
"datasets",
"under",
"a",
"project",
".",
"Pagination",
"is",
"supported",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L634-L639
|
12,405
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.deleteDataset
|
public final void deleteDataset(String name) {
DATASET_PATH_TEMPLATE.validate(name, "deleteDataset");
DeleteDatasetRequest request = DeleteDatasetRequest.newBuilder().setName(name).build();
deleteDataset(request);
}
|
java
|
public final void deleteDataset(String name) {
DATASET_PATH_TEMPLATE.validate(name, "deleteDataset");
DeleteDatasetRequest request = DeleteDatasetRequest.newBuilder().setName(name).build();
deleteDataset(request);
}
|
[
"public",
"final",
"void",
"deleteDataset",
"(",
"String",
"name",
")",
"{",
"DATASET_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"deleteDataset\"",
")",
";",
"DeleteDatasetRequest",
"request",
"=",
"DeleteDatasetRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"deleteDataset",
"(",
"request",
")",
";",
"}"
] |
Deletes a dataset by resource name.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatDatasetName("[PROJECT]", "[DATASET]");
dataLabelingServiceClient.deleteDataset(formattedName);
}
</code></pre>
@param name Required. Dataset resource name, format:
projects/{project_id}/datasets/{dataset_id}
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Deletes",
"a",
"dataset",
"by",
"resource",
"name",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L739-L743
|
12,406
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.getDataItem
|
public final DataItem getDataItem(String name) {
DATA_ITEM_PATH_TEMPLATE.validate(name, "getDataItem");
GetDataItemRequest request = GetDataItemRequest.newBuilder().setName(name).build();
return getDataItem(request);
}
|
java
|
public final DataItem getDataItem(String name) {
DATA_ITEM_PATH_TEMPLATE.validate(name, "getDataItem");
GetDataItemRequest request = GetDataItemRequest.newBuilder().setName(name).build();
return getDataItem(request);
}
|
[
"public",
"final",
"DataItem",
"getDataItem",
"(",
"String",
"name",
")",
"{",
"DATA_ITEM_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"getDataItem\"",
")",
";",
"GetDataItemRequest",
"request",
"=",
"GetDataItemRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"return",
"getDataItem",
"(",
"request",
")",
";",
"}"
] |
Gets a data item in a dataset by resource name. This API can be called after data are imported
into dataset.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatDataItemName("[PROJECT]", "[DATASET]", "[DATA_ITEM]");
DataItem response = dataLabelingServiceClient.getDataItem(formattedName);
}
</code></pre>
@param name Required. The name of the data item to get, format:
projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id}
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"a",
"data",
"item",
"in",
"a",
"dataset",
"by",
"resource",
"name",
".",
"This",
"API",
"can",
"be",
"called",
"after",
"data",
"are",
"imported",
"into",
"dataset",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1054-L1058
|
12,407
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.listDataItems
|
public final ListDataItemsPagedResponse listDataItems(String parent, String filter) {
DATASET_PATH_TEMPLATE.validate(parent, "listDataItems");
ListDataItemsRequest request =
ListDataItemsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listDataItems(request);
}
|
java
|
public final ListDataItemsPagedResponse listDataItems(String parent, String filter) {
DATASET_PATH_TEMPLATE.validate(parent, "listDataItems");
ListDataItemsRequest request =
ListDataItemsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listDataItems(request);
}
|
[
"public",
"final",
"ListDataItemsPagedResponse",
"listDataItems",
"(",
"String",
"parent",
",",
"String",
"filter",
")",
"{",
"DATASET_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"listDataItems\"",
")",
";",
"ListDataItemsRequest",
"request",
"=",
"ListDataItemsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listDataItems",
"(",
"request",
")",
";",
"}"
] |
Lists data items in a dataset. This API can be called after data are imported into dataset.
Pagination is supported.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatDatasetName("[PROJECT]", "[DATASET]");
String filter = "";
for (DataItem element : dataLabelingServiceClient.listDataItems(formattedParent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. Name of the dataset to list data items, format:
projects/{project_id}/datasets/{dataset_id}
@param filter Optional. Filter is not supported at this moment.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Lists",
"data",
"items",
"in",
"a",
"dataset",
".",
"This",
"API",
"can",
"be",
"called",
"after",
"data",
"are",
"imported",
"into",
"dataset",
".",
"Pagination",
"is",
"supported",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1129-L1134
|
12,408
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.getAnnotatedDataset
|
public final AnnotatedDataset getAnnotatedDataset(String name) {
ANNOTATED_DATASET_PATH_TEMPLATE.validate(name, "getAnnotatedDataset");
GetAnnotatedDatasetRequest request =
GetAnnotatedDatasetRequest.newBuilder().setName(name).build();
return getAnnotatedDataset(request);
}
|
java
|
public final AnnotatedDataset getAnnotatedDataset(String name) {
ANNOTATED_DATASET_PATH_TEMPLATE.validate(name, "getAnnotatedDataset");
GetAnnotatedDatasetRequest request =
GetAnnotatedDatasetRequest.newBuilder().setName(name).build();
return getAnnotatedDataset(request);
}
|
[
"public",
"final",
"AnnotatedDataset",
"getAnnotatedDataset",
"(",
"String",
"name",
")",
"{",
"ANNOTATED_DATASET_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"getAnnotatedDataset\"",
")",
";",
"GetAnnotatedDatasetRequest",
"request",
"=",
"GetAnnotatedDatasetRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"return",
"getAnnotatedDataset",
"(",
"request",
")",
";",
"}"
] |
Gets an annotated dataset by resource name.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatAnnotatedDatasetName("[PROJECT]", "[DATASET]", "[ANNOTATED_DATASET]");
AnnotatedDataset response = dataLabelingServiceClient.getAnnotatedDataset(formattedName);
}
</code></pre>
@param name Required. Name of the annotated dataset to get, format:
projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"an",
"annotated",
"dataset",
"by",
"resource",
"name",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1237-L1242
|
12,409
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.listAnnotatedDatasets
|
public final ListAnnotatedDatasetsPagedResponse listAnnotatedDatasets(
String parent, String filter) {
DATASET_PATH_TEMPLATE.validate(parent, "listAnnotatedDatasets");
ListAnnotatedDatasetsRequest request =
ListAnnotatedDatasetsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listAnnotatedDatasets(request);
}
|
java
|
public final ListAnnotatedDatasetsPagedResponse listAnnotatedDatasets(
String parent, String filter) {
DATASET_PATH_TEMPLATE.validate(parent, "listAnnotatedDatasets");
ListAnnotatedDatasetsRequest request =
ListAnnotatedDatasetsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listAnnotatedDatasets(request);
}
|
[
"public",
"final",
"ListAnnotatedDatasetsPagedResponse",
"listAnnotatedDatasets",
"(",
"String",
"parent",
",",
"String",
"filter",
")",
"{",
"DATASET_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"listAnnotatedDatasets\"",
")",
";",
"ListAnnotatedDatasetsRequest",
"request",
"=",
"ListAnnotatedDatasetsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listAnnotatedDatasets",
"(",
"request",
")",
";",
"}"
] |
Lists annotated datasets for a dataset. Pagination is supported.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatDatasetName("[PROJECT]", "[DATASET]");
String filter = "";
for (AnnotatedDataset element : dataLabelingServiceClient.listAnnotatedDatasets(formattedParent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. Name of the dataset to list annotated datasets, format:
projects/{project_id}/datasets/{dataset_id}
@param filter Optional. Filter is not supported at this moment.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Lists",
"annotated",
"datasets",
"for",
"a",
"dataset",
".",
"Pagination",
"is",
"supported",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1311-L1317
|
12,410
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.getExample
|
public final Example getExample(String name, String filter) {
EXAMPLE_PATH_TEMPLATE.validate(name, "getExample");
GetExampleRequest request =
GetExampleRequest.newBuilder().setName(name).setFilter(filter).build();
return getExample(request);
}
|
java
|
public final Example getExample(String name, String filter) {
EXAMPLE_PATH_TEMPLATE.validate(name, "getExample");
GetExampleRequest request =
GetExampleRequest.newBuilder().setName(name).setFilter(filter).build();
return getExample(request);
}
|
[
"public",
"final",
"Example",
"getExample",
"(",
"String",
"name",
",",
"String",
"filter",
")",
"{",
"EXAMPLE_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"getExample\"",
")",
";",
"GetExampleRequest",
"request",
"=",
"GetExampleRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"getExample",
"(",
"request",
")",
";",
"}"
] |
Gets an example by resource name, including both data and annotation.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatExampleName("[PROJECT]", "[DATASET]", "[ANNOTATED_DATASET]", "[EXAMPLE]");
String filter = "";
Example response = dataLabelingServiceClient.getExample(formattedName, filter);
}
</code></pre>
@param name Required. Name of example, format:
projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
{annotated_dataset_id}/examples/{example_id}
@param filter Optional. An expression for filtering Examples. Filter by
annotation_spec.display_name is supported. Format "annotation_spec.display_name =
{display_name}"
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"an",
"example",
"by",
"resource",
"name",
"including",
"both",
"data",
"and",
"annotation",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1916-L1921
|
12,411
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.listExamples
|
public final ListExamplesPagedResponse listExamples(String parent, String filter) {
ANNOTATED_DATASET_PATH_TEMPLATE.validate(parent, "listExamples");
ListExamplesRequest request =
ListExamplesRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listExamples(request);
}
|
java
|
public final ListExamplesPagedResponse listExamples(String parent, String filter) {
ANNOTATED_DATASET_PATH_TEMPLATE.validate(parent, "listExamples");
ListExamplesRequest request =
ListExamplesRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listExamples(request);
}
|
[
"public",
"final",
"ListExamplesPagedResponse",
"listExamples",
"(",
"String",
"parent",
",",
"String",
"filter",
")",
"{",
"ANNOTATED_DATASET_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"listExamples\"",
")",
";",
"ListExamplesRequest",
"request",
"=",
"ListExamplesRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listExamples",
"(",
"request",
")",
";",
"}"
] |
Lists examples in an annotated dataset. Pagination is supported.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatAnnotatedDatasetName("[PROJECT]", "[DATASET]", "[ANNOTATED_DATASET]");
String filter = "";
for (Example element : dataLabelingServiceClient.listExamples(formattedParent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. Example resource parent.
@param filter Optional. An expression for filtering Examples. For annotated datasets that have
annotation spec set, filter by annotation_spec.display_name is supported. Format
"annotation_spec.display_name = {display_name}"
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Lists",
"examples",
"in",
"an",
"annotated",
"dataset",
".",
"Pagination",
"is",
"supported",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L1990-L1995
|
12,412
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.createAnnotationSpecSet
|
public final AnnotationSpecSet createAnnotationSpecSet(
String parent, AnnotationSpecSet annotationSpecSet) {
PROJECT_PATH_TEMPLATE.validate(parent, "createAnnotationSpecSet");
CreateAnnotationSpecSetRequest request =
CreateAnnotationSpecSetRequest.newBuilder()
.setParent(parent)
.setAnnotationSpecSet(annotationSpecSet)
.build();
return createAnnotationSpecSet(request);
}
|
java
|
public final AnnotationSpecSet createAnnotationSpecSet(
String parent, AnnotationSpecSet annotationSpecSet) {
PROJECT_PATH_TEMPLATE.validate(parent, "createAnnotationSpecSet");
CreateAnnotationSpecSetRequest request =
CreateAnnotationSpecSetRequest.newBuilder()
.setParent(parent)
.setAnnotationSpecSet(annotationSpecSet)
.build();
return createAnnotationSpecSet(request);
}
|
[
"public",
"final",
"AnnotationSpecSet",
"createAnnotationSpecSet",
"(",
"String",
"parent",
",",
"AnnotationSpecSet",
"annotationSpecSet",
")",
"{",
"PROJECT_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"createAnnotationSpecSet\"",
")",
";",
"CreateAnnotationSpecSetRequest",
"request",
"=",
"CreateAnnotationSpecSetRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setAnnotationSpecSet",
"(",
"annotationSpecSet",
")",
".",
"build",
"(",
")",
";",
"return",
"createAnnotationSpecSet",
"(",
"request",
")",
";",
"}"
] |
Creates an annotation spec set by providing a set of labels.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatProjectName("[PROJECT]");
AnnotationSpecSet annotationSpecSet = AnnotationSpecSet.newBuilder().build();
AnnotationSpecSet response = dataLabelingServiceClient.createAnnotationSpecSet(formattedParent, annotationSpecSet);
}
</code></pre>
@param parent Required. AnnotationSpecSet resource parent, format: projects/{project_id}
@param annotationSpecSet Required. Annotation spec set to create. Annotation specs must be
included. Only one annotation spec will be accepted for annotation specs with same
display_name.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Creates",
"an",
"annotation",
"spec",
"set",
"by",
"providing",
"a",
"set",
"of",
"labels",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2098-L2107
|
12,413
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.getAnnotationSpecSet
|
public final AnnotationSpecSet getAnnotationSpecSet(String name) {
ANNOTATION_SPEC_SET_PATH_TEMPLATE.validate(name, "getAnnotationSpecSet");
GetAnnotationSpecSetRequest request =
GetAnnotationSpecSetRequest.newBuilder().setName(name).build();
return getAnnotationSpecSet(request);
}
|
java
|
public final AnnotationSpecSet getAnnotationSpecSet(String name) {
ANNOTATION_SPEC_SET_PATH_TEMPLATE.validate(name, "getAnnotationSpecSet");
GetAnnotationSpecSetRequest request =
GetAnnotationSpecSetRequest.newBuilder().setName(name).build();
return getAnnotationSpecSet(request);
}
|
[
"public",
"final",
"AnnotationSpecSet",
"getAnnotationSpecSet",
"(",
"String",
"name",
")",
"{",
"ANNOTATION_SPEC_SET_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"getAnnotationSpecSet\"",
")",
";",
"GetAnnotationSpecSetRequest",
"request",
"=",
"GetAnnotationSpecSetRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"return",
"getAnnotationSpecSet",
"(",
"request",
")",
";",
"}"
] |
Gets an annotation spec set by resource name.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatAnnotationSpecSetName("[PROJECT]", "[ANNOTATION_SPEC_SET]");
AnnotationSpecSet response = dataLabelingServiceClient.getAnnotationSpecSet(formattedName);
}
</code></pre>
@param name Required. AnnotationSpecSet resource name, format:
projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"an",
"annotation",
"spec",
"set",
"by",
"resource",
"name",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2176-L2181
|
12,414
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.listAnnotationSpecSets
|
public final ListAnnotationSpecSetsPagedResponse listAnnotationSpecSets(
String parent, String filter) {
PROJECT_PATH_TEMPLATE.validate(parent, "listAnnotationSpecSets");
ListAnnotationSpecSetsRequest request =
ListAnnotationSpecSetsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listAnnotationSpecSets(request);
}
|
java
|
public final ListAnnotationSpecSetsPagedResponse listAnnotationSpecSets(
String parent, String filter) {
PROJECT_PATH_TEMPLATE.validate(parent, "listAnnotationSpecSets");
ListAnnotationSpecSetsRequest request =
ListAnnotationSpecSetsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listAnnotationSpecSets(request);
}
|
[
"public",
"final",
"ListAnnotationSpecSetsPagedResponse",
"listAnnotationSpecSets",
"(",
"String",
"parent",
",",
"String",
"filter",
")",
"{",
"PROJECT_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"listAnnotationSpecSets\"",
")",
";",
"ListAnnotationSpecSetsRequest",
"request",
"=",
"ListAnnotationSpecSetsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listAnnotationSpecSets",
"(",
"request",
")",
";",
"}"
] |
Lists annotation spec sets for a project. Pagination is supported.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatProjectName("[PROJECT]");
String filter = "";
for (AnnotationSpecSet element : dataLabelingServiceClient.listAnnotationSpecSets(formattedParent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. Parent of AnnotationSpecSet resource, format: projects/{project_id}
@param filter Optional. Filter is not supported at this moment.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Lists",
"annotation",
"spec",
"sets",
"for",
"a",
"project",
".",
"Pagination",
"is",
"supported",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2249-L2255
|
12,415
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.deleteAnnotationSpecSet
|
public final void deleteAnnotationSpecSet(String name) {
ANNOTATION_SPEC_SET_PATH_TEMPLATE.validate(name, "deleteAnnotationSpecSet");
DeleteAnnotationSpecSetRequest request =
DeleteAnnotationSpecSetRequest.newBuilder().setName(name).build();
deleteAnnotationSpecSet(request);
}
|
java
|
public final void deleteAnnotationSpecSet(String name) {
ANNOTATION_SPEC_SET_PATH_TEMPLATE.validate(name, "deleteAnnotationSpecSet");
DeleteAnnotationSpecSetRequest request =
DeleteAnnotationSpecSetRequest.newBuilder().setName(name).build();
deleteAnnotationSpecSet(request);
}
|
[
"public",
"final",
"void",
"deleteAnnotationSpecSet",
"(",
"String",
"name",
")",
"{",
"ANNOTATION_SPEC_SET_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"deleteAnnotationSpecSet\"",
")",
";",
"DeleteAnnotationSpecSetRequest",
"request",
"=",
"DeleteAnnotationSpecSetRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"deleteAnnotationSpecSet",
"(",
"request",
")",
";",
"}"
] |
Deletes an annotation spec set by resource name.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatAnnotationSpecSetName("[PROJECT]", "[ANNOTATION_SPEC_SET]");
dataLabelingServiceClient.deleteAnnotationSpecSet(formattedName);
}
</code></pre>
@param name Required. AnnotationSpec resource name, format:
`projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}`.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Deletes",
"an",
"annotation",
"spec",
"set",
"by",
"resource",
"name",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2357-L2362
|
12,416
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.getInstruction
|
public final Instruction getInstruction(String name) {
INSTRUCTION_PATH_TEMPLATE.validate(name, "getInstruction");
GetInstructionRequest request = GetInstructionRequest.newBuilder().setName(name).build();
return getInstruction(request);
}
|
java
|
public final Instruction getInstruction(String name) {
INSTRUCTION_PATH_TEMPLATE.validate(name, "getInstruction");
GetInstructionRequest request = GetInstructionRequest.newBuilder().setName(name).build();
return getInstruction(request);
}
|
[
"public",
"final",
"Instruction",
"getInstruction",
"(",
"String",
"name",
")",
"{",
"INSTRUCTION_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"getInstruction\"",
")",
";",
"GetInstructionRequest",
"request",
"=",
"GetInstructionRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"return",
"getInstruction",
"(",
"request",
")",
";",
"}"
] |
Gets an instruction by resource name.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatInstructionName("[PROJECT]", "[INSTRUCTION]");
Instruction response = dataLabelingServiceClient.getInstruction(formattedName);
}
</code></pre>
@param name Required. Instruction resource name, format:
projects/{project_id}/instructions/{instruction_id}
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"an",
"instruction",
"by",
"resource",
"name",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2533-L2537
|
12,417
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.listInstructions
|
public final ListInstructionsPagedResponse listInstructions(String parent, String filter) {
PROJECT_PATH_TEMPLATE.validate(parent, "listInstructions");
ListInstructionsRequest request =
ListInstructionsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listInstructions(request);
}
|
java
|
public final ListInstructionsPagedResponse listInstructions(String parent, String filter) {
PROJECT_PATH_TEMPLATE.validate(parent, "listInstructions");
ListInstructionsRequest request =
ListInstructionsRequest.newBuilder().setParent(parent).setFilter(filter).build();
return listInstructions(request);
}
|
[
"public",
"final",
"ListInstructionsPagedResponse",
"listInstructions",
"(",
"String",
"parent",
",",
"String",
"filter",
")",
"{",
"PROJECT_PATH_TEMPLATE",
".",
"validate",
"(",
"parent",
",",
"\"listInstructions\"",
")",
";",
"ListInstructionsRequest",
"request",
"=",
"ListInstructionsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listInstructions",
"(",
"request",
")",
";",
"}"
] |
Lists instructions for a project. Pagination is supported.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedParent = DataLabelingServiceClient.formatProjectName("[PROJECT]");
String filter = "";
for (Instruction element : dataLabelingServiceClient.listInstructions(formattedParent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. Instruction resource parent, format: projects/{project_id}
@param filter Optional. Filter is not supported at this moment.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Lists",
"instructions",
"for",
"a",
"project",
".",
"Pagination",
"is",
"supported",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2604-L2609
|
12,418
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
|
DataLabelingServiceClient.deleteInstruction
|
public final void deleteInstruction(String name) {
INSTRUCTION_PATH_TEMPLATE.validate(name, "deleteInstruction");
DeleteInstructionRequest request = DeleteInstructionRequest.newBuilder().setName(name).build();
deleteInstruction(request);
}
|
java
|
public final void deleteInstruction(String name) {
INSTRUCTION_PATH_TEMPLATE.validate(name, "deleteInstruction");
DeleteInstructionRequest request = DeleteInstructionRequest.newBuilder().setName(name).build();
deleteInstruction(request);
}
|
[
"public",
"final",
"void",
"deleteInstruction",
"(",
"String",
"name",
")",
"{",
"INSTRUCTION_PATH_TEMPLATE",
".",
"validate",
"(",
"name",
",",
"\"deleteInstruction\"",
")",
";",
"DeleteInstructionRequest",
"request",
"=",
"DeleteInstructionRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"deleteInstruction",
"(",
"request",
")",
";",
"}"
] |
Deletes an instruction object by resource name.
<p>Sample code:
<pre><code>
try (DataLabelingServiceClient dataLabelingServiceClient = DataLabelingServiceClient.create()) {
String formattedName = DataLabelingServiceClient.formatInstructionName("[PROJECT]", "[INSTRUCTION]");
dataLabelingServiceClient.deleteInstruction(formattedName);
}
</code></pre>
@param name Required. Instruction resource name, format:
projects/{project_id}/instructions/{instruction_id}
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Deletes",
"an",
"instruction",
"object",
"by",
"resource",
"name",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L2710-L2714
|
12,419
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsException.java
|
DnsException.translateAndThrow
|
static DnsException translateAndThrow(RetryHelperException ex) {
BaseServiceException.translate(ex);
throw new DnsException(UNKNOWN_CODE, ex.getMessage(), ex.getCause());
}
|
java
|
static DnsException translateAndThrow(RetryHelperException ex) {
BaseServiceException.translate(ex);
throw new DnsException(UNKNOWN_CODE, ex.getMessage(), ex.getCause());
}
|
[
"static",
"DnsException",
"translateAndThrow",
"(",
"RetryHelperException",
"ex",
")",
"{",
"BaseServiceException",
".",
"translate",
"(",
"ex",
")",
";",
"throw",
"new",
"DnsException",
"(",
"UNKNOWN_CODE",
",",
"ex",
".",
"getMessage",
"(",
")",
",",
"ex",
".",
"getCause",
"(",
")",
")",
";",
"}"
] |
Translate RetryHelperException to the DnsException that caused the error. This method will
always throw an exception.
@throws DnsException when {@code ex} was caused by a {@code DnsException}
|
[
"Translate",
"RetryHelperException",
"to",
"the",
"DnsException",
"that",
"caused",
"the",
"error",
".",
"This",
"method",
"will",
"always",
"throw",
"an",
"exception",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsException.java#L59-L62
|
12,420
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutationBatcher.java
|
BulkMutationBatcher.close
|
public void close(Duration duration) throws InterruptedException, TimeoutException {
closed = true;
long deadlineMs = System.currentTimeMillis() + duration.toMillis();
synchronized (lock) {
while (numOutstanding.get() > 0) {
long waitMs = deadlineMs - System.currentTimeMillis();
if (waitMs <= 0) {
throw new TimeoutException("Timed out waiting outstanding mutations to finish");
}
lock.wait(waitMs);
}
// numFailures can only be checked after numOutstanding is zero.
if (numFailures > 0) {
throw new BulkMutationFailure(numFailures);
}
}
}
|
java
|
public void close(Duration duration) throws InterruptedException, TimeoutException {
closed = true;
long deadlineMs = System.currentTimeMillis() + duration.toMillis();
synchronized (lock) {
while (numOutstanding.get() > 0) {
long waitMs = deadlineMs - System.currentTimeMillis();
if (waitMs <= 0) {
throw new TimeoutException("Timed out waiting outstanding mutations to finish");
}
lock.wait(waitMs);
}
// numFailures can only be checked after numOutstanding is zero.
if (numFailures > 0) {
throw new BulkMutationFailure(numFailures);
}
}
}
|
[
"public",
"void",
"close",
"(",
"Duration",
"duration",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"closed",
"=",
"true",
";",
"long",
"deadlineMs",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"duration",
".",
"toMillis",
"(",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"while",
"(",
"numOutstanding",
".",
"get",
"(",
")",
">",
"0",
")",
"{",
"long",
"waitMs",
"=",
"deadlineMs",
"-",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"waitMs",
"<=",
"0",
")",
"{",
"throw",
"new",
"TimeoutException",
"(",
"\"Timed out waiting outstanding mutations to finish\"",
")",
";",
"}",
"lock",
".",
"wait",
"(",
"waitMs",
")",
";",
"}",
"// numFailures can only be checked after numOutstanding is zero.",
"if",
"(",
"numFailures",
">",
"0",
")",
"{",
"throw",
"new",
"BulkMutationFailure",
"(",
"numFailures",
")",
";",
"}",
"}",
"}"
] |
Prevents further mutations and waits for all outstanding mutations to complete.
@throws BulkMutationFailure If any mutations failed.
@throws InterruptedException If interrupted.
@throws TimeoutException If the outstanding requests don't finish in time.
|
[
"Prevents",
"further",
"mutations",
"and",
"waits",
"for",
"all",
"outstanding",
"mutations",
"to",
"complete",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutationBatcher.java#L70-L88
|
12,421
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutationBatcher.java
|
BulkMutationBatcher.add
|
public ApiFuture<Void> add(final RowMutation rowMutation) {
Preconditions.checkState(!closed, "BulkMutations has been closed");
numOutstanding.incrementAndGet();
ApiFuture<Void> future = callable.futureCall(rowMutation);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
onMutationComplete(false);
}
@Override
public void onSuccess(Void aVoid) {
onMutationComplete(true);
}
},
MoreExecutors.directExecutor());
return future;
}
|
java
|
public ApiFuture<Void> add(final RowMutation rowMutation) {
Preconditions.checkState(!closed, "BulkMutations has been closed");
numOutstanding.incrementAndGet();
ApiFuture<Void> future = callable.futureCall(rowMutation);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Void>() {
@Override
public void onFailure(Throwable throwable) {
onMutationComplete(false);
}
@Override
public void onSuccess(Void aVoid) {
onMutationComplete(true);
}
},
MoreExecutors.directExecutor());
return future;
}
|
[
"public",
"ApiFuture",
"<",
"Void",
">",
"add",
"(",
"final",
"RowMutation",
"rowMutation",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"closed",
",",
"\"BulkMutations has been closed\"",
")",
";",
"numOutstanding",
".",
"incrementAndGet",
"(",
")",
";",
"ApiFuture",
"<",
"Void",
">",
"future",
"=",
"callable",
".",
"futureCall",
"(",
"rowMutation",
")",
";",
"ApiFutures",
".",
"addCallback",
"(",
"future",
",",
"new",
"ApiFutureCallback",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onFailure",
"(",
"Throwable",
"throwable",
")",
"{",
"onMutationComplete",
"(",
"false",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onSuccess",
"(",
"Void",
"aVoid",
")",
"{",
"onMutationComplete",
"(",
"true",
")",
";",
"}",
"}",
",",
"MoreExecutors",
".",
"directExecutor",
"(",
")",
")",
";",
"return",
"future",
";",
"}"
] |
Queues the mutation to be batched and sent. Please note that the order of mutations is not
guaranteed.
@throws IllegalStateException If this instance has been closed.
|
[
"Queues",
"the",
"mutation",
"to",
"be",
"batched",
"and",
"sent",
".",
"Please",
"note",
"that",
"the",
"order",
"of",
"mutations",
"is",
"not",
"guaranteed",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutationBatcher.java#L96-L118
|
12,422
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java
|
HealthCheckClient.patchHealthCheck
|
@BetaApi
public final Operation patchHealthCheck(
ProjectGlobalHealthCheckName healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask) {
PatchHealthCheckHttpRequest request =
PatchHealthCheckHttpRequest.newBuilder()
.setHealthCheck(healthCheck == null ? null : healthCheck.toString())
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
return patchHealthCheck(request);
}
|
java
|
@BetaApi
public final Operation patchHealthCheck(
ProjectGlobalHealthCheckName healthCheck,
HealthCheck healthCheckResource,
List<String> fieldMask) {
PatchHealthCheckHttpRequest request =
PatchHealthCheckHttpRequest.newBuilder()
.setHealthCheck(healthCheck == null ? null : healthCheck.toString())
.setHealthCheckResource(healthCheckResource)
.addAllFieldMask(fieldMask)
.build();
return patchHealthCheck(request);
}
|
[
"@",
"BetaApi",
"public",
"final",
"Operation",
"patchHealthCheck",
"(",
"ProjectGlobalHealthCheckName",
"healthCheck",
",",
"HealthCheck",
"healthCheckResource",
",",
"List",
"<",
"String",
">",
"fieldMask",
")",
"{",
"PatchHealthCheckHttpRequest",
"request",
"=",
"PatchHealthCheckHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setHealthCheck",
"(",
"healthCheck",
"==",
"null",
"?",
"null",
":",
"healthCheck",
".",
"toString",
"(",
")",
")",
".",
"setHealthCheckResource",
"(",
"healthCheckResource",
")",
".",
"addAllFieldMask",
"(",
"fieldMask",
")",
".",
"build",
"(",
")",
";",
"return",
"patchHealthCheck",
"(",
"request",
")",
";",
"}"
] |
Updates a HealthCheck resource in the specified project using the data included in the request.
This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
<p>Sample code:
<pre><code>
try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
HealthCheck healthCheckResource = HealthCheck.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = healthCheckClient.patchHealthCheck(healthCheck, healthCheckResource, fieldMask);
}
</code></pre>
@param healthCheck Name of the HealthCheck resource to patch.
@param healthCheckResource An HealthCheck resource. This resource defines a template for how
individual virtual machines should be checked for health, via one of the supported
protocols.
@param fieldMask The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Updates",
"a",
"HealthCheck",
"resource",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
".",
"This",
"method",
"supports",
"PATCH",
"semantics",
"and",
"uses",
"the",
"JSON",
"merge",
"patch",
"format",
"and",
"processing",
"rules",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/HealthCheckClient.java#L629-L642
|
12,423
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java
|
GqlQuery.getNamedBindings
|
public Map<String, Object> getNamedBindings() {
ImmutableMap.Builder<String, Object> builder = ImmutableSortedMap.naturalOrder();
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
builder.put(binding.getKey(), binding.getValue().getCursorOrValue());
}
return builder.build();
}
|
java
|
public Map<String, Object> getNamedBindings() {
ImmutableMap.Builder<String, Object> builder = ImmutableSortedMap.naturalOrder();
for (Map.Entry<String, Binding> binding : namedBindings.entrySet()) {
builder.put(binding.getKey(), binding.getValue().getCursorOrValue());
}
return builder.build();
}
|
[
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getNamedBindings",
"(",
")",
"{",
"ImmutableMap",
".",
"Builder",
"<",
"String",
",",
"Object",
">",
"builder",
"=",
"ImmutableSortedMap",
".",
"naturalOrder",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Binding",
">",
"binding",
":",
"namedBindings",
".",
"entrySet",
"(",
")",
")",
"{",
"builder",
".",
"put",
"(",
"binding",
".",
"getKey",
"(",
")",
",",
"binding",
".",
"getValue",
"(",
")",
".",
"getCursorOrValue",
"(",
")",
")",
";",
"}",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}"
] |
Returns an immutable map of named bindings.
|
[
"Returns",
"an",
"immutable",
"map",
"of",
"named",
"bindings",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/GqlQuery.java#L437-L443
|
12,424
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.createTable
|
public void createTable() {
// [START bigtable_create_table]
// Checks if table exists, creates table if does not exist.
if (!adminClient.exists(tableId)) {
System.out.println("Table does not exist, creating table: " + tableId);
CreateTableRequest createTableRequest = CreateTableRequest.of(tableId).addFamily("cf");
Table table = adminClient.createTable(createTableRequest);
System.out.printf("Table: %s created successfully%n", table.getId());
}
// [END bigtable_create_table]
}
|
java
|
public void createTable() {
// [START bigtable_create_table]
// Checks if table exists, creates table if does not exist.
if (!adminClient.exists(tableId)) {
System.out.println("Table does not exist, creating table: " + tableId);
CreateTableRequest createTableRequest = CreateTableRequest.of(tableId).addFamily("cf");
Table table = adminClient.createTable(createTableRequest);
System.out.printf("Table: %s created successfully%n", table.getId());
}
// [END bigtable_create_table]
}
|
[
"public",
"void",
"createTable",
"(",
")",
"{",
"// [START bigtable_create_table]",
"// Checks if table exists, creates table if does not exist.",
"if",
"(",
"!",
"adminClient",
".",
"exists",
"(",
"tableId",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Table does not exist, creating table: \"",
"+",
"tableId",
")",
";",
"CreateTableRequest",
"createTableRequest",
"=",
"CreateTableRequest",
".",
"of",
"(",
"tableId",
")",
".",
"addFamily",
"(",
"\"cf\"",
")",
";",
"Table",
"table",
"=",
"adminClient",
".",
"createTable",
"(",
"createTableRequest",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"Table: %s created successfully%n\"",
",",
"table",
".",
"getId",
"(",
")",
")",
";",
"}",
"// [END bigtable_create_table]",
"}"
] |
Demonstrates how to create a table with the specified configuration.
|
[
"Demonstrates",
"how",
"to",
"create",
"a",
"table",
"with",
"the",
"specified",
"configuration",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L116-L126
|
12,425
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.listAllTables
|
public void listAllTables() {
System.out.println("\nListing tables in current instance");
// [START bigtable_list_tables]
// Lists tables in the current instance.
try {
List<String> tableIds = adminClient.listTables();
for (String tableId : tableIds) {
System.out.println(tableId);
}
} catch (NotFoundException e) {
System.err.println("Failed to list tables from a non-existent instance: " + e.getMessage());
}
// [END bigtable_list_tables]
}
|
java
|
public void listAllTables() {
System.out.println("\nListing tables in current instance");
// [START bigtable_list_tables]
// Lists tables in the current instance.
try {
List<String> tableIds = adminClient.listTables();
for (String tableId : tableIds) {
System.out.println(tableId);
}
} catch (NotFoundException e) {
System.err.println("Failed to list tables from a non-existent instance: " + e.getMessage());
}
// [END bigtable_list_tables]
}
|
[
"public",
"void",
"listAllTables",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\\nListing tables in current instance\"",
")",
";",
"// [START bigtable_list_tables]",
"// Lists tables in the current instance.",
"try",
"{",
"List",
"<",
"String",
">",
"tableIds",
"=",
"adminClient",
".",
"listTables",
"(",
")",
";",
"for",
"(",
"String",
"tableId",
":",
"tableIds",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"tableId",
")",
";",
"}",
"}",
"catch",
"(",
"NotFoundException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to list tables from a non-existent instance: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_list_tables]",
"}"
] |
Demonstrates how to list all tables within an instance.
|
[
"Demonstrates",
"how",
"to",
"list",
"all",
"tables",
"within",
"an",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L129-L142
|
12,426
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.addFamilyWithMaxAgeRule
|
public void addFamilyWithMaxAgeRule() {
System.out.printf("%nCreating column family %s with max age GC rule%n", COLUMN_FAMILY_1);
// [START bigtable_create_family_gc_max_age]
// Creates a column family with GC policy : maximum age
// where age = current time minus cell timestamp
// Defines the GC rule to retain data with max age of 5 days.
DurationRule maxAgeRule = GCRULES.maxAge(5, TimeUnit.DAYS);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_1, maxAgeRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_1);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_max_age]
}
|
java
|
public void addFamilyWithMaxAgeRule() {
System.out.printf("%nCreating column family %s with max age GC rule%n", COLUMN_FAMILY_1);
// [START bigtable_create_family_gc_max_age]
// Creates a column family with GC policy : maximum age
// where age = current time minus cell timestamp
// Defines the GC rule to retain data with max age of 5 days.
DurationRule maxAgeRule = GCRULES.maxAge(5, TimeUnit.DAYS);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_1, maxAgeRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_1);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_max_age]
}
|
[
"public",
"void",
"addFamilyWithMaxAgeRule",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nCreating column family %s with max age GC rule%n\"",
",",
"COLUMN_FAMILY_1",
")",
";",
"// [START bigtable_create_family_gc_max_age]",
"// Creates a column family with GC policy : maximum age",
"// where age = current time minus cell timestamp",
"// Defines the GC rule to retain data with max age of 5 days.",
"DurationRule",
"maxAgeRule",
"=",
"GCRULES",
".",
"maxAge",
"(",
"5",
",",
"TimeUnit",
".",
"DAYS",
")",
";",
"// Creates column family with given GC rule.",
"try",
"{",
"// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is",
"// being used to add a family",
"ModifyColumnFamiliesRequest",
"columnFamiliesRequest",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"addFamily",
"(",
"COLUMN_FAMILY_1",
",",
"maxAgeRule",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"columnFamiliesRequest",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Created column family: \"",
"+",
"COLUMN_FAMILY_1",
")",
";",
"}",
"catch",
"(",
"AlreadyExistsException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to create column family with rule, already exists: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_create_family_gc_max_age]",
"}"
] |
Demonstrates how to create a new instance of the DurationRule.
|
[
"Demonstrates",
"how",
"to",
"create",
"a",
"new",
"instance",
"of",
"the",
"DurationRule",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L166-L188
|
12,427
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.addFamilyWithMaxVersionsRule
|
public void addFamilyWithMaxVersionsRule() {
System.out.printf("%nCreating column family %s with max versions GC rule%n", COLUMN_FAMILY_2);
// [START bigtable_create_family_gc_max_versions]
// Creates a column family with GC policy : most recent N versions
// where 1 = most recent version
// Defines the GC policy to retain only the most recent 2 versions.
VersionRule versionRule = GCRULES.maxVersions(2);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_2, versionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_2);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_max_versions]
}
|
java
|
public void addFamilyWithMaxVersionsRule() {
System.out.printf("%nCreating column family %s with max versions GC rule%n", COLUMN_FAMILY_2);
// [START bigtable_create_family_gc_max_versions]
// Creates a column family with GC policy : most recent N versions
// where 1 = most recent version
// Defines the GC policy to retain only the most recent 2 versions.
VersionRule versionRule = GCRULES.maxVersions(2);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_2, versionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_2);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_max_versions]
}
|
[
"public",
"void",
"addFamilyWithMaxVersionsRule",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nCreating column family %s with max versions GC rule%n\"",
",",
"COLUMN_FAMILY_2",
")",
";",
"// [START bigtable_create_family_gc_max_versions]",
"// Creates a column family with GC policy : most recent N versions",
"// where 1 = most recent version",
"// Defines the GC policy to retain only the most recent 2 versions.",
"VersionRule",
"versionRule",
"=",
"GCRULES",
".",
"maxVersions",
"(",
"2",
")",
";",
"// Creates column family with given GC rule.",
"try",
"{",
"// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is",
"// being used to add a family",
"ModifyColumnFamiliesRequest",
"columnFamiliesRequest",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"addFamily",
"(",
"COLUMN_FAMILY_2",
",",
"versionRule",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"columnFamiliesRequest",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Created column family: \"",
"+",
"COLUMN_FAMILY_2",
")",
";",
"}",
"catch",
"(",
"AlreadyExistsException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to create column family with rule, already exists: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_create_family_gc_max_versions]",
"}"
] |
Demonstrates how to create a new instance of the VersionRule.
|
[
"Demonstrates",
"how",
"to",
"create",
"a",
"new",
"instance",
"of",
"the",
"VersionRule",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L191-L213
|
12,428
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.addFamilyWithUnionRule
|
public void addFamilyWithUnionRule() {
System.out.printf("%nCreating column family %s with union GC rule%n", COLUMN_FAMILY_3);
// [START bigtable_create_family_gc_union]
// Creates a column family with GC policy to drop data that matches at least one condition.
// Defines a list of GC rules to drop cells older than 5 days OR not the most recent
// version.
UnionRule unionRule =
GCRULES.union().rule(GCRULES.maxAge(5, TimeUnit.DAYS)).rule(GCRULES.maxVersions(1));
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_3, unionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_3);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_union]
}
|
java
|
public void addFamilyWithUnionRule() {
System.out.printf("%nCreating column family %s with union GC rule%n", COLUMN_FAMILY_3);
// [START bigtable_create_family_gc_union]
// Creates a column family with GC policy to drop data that matches at least one condition.
// Defines a list of GC rules to drop cells older than 5 days OR not the most recent
// version.
UnionRule unionRule =
GCRULES.union().rule(GCRULES.maxAge(5, TimeUnit.DAYS)).rule(GCRULES.maxVersions(1));
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_3, unionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_3);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_union]
}
|
[
"public",
"void",
"addFamilyWithUnionRule",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nCreating column family %s with union GC rule%n\"",
",",
"COLUMN_FAMILY_3",
")",
";",
"// [START bigtable_create_family_gc_union]",
"// Creates a column family with GC policy to drop data that matches at least one condition.",
"// Defines a list of GC rules to drop cells older than 5 days OR not the most recent",
"// version.",
"UnionRule",
"unionRule",
"=",
"GCRULES",
".",
"union",
"(",
")",
".",
"rule",
"(",
"GCRULES",
".",
"maxAge",
"(",
"5",
",",
"TimeUnit",
".",
"DAYS",
")",
")",
".",
"rule",
"(",
"GCRULES",
".",
"maxVersions",
"(",
"1",
")",
")",
";",
"// Creates column family with given GC rule.",
"try",
"{",
"// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is",
"// being used to add a family",
"ModifyColumnFamiliesRequest",
"columnFamiliesRequest",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"addFamily",
"(",
"COLUMN_FAMILY_3",
",",
"unionRule",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"columnFamiliesRequest",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Created column family: \"",
"+",
"COLUMN_FAMILY_3",
")",
";",
"}",
"catch",
"(",
"AlreadyExistsException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to create column family with rule, already exists: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_create_family_gc_union]",
"}"
] |
Demonstrates how to create a new instance of the UnionRule.
|
[
"Demonstrates",
"how",
"to",
"create",
"a",
"new",
"instance",
"of",
"the",
"UnionRule",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L216-L239
|
12,429
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.addFamilyWithIntersectionRule
|
public void addFamilyWithIntersectionRule() {
System.out.printf("%nCreating column family %s with intersection GC rule%n", COLUMN_FAMILY_4);
// [START bigtable_create_family_gc_intersection]
// Creates a column family with GC policy to drop data that matches all conditions.
// Defines a GC rule to drop cells older than 5 days AND older than the most recent 2 versions.
DurationRule maxAgeRule = GCRULES.maxAge(5, TimeUnit.DAYS);
VersionRule versionRule = GCRULES.maxVersions(2);
IntersectionRule intersectionRule = GCRULES.intersection().rule(maxAgeRule).rule(versionRule);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_4, intersectionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_4);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_intersection]
}
|
java
|
public void addFamilyWithIntersectionRule() {
System.out.printf("%nCreating column family %s with intersection GC rule%n", COLUMN_FAMILY_4);
// [START bigtable_create_family_gc_intersection]
// Creates a column family with GC policy to drop data that matches all conditions.
// Defines a GC rule to drop cells older than 5 days AND older than the most recent 2 versions.
DurationRule maxAgeRule = GCRULES.maxAge(5, TimeUnit.DAYS);
VersionRule versionRule = GCRULES.maxVersions(2);
IntersectionRule intersectionRule = GCRULES.intersection().rule(maxAgeRule).rule(versionRule);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_4, intersectionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_4);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_intersection]
}
|
[
"public",
"void",
"addFamilyWithIntersectionRule",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nCreating column family %s with intersection GC rule%n\"",
",",
"COLUMN_FAMILY_4",
")",
";",
"// [START bigtable_create_family_gc_intersection]",
"// Creates a column family with GC policy to drop data that matches all conditions.",
"// Defines a GC rule to drop cells older than 5 days AND older than the most recent 2 versions.",
"DurationRule",
"maxAgeRule",
"=",
"GCRULES",
".",
"maxAge",
"(",
"5",
",",
"TimeUnit",
".",
"DAYS",
")",
";",
"VersionRule",
"versionRule",
"=",
"GCRULES",
".",
"maxVersions",
"(",
"2",
")",
";",
"IntersectionRule",
"intersectionRule",
"=",
"GCRULES",
".",
"intersection",
"(",
")",
".",
"rule",
"(",
"maxAgeRule",
")",
".",
"rule",
"(",
"versionRule",
")",
";",
"// Creates column family with given GC rule.",
"try",
"{",
"// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is",
"// being used to add a family",
"ModifyColumnFamiliesRequest",
"columnFamiliesRequest",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"addFamily",
"(",
"COLUMN_FAMILY_4",
",",
"intersectionRule",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"columnFamiliesRequest",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Created column family: \"",
"+",
"COLUMN_FAMILY_4",
")",
";",
"}",
"catch",
"(",
"AlreadyExistsException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to create column family with rule, already exists: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_create_family_gc_intersection]",
"}"
] |
Demonstrates how to create a new instance of the IntersectionRule.
|
[
"Demonstrates",
"how",
"to",
"create",
"a",
"new",
"instance",
"of",
"the",
"IntersectionRule",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L242-L265
|
12,430
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.addFamilyWithNestedRule
|
public void addFamilyWithNestedRule() {
System.out.printf("%nCreating column family %s with a nested GC rule%n", COLUMN_FAMILY_5);
// [START bigtable_create_family_gc_nested]
// Creates a nested GC rule:
// Drop cells that are either older than the 10 recent versions
// OR
// Drop cells that are older than a month AND older than the 2 recent versions
VersionRule versionRule1 = GCRULES.maxVersions(10);
VersionRule versionRule2 = GCRULES.maxVersions(2);
DurationRule maxAgeRule = GCRULES.maxAge(30, TimeUnit.DAYS);
IntersectionRule intersectionRule = GCRULES.intersection().rule(maxAgeRule).rule(versionRule2);
UnionRule unionRule = GCRULES.union().rule(intersectionRule).rule(versionRule1);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_5, unionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_5);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_nested]
}
|
java
|
public void addFamilyWithNestedRule() {
System.out.printf("%nCreating column family %s with a nested GC rule%n", COLUMN_FAMILY_5);
// [START bigtable_create_family_gc_nested]
// Creates a nested GC rule:
// Drop cells that are either older than the 10 recent versions
// OR
// Drop cells that are older than a month AND older than the 2 recent versions
VersionRule versionRule1 = GCRULES.maxVersions(10);
VersionRule versionRule2 = GCRULES.maxVersions(2);
DurationRule maxAgeRule = GCRULES.maxAge(30, TimeUnit.DAYS);
IntersectionRule intersectionRule = GCRULES.intersection().rule(maxAgeRule).rule(versionRule2);
UnionRule unionRule = GCRULES.union().rule(intersectionRule).rule(versionRule1);
// Creates column family with given GC rule.
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to add a family
ModifyColumnFamiliesRequest columnFamiliesRequest =
ModifyColumnFamiliesRequest.of(tableId).addFamily(COLUMN_FAMILY_5, unionRule);
adminClient.modifyFamilies(columnFamiliesRequest);
System.out.println("Created column family: " + COLUMN_FAMILY_5);
} catch (AlreadyExistsException e) {
System.err.println(
"Failed to create column family with rule, already exists: " + e.getMessage());
}
// [END bigtable_create_family_gc_nested]
}
|
[
"public",
"void",
"addFamilyWithNestedRule",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nCreating column family %s with a nested GC rule%n\"",
",",
"COLUMN_FAMILY_5",
")",
";",
"// [START bigtable_create_family_gc_nested]",
"// Creates a nested GC rule:",
"// Drop cells that are either older than the 10 recent versions",
"// OR",
"// Drop cells that are older than a month AND older than the 2 recent versions",
"VersionRule",
"versionRule1",
"=",
"GCRULES",
".",
"maxVersions",
"(",
"10",
")",
";",
"VersionRule",
"versionRule2",
"=",
"GCRULES",
".",
"maxVersions",
"(",
"2",
")",
";",
"DurationRule",
"maxAgeRule",
"=",
"GCRULES",
".",
"maxAge",
"(",
"30",
",",
"TimeUnit",
".",
"DAYS",
")",
";",
"IntersectionRule",
"intersectionRule",
"=",
"GCRULES",
".",
"intersection",
"(",
")",
".",
"rule",
"(",
"maxAgeRule",
")",
".",
"rule",
"(",
"versionRule2",
")",
";",
"UnionRule",
"unionRule",
"=",
"GCRULES",
".",
"union",
"(",
")",
".",
"rule",
"(",
"intersectionRule",
")",
".",
"rule",
"(",
"versionRule1",
")",
";",
"// Creates column family with given GC rule.",
"try",
"{",
"// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is",
"// being used to add a family",
"ModifyColumnFamiliesRequest",
"columnFamiliesRequest",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"addFamily",
"(",
"COLUMN_FAMILY_5",
",",
"unionRule",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"columnFamiliesRequest",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Created column family: \"",
"+",
"COLUMN_FAMILY_5",
")",
";",
"}",
"catch",
"(",
"AlreadyExistsException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to create column family with rule, already exists: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_create_family_gc_nested]",
"}"
] |
Demonstrates how to create a nested rule using the IntersectionRule and UnionRule.
|
[
"Demonstrates",
"how",
"to",
"create",
"a",
"nested",
"rule",
"using",
"the",
"IntersectionRule",
"and",
"UnionRule",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L268-L294
|
12,431
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.modifyColumnFamilyRule
|
public void modifyColumnFamilyRule() {
System.out.printf("%nUpdating column family %s GC rule%n", COLUMN_FAMILY_1);
// [START bigtable_update_gc_rule]
// Updates the column family metadata to update the GC rule.
// Updates a column family GC rule.
VersionRule versionRule = GCRULES.maxVersions(1);
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to modify a family
// Updates column family with given GC rule.
ModifyColumnFamiliesRequest updateRequest =
ModifyColumnFamiliesRequest.of(tableId).updateFamily(COLUMN_FAMILY_1, versionRule);
adminClient.modifyFamilies(updateRequest);
System.out.printf("Column family %s GC rule updated%n", COLUMN_FAMILY_1);
} catch (NotFoundException e) {
System.err.println("Failed to modify a non-existent column family: " + e.getMessage());
}
// [END bigtable_update_gc_rule]
}
|
java
|
public void modifyColumnFamilyRule() {
System.out.printf("%nUpdating column family %s GC rule%n", COLUMN_FAMILY_1);
// [START bigtable_update_gc_rule]
// Updates the column family metadata to update the GC rule.
// Updates a column family GC rule.
VersionRule versionRule = GCRULES.maxVersions(1);
try {
// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is
// being used to modify a family
// Updates column family with given GC rule.
ModifyColumnFamiliesRequest updateRequest =
ModifyColumnFamiliesRequest.of(tableId).updateFamily(COLUMN_FAMILY_1, versionRule);
adminClient.modifyFamilies(updateRequest);
System.out.printf("Column family %s GC rule updated%n", COLUMN_FAMILY_1);
} catch (NotFoundException e) {
System.err.println("Failed to modify a non-existent column family: " + e.getMessage());
}
// [END bigtable_update_gc_rule]
}
|
[
"public",
"void",
"modifyColumnFamilyRule",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nUpdating column family %s GC rule%n\"",
",",
"COLUMN_FAMILY_1",
")",
";",
"// [START bigtable_update_gc_rule]",
"// Updates the column family metadata to update the GC rule.",
"// Updates a column family GC rule.",
"VersionRule",
"versionRule",
"=",
"GCRULES",
".",
"maxVersions",
"(",
"1",
")",
";",
"try",
"{",
"// ModifyColumnFamiliesRequest can be used both for adding and modifying families, here it is",
"// being used to modify a family",
"// Updates column family with given GC rule.",
"ModifyColumnFamiliesRequest",
"updateRequest",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"updateFamily",
"(",
"COLUMN_FAMILY_1",
",",
"versionRule",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"updateRequest",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"Column family %s GC rule updated%n\"",
",",
"COLUMN_FAMILY_1",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to modify a non-existent column family: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_update_gc_rule]",
"}"
] |
Demonstrates how to modify a column family's rule.
|
[
"Demonstrates",
"how",
"to",
"modify",
"a",
"column",
"family",
"s",
"rule",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L317-L335
|
12,432
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.printModifiedColumnFamily
|
public void printModifiedColumnFamily() {
System.out.printf("%nPrint updated GC rule for column family %s%n", COLUMN_FAMILY_1);
// [START bigtable_family_get_gc_rule]
try {
Table table = adminClient.getTable(tableId);
Collection<ColumnFamily> columnFamilies = table.getColumnFamilies();
for (ColumnFamily columnFamily : columnFamilies) {
if (columnFamily.getId().equals(COLUMN_FAMILY_1)) {
System.out.printf(
"Column family: %s%nGC Rule: %s%n",
columnFamily.getId(), columnFamily.getGCRule().toString());
}
}
} catch (NotFoundException e) {
System.err.println("Failed to print a non-existent column family: " + e.getMessage());
}
// [END bigtable_family_get_gc_rule]
}
|
java
|
public void printModifiedColumnFamily() {
System.out.printf("%nPrint updated GC rule for column family %s%n", COLUMN_FAMILY_1);
// [START bigtable_family_get_gc_rule]
try {
Table table = adminClient.getTable(tableId);
Collection<ColumnFamily> columnFamilies = table.getColumnFamilies();
for (ColumnFamily columnFamily : columnFamilies) {
if (columnFamily.getId().equals(COLUMN_FAMILY_1)) {
System.out.printf(
"Column family: %s%nGC Rule: %s%n",
columnFamily.getId(), columnFamily.getGCRule().toString());
}
}
} catch (NotFoundException e) {
System.err.println("Failed to print a non-existent column family: " + e.getMessage());
}
// [END bigtable_family_get_gc_rule]
}
|
[
"public",
"void",
"printModifiedColumnFamily",
"(",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%nPrint updated GC rule for column family %s%n\"",
",",
"COLUMN_FAMILY_1",
")",
";",
"// [START bigtable_family_get_gc_rule]",
"try",
"{",
"Table",
"table",
"=",
"adminClient",
".",
"getTable",
"(",
"tableId",
")",
";",
"Collection",
"<",
"ColumnFamily",
">",
"columnFamilies",
"=",
"table",
".",
"getColumnFamilies",
"(",
")",
";",
"for",
"(",
"ColumnFamily",
"columnFamily",
":",
"columnFamilies",
")",
"{",
"if",
"(",
"columnFamily",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"COLUMN_FAMILY_1",
")",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"Column family: %s%nGC Rule: %s%n\"",
",",
"columnFamily",
".",
"getId",
"(",
")",
",",
"columnFamily",
".",
"getGCRule",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"NotFoundException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to print a non-existent column family: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_family_get_gc_rule]",
"}"
] |
Demonstrates how to print the modified column family.
|
[
"Demonstrates",
"how",
"to",
"print",
"the",
"modified",
"column",
"family",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L338-L355
|
12,433
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.deleteColumnFamily
|
public void deleteColumnFamily() {
System.out.println("\nDelete column family: " + COLUMN_FAMILY_2);
// [START bigtable_delete_family]
// Deletes a column family.
try {
ModifyColumnFamiliesRequest deleted =
ModifyColumnFamiliesRequest.of(tableId).dropFamily(COLUMN_FAMILY_2);
adminClient.modifyFamilies(deleted);
System.out.printf("Column family %s deleted successfully%n", COLUMN_FAMILY_2);
} catch (NotFoundException e) {
System.err.println("Failed to delete a non-existent column family: " + e.getMessage());
}
// [END bigtable_delete_family]
}
|
java
|
public void deleteColumnFamily() {
System.out.println("\nDelete column family: " + COLUMN_FAMILY_2);
// [START bigtable_delete_family]
// Deletes a column family.
try {
ModifyColumnFamiliesRequest deleted =
ModifyColumnFamiliesRequest.of(tableId).dropFamily(COLUMN_FAMILY_2);
adminClient.modifyFamilies(deleted);
System.out.printf("Column family %s deleted successfully%n", COLUMN_FAMILY_2);
} catch (NotFoundException e) {
System.err.println("Failed to delete a non-existent column family: " + e.getMessage());
}
// [END bigtable_delete_family]
}
|
[
"public",
"void",
"deleteColumnFamily",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\\nDelete column family: \"",
"+",
"COLUMN_FAMILY_2",
")",
";",
"// [START bigtable_delete_family]",
"// Deletes a column family.",
"try",
"{",
"ModifyColumnFamiliesRequest",
"deleted",
"=",
"ModifyColumnFamiliesRequest",
".",
"of",
"(",
"tableId",
")",
".",
"dropFamily",
"(",
"COLUMN_FAMILY_2",
")",
";",
"adminClient",
".",
"modifyFamilies",
"(",
"deleted",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"Column family %s deleted successfully%n\"",
",",
"COLUMN_FAMILY_2",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to delete a non-existent column family: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_delete_family]",
"}"
] |
Demonstrates how to delete a column family.
|
[
"Demonstrates",
"how",
"to",
"delete",
"a",
"column",
"family",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L358-L371
|
12,434
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java
|
TableAdminExample.deleteTable
|
public void deleteTable() {
// [START bigtable_delete_table]
// Deletes the entire table.
System.out.println("\nDelete table: " + tableId);
try {
adminClient.deleteTable(tableId);
System.out.printf("Table: %s deleted successfully%n", tableId);
} catch (NotFoundException e) {
System.err.println("Failed to delete a non-existent table: " + e.getMessage());
}
// [END bigtable_delete_table]
}
|
java
|
public void deleteTable() {
// [START bigtable_delete_table]
// Deletes the entire table.
System.out.println("\nDelete table: " + tableId);
try {
adminClient.deleteTable(tableId);
System.out.printf("Table: %s deleted successfully%n", tableId);
} catch (NotFoundException e) {
System.err.println("Failed to delete a non-existent table: " + e.getMessage());
}
// [END bigtable_delete_table]
}
|
[
"public",
"void",
"deleteTable",
"(",
")",
"{",
"// [START bigtable_delete_table]",
"// Deletes the entire table.",
"System",
".",
"out",
".",
"println",
"(",
"\"\\nDelete table: \"",
"+",
"tableId",
")",
";",
"try",
"{",
"adminClient",
".",
"deleteTable",
"(",
"tableId",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"Table: %s deleted successfully%n\"",
",",
"tableId",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Failed to delete a non-existent table: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// [END bigtable_delete_table]",
"}"
] |
Demonstrates how to delete a table.
|
[
"Demonstrates",
"how",
"to",
"delete",
"a",
"table",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/TableAdminExample.java#L374-L385
|
12,435
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.forDocument
|
static Watch forDocument(DocumentReference documentReference) {
Target.Builder target = Target.newBuilder();
target.getDocumentsBuilder().addDocuments(documentReference.getName());
target.setTargetId(WATCH_TARGET_ID);
return new Watch(
(FirestoreImpl) documentReference.getFirestore(),
documentReference.getParent(),
target.build());
}
|
java
|
static Watch forDocument(DocumentReference documentReference) {
Target.Builder target = Target.newBuilder();
target.getDocumentsBuilder().addDocuments(documentReference.getName());
target.setTargetId(WATCH_TARGET_ID);
return new Watch(
(FirestoreImpl) documentReference.getFirestore(),
documentReference.getParent(),
target.build());
}
|
[
"static",
"Watch",
"forDocument",
"(",
"DocumentReference",
"documentReference",
")",
"{",
"Target",
".",
"Builder",
"target",
"=",
"Target",
".",
"newBuilder",
"(",
")",
";",
"target",
".",
"getDocumentsBuilder",
"(",
")",
".",
"addDocuments",
"(",
"documentReference",
".",
"getName",
"(",
")",
")",
";",
"target",
".",
"setTargetId",
"(",
"WATCH_TARGET_ID",
")",
";",
"return",
"new",
"Watch",
"(",
"(",
"FirestoreImpl",
")",
"documentReference",
".",
"getFirestore",
"(",
")",
",",
"documentReference",
".",
"getParent",
"(",
")",
",",
"target",
".",
"build",
"(",
")",
")",
";",
"}"
] |
Creates a new Watch instance that listens on DocumentReferences.
@param documentReference The document reference for this watch.
@return A newly created Watch instance.
|
[
"Creates",
"a",
"new",
"Watch",
"instance",
"that",
"listens",
"on",
"DocumentReferences",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L153-L162
|
12,436
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.forQuery
|
static Watch forQuery(Query query) {
Target.Builder target = Target.newBuilder();
target.setQuery(
QueryTarget.newBuilder()
.setStructuredQuery(query.buildQuery())
.setParent(query.getResourcePath().getParent().getName())
.build());
target.setTargetId(WATCH_TARGET_ID);
return new Watch((FirestoreImpl) query.getFirestore(), query, target.build());
}
|
java
|
static Watch forQuery(Query query) {
Target.Builder target = Target.newBuilder();
target.setQuery(
QueryTarget.newBuilder()
.setStructuredQuery(query.buildQuery())
.setParent(query.getResourcePath().getParent().getName())
.build());
target.setTargetId(WATCH_TARGET_ID);
return new Watch((FirestoreImpl) query.getFirestore(), query, target.build());
}
|
[
"static",
"Watch",
"forQuery",
"(",
"Query",
"query",
")",
"{",
"Target",
".",
"Builder",
"target",
"=",
"Target",
".",
"newBuilder",
"(",
")",
";",
"target",
".",
"setQuery",
"(",
"QueryTarget",
".",
"newBuilder",
"(",
")",
".",
"setStructuredQuery",
"(",
"query",
".",
"buildQuery",
"(",
")",
")",
".",
"setParent",
"(",
"query",
".",
"getResourcePath",
"(",
")",
".",
"getParent",
"(",
")",
".",
"getName",
"(",
")",
")",
".",
"build",
"(",
")",
")",
";",
"target",
".",
"setTargetId",
"(",
"WATCH_TARGET_ID",
")",
";",
"return",
"new",
"Watch",
"(",
"(",
"FirestoreImpl",
")",
"query",
".",
"getFirestore",
"(",
")",
",",
"query",
",",
"target",
".",
"build",
"(",
")",
")",
";",
"}"
] |
Creates a new Watch instance that listens on Queries.
@param query The query used for this watch.
@return A newly created Watch instance.
|
[
"Creates",
"a",
"new",
"Watch",
"instance",
"that",
"listens",
"on",
"Queries",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L170-L180
|
12,437
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.runWatch
|
ListenerRegistration runWatch(
final Executor userCallbackExecutor, EventListener<QuerySnapshot> listener) {
boolean watchStarted = isActive.compareAndSet(false, true);
Preconditions.checkState(watchStarted, "Can't restart an already active watch");
this.userCallbackExecutor = userCallbackExecutor;
this.listener = listener;
this.stream = null;
this.documentSet = DocumentSet.emptySet(comparator);
this.changeMap = new HashMap<>();
this.resumeToken = null;
this.current = false;
initStream();
return new ListenerRegistration() {
@Override
public void remove() {
isActive.set(false);
firestore
.getClient()
.getExecutor()
.execute(
new Runnable() {
@Override
public void run() {
synchronized (Watch.this) {
stream.onCompleted();
stream = null;
}
}
});
}
};
}
|
java
|
ListenerRegistration runWatch(
final Executor userCallbackExecutor, EventListener<QuerySnapshot> listener) {
boolean watchStarted = isActive.compareAndSet(false, true);
Preconditions.checkState(watchStarted, "Can't restart an already active watch");
this.userCallbackExecutor = userCallbackExecutor;
this.listener = listener;
this.stream = null;
this.documentSet = DocumentSet.emptySet(comparator);
this.changeMap = new HashMap<>();
this.resumeToken = null;
this.current = false;
initStream();
return new ListenerRegistration() {
@Override
public void remove() {
isActive.set(false);
firestore
.getClient()
.getExecutor()
.execute(
new Runnable() {
@Override
public void run() {
synchronized (Watch.this) {
stream.onCompleted();
stream = null;
}
}
});
}
};
}
|
[
"ListenerRegistration",
"runWatch",
"(",
"final",
"Executor",
"userCallbackExecutor",
",",
"EventListener",
"<",
"QuerySnapshot",
">",
"listener",
")",
"{",
"boolean",
"watchStarted",
"=",
"isActive",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"watchStarted",
",",
"\"Can't restart an already active watch\"",
")",
";",
"this",
".",
"userCallbackExecutor",
"=",
"userCallbackExecutor",
";",
"this",
".",
"listener",
"=",
"listener",
";",
"this",
".",
"stream",
"=",
"null",
";",
"this",
".",
"documentSet",
"=",
"DocumentSet",
".",
"emptySet",
"(",
"comparator",
")",
";",
"this",
".",
"changeMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"this",
".",
"resumeToken",
"=",
"null",
";",
"this",
".",
"current",
"=",
"false",
";",
"initStream",
"(",
")",
";",
"return",
"new",
"ListenerRegistration",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"remove",
"(",
")",
"{",
"isActive",
".",
"set",
"(",
"false",
")",
";",
"firestore",
".",
"getClient",
"(",
")",
".",
"getExecutor",
"(",
")",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"synchronized",
"(",
"Watch",
".",
"this",
")",
"{",
"stream",
".",
"onCompleted",
"(",
")",
";",
"stream",
"=",
"null",
";",
"}",
"}",
"}",
")",
";",
"}",
"}",
";",
"}"
] |
API entry point that starts the Watch stream.
|
[
"API",
"entry",
"point",
"that",
"starts",
"the",
"Watch",
"stream",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L278-L315
|
12,438
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.currentSize
|
private int currentSize() {
ChangeSet changeSet = extractChanges(Timestamp.now());
return documentSet.size() + changeSet.adds.size() - changeSet.deletes.size();
}
|
java
|
private int currentSize() {
ChangeSet changeSet = extractChanges(Timestamp.now());
return documentSet.size() + changeSet.adds.size() - changeSet.deletes.size();
}
|
[
"private",
"int",
"currentSize",
"(",
")",
"{",
"ChangeSet",
"changeSet",
"=",
"extractChanges",
"(",
"Timestamp",
".",
"now",
"(",
")",
")",
";",
"return",
"documentSet",
".",
"size",
"(",
")",
"+",
"changeSet",
".",
"adds",
".",
"size",
"(",
")",
"-",
"changeSet",
".",
"deletes",
".",
"size",
"(",
")",
";",
"}"
] |
Returns the current count of all documents, including the changes from the current changeMap.
|
[
"Returns",
"the",
"current",
"count",
"of",
"all",
"documents",
"including",
"the",
"changes",
"from",
"the",
"current",
"changeMap",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L320-L323
|
12,439
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.resetDocs
|
private void resetDocs() {
changeMap.clear();
resumeToken = null;
for (DocumentSnapshot snapshot : documentSet) {
// Mark each document as deleted. If documents are not deleted, they will be send again by
// the server.
changeMap.put(snapshot.getReference().getResourcePath(), null);
}
current = false;
}
|
java
|
private void resetDocs() {
changeMap.clear();
resumeToken = null;
for (DocumentSnapshot snapshot : documentSet) {
// Mark each document as deleted. If documents are not deleted, they will be send again by
// the server.
changeMap.put(snapshot.getReference().getResourcePath(), null);
}
current = false;
}
|
[
"private",
"void",
"resetDocs",
"(",
")",
"{",
"changeMap",
".",
"clear",
"(",
")",
";",
"resumeToken",
"=",
"null",
";",
"for",
"(",
"DocumentSnapshot",
"snapshot",
":",
"documentSet",
")",
"{",
"// Mark each document as deleted. If documents are not deleted, they will be send again by",
"// the server.",
"changeMap",
".",
"put",
"(",
"snapshot",
".",
"getReference",
"(",
")",
".",
"getResourcePath",
"(",
")",
",",
"null",
")",
";",
"}",
"current",
"=",
"false",
";",
"}"
] |
Helper to clear the docs on RESET or filter mismatch.
|
[
"Helper",
"to",
"clear",
"the",
"docs",
"on",
"RESET",
"or",
"filter",
"mismatch",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L326-L337
|
12,440
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.maybeReopenStream
|
private void maybeReopenStream(Throwable throwable) {
if (isActive.get() && !isPermanentError(throwable)) {
if (isResourceExhaustedError(throwable)) {
nextAttempt = backoff.createNextAttempt(nextAttempt);
}
changeMap.clear();
resetStream();
} else {
closeStream(throwable);
}
}
|
java
|
private void maybeReopenStream(Throwable throwable) {
if (isActive.get() && !isPermanentError(throwable)) {
if (isResourceExhaustedError(throwable)) {
nextAttempt = backoff.createNextAttempt(nextAttempt);
}
changeMap.clear();
resetStream();
} else {
closeStream(throwable);
}
}
|
[
"private",
"void",
"maybeReopenStream",
"(",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"isActive",
".",
"get",
"(",
")",
"&&",
"!",
"isPermanentError",
"(",
"throwable",
")",
")",
"{",
"if",
"(",
"isResourceExhaustedError",
"(",
"throwable",
")",
")",
"{",
"nextAttempt",
"=",
"backoff",
".",
"createNextAttempt",
"(",
"nextAttempt",
")",
";",
"}",
"changeMap",
".",
"clear",
"(",
")",
";",
"resetStream",
"(",
")",
";",
"}",
"else",
"{",
"closeStream",
"(",
"throwable",
")",
";",
"}",
"}"
] |
Re-opens the stream unless the specified error is considered permanent. Clears the change map.
|
[
"Re",
"-",
"opens",
"the",
"stream",
"unless",
"the",
"specified",
"error",
"is",
"considered",
"permanent",
".",
"Clears",
"the",
"change",
"map",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L368-L379
|
12,441
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.initStream
|
private void initStream() {
firestoreExecutor.schedule(
new Runnable() {
@Override
public void run() {
if (!isActive.get()) {
return;
}
synchronized (Watch.this) {
if (!isActive.get()) {
return;
}
Preconditions.checkState(stream == null);
current = false;
nextAttempt = backoff.createNextAttempt(nextAttempt);
stream = firestore.streamRequest(Watch.this, firestore.getClient().listenCallable());
ListenRequest.Builder request = ListenRequest.newBuilder();
request.setDatabase(firestore.getDatabaseName());
request.setAddTarget(target);
if (resumeToken != null) {
request.getAddTargetBuilder().setResumeToken(resumeToken);
}
stream.onNext(request.build());
}
}
},
nextAttempt.getRandomizedRetryDelay().toMillis(),
TimeUnit.MILLISECONDS);
}
|
java
|
private void initStream() {
firestoreExecutor.schedule(
new Runnable() {
@Override
public void run() {
if (!isActive.get()) {
return;
}
synchronized (Watch.this) {
if (!isActive.get()) {
return;
}
Preconditions.checkState(stream == null);
current = false;
nextAttempt = backoff.createNextAttempt(nextAttempt);
stream = firestore.streamRequest(Watch.this, firestore.getClient().listenCallable());
ListenRequest.Builder request = ListenRequest.newBuilder();
request.setDatabase(firestore.getDatabaseName());
request.setAddTarget(target);
if (resumeToken != null) {
request.getAddTargetBuilder().setResumeToken(resumeToken);
}
stream.onNext(request.build());
}
}
},
nextAttempt.getRandomizedRetryDelay().toMillis(),
TimeUnit.MILLISECONDS);
}
|
[
"private",
"void",
"initStream",
"(",
")",
"{",
"firestoreExecutor",
".",
"schedule",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"!",
"isActive",
".",
"get",
"(",
")",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"Watch",
".",
"this",
")",
"{",
"if",
"(",
"!",
"isActive",
".",
"get",
"(",
")",
")",
"{",
"return",
";",
"}",
"Preconditions",
".",
"checkState",
"(",
"stream",
"==",
"null",
")",
";",
"current",
"=",
"false",
";",
"nextAttempt",
"=",
"backoff",
".",
"createNextAttempt",
"(",
"nextAttempt",
")",
";",
"stream",
"=",
"firestore",
".",
"streamRequest",
"(",
"Watch",
".",
"this",
",",
"firestore",
".",
"getClient",
"(",
")",
".",
"listenCallable",
"(",
")",
")",
";",
"ListenRequest",
".",
"Builder",
"request",
"=",
"ListenRequest",
".",
"newBuilder",
"(",
")",
";",
"request",
".",
"setDatabase",
"(",
"firestore",
".",
"getDatabaseName",
"(",
")",
")",
";",
"request",
".",
"setAddTarget",
"(",
"target",
")",
";",
"if",
"(",
"resumeToken",
"!=",
"null",
")",
"{",
"request",
".",
"getAddTargetBuilder",
"(",
")",
".",
"setResumeToken",
"(",
"resumeToken",
")",
";",
"}",
"stream",
".",
"onNext",
"(",
"request",
".",
"build",
"(",
")",
")",
";",
"}",
"}",
"}",
",",
"nextAttempt",
".",
"getRandomizedRetryDelay",
"(",
")",
".",
"toMillis",
"(",
")",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] |
Initializes a new stream to the backend with backoff.
|
[
"Initializes",
"a",
"new",
"stream",
"to",
"the",
"backend",
"with",
"backoff",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L392-L426
|
12,442
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.affectsTarget
|
private boolean affectsTarget(List<Integer> targetIds, int currentId) {
return targetIds == null || targetIds.isEmpty() || targetIds.contains(currentId);
}
|
java
|
private boolean affectsTarget(List<Integer> targetIds, int currentId) {
return targetIds == null || targetIds.isEmpty() || targetIds.contains(currentId);
}
|
[
"private",
"boolean",
"affectsTarget",
"(",
"List",
"<",
"Integer",
">",
"targetIds",
",",
"int",
"currentId",
")",
"{",
"return",
"targetIds",
"==",
"null",
"||",
"targetIds",
".",
"isEmpty",
"(",
")",
"||",
"targetIds",
".",
"contains",
"(",
"currentId",
")",
";",
"}"
] |
Checks if the current target id is included in the list of target ids. Returns true if no
targetIds are provided.
|
[
"Checks",
"if",
"the",
"current",
"target",
"id",
"is",
"included",
"in",
"the",
"list",
"of",
"target",
"ids",
".",
"Returns",
"true",
"if",
"no",
"targetIds",
"are",
"provided",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L432-L434
|
12,443
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.extractChanges
|
private ChangeSet extractChanges(Timestamp readTime) {
ChangeSet changeSet = new ChangeSet();
for (Entry<ResourcePath, Document> change : changeMap.entrySet()) {
if (change.getValue() == null) {
if (documentSet.contains(change.getKey())) {
changeSet.deletes.add(documentSet.getDocument(change.getKey()));
}
continue;
}
QueryDocumentSnapshot snapshot =
QueryDocumentSnapshot.fromDocument(firestore, readTime, change.getValue());
if (documentSet.contains(change.getKey())) {
changeSet.updates.add(snapshot);
} else {
changeSet.adds.add(snapshot);
}
}
return changeSet;
}
|
java
|
private ChangeSet extractChanges(Timestamp readTime) {
ChangeSet changeSet = new ChangeSet();
for (Entry<ResourcePath, Document> change : changeMap.entrySet()) {
if (change.getValue() == null) {
if (documentSet.contains(change.getKey())) {
changeSet.deletes.add(documentSet.getDocument(change.getKey()));
}
continue;
}
QueryDocumentSnapshot snapshot =
QueryDocumentSnapshot.fromDocument(firestore, readTime, change.getValue());
if (documentSet.contains(change.getKey())) {
changeSet.updates.add(snapshot);
} else {
changeSet.adds.add(snapshot);
}
}
return changeSet;
}
|
[
"private",
"ChangeSet",
"extractChanges",
"(",
"Timestamp",
"readTime",
")",
"{",
"ChangeSet",
"changeSet",
"=",
"new",
"ChangeSet",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"ResourcePath",
",",
"Document",
">",
"change",
":",
"changeMap",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"change",
".",
"getValue",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"documentSet",
".",
"contains",
"(",
"change",
".",
"getKey",
"(",
")",
")",
")",
"{",
"changeSet",
".",
"deletes",
".",
"add",
"(",
"documentSet",
".",
"getDocument",
"(",
"change",
".",
"getKey",
"(",
")",
")",
")",
";",
"}",
"continue",
";",
"}",
"QueryDocumentSnapshot",
"snapshot",
"=",
"QueryDocumentSnapshot",
".",
"fromDocument",
"(",
"firestore",
",",
"readTime",
",",
"change",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"documentSet",
".",
"contains",
"(",
"change",
".",
"getKey",
"(",
")",
")",
")",
"{",
"changeSet",
".",
"updates",
".",
"add",
"(",
"snapshot",
")",
";",
"}",
"else",
"{",
"changeSet",
".",
"adds",
".",
"add",
"(",
"snapshot",
")",
";",
"}",
"}",
"return",
"changeSet",
";",
"}"
] |
Splits up document changes into removals, additions, and updates.
|
[
"Splits",
"up",
"document",
"changes",
"into",
"removals",
"additions",
"and",
"updates",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L437-L459
|
12,444
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.pushSnapshot
|
private void pushSnapshot(final Timestamp readTime, ByteString nextResumeToken) {
final List<DocumentChange> changes = computeSnapshot(readTime);
if (!hasPushed || !changes.isEmpty()) {
final QuerySnapshot querySnapshot =
QuerySnapshot.withChanges(query, readTime, documentSet, changes);
userCallbackExecutor.execute(
new Runnable() {
@Override
public void run() {
listener.onEvent(querySnapshot, null);
}
});
hasPushed = true;
}
changeMap.clear();
resumeToken = nextResumeToken;
}
|
java
|
private void pushSnapshot(final Timestamp readTime, ByteString nextResumeToken) {
final List<DocumentChange> changes = computeSnapshot(readTime);
if (!hasPushed || !changes.isEmpty()) {
final QuerySnapshot querySnapshot =
QuerySnapshot.withChanges(query, readTime, documentSet, changes);
userCallbackExecutor.execute(
new Runnable() {
@Override
public void run() {
listener.onEvent(querySnapshot, null);
}
});
hasPushed = true;
}
changeMap.clear();
resumeToken = nextResumeToken;
}
|
[
"private",
"void",
"pushSnapshot",
"(",
"final",
"Timestamp",
"readTime",
",",
"ByteString",
"nextResumeToken",
")",
"{",
"final",
"List",
"<",
"DocumentChange",
">",
"changes",
"=",
"computeSnapshot",
"(",
"readTime",
")",
";",
"if",
"(",
"!",
"hasPushed",
"||",
"!",
"changes",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"QuerySnapshot",
"querySnapshot",
"=",
"QuerySnapshot",
".",
"withChanges",
"(",
"query",
",",
"readTime",
",",
"documentSet",
",",
"changes",
")",
";",
"userCallbackExecutor",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"listener",
".",
"onEvent",
"(",
"querySnapshot",
",",
"null",
")",
";",
"}",
"}",
")",
";",
"hasPushed",
"=",
"true",
";",
"}",
"changeMap",
".",
"clear",
"(",
")",
";",
"resumeToken",
"=",
"nextResumeToken",
";",
"}"
] |
Assembles a new snapshot from the current set of changes and invokes the user's callback.
Clears the current changes on completion.
|
[
"Assembles",
"a",
"new",
"snapshot",
"from",
"the",
"current",
"set",
"of",
"changes",
"and",
"invokes",
"the",
"user",
"s",
"callback",
".",
"Clears",
"the",
"current",
"changes",
"on",
"completion",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L465-L482
|
12,445
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.deleteDoc
|
private DocumentChange deleteDoc(QueryDocumentSnapshot oldDocument) {
ResourcePath resourcePath = oldDocument.getReference().getResourcePath();
int oldIndex = documentSet.indexOf(resourcePath);
documentSet = documentSet.remove(resourcePath);
return new DocumentChange(oldDocument, Type.REMOVED, oldIndex, -1);
}
|
java
|
private DocumentChange deleteDoc(QueryDocumentSnapshot oldDocument) {
ResourcePath resourcePath = oldDocument.getReference().getResourcePath();
int oldIndex = documentSet.indexOf(resourcePath);
documentSet = documentSet.remove(resourcePath);
return new DocumentChange(oldDocument, Type.REMOVED, oldIndex, -1);
}
|
[
"private",
"DocumentChange",
"deleteDoc",
"(",
"QueryDocumentSnapshot",
"oldDocument",
")",
"{",
"ResourcePath",
"resourcePath",
"=",
"oldDocument",
".",
"getReference",
"(",
")",
".",
"getResourcePath",
"(",
")",
";",
"int",
"oldIndex",
"=",
"documentSet",
".",
"indexOf",
"(",
"resourcePath",
")",
";",
"documentSet",
"=",
"documentSet",
".",
"remove",
"(",
"resourcePath",
")",
";",
"return",
"new",
"DocumentChange",
"(",
"oldDocument",
",",
"Type",
".",
"REMOVED",
",",
"oldIndex",
",",
"-",
"1",
")",
";",
"}"
] |
Applies a document delete to the document tree. Returns the corresponding DocumentChange event.
|
[
"Applies",
"a",
"document",
"delete",
"to",
"the",
"document",
"tree",
".",
"Returns",
"the",
"corresponding",
"DocumentChange",
"event",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L487-L492
|
12,446
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.addDoc
|
private DocumentChange addDoc(QueryDocumentSnapshot newDocument) {
ResourcePath resourcePath = newDocument.getReference().getResourcePath();
documentSet = documentSet.add(newDocument);
int newIndex = documentSet.indexOf(resourcePath);
return new DocumentChange(newDocument, Type.ADDED, -1, newIndex);
}
|
java
|
private DocumentChange addDoc(QueryDocumentSnapshot newDocument) {
ResourcePath resourcePath = newDocument.getReference().getResourcePath();
documentSet = documentSet.add(newDocument);
int newIndex = documentSet.indexOf(resourcePath);
return new DocumentChange(newDocument, Type.ADDED, -1, newIndex);
}
|
[
"private",
"DocumentChange",
"addDoc",
"(",
"QueryDocumentSnapshot",
"newDocument",
")",
"{",
"ResourcePath",
"resourcePath",
"=",
"newDocument",
".",
"getReference",
"(",
")",
".",
"getResourcePath",
"(",
")",
";",
"documentSet",
"=",
"documentSet",
".",
"add",
"(",
"newDocument",
")",
";",
"int",
"newIndex",
"=",
"documentSet",
".",
"indexOf",
"(",
"resourcePath",
")",
";",
"return",
"new",
"DocumentChange",
"(",
"newDocument",
",",
"Type",
".",
"ADDED",
",",
"-",
"1",
",",
"newIndex",
")",
";",
"}"
] |
Applies a document add to the document tree. Returns the corresponding DocumentChange event.
|
[
"Applies",
"a",
"document",
"add",
"to",
"the",
"document",
"tree",
".",
"Returns",
"the",
"corresponding",
"DocumentChange",
"event",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L497-L502
|
12,447
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.modifyDoc
|
@Nullable
private DocumentChange modifyDoc(QueryDocumentSnapshot newDocument) {
ResourcePath resourcePath = newDocument.getReference().getResourcePath();
DocumentSnapshot oldDocument = documentSet.getDocument(resourcePath);
if (!oldDocument.getUpdateTime().equals(newDocument.getUpdateTime())) {
int oldIndex = documentSet.indexOf(resourcePath);
documentSet = documentSet.remove(resourcePath);
documentSet = documentSet.add(newDocument);
int newIndex = documentSet.indexOf(resourcePath);
return new DocumentChange(newDocument, Type.MODIFIED, oldIndex, newIndex);
}
return null;
}
|
java
|
@Nullable
private DocumentChange modifyDoc(QueryDocumentSnapshot newDocument) {
ResourcePath resourcePath = newDocument.getReference().getResourcePath();
DocumentSnapshot oldDocument = documentSet.getDocument(resourcePath);
if (!oldDocument.getUpdateTime().equals(newDocument.getUpdateTime())) {
int oldIndex = documentSet.indexOf(resourcePath);
documentSet = documentSet.remove(resourcePath);
documentSet = documentSet.add(newDocument);
int newIndex = documentSet.indexOf(resourcePath);
return new DocumentChange(newDocument, Type.MODIFIED, oldIndex, newIndex);
}
return null;
}
|
[
"@",
"Nullable",
"private",
"DocumentChange",
"modifyDoc",
"(",
"QueryDocumentSnapshot",
"newDocument",
")",
"{",
"ResourcePath",
"resourcePath",
"=",
"newDocument",
".",
"getReference",
"(",
")",
".",
"getResourcePath",
"(",
")",
";",
"DocumentSnapshot",
"oldDocument",
"=",
"documentSet",
".",
"getDocument",
"(",
"resourcePath",
")",
";",
"if",
"(",
"!",
"oldDocument",
".",
"getUpdateTime",
"(",
")",
".",
"equals",
"(",
"newDocument",
".",
"getUpdateTime",
"(",
")",
")",
")",
"{",
"int",
"oldIndex",
"=",
"documentSet",
".",
"indexOf",
"(",
"resourcePath",
")",
";",
"documentSet",
"=",
"documentSet",
".",
"remove",
"(",
"resourcePath",
")",
";",
"documentSet",
"=",
"documentSet",
".",
"add",
"(",
"newDocument",
")",
";",
"int",
"newIndex",
"=",
"documentSet",
".",
"indexOf",
"(",
"resourcePath",
")",
";",
"return",
"new",
"DocumentChange",
"(",
"newDocument",
",",
"Type",
".",
"MODIFIED",
",",
"oldIndex",
",",
"newIndex",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Applies a document modification to the document tree. Returns the DocumentChange event for
successful modifications.
|
[
"Applies",
"a",
"document",
"modification",
"to",
"the",
"document",
"tree",
".",
"Returns",
"the",
"DocumentChange",
"event",
"for",
"successful",
"modifications",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L508-L521
|
12,448
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.computeSnapshot
|
private List<DocumentChange> computeSnapshot(Timestamp readTime) {
List<DocumentChange> appliedChanges = new ArrayList<>();
ChangeSet changeSet = extractChanges(readTime);
// Process the sorted changes in the order that is expected by our clients (removals, additions,
// and then modifications). We also need to sort the individual changes to assure that
// oldIndex/newIndex keep incrementing.
Collections.sort(changeSet.deletes, comparator);
for (QueryDocumentSnapshot delete : changeSet.deletes) {
appliedChanges.add(deleteDoc(delete));
}
Collections.sort(changeSet.adds, comparator);
for (QueryDocumentSnapshot add : changeSet.adds) {
appliedChanges.add(addDoc(add));
}
Collections.sort(changeSet.updates, comparator);
for (QueryDocumentSnapshot update : changeSet.updates) {
DocumentChange change = modifyDoc(update);
if (change != null) {
appliedChanges.add(change);
}
}
return appliedChanges;
}
|
java
|
private List<DocumentChange> computeSnapshot(Timestamp readTime) {
List<DocumentChange> appliedChanges = new ArrayList<>();
ChangeSet changeSet = extractChanges(readTime);
// Process the sorted changes in the order that is expected by our clients (removals, additions,
// and then modifications). We also need to sort the individual changes to assure that
// oldIndex/newIndex keep incrementing.
Collections.sort(changeSet.deletes, comparator);
for (QueryDocumentSnapshot delete : changeSet.deletes) {
appliedChanges.add(deleteDoc(delete));
}
Collections.sort(changeSet.adds, comparator);
for (QueryDocumentSnapshot add : changeSet.adds) {
appliedChanges.add(addDoc(add));
}
Collections.sort(changeSet.updates, comparator);
for (QueryDocumentSnapshot update : changeSet.updates) {
DocumentChange change = modifyDoc(update);
if (change != null) {
appliedChanges.add(change);
}
}
return appliedChanges;
}
|
[
"private",
"List",
"<",
"DocumentChange",
">",
"computeSnapshot",
"(",
"Timestamp",
"readTime",
")",
"{",
"List",
"<",
"DocumentChange",
">",
"appliedChanges",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ChangeSet",
"changeSet",
"=",
"extractChanges",
"(",
"readTime",
")",
";",
"// Process the sorted changes in the order that is expected by our clients (removals, additions,",
"// and then modifications). We also need to sort the individual changes to assure that",
"// oldIndex/newIndex keep incrementing.",
"Collections",
".",
"sort",
"(",
"changeSet",
".",
"deletes",
",",
"comparator",
")",
";",
"for",
"(",
"QueryDocumentSnapshot",
"delete",
":",
"changeSet",
".",
"deletes",
")",
"{",
"appliedChanges",
".",
"add",
"(",
"deleteDoc",
"(",
"delete",
")",
")",
";",
"}",
"Collections",
".",
"sort",
"(",
"changeSet",
".",
"adds",
",",
"comparator",
")",
";",
"for",
"(",
"QueryDocumentSnapshot",
"add",
":",
"changeSet",
".",
"adds",
")",
"{",
"appliedChanges",
".",
"add",
"(",
"addDoc",
"(",
"add",
")",
")",
";",
"}",
"Collections",
".",
"sort",
"(",
"changeSet",
".",
"updates",
",",
"comparator",
")",
";",
"for",
"(",
"QueryDocumentSnapshot",
"update",
":",
"changeSet",
".",
"updates",
")",
"{",
"DocumentChange",
"change",
"=",
"modifyDoc",
"(",
"update",
")",
";",
"if",
"(",
"change",
"!=",
"null",
")",
"{",
"appliedChanges",
".",
"add",
"(",
"change",
")",
";",
"}",
"}",
"return",
"appliedChanges",
";",
"}"
] |
Applies the mutations in changeMap to the document tree. Modified 'documentSet' in-place and
returns the changed documents.
@param readTime The time at which this snapshot was obtained.
|
[
"Applies",
"the",
"mutations",
"in",
"changeMap",
"to",
"the",
"document",
"tree",
".",
"Modified",
"documentSet",
"in",
"-",
"place",
"and",
"returns",
"the",
"changed",
"documents",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L529-L556
|
12,449
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.isPermanentError
|
private static boolean isPermanentError(Throwable throwable) {
Status status = getStatus(throwable);
switch (status.getCode()) {
case CANCELLED:
case UNKNOWN:
case DEADLINE_EXCEEDED:
case RESOURCE_EXHAUSTED:
case INTERNAL:
case UNAVAILABLE:
case UNAUTHENTICATED:
return false;
default:
return true;
}
}
|
java
|
private static boolean isPermanentError(Throwable throwable) {
Status status = getStatus(throwable);
switch (status.getCode()) {
case CANCELLED:
case UNKNOWN:
case DEADLINE_EXCEEDED:
case RESOURCE_EXHAUSTED:
case INTERNAL:
case UNAVAILABLE:
case UNAUTHENTICATED:
return false;
default:
return true;
}
}
|
[
"private",
"static",
"boolean",
"isPermanentError",
"(",
"Throwable",
"throwable",
")",
"{",
"Status",
"status",
"=",
"getStatus",
"(",
"throwable",
")",
";",
"switch",
"(",
"status",
".",
"getCode",
"(",
")",
")",
"{",
"case",
"CANCELLED",
":",
"case",
"UNKNOWN",
":",
"case",
"DEADLINE_EXCEEDED",
":",
"case",
"RESOURCE_EXHAUSTED",
":",
"case",
"INTERNAL",
":",
"case",
"UNAVAILABLE",
":",
"case",
"UNAUTHENTICATED",
":",
"return",
"false",
";",
"default",
":",
"return",
"true",
";",
"}",
"}"
] |
Determines whether a GRPC Error is considered permanent and should not be retried.
|
[
"Determines",
"whether",
"a",
"GRPC",
"Error",
"is",
"considered",
"permanent",
"and",
"should",
"not",
"be",
"retried",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L559-L574
|
12,450
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
|
Watch.getStatus
|
private static Status getStatus(Throwable throwable) {
Status status = Status.UNKNOWN;
if (throwable instanceof StatusRuntimeException) {
status = ((StatusRuntimeException) throwable).getStatus();
} else if (throwable instanceof StatusException) {
status = ((StatusException) throwable).getStatus();
}
return status;
}
|
java
|
private static Status getStatus(Throwable throwable) {
Status status = Status.UNKNOWN;
if (throwable instanceof StatusRuntimeException) {
status = ((StatusRuntimeException) throwable).getStatus();
} else if (throwable instanceof StatusException) {
status = ((StatusException) throwable).getStatus();
}
return status;
}
|
[
"private",
"static",
"Status",
"getStatus",
"(",
"Throwable",
"throwable",
")",
"{",
"Status",
"status",
"=",
"Status",
".",
"UNKNOWN",
";",
"if",
"(",
"throwable",
"instanceof",
"StatusRuntimeException",
")",
"{",
"status",
"=",
"(",
"(",
"StatusRuntimeException",
")",
"throwable",
")",
".",
"getStatus",
"(",
")",
";",
"}",
"else",
"if",
"(",
"throwable",
"instanceof",
"StatusException",
")",
"{",
"status",
"=",
"(",
"(",
"StatusException",
")",
"throwable",
")",
".",
"getStatus",
"(",
")",
";",
"}",
"return",
"status",
";",
"}"
] |
Extracts the GRPC status code if available. Returns UNKNOWN for non-GRPC exceptions.
|
[
"Extracts",
"the",
"GRPC",
"status",
"code",
"if",
"available",
".",
"Returns",
"UNKNOWN",
"for",
"non",
"-",
"GRPC",
"exceptions",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L577-L586
|
12,451
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java
|
FirewallClient.patchFirewall
|
@BetaApi
public final Operation patchFirewall(
ProjectGlobalFirewallName firewall, Firewall firewallResource, List<String> fieldMask) {
PatchFirewallHttpRequest request =
PatchFirewallHttpRequest.newBuilder()
.setFirewall(firewall == null ? null : firewall.toString())
.setFirewallResource(firewallResource)
.addAllFieldMask(fieldMask)
.build();
return patchFirewall(request);
}
|
java
|
@BetaApi
public final Operation patchFirewall(
ProjectGlobalFirewallName firewall, Firewall firewallResource, List<String> fieldMask) {
PatchFirewallHttpRequest request =
PatchFirewallHttpRequest.newBuilder()
.setFirewall(firewall == null ? null : firewall.toString())
.setFirewallResource(firewallResource)
.addAllFieldMask(fieldMask)
.build();
return patchFirewall(request);
}
|
[
"@",
"BetaApi",
"public",
"final",
"Operation",
"patchFirewall",
"(",
"ProjectGlobalFirewallName",
"firewall",
",",
"Firewall",
"firewallResource",
",",
"List",
"<",
"String",
">",
"fieldMask",
")",
"{",
"PatchFirewallHttpRequest",
"request",
"=",
"PatchFirewallHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setFirewall",
"(",
"firewall",
"==",
"null",
"?",
"null",
":",
"firewall",
".",
"toString",
"(",
")",
")",
".",
"setFirewallResource",
"(",
"firewallResource",
")",
".",
"addAllFieldMask",
"(",
"fieldMask",
")",
".",
"build",
"(",
")",
";",
"return",
"patchFirewall",
"(",
"request",
")",
";",
"}"
] |
Updates the specified firewall rule with the data included in the request. This method supports
PATCH semantics and uses the JSON merge patch format and processing rules.
<p>Sample code:
<pre><code>
try (FirewallClient firewallClient = FirewallClient.create()) {
ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
Firewall firewallResource = Firewall.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = firewallClient.patchFirewall(firewall, firewallResource, fieldMask);
}
</code></pre>
@param firewall Name of the firewall rule to patch.
@param firewallResource Represents a Firewall resource.
@param fieldMask The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Updates",
"the",
"specified",
"firewall",
"rule",
"with",
"the",
"data",
"included",
"in",
"the",
"request",
".",
"This",
"method",
"supports",
"PATCH",
"semantics",
"and",
"uses",
"the",
"JSON",
"merge",
"patch",
"format",
"and",
"processing",
"rules",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java#L617-L628
|
12,452
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageOptions.java
|
CloudStorageOptions.withUserMetadata
|
public static CloudStorageOption.OpenCopy withUserMetadata(String key, String value) {
return OptionUserMetadata.create(key, value);
}
|
java
|
public static CloudStorageOption.OpenCopy withUserMetadata(String key, String value) {
return OptionUserMetadata.create(key, value);
}
|
[
"public",
"static",
"CloudStorageOption",
".",
"OpenCopy",
"withUserMetadata",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"OptionUserMetadata",
".",
"create",
"(",
"key",
",",
"value",
")",
";",
"}"
] |
Sets an unmodifiable piece of user metadata on a Cloud Storage object.
@see "https://developers.google.com/storage/docs/reference-headers#xgoogmeta"
|
[
"Sets",
"an",
"unmodifiable",
"piece",
"of",
"user",
"metadata",
"on",
"a",
"Cloud",
"Storage",
"object",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageOptions.java#L75-L77
|
12,453
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java
|
ClusterControllerClient.createClusterAsync
|
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Cluster, ClusterOperationMetadata> createClusterAsync(
String projectId, String region, Cluster cluster) {
CreateClusterRequest request =
CreateClusterRequest.newBuilder()
.setProjectId(projectId)
.setRegion(region)
.setCluster(cluster)
.build();
return createClusterAsync(request);
}
|
java
|
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Cluster, ClusterOperationMetadata> createClusterAsync(
String projectId, String region, Cluster cluster) {
CreateClusterRequest request =
CreateClusterRequest.newBuilder()
.setProjectId(projectId)
.setRegion(region)
.setCluster(cluster)
.build();
return createClusterAsync(request);
}
|
[
"@",
"BetaApi",
"(",
"\"The surface for long-running operations is not stable yet and may change in the future.\"",
")",
"public",
"final",
"OperationFuture",
"<",
"Cluster",
",",
"ClusterOperationMetadata",
">",
"createClusterAsync",
"(",
"String",
"projectId",
",",
"String",
"region",
",",
"Cluster",
"cluster",
")",
"{",
"CreateClusterRequest",
"request",
"=",
"CreateClusterRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
"(",
"projectId",
")",
".",
"setRegion",
"(",
"region",
")",
".",
"setCluster",
"(",
"cluster",
")",
".",
"build",
"(",
")",
";",
"return",
"createClusterAsync",
"(",
"request",
")",
";",
"}"
] |
Creates a cluster in a project.
<p>Sample code:
<pre><code>
try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
String projectId = "";
String region = "";
Cluster cluster = Cluster.newBuilder().build();
Cluster response = clusterControllerClient.createClusterAsync(projectId, region, cluster).get();
}
</code></pre>
@param projectId Required. The ID of the Google Cloud Platform project that the cluster belongs
to.
@param region Required. The Cloud Dataproc region in which to handle the request.
@param cluster Required. The cluster to create.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Creates",
"a",
"cluster",
"in",
"a",
"project",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java#L200-L212
|
12,454
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java
|
ClusterControllerClient.getCluster
|
public final Cluster getCluster(String projectId, String region, String clusterName) {
GetClusterRequest request =
GetClusterRequest.newBuilder()
.setProjectId(projectId)
.setRegion(region)
.setClusterName(clusterName)
.build();
return getCluster(request);
}
|
java
|
public final Cluster getCluster(String projectId, String region, String clusterName) {
GetClusterRequest request =
GetClusterRequest.newBuilder()
.setProjectId(projectId)
.setRegion(region)
.setClusterName(clusterName)
.build();
return getCluster(request);
}
|
[
"public",
"final",
"Cluster",
"getCluster",
"(",
"String",
"projectId",
",",
"String",
"region",
",",
"String",
"clusterName",
")",
"{",
"GetClusterRequest",
"request",
"=",
"GetClusterRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
"(",
"projectId",
")",
".",
"setRegion",
"(",
"region",
")",
".",
"setClusterName",
"(",
"clusterName",
")",
".",
"build",
"(",
")",
";",
"return",
"getCluster",
"(",
"request",
")",
";",
"}"
] |
Gets the resource representation for a cluster in a project.
<p>Sample code:
<pre><code>
try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) {
String projectId = "";
String region = "";
String clusterName = "";
Cluster response = clusterControllerClient.getCluster(projectId, region, clusterName);
}
</code></pre>
@param projectId Required. The ID of the Google Cloud Platform project that the cluster belongs
to.
@param region Required. The Cloud Dataproc region in which to handle the request.
@param clusterName Required. The cluster name.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"the",
"resource",
"representation",
"for",
"a",
"cluster",
"in",
"a",
"project",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java#L593-L602
|
12,455
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getString
|
@SuppressWarnings("unchecked")
public String getString(String name) {
return ((Value<String>) getValue(name)).get();
}
|
java
|
@SuppressWarnings("unchecked")
public String getString(String name) {
return ((Value<String>) getValue(name)).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"String",
"getString",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"Value",
"<",
"String",
">",
")",
"getValue",
"(",
"name",
")",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as a string.
@throws DatastoreException if no such property
@throws ClassCastException if value is not a string
|
[
"Returns",
"the",
"property",
"value",
"as",
"a",
"string",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L525-L528
|
12,456
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getTimestamp
|
@SuppressWarnings("unchecked")
public Timestamp getTimestamp(String name) {
return ((Value<Timestamp>) getValue(name)).get();
}
|
java
|
@SuppressWarnings("unchecked")
public Timestamp getTimestamp(String name) {
return ((Value<Timestamp>) getValue(name)).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Timestamp",
"getTimestamp",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"Value",
"<",
"Timestamp",
">",
")",
"getValue",
"(",
"name",
")",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as a Timestamp.
@throws DatastoreException if no such property
@throws ClassCastException if value is not a Timestamp
|
[
"Returns",
"the",
"property",
"value",
"as",
"a",
"Timestamp",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L569-L572
|
12,457
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getLatLng
|
@SuppressWarnings("unchecked")
public LatLng getLatLng(String name) {
return ((Value<LatLng>) getValue(name)).get();
}
|
java
|
@SuppressWarnings("unchecked")
public LatLng getLatLng(String name) {
return ((Value<LatLng>) getValue(name)).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"LatLng",
"getLatLng",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"Value",
"<",
"LatLng",
">",
")",
"getValue",
"(",
"name",
")",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as a LatLng.
@throws DatastoreException if no such property.
@throws ClassCastException if value is not a LatLng.
|
[
"Returns",
"the",
"property",
"value",
"as",
"a",
"LatLng",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L580-L583
|
12,458
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getKey
|
@SuppressWarnings("unchecked")
public Key getKey(String name) {
return ((Value<Key>) getValue(name)).get();
}
|
java
|
@SuppressWarnings("unchecked")
public Key getKey(String name) {
return ((Value<Key>) getValue(name)).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Key",
"getKey",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"Value",
"<",
"Key",
">",
")",
"getValue",
"(",
"name",
")",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as a Key.
@throws DatastoreException if no such property
@throws ClassCastException if value is not a Key
|
[
"Returns",
"the",
"property",
"value",
"as",
"a",
"Key",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L591-L594
|
12,459
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getEntity
|
@SuppressWarnings("unchecked")
public <K extends IncompleteKey> FullEntity<K> getEntity(String name) {
return ((Value<FullEntity<K>>) getValue(name)).get();
}
|
java
|
@SuppressWarnings("unchecked")
public <K extends IncompleteKey> FullEntity<K> getEntity(String name) {
return ((Value<FullEntity<K>>) getValue(name)).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"K",
"extends",
"IncompleteKey",
">",
"FullEntity",
"<",
"K",
">",
"getEntity",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"Value",
"<",
"FullEntity",
"<",
"K",
">",
">",
")",
"getValue",
"(",
"name",
")",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as an entity.
@throws DatastoreException if no such property
@throws ClassCastException if value is not an entity
|
[
"Returns",
"the",
"property",
"value",
"as",
"an",
"entity",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L602-L605
|
12,460
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getList
|
@SuppressWarnings("unchecked")
public <T extends Value<?>> List<T> getList(String name) {
return (List<T>) getValue(name).get();
}
|
java
|
@SuppressWarnings("unchecked")
public <T extends Value<?>> List<T> getList(String name) {
return (List<T>) getValue(name).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Value",
"<",
"?",
">",
">",
"List",
"<",
"T",
">",
"getList",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"List",
"<",
"T",
">",
")",
"getValue",
"(",
"name",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as a list of values.
@throws DatastoreException if no such property
@throws ClassCastException if value is not a list of values
|
[
"Returns",
"the",
"property",
"value",
"as",
"a",
"list",
"of",
"values",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L613-L616
|
12,461
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java
|
BaseEntity.getBlob
|
@SuppressWarnings("unchecked")
public Blob getBlob(String name) {
return ((Value<Blob>) getValue(name)).get();
}
|
java
|
@SuppressWarnings("unchecked")
public Blob getBlob(String name) {
return ((Value<Blob>) getValue(name)).get();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Blob",
"getBlob",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"Value",
"<",
"Blob",
">",
")",
"getValue",
"(",
"name",
")",
")",
".",
"get",
"(",
")",
";",
"}"
] |
Returns the property value as a blob.
@throws DatastoreException if no such property
@throws ClassCastException if value is not a blob
|
[
"Returns",
"the",
"property",
"value",
"as",
"a",
"blob",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java#L624-L627
|
12,462
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.addAccessConfig
|
public Operation addAccessConfig(
String networkInterface, AccessConfig accessConfig, OperationOption... options) {
return compute.addAccessConfig(getInstanceId(), networkInterface, accessConfig, options);
}
|
java
|
public Operation addAccessConfig(
String networkInterface, AccessConfig accessConfig, OperationOption... options) {
return compute.addAccessConfig(getInstanceId(), networkInterface, accessConfig, options);
}
|
[
"public",
"Operation",
"addAccessConfig",
"(",
"String",
"networkInterface",
",",
"AccessConfig",
"accessConfig",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"addAccessConfig",
"(",
"getInstanceId",
"(",
")",
",",
"networkInterface",
",",
"accessConfig",
",",
"options",
")",
";",
"}"
] |
Adds an access configuration to the provided network interface for this instance.
@return a zone operation if the add request was issued correctly, {@code null} if the instance
was not found
@throws ComputeException upon failure
|
[
"Adds",
"an",
"access",
"configuration",
"to",
"the",
"provided",
"network",
"interface",
"for",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L227-L230
|
12,463
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.attachDisk
|
public Operation attachDisk(
PersistentDiskConfiguration configuration, OperationOption... options) {
return compute.attachDisk(getInstanceId(), configuration, options);
}
|
java
|
public Operation attachDisk(
PersistentDiskConfiguration configuration, OperationOption... options) {
return compute.attachDisk(getInstanceId(), configuration, options);
}
|
[
"public",
"Operation",
"attachDisk",
"(",
"PersistentDiskConfiguration",
"configuration",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"attachDisk",
"(",
"getInstanceId",
"(",
")",
",",
"configuration",
",",
"options",
")",
";",
"}"
] |
Attaches a persistent disk to this instance given its configuration.
@return a zone operation if the attach request was issued correctly, {@code null} if the
instance was not found
@throws ComputeException upon failure
|
[
"Attaches",
"a",
"persistent",
"disk",
"to",
"this",
"instance",
"given",
"its",
"configuration",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L239-L242
|
12,464
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.deleteAccessConfig
|
public Operation deleteAccessConfig(
String networkInterface, String accessConfig, OperationOption... options) {
return compute.deleteAccessConfig(getInstanceId(), networkInterface, accessConfig, options);
}
|
java
|
public Operation deleteAccessConfig(
String networkInterface, String accessConfig, OperationOption... options) {
return compute.deleteAccessConfig(getInstanceId(), networkInterface, accessConfig, options);
}
|
[
"public",
"Operation",
"deleteAccessConfig",
"(",
"String",
"networkInterface",
",",
"String",
"accessConfig",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"deleteAccessConfig",
"(",
"getInstanceId",
"(",
")",
",",
"networkInterface",
",",
"accessConfig",
",",
"options",
")",
";",
"}"
] |
Deletes an access configuration from the provided network interface for this instance.
@return a zone operation if the delete request was issued correctly, {@code null} if the
instance was not found
@throws ComputeException upon failure
|
[
"Deletes",
"an",
"access",
"configuration",
"from",
"the",
"provided",
"network",
"interface",
"for",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L279-L282
|
12,465
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.detachDisk
|
public Operation detachDisk(String deviceName, OperationOption... options) {
return compute.detachDisk(getInstanceId(), deviceName, options);
}
|
java
|
public Operation detachDisk(String deviceName, OperationOption... options) {
return compute.detachDisk(getInstanceId(), deviceName, options);
}
|
[
"public",
"Operation",
"detachDisk",
"(",
"String",
"deviceName",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"detachDisk",
"(",
"getInstanceId",
"(",
")",
",",
"deviceName",
",",
"options",
")",
";",
"}"
] |
Detaches a disk from this instance.
@return a zone operation if the detach request was issued correctly, {@code null} if the
instance was not found
@throws ComputeException upon failure
|
[
"Detaches",
"a",
"disk",
"from",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L291-L293
|
12,466
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.setDiskAutoDelete
|
public Operation setDiskAutoDelete(
String deviceName, boolean autoDelete, OperationOption... options) {
return compute.setDiskAutoDelete(getInstanceId(), deviceName, autoDelete, options);
}
|
java
|
public Operation setDiskAutoDelete(
String deviceName, boolean autoDelete, OperationOption... options) {
return compute.setDiskAutoDelete(getInstanceId(), deviceName, autoDelete, options);
}
|
[
"public",
"Operation",
"setDiskAutoDelete",
"(",
"String",
"deviceName",
",",
"boolean",
"autoDelete",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"setDiskAutoDelete",
"(",
"getInstanceId",
"(",
")",
",",
"deviceName",
",",
"autoDelete",
",",
"options",
")",
";",
"}"
] |
Sets the auto-delete flag for a disk attached to this instance.
@return a zone operation if the flag setting request was issued correctly, {@code null} if the
instance was not found
@throws ComputeException upon failure
|
[
"Sets",
"the",
"auto",
"-",
"delete",
"flag",
"for",
"a",
"disk",
"attached",
"to",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L335-L338
|
12,467
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.setMetadata
|
public Operation setMetadata(Metadata metadata, OperationOption... options) {
return compute.setMetadata(getInstanceId(), metadata, options);
}
|
java
|
public Operation setMetadata(Metadata metadata, OperationOption... options) {
return compute.setMetadata(getInstanceId(), metadata, options);
}
|
[
"public",
"Operation",
"setMetadata",
"(",
"Metadata",
"metadata",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"setMetadata",
"(",
"getInstanceId",
"(",
")",
",",
"metadata",
",",
"options",
")",
";",
"}"
] |
Sets the metadata for this instance.
@return a zone operation if the set request was issued correctly, {@code null} if the instance
was not found
@throws ComputeException upon failure
|
[
"Sets",
"the",
"metadata",
"for",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L359-L361
|
12,468
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.setSchedulingOptions
|
public Operation setSchedulingOptions(SchedulingOptions scheduling, OperationOption... options) {
return compute.setSchedulingOptions(getInstanceId(), scheduling, options);
}
|
java
|
public Operation setSchedulingOptions(SchedulingOptions scheduling, OperationOption... options) {
return compute.setSchedulingOptions(getInstanceId(), scheduling, options);
}
|
[
"public",
"Operation",
"setSchedulingOptions",
"(",
"SchedulingOptions",
"scheduling",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"setSchedulingOptions",
"(",
"getInstanceId",
"(",
")",
",",
"scheduling",
",",
"options",
")",
";",
"}"
] |
Sets the scheduling options for this instance.
@return a zone operation if the set request was issued correctly, {@code null} if the instance
was not found
@throws ComputeException upon failure
|
[
"Sets",
"the",
"scheduling",
"options",
"for",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L382-L384
|
12,469
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
|
Instance.setTags
|
public Operation setTags(Tags tags, OperationOption... options) {
return compute.setTags(getInstanceId(), tags, options);
}
|
java
|
public Operation setTags(Tags tags, OperationOption... options) {
return compute.setTags(getInstanceId(), tags, options);
}
|
[
"public",
"Operation",
"setTags",
"(",
"Tags",
"tags",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"setTags",
"(",
"getInstanceId",
"(",
")",
",",
"tags",
",",
"options",
")",
";",
"}"
] |
Sets the tags for this instance.
@return a zone operation if the set request was issued correctly, {@code null} if the instance
was not found
@throws ComputeException upon failure
|
[
"Sets",
"the",
"tags",
"for",
"this",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L393-L395
|
12,470
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java
|
LoggingHandler.getLogging
|
private Logging getLogging() {
if (logging == null) {
synchronized (this) {
if (logging == null) {
logging = loggingOptions.getService();
}
}
}
return logging;
}
|
java
|
private Logging getLogging() {
if (logging == null) {
synchronized (this) {
if (logging == null) {
logging = loggingOptions.getService();
}
}
}
return logging;
}
|
[
"private",
"Logging",
"getLogging",
"(",
")",
"{",
"if",
"(",
"logging",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"logging",
"==",
"null",
")",
"{",
"logging",
"=",
"loggingOptions",
".",
"getService",
"(",
")",
";",
"}",
"}",
"}",
"return",
"logging",
";",
"}"
] |
Returns an instance of the logging service.
|
[
"Returns",
"an",
"instance",
"of",
"the",
"logging",
"service",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java#L358-L367
|
12,471
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RegexUtil.java
|
RegexUtil.literalRegex
|
public static ByteString literalRegex(ByteString value) {
ByteString.Output output = ByteString.newOutput(value.size() * 2);
ByteIterator it = value.iterator();
writeLiteralRegex(it, output);
return output.toByteString();
}
|
java
|
public static ByteString literalRegex(ByteString value) {
ByteString.Output output = ByteString.newOutput(value.size() * 2);
ByteIterator it = value.iterator();
writeLiteralRegex(it, output);
return output.toByteString();
}
|
[
"public",
"static",
"ByteString",
"literalRegex",
"(",
"ByteString",
"value",
")",
"{",
"ByteString",
".",
"Output",
"output",
"=",
"ByteString",
".",
"newOutput",
"(",
"value",
".",
"size",
"(",
")",
"*",
"2",
")",
";",
"ByteIterator",
"it",
"=",
"value",
".",
"iterator",
"(",
")",
";",
"writeLiteralRegex",
"(",
"it",
",",
"output",
")",
";",
"return",
"output",
".",
"toByteString",
"(",
")",
";",
"}"
] |
Converts the value to a quoted regular expression.
|
[
"Converts",
"the",
"value",
"to",
"a",
"quoted",
"regular",
"expression",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RegexUtil.java#L44-L51
|
12,472
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java
|
BaseBigtableTableAdminClient.createTable
|
public final Table createTable(InstanceName parent, String tableId, Table table) {
CreateTableRequest request =
CreateTableRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setTableId(tableId)
.setTable(table)
.build();
return createTable(request);
}
|
java
|
public final Table createTable(InstanceName parent, String tableId, Table table) {
CreateTableRequest request =
CreateTableRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setTableId(tableId)
.setTable(table)
.build();
return createTable(request);
}
|
[
"public",
"final",
"Table",
"createTable",
"(",
"InstanceName",
"parent",
",",
"String",
"tableId",
",",
"Table",
"table",
")",
"{",
"CreateTableRequest",
"request",
"=",
"CreateTableRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",
"?",
"null",
":",
"parent",
".",
"toString",
"(",
")",
")",
".",
"setTableId",
"(",
"tableId",
")",
".",
"setTable",
"(",
"table",
")",
".",
"build",
"(",
")",
";",
"return",
"createTable",
"(",
"request",
")",
";",
"}"
] |
Creates a new table in the specified instance. The table can be created with a full set of
initial column families, specified in the request.
<p>Sample code:
<pre><code>
try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String tableId = "";
Table table = Table.newBuilder().build();
Table response = baseBigtableTableAdminClient.createTable(parent, tableId, table);
}
</code></pre>
@param parent The unique name of the instance in which to create the table. Values are of the
form `projects/<project>/instances/<instance>`.
@param tableId The name by which the new table should be referred to within the parent
instance, e.g., `foobar` rather than `<parent>/tables/foobar`.
@param table The Table to create.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Creates",
"a",
"new",
"table",
"in",
"the",
"specified",
"instance",
".",
"The",
"table",
"can",
"be",
"created",
"with",
"a",
"full",
"set",
"of",
"initial",
"column",
"families",
"specified",
"in",
"the",
"request",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java#L160-L169
|
12,473
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java
|
DocumentSet.emptySet
|
static DocumentSet emptySet(final Comparator<QueryDocumentSnapshot> comparator) {
return new DocumentSet(
EMPTY_DOCUMENT_MAP,
new ImmutableSortedSet<>(Collections.<QueryDocumentSnapshot>emptyList(), comparator));
}
|
java
|
static DocumentSet emptySet(final Comparator<QueryDocumentSnapshot> comparator) {
return new DocumentSet(
EMPTY_DOCUMENT_MAP,
new ImmutableSortedSet<>(Collections.<QueryDocumentSnapshot>emptyList(), comparator));
}
|
[
"static",
"DocumentSet",
"emptySet",
"(",
"final",
"Comparator",
"<",
"QueryDocumentSnapshot",
">",
"comparator",
")",
"{",
"return",
"new",
"DocumentSet",
"(",
"EMPTY_DOCUMENT_MAP",
",",
"new",
"ImmutableSortedSet",
"<>",
"(",
"Collections",
".",
"<",
"QueryDocumentSnapshot",
">",
"emptyList",
"(",
")",
",",
"comparator",
")",
")",
";",
"}"
] |
Returns an empty DocumentSet sorted by the given comparator, then by keys.
|
[
"Returns",
"an",
"empty",
"DocumentSet",
"sorted",
"by",
"the",
"given",
"comparator",
"then",
"by",
"keys",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java#L37-L41
|
12,474
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java
|
DocumentSet.indexOf
|
int indexOf(ResourcePath key) {
QueryDocumentSnapshot document = keyIndex.get(key);
if (document == null) {
return -1;
}
return sortedSet.indexOf(document);
}
|
java
|
int indexOf(ResourcePath key) {
QueryDocumentSnapshot document = keyIndex.get(key);
if (document == null) {
return -1;
}
return sortedSet.indexOf(document);
}
|
[
"int",
"indexOf",
"(",
"ResourcePath",
"key",
")",
"{",
"QueryDocumentSnapshot",
"document",
"=",
"keyIndex",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"sortedSet",
".",
"indexOf",
"(",
"document",
")",
";",
"}"
] |
Returns the index of the provided key in the document set, or -1 if the document key is not
present in the set;
|
[
"Returns",
"the",
"index",
"of",
"the",
"provided",
"key",
"in",
"the",
"document",
"set",
"or",
"-",
"1",
"if",
"the",
"document",
"key",
"is",
"not",
"present",
"in",
"the",
"set",
";"
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java#L87-L93
|
12,475
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java
|
DocumentSet.add
|
DocumentSet add(QueryDocumentSnapshot document) {
// Remove any prior mapping of the document's key before adding, preventing sortedSet from
// accumulating values that aren't in the index.
DocumentSet removed = remove(document.getReference().getResourcePath());
ImmutableSortedMap<ResourcePath, QueryDocumentSnapshot> newKeyIndex =
removed.keyIndex.insert(document.getReference().getResourcePath(), document);
ImmutableSortedSet<QueryDocumentSnapshot> newSortedSet = removed.sortedSet.insert(document);
return new DocumentSet(newKeyIndex, newSortedSet);
}
|
java
|
DocumentSet add(QueryDocumentSnapshot document) {
// Remove any prior mapping of the document's key before adding, preventing sortedSet from
// accumulating values that aren't in the index.
DocumentSet removed = remove(document.getReference().getResourcePath());
ImmutableSortedMap<ResourcePath, QueryDocumentSnapshot> newKeyIndex =
removed.keyIndex.insert(document.getReference().getResourcePath(), document);
ImmutableSortedSet<QueryDocumentSnapshot> newSortedSet = removed.sortedSet.insert(document);
return new DocumentSet(newKeyIndex, newSortedSet);
}
|
[
"DocumentSet",
"add",
"(",
"QueryDocumentSnapshot",
"document",
")",
"{",
"// Remove any prior mapping of the document's key before adding, preventing sortedSet from",
"// accumulating values that aren't in the index.",
"DocumentSet",
"removed",
"=",
"remove",
"(",
"document",
".",
"getReference",
"(",
")",
".",
"getResourcePath",
"(",
")",
")",
";",
"ImmutableSortedMap",
"<",
"ResourcePath",
",",
"QueryDocumentSnapshot",
">",
"newKeyIndex",
"=",
"removed",
".",
"keyIndex",
".",
"insert",
"(",
"document",
".",
"getReference",
"(",
")",
".",
"getResourcePath",
"(",
")",
",",
"document",
")",
";",
"ImmutableSortedSet",
"<",
"QueryDocumentSnapshot",
">",
"newSortedSet",
"=",
"removed",
".",
"sortedSet",
".",
"insert",
"(",
"document",
")",
";",
"return",
"new",
"DocumentSet",
"(",
"newKeyIndex",
",",
"newSortedSet",
")",
";",
"}"
] |
Returns a new DocumentSet that contains the given document, replacing any old document with the
same key.
|
[
"Returns",
"a",
"new",
"DocumentSet",
"that",
"contains",
"the",
"given",
"document",
"replacing",
"any",
"old",
"document",
"with",
"the",
"same",
"key",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java#L99-L108
|
12,476
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java
|
DocumentSet.remove
|
DocumentSet remove(ResourcePath key) {
QueryDocumentSnapshot document = keyIndex.get(key);
if (document == null) {
return this;
}
ImmutableSortedMap<ResourcePath, QueryDocumentSnapshot> newKeyIndex = keyIndex.remove(key);
ImmutableSortedSet<QueryDocumentSnapshot> newSortedSet = sortedSet.remove(document);
return new DocumentSet(newKeyIndex, newSortedSet);
}
|
java
|
DocumentSet remove(ResourcePath key) {
QueryDocumentSnapshot document = keyIndex.get(key);
if (document == null) {
return this;
}
ImmutableSortedMap<ResourcePath, QueryDocumentSnapshot> newKeyIndex = keyIndex.remove(key);
ImmutableSortedSet<QueryDocumentSnapshot> newSortedSet = sortedSet.remove(document);
return new DocumentSet(newKeyIndex, newSortedSet);
}
|
[
"DocumentSet",
"remove",
"(",
"ResourcePath",
"key",
")",
"{",
"QueryDocumentSnapshot",
"document",
"=",
"keyIndex",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"document",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"ImmutableSortedMap",
"<",
"ResourcePath",
",",
"QueryDocumentSnapshot",
">",
"newKeyIndex",
"=",
"keyIndex",
".",
"remove",
"(",
"key",
")",
";",
"ImmutableSortedSet",
"<",
"QueryDocumentSnapshot",
">",
"newSortedSet",
"=",
"sortedSet",
".",
"remove",
"(",
"document",
")",
";",
"return",
"new",
"DocumentSet",
"(",
"newKeyIndex",
",",
"newSortedSet",
")",
";",
"}"
] |
Returns a new DocumentSet with the document for the provided key removed.
|
[
"Returns",
"a",
"new",
"DocumentSet",
"with",
"the",
"document",
"for",
"the",
"provided",
"key",
"removed",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java#L111-L120
|
12,477
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
|
BigtableDataClient.create
|
public static BigtableDataClient create(String projectId, String instanceId) throws IOException {
BigtableDataSettings settings =
BigtableDataSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId).build();
return create(settings);
}
|
java
|
public static BigtableDataClient create(String projectId, String instanceId) throws IOException {
BigtableDataSettings settings =
BigtableDataSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId).build();
return create(settings);
}
|
[
"public",
"static",
"BigtableDataClient",
"create",
"(",
"String",
"projectId",
",",
"String",
"instanceId",
")",
"throws",
"IOException",
"{",
"BigtableDataSettings",
"settings",
"=",
"BigtableDataSettings",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
"(",
"projectId",
")",
".",
"setInstanceId",
"(",
"instanceId",
")",
".",
"build",
"(",
")",
";",
"return",
"create",
"(",
"settings",
")",
";",
"}"
] |
Constructs an instance of BigtableDataClient with default settings.
@param projectId The project id of the instance to connect to.
@param instanceId The id of the instance to connect to.
@return A new client.
@throws IOException If any.
|
[
"Constructs",
"an",
"instance",
"of",
"BigtableDataClient",
"with",
"default",
"settings",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L123-L127
|
12,478
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
|
BigtableDataClient.create
|
public static BigtableDataClient create(BigtableDataSettings settings) throws IOException {
EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings.getStubSettings());
return new BigtableDataClient(stub);
}
|
java
|
public static BigtableDataClient create(BigtableDataSettings settings) throws IOException {
EnhancedBigtableStub stub = EnhancedBigtableStub.create(settings.getStubSettings());
return new BigtableDataClient(stub);
}
|
[
"public",
"static",
"BigtableDataClient",
"create",
"(",
"BigtableDataSettings",
"settings",
")",
"throws",
"IOException",
"{",
"EnhancedBigtableStub",
"stub",
"=",
"EnhancedBigtableStub",
".",
"create",
"(",
"settings",
".",
"getStubSettings",
"(",
")",
")",
";",
"return",
"new",
"BigtableDataClient",
"(",
"stub",
")",
";",
"}"
] |
Constructs an instance of BigtableDataClient, using the given settings. The channels are
created based on the settings passed in, or defaults for any settings that are not set.
|
[
"Constructs",
"an",
"instance",
"of",
"BigtableDataClient",
"using",
"the",
"given",
"settings",
".",
"The",
"channels",
"are",
"created",
"based",
"on",
"the",
"settings",
"passed",
"in",
"or",
"defaults",
"for",
"any",
"settings",
"that",
"are",
"not",
"set",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L133-L136
|
12,479
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
|
BigtableDataClient.readRowCallable
|
public <RowT> UnaryCallable<Query, RowT> readRowCallable(RowAdapter<RowT> rowAdapter) {
return stub.createReadRowCallable(rowAdapter);
}
|
java
|
public <RowT> UnaryCallable<Query, RowT> readRowCallable(RowAdapter<RowT> rowAdapter) {
return stub.createReadRowCallable(rowAdapter);
}
|
[
"public",
"<",
"RowT",
">",
"UnaryCallable",
"<",
"Query",
",",
"RowT",
">",
"readRowCallable",
"(",
"RowAdapter",
"<",
"RowT",
">",
"rowAdapter",
")",
"{",
"return",
"stub",
".",
"createReadRowCallable",
"(",
"rowAdapter",
")",
";",
"}"
] |
Reads a single row. This callable allows for customization of the logical representation of a
row. It's meant for advanced use cases.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
Query query = Query.create(tableId)
.rowKey("[KEY]")
.filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*"));
// Synchronous invocation
CustomRow row = bigtableDataClient.readRowCallable(new CustomRowAdapter()).call(query));
// Do something with row
}
}</pre>
@see ServerStreamingCallable For call styles.
@see Query For query options.
@see com.google.cloud.bigtable.data.v2.models.Filters For the filter building DSL.
|
[
"Reads",
"a",
"single",
"row",
".",
"This",
"callable",
"allows",
"for",
"customization",
"of",
"the",
"logical",
"representation",
"of",
"a",
"row",
".",
"It",
"s",
"meant",
"for",
"advanced",
"use",
"cases",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L496-L498
|
12,480
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java
|
BigtableDataClient.readRowsCallable
|
public <RowT> ServerStreamingCallable<Query, RowT> readRowsCallable(RowAdapter<RowT> rowAdapter) {
return stub.createReadRowsCallable(rowAdapter);
}
|
java
|
public <RowT> ServerStreamingCallable<Query, RowT> readRowsCallable(RowAdapter<RowT> rowAdapter) {
return stub.createReadRowsCallable(rowAdapter);
}
|
[
"public",
"<",
"RowT",
">",
"ServerStreamingCallable",
"<",
"Query",
",",
"RowT",
">",
"readRowsCallable",
"(",
"RowAdapter",
"<",
"RowT",
">",
"rowAdapter",
")",
"{",
"return",
"stub",
".",
"createReadRowsCallable",
"(",
"rowAdapter",
")",
";",
"}"
] |
Streams back the results of the query. This callable allows for customization of the logical
representation of a row. It's meant for advanced use cases.
<p>Sample code:
<pre>{@code
try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
String tableId = "[TABLE]";
Query query = Query.create(tableId)
.range("[START KEY]", "[END KEY]")
.filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*"));
// Iterator style
try {
for(CustomRow row : bigtableDataClient.readRowsCallable(new CustomRowAdapter()).call(query)) {
// Do something with row
}
} catch (NotFoundException e) {
System.out.println("Tried to read a non-existent table");
} catch (RuntimeException e) {
e.printStackTrace();
}
}
}</pre>
@see ServerStreamingCallable For call styles.
@see Query For query options.
@see com.google.cloud.bigtable.data.v2.models.Filters For the filter building DSL.
|
[
"Streams",
"back",
"the",
"results",
"of",
"the",
"query",
".",
"This",
"callable",
"allows",
"for",
"customization",
"of",
"the",
"logical",
"representation",
"of",
"a",
"row",
".",
"It",
"s",
"meant",
"for",
"advanced",
"use",
"cases",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java#L666-L668
|
12,481
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java
|
InstanceAdminClientSnippets.getInstanceConfig
|
public InstanceConfig getInstanceConfig(final String my_config_id) {
// [START instance_admin_client_get_instance_config]
final String configId = my_config_id;
InstanceConfig instanceConfig = instanceAdminClient.getInstanceConfig(configId);
// [END instance_admin_client_get_instance_config]
return instanceConfig;
}
|
java
|
public InstanceConfig getInstanceConfig(final String my_config_id) {
// [START instance_admin_client_get_instance_config]
final String configId = my_config_id;
InstanceConfig instanceConfig = instanceAdminClient.getInstanceConfig(configId);
// [END instance_admin_client_get_instance_config]
return instanceConfig;
}
|
[
"public",
"InstanceConfig",
"getInstanceConfig",
"(",
"final",
"String",
"my_config_id",
")",
"{",
"// [START instance_admin_client_get_instance_config]",
"final",
"String",
"configId",
"=",
"my_config_id",
";",
"InstanceConfig",
"instanceConfig",
"=",
"instanceAdminClient",
".",
"getInstanceConfig",
"(",
"configId",
")",
";",
"// [END instance_admin_client_get_instance_config]",
"return",
"instanceConfig",
";",
"}"
] |
Example to get instance config.
|
[
"Example",
"to",
"get",
"instance",
"config",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java#L51-L57
|
12,482
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java
|
InstanceAdminClientSnippets.listInstanceConfigs
|
public List<InstanceConfig> listInstanceConfigs() {
// [START instance_admin_client_list_configs]
List<InstanceConfig> configs =
Lists.newArrayList(
instanceAdminClient.listInstanceConfigs(Options.pageSize(1)).iterateAll());
// [END instance_admin_client_list_configs]
return configs;
}
|
java
|
public List<InstanceConfig> listInstanceConfigs() {
// [START instance_admin_client_list_configs]
List<InstanceConfig> configs =
Lists.newArrayList(
instanceAdminClient.listInstanceConfigs(Options.pageSize(1)).iterateAll());
// [END instance_admin_client_list_configs]
return configs;
}
|
[
"public",
"List",
"<",
"InstanceConfig",
">",
"listInstanceConfigs",
"(",
")",
"{",
"// [START instance_admin_client_list_configs]",
"List",
"<",
"InstanceConfig",
">",
"configs",
"=",
"Lists",
".",
"newArrayList",
"(",
"instanceAdminClient",
".",
"listInstanceConfigs",
"(",
"Options",
".",
"pageSize",
"(",
"1",
")",
")",
".",
"iterateAll",
"(",
")",
")",
";",
"// [END instance_admin_client_list_configs]",
"return",
"configs",
";",
"}"
] |
Example to list instance configs.
|
[
"Example",
"to",
"list",
"instance",
"configs",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java#L60-L67
|
12,483
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java
|
InstanceAdminClientSnippets.createInstance
|
public void createInstance(
final String my_instance_id, final String my_config_id, final String my_client_project) {
// [START instance_admin_client_create_instance]
final String instanceId = my_instance_id;
final String configId = my_config_id;
final String clientProject = my_client_project;
OperationFuture<Instance, CreateInstanceMetadata> op =
instanceAdminClient.createInstance(
InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
.setInstanceConfigId(InstanceConfigId.of(clientProject, configId))
.setDisplayName(instanceId)
.setNodeCount(1)
.build());
try {
op.get();
} catch (ExecutionException e) {
throw (SpannerException) e.getCause();
} catch (InterruptedException e) {
throw SpannerExceptionFactory.propagateInterrupt(e);
}
// [END instance_admin_client_create_instance]
}
|
java
|
public void createInstance(
final String my_instance_id, final String my_config_id, final String my_client_project) {
// [START instance_admin_client_create_instance]
final String instanceId = my_instance_id;
final String configId = my_config_id;
final String clientProject = my_client_project;
OperationFuture<Instance, CreateInstanceMetadata> op =
instanceAdminClient.createInstance(
InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
.setInstanceConfigId(InstanceConfigId.of(clientProject, configId))
.setDisplayName(instanceId)
.setNodeCount(1)
.build());
try {
op.get();
} catch (ExecutionException e) {
throw (SpannerException) e.getCause();
} catch (InterruptedException e) {
throw SpannerExceptionFactory.propagateInterrupt(e);
}
// [END instance_admin_client_create_instance]
}
|
[
"public",
"void",
"createInstance",
"(",
"final",
"String",
"my_instance_id",
",",
"final",
"String",
"my_config_id",
",",
"final",
"String",
"my_client_project",
")",
"{",
"// [START instance_admin_client_create_instance]",
"final",
"String",
"instanceId",
"=",
"my_instance_id",
";",
"final",
"String",
"configId",
"=",
"my_config_id",
";",
"final",
"String",
"clientProject",
"=",
"my_client_project",
";",
"OperationFuture",
"<",
"Instance",
",",
"CreateInstanceMetadata",
">",
"op",
"=",
"instanceAdminClient",
".",
"createInstance",
"(",
"InstanceInfo",
".",
"newBuilder",
"(",
"InstanceId",
".",
"of",
"(",
"clientProject",
",",
"instanceId",
")",
")",
".",
"setInstanceConfigId",
"(",
"InstanceConfigId",
".",
"of",
"(",
"clientProject",
",",
"configId",
")",
")",
".",
"setDisplayName",
"(",
"instanceId",
")",
".",
"setNodeCount",
"(",
"1",
")",
".",
"build",
"(",
")",
")",
";",
"try",
"{",
"op",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"throw",
"(",
"SpannerException",
")",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"SpannerExceptionFactory",
".",
"propagateInterrupt",
"(",
"e",
")",
";",
"}",
"// [END instance_admin_client_create_instance]",
"}"
] |
Example to create an instance.
|
[
"Example",
"to",
"create",
"an",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java#L70-L92
|
12,484
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java
|
InstanceAdminClientSnippets.getInstance
|
public Instance getInstance(final String my_instance_id) {
// [START instance_admin_client_get_instance]
final String instanceId = my_instance_id;
Instance ins = instanceAdminClient.getInstance(instanceId);
// [END instance_admin_client_get_instance]
return ins;
}
|
java
|
public Instance getInstance(final String my_instance_id) {
// [START instance_admin_client_get_instance]
final String instanceId = my_instance_id;
Instance ins = instanceAdminClient.getInstance(instanceId);
// [END instance_admin_client_get_instance]
return ins;
}
|
[
"public",
"Instance",
"getInstance",
"(",
"final",
"String",
"my_instance_id",
")",
"{",
"// [START instance_admin_client_get_instance]",
"final",
"String",
"instanceId",
"=",
"my_instance_id",
";",
"Instance",
"ins",
"=",
"instanceAdminClient",
".",
"getInstance",
"(",
"instanceId",
")",
";",
"// [END instance_admin_client_get_instance]",
"return",
"ins",
";",
"}"
] |
Example to get an instance.
|
[
"Example",
"to",
"get",
"an",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java#L95-L101
|
12,485
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java
|
InstanceAdminClientSnippets.listInstances
|
public List<Instance> listInstances() {
// [START instance_admin_client_list_instances]
List<Instance> instances =
Lists.newArrayList(instanceAdminClient.listInstances(Options.pageSize(1)).iterateAll());
// [END instance_admin_client_list_instances]
return instances;
}
|
java
|
public List<Instance> listInstances() {
// [START instance_admin_client_list_instances]
List<Instance> instances =
Lists.newArrayList(instanceAdminClient.listInstances(Options.pageSize(1)).iterateAll());
// [END instance_admin_client_list_instances]
return instances;
}
|
[
"public",
"List",
"<",
"Instance",
">",
"listInstances",
"(",
")",
"{",
"// [START instance_admin_client_list_instances]",
"List",
"<",
"Instance",
">",
"instances",
"=",
"Lists",
".",
"newArrayList",
"(",
"instanceAdminClient",
".",
"listInstances",
"(",
"Options",
".",
"pageSize",
"(",
"1",
")",
")",
".",
"iterateAll",
"(",
")",
")",
";",
"// [END instance_admin_client_list_instances]",
"return",
"instances",
";",
"}"
] |
Example to list instances.
|
[
"Example",
"to",
"list",
"instances",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java#L104-L110
|
12,486
|
googleapis/google-cloud-java
|
google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java
|
InstanceAdminClientSnippets.updateInstance
|
public void updateInstance(
Instance my_instance,
final String my_client_project,
final String my_instance_id,
final String my_display_name) {
// [START instance_admin_client_update_instance]
Instance instance = my_instance;
final String clientProject = my_client_project;
final String instanceId = my_instance_id;
final String newDisplayName = my_display_name;
InstanceInfo toUpdate =
InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
.setDisplayName(newDisplayName)
.setNodeCount(instance.getNodeCount() + 1)
.build();
// Only update display name
OperationFuture<Instance, UpdateInstanceMetadata> op =
instanceAdminClient.updateInstance(toUpdate, InstanceInfo.InstanceField.DISPLAY_NAME);
try {
op.get();
} catch (ExecutionException e) {
throw (SpannerException) e.getCause();
} catch (InterruptedException e) {
throw SpannerExceptionFactory.propagateInterrupt(e);
}
// [END instance_admin_client_update_instance]
}
|
java
|
public void updateInstance(
Instance my_instance,
final String my_client_project,
final String my_instance_id,
final String my_display_name) {
// [START instance_admin_client_update_instance]
Instance instance = my_instance;
final String clientProject = my_client_project;
final String instanceId = my_instance_id;
final String newDisplayName = my_display_name;
InstanceInfo toUpdate =
InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
.setDisplayName(newDisplayName)
.setNodeCount(instance.getNodeCount() + 1)
.build();
// Only update display name
OperationFuture<Instance, UpdateInstanceMetadata> op =
instanceAdminClient.updateInstance(toUpdate, InstanceInfo.InstanceField.DISPLAY_NAME);
try {
op.get();
} catch (ExecutionException e) {
throw (SpannerException) e.getCause();
} catch (InterruptedException e) {
throw SpannerExceptionFactory.propagateInterrupt(e);
}
// [END instance_admin_client_update_instance]
}
|
[
"public",
"void",
"updateInstance",
"(",
"Instance",
"my_instance",
",",
"final",
"String",
"my_client_project",
",",
"final",
"String",
"my_instance_id",
",",
"final",
"String",
"my_display_name",
")",
"{",
"// [START instance_admin_client_update_instance]",
"Instance",
"instance",
"=",
"my_instance",
";",
"final",
"String",
"clientProject",
"=",
"my_client_project",
";",
"final",
"String",
"instanceId",
"=",
"my_instance_id",
";",
"final",
"String",
"newDisplayName",
"=",
"my_display_name",
";",
"InstanceInfo",
"toUpdate",
"=",
"InstanceInfo",
".",
"newBuilder",
"(",
"InstanceId",
".",
"of",
"(",
"clientProject",
",",
"instanceId",
")",
")",
".",
"setDisplayName",
"(",
"newDisplayName",
")",
".",
"setNodeCount",
"(",
"instance",
".",
"getNodeCount",
"(",
")",
"+",
"1",
")",
".",
"build",
"(",
")",
";",
"// Only update display name",
"OperationFuture",
"<",
"Instance",
",",
"UpdateInstanceMetadata",
">",
"op",
"=",
"instanceAdminClient",
".",
"updateInstance",
"(",
"toUpdate",
",",
"InstanceInfo",
".",
"InstanceField",
".",
"DISPLAY_NAME",
")",
";",
"try",
"{",
"op",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"throw",
"(",
"SpannerException",
")",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"SpannerExceptionFactory",
".",
"propagateInterrupt",
"(",
"e",
")",
";",
"}",
"// [END instance_admin_client_update_instance]",
"}"
] |
Example to update an instance.
|
[
"Example",
"to",
"update",
"an",
"instance",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/spanner/snippets/InstanceAdminClientSnippets.java#L121-L149
|
12,487
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Cluster.java
|
Cluster.getId
|
@SuppressWarnings("WeakerAccess")
public String getId() {
// Constructor ensures that name is not null
ClusterName fullName =
Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null");
//noinspection ConstantConditions
return fullName.getCluster();
}
|
java
|
@SuppressWarnings("WeakerAccess")
public String getId() {
// Constructor ensures that name is not null
ClusterName fullName =
Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null");
//noinspection ConstantConditions
return fullName.getCluster();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"String",
"getId",
"(",
")",
"{",
"// Constructor ensures that name is not null",
"ClusterName",
"fullName",
"=",
"Verify",
".",
"verifyNotNull",
"(",
"ClusterName",
".",
"parse",
"(",
"stateProto",
".",
"getName",
"(",
")",
")",
",",
"\"Name can never be null\"",
")",
";",
"//noinspection ConstantConditions",
"return",
"fullName",
".",
"getCluster",
"(",
")",
";",
"}"
] |
Gets the cluster's id.
|
[
"Gets",
"the",
"cluster",
"s",
"id",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Cluster.java#L108-L115
|
12,488
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Cluster.java
|
Cluster.getInstanceId
|
@SuppressWarnings("WeakerAccess")
public String getInstanceId() {
// Constructor ensures that name is not null
ClusterName fullName =
Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null");
//noinspection ConstantConditions
return fullName.getInstance();
}
|
java
|
@SuppressWarnings("WeakerAccess")
public String getInstanceId() {
// Constructor ensures that name is not null
ClusterName fullName =
Verify.verifyNotNull(ClusterName.parse(stateProto.getName()), "Name can never be null");
//noinspection ConstantConditions
return fullName.getInstance();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"String",
"getInstanceId",
"(",
")",
"{",
"// Constructor ensures that name is not null",
"ClusterName",
"fullName",
"=",
"Verify",
".",
"verifyNotNull",
"(",
"ClusterName",
".",
"parse",
"(",
"stateProto",
".",
"getName",
"(",
")",
")",
",",
"\"Name can never be null\"",
")",
";",
"//noinspection ConstantConditions",
"return",
"fullName",
".",
"getInstance",
"(",
")",
";",
"}"
] |
Gets the instance id.
|
[
"Gets",
"the",
"instance",
"id",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Cluster.java#L118-L125
|
12,489
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Cluster.java
|
Cluster.getZone
|
@SuppressWarnings("WeakerAccess")
public String getZone() {
LocationName location = Verify.verifyNotNull(LocationName.parse(stateProto.getLocation()));
//noinspection ConstantConditions
return location.getLocation();
}
|
java
|
@SuppressWarnings("WeakerAccess")
public String getZone() {
LocationName location = Verify.verifyNotNull(LocationName.parse(stateProto.getLocation()));
//noinspection ConstantConditions
return location.getLocation();
}
|
[
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"String",
"getZone",
"(",
")",
"{",
"LocationName",
"location",
"=",
"Verify",
".",
"verifyNotNull",
"(",
"LocationName",
".",
"parse",
"(",
"stateProto",
".",
"getLocation",
"(",
")",
")",
")",
";",
"//noinspection ConstantConditions",
"return",
"location",
".",
"getLocation",
"(",
")",
";",
"}"
] |
Get the zone where this cluster is located.
|
[
"Get",
"the",
"zone",
"where",
"this",
"cluster",
"is",
"located",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Cluster.java#L128-L133
|
12,490
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java
|
AutoscalerClient.patchAutoscaler
|
@BetaApi
public final Operation patchAutoscaler(
String autoscaler,
ProjectZoneName zone,
Autoscaler autoscalerResource,
List<String> fieldMask) {
PatchAutoscalerHttpRequest request =
PatchAutoscalerHttpRequest.newBuilder()
.setAutoscaler(autoscaler)
.setZone(zone == null ? null : zone.toString())
.setAutoscalerResource(autoscalerResource)
.addAllFieldMask(fieldMask)
.build();
return patchAutoscaler(request);
}
|
java
|
@BetaApi
public final Operation patchAutoscaler(
String autoscaler,
ProjectZoneName zone,
Autoscaler autoscalerResource,
List<String> fieldMask) {
PatchAutoscalerHttpRequest request =
PatchAutoscalerHttpRequest.newBuilder()
.setAutoscaler(autoscaler)
.setZone(zone == null ? null : zone.toString())
.setAutoscalerResource(autoscalerResource)
.addAllFieldMask(fieldMask)
.build();
return patchAutoscaler(request);
}
|
[
"@",
"BetaApi",
"public",
"final",
"Operation",
"patchAutoscaler",
"(",
"String",
"autoscaler",
",",
"ProjectZoneName",
"zone",
",",
"Autoscaler",
"autoscalerResource",
",",
"List",
"<",
"String",
">",
"fieldMask",
")",
"{",
"PatchAutoscalerHttpRequest",
"request",
"=",
"PatchAutoscalerHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setAutoscaler",
"(",
"autoscaler",
")",
".",
"setZone",
"(",
"zone",
"==",
"null",
"?",
"null",
":",
"zone",
".",
"toString",
"(",
")",
")",
".",
"setAutoscalerResource",
"(",
"autoscalerResource",
")",
".",
"addAllFieldMask",
"(",
"fieldMask",
")",
".",
"build",
"(",
")",
";",
"return",
"patchAutoscaler",
"(",
"request",
")",
";",
"}"
] |
Updates an autoscaler in the specified project using the data included in the request. This
method supports PATCH semantics and uses the JSON merge patch format and processing rules.
<p>Sample code:
<pre><code>
try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
String autoscaler = "";
ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = autoscalerClient.patchAutoscaler(autoscaler, zone, autoscalerResource, fieldMask);
}
</code></pre>
@param autoscaler Name of the autoscaler to patch.
@param zone Name of the zone for this request.
@param autoscalerResource Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)
@param fieldMask The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Updates",
"an",
"autoscaler",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
".",
"This",
"method",
"supports",
"PATCH",
"semantics",
"and",
"uses",
"the",
"JSON",
"merge",
"patch",
"format",
"and",
"processing",
"rules",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AutoscalerClient.java#L775-L790
|
12,491
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClient.java
|
RegionInstanceGroupManagerClient.patchRegionInstanceGroupManager
|
@BetaApi
public final Operation patchRegionInstanceGroupManager(
String instanceGroupManager,
InstanceGroupManager instanceGroupManagerResource,
List<String> fieldMask) {
PatchRegionInstanceGroupManagerHttpRequest request =
PatchRegionInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(instanceGroupManager)
.setInstanceGroupManagerResource(instanceGroupManagerResource)
.addAllFieldMask(fieldMask)
.build();
return patchRegionInstanceGroupManager(request);
}
|
java
|
@BetaApi
public final Operation patchRegionInstanceGroupManager(
String instanceGroupManager,
InstanceGroupManager instanceGroupManagerResource,
List<String> fieldMask) {
PatchRegionInstanceGroupManagerHttpRequest request =
PatchRegionInstanceGroupManagerHttpRequest.newBuilder()
.setInstanceGroupManager(instanceGroupManager)
.setInstanceGroupManagerResource(instanceGroupManagerResource)
.addAllFieldMask(fieldMask)
.build();
return patchRegionInstanceGroupManager(request);
}
|
[
"@",
"BetaApi",
"public",
"final",
"Operation",
"patchRegionInstanceGroupManager",
"(",
"String",
"instanceGroupManager",
",",
"InstanceGroupManager",
"instanceGroupManagerResource",
",",
"List",
"<",
"String",
">",
"fieldMask",
")",
"{",
"PatchRegionInstanceGroupManagerHttpRequest",
"request",
"=",
"PatchRegionInstanceGroupManagerHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setInstanceGroupManager",
"(",
"instanceGroupManager",
")",
".",
"setInstanceGroupManagerResource",
"(",
"instanceGroupManagerResource",
")",
".",
"addAllFieldMask",
"(",
"fieldMask",
")",
".",
"build",
"(",
")",
";",
"return",
"patchRegionInstanceGroupManager",
"(",
"request",
")",
";",
"}"
] |
Updates a managed instance group using the information that you specify in the request. This
operation is marked as DONE when the group is patched even if the instances in the group are
still in the process of being patched. You must separately verify the status of the individual
instances with the listmanagedinstances method. This method supports PATCH semantics and uses
the JSON merge patch format and processing rules.
<p>Sample code:
<pre><code>
try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
InstanceGroupManager instanceGroupManagerResource = InstanceGroupManager.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionInstanceGroupManagerClient.patchRegionInstanceGroupManager(instanceGroupManager.toString(), instanceGroupManagerResource, fieldMask);
}
</code></pre>
@param instanceGroupManager The name of the instance group manager.
@param instanceGroupManagerResource An Instance Group Manager resource. (== resource_for
beta.instanceGroupManagers ==) (== resource_for v1.instanceGroupManagers ==) (==
resource_for beta.regionInstanceGroupManagers ==) (== resource_for
v1.regionInstanceGroupManagers ==)
@param fieldMask The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Updates",
"a",
"managed",
"instance",
"group",
"using",
"the",
"information",
"that",
"you",
"specify",
"in",
"the",
"request",
".",
"This",
"operation",
"is",
"marked",
"as",
"DONE",
"when",
"the",
"group",
"is",
"patched",
"even",
"if",
"the",
"instances",
"in",
"the",
"group",
"are",
"still",
"in",
"the",
"process",
"of",
"being",
"patched",
".",
"You",
"must",
"separately",
"verify",
"the",
"status",
"of",
"the",
"individual",
"instances",
"with",
"the",
"listmanagedinstances",
"method",
".",
"This",
"method",
"supports",
"PATCH",
"semantics",
"and",
"uses",
"the",
"JSON",
"merge",
"patch",
"format",
"and",
"processing",
"rules",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionInstanceGroupManagerClient.java#L1171-L1184
|
12,492
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentReference.java
|
DocumentReference.extractFirst
|
private <T> ApiFuture<T> extractFirst(ApiFuture<List<T>> results) {
return ApiFutures.transform(
results,
new ApiFunction<List<T>, T>() {
@Override
public T apply(List<T> results) {
return results.isEmpty() ? null : results.get(0);
}
});
}
|
java
|
private <T> ApiFuture<T> extractFirst(ApiFuture<List<T>> results) {
return ApiFutures.transform(
results,
new ApiFunction<List<T>, T>() {
@Override
public T apply(List<T> results) {
return results.isEmpty() ? null : results.get(0);
}
});
}
|
[
"private",
"<",
"T",
">",
"ApiFuture",
"<",
"T",
">",
"extractFirst",
"(",
"ApiFuture",
"<",
"List",
"<",
"T",
">",
">",
"results",
")",
"{",
"return",
"ApiFutures",
".",
"transform",
"(",
"results",
",",
"new",
"ApiFunction",
"<",
"List",
"<",
"T",
">",
",",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"T",
"apply",
"(",
"List",
"<",
"T",
">",
"results",
")",
"{",
"return",
"results",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"results",
".",
"get",
"(",
"0",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Extracts the first result from an ApiFuture with list of results.
@param results A list with results.
@return An ApiFuture with the first WriteResult.
|
[
"Extracts",
"the",
"first",
"result",
"from",
"an",
"ApiFuture",
"with",
"list",
"of",
"results",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentReference.java#L125-L134
|
12,493
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentReference.java
|
DocumentReference.listCollections
|
public Iterable<CollectionReference> listCollections() {
ListCollectionIdsRequest.Builder request = ListCollectionIdsRequest.newBuilder();
request.setParent(path.toString());
final ListCollectionIdsPagedResponse response;
try {
response =
ApiExceptions.callAndTranslateApiException(
firestore.sendRequest(
request.build(), firestore.getClient().listCollectionIdsPagedCallable()));
} catch (ApiException exception) {
throw FirestoreException.apiException(exception);
}
return new Iterable<CollectionReference>() {
@Override
@Nonnull
public Iterator<CollectionReference> iterator() {
final Iterator<String> iterator = response.iterateAll().iterator();
return new Iterator<CollectionReference>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public CollectionReference next() {
return DocumentReference.this.collection(iterator.next());
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
};
}
};
}
|
java
|
public Iterable<CollectionReference> listCollections() {
ListCollectionIdsRequest.Builder request = ListCollectionIdsRequest.newBuilder();
request.setParent(path.toString());
final ListCollectionIdsPagedResponse response;
try {
response =
ApiExceptions.callAndTranslateApiException(
firestore.sendRequest(
request.build(), firestore.getClient().listCollectionIdsPagedCallable()));
} catch (ApiException exception) {
throw FirestoreException.apiException(exception);
}
return new Iterable<CollectionReference>() {
@Override
@Nonnull
public Iterator<CollectionReference> iterator() {
final Iterator<String> iterator = response.iterateAll().iterator();
return new Iterator<CollectionReference>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public CollectionReference next() {
return DocumentReference.this.collection(iterator.next());
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove");
}
};
}
};
}
|
[
"public",
"Iterable",
"<",
"CollectionReference",
">",
"listCollections",
"(",
")",
"{",
"ListCollectionIdsRequest",
".",
"Builder",
"request",
"=",
"ListCollectionIdsRequest",
".",
"newBuilder",
"(",
")",
";",
"request",
".",
"setParent",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"final",
"ListCollectionIdsPagedResponse",
"response",
";",
"try",
"{",
"response",
"=",
"ApiExceptions",
".",
"callAndTranslateApiException",
"(",
"firestore",
".",
"sendRequest",
"(",
"request",
".",
"build",
"(",
")",
",",
"firestore",
".",
"getClient",
"(",
")",
".",
"listCollectionIdsPagedCallable",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"ApiException",
"exception",
")",
"{",
"throw",
"FirestoreException",
".",
"apiException",
"(",
"exception",
")",
";",
"}",
"return",
"new",
"Iterable",
"<",
"CollectionReference",
">",
"(",
")",
"{",
"@",
"Override",
"@",
"Nonnull",
"public",
"Iterator",
"<",
"CollectionReference",
">",
"iterator",
"(",
")",
"{",
"final",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"response",
".",
"iterateAll",
"(",
")",
".",
"iterator",
"(",
")",
";",
"return",
"new",
"Iterator",
"<",
"CollectionReference",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"iterator",
".",
"hasNext",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"CollectionReference",
"next",
"(",
")",
"{",
"return",
"DocumentReference",
".",
"this",
".",
"collection",
"(",
"iterator",
".",
"next",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"remove",
"(",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"remove\"",
")",
";",
"}",
"}",
";",
"}",
"}",
";",
"}"
] |
Fetches the subcollections that are direct children of this document.
@throws FirestoreException if the Iterable could not be initialized.
@return An Iterable that can be used to fetch all subcollections.
|
[
"Fetches",
"the",
"subcollections",
"that",
"are",
"direct",
"children",
"of",
"this",
"document",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentReference.java#L361-L398
|
12,494
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClient.java
|
DataCatalogClient.formatEntryName
|
@Deprecated
public static final String formatEntryName(
String project, String location, String entryGroup, String entry) {
return ENTRY_PATH_TEMPLATE.instantiate(
"project", project,
"location", location,
"entry_group", entryGroup,
"entry", entry);
}
|
java
|
@Deprecated
public static final String formatEntryName(
String project, String location, String entryGroup, String entry) {
return ENTRY_PATH_TEMPLATE.instantiate(
"project", project,
"location", location,
"entry_group", entryGroup,
"entry", entry);
}
|
[
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatEntryName",
"(",
"String",
"project",
",",
"String",
"location",
",",
"String",
"entryGroup",
",",
"String",
"entry",
")",
"{",
"return",
"ENTRY_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"location\"",
",",
"location",
",",
"\"entry_group\"",
",",
"entryGroup",
",",
"\"entry\"",
",",
"entry",
")",
";",
"}"
] |
Formats a string containing the fully-qualified path to represent a entry resource.
@deprecated Use the {@link EntryName} class instead.
|
[
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"entry",
"resource",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datacatalog/src/main/java/com/google/cloud/datacatalog/v1beta1/DataCatalogClient.java#L115-L123
|
12,495
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java
|
AlertPolicyServiceClient.updateAlertPolicy
|
public final AlertPolicy updateAlertPolicy(FieldMask updateMask, AlertPolicy alertPolicy) {
UpdateAlertPolicyRequest request =
UpdateAlertPolicyRequest.newBuilder()
.setUpdateMask(updateMask)
.setAlertPolicy(alertPolicy)
.build();
return updateAlertPolicy(request);
}
|
java
|
public final AlertPolicy updateAlertPolicy(FieldMask updateMask, AlertPolicy alertPolicy) {
UpdateAlertPolicyRequest request =
UpdateAlertPolicyRequest.newBuilder()
.setUpdateMask(updateMask)
.setAlertPolicy(alertPolicy)
.build();
return updateAlertPolicy(request);
}
|
[
"public",
"final",
"AlertPolicy",
"updateAlertPolicy",
"(",
"FieldMask",
"updateMask",
",",
"AlertPolicy",
"alertPolicy",
")",
"{",
"UpdateAlertPolicyRequest",
"request",
"=",
"UpdateAlertPolicyRequest",
".",
"newBuilder",
"(",
")",
".",
"setUpdateMask",
"(",
"updateMask",
")",
".",
"setAlertPolicy",
"(",
"alertPolicy",
")",
".",
"build",
"(",
")",
";",
"return",
"updateAlertPolicy",
"(",
"request",
")",
";",
"}"
] |
Updates an alerting policy. You can either replace the entire policy with a new one or replace
only certain fields in the current alerting policy by specifying the fields to be updated via
`updateMask`. Returns the updated alerting policy.
<p>Sample code:
<pre><code>
try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
FieldMask updateMask = FieldMask.newBuilder().build();
AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
AlertPolicy response = alertPolicyServiceClient.updateAlertPolicy(updateMask, alertPolicy);
}
</code></pre>
@param updateMask Optional. A list of alerting policy field names. If this field is not empty,
each listed field in the existing alerting policy is set to the value of the corresponding
field in the supplied policy (`alert_policy`), or to the field's default value if the field
is not in the supplied alerting policy. Fields not listed retain their previous value.
<p>Examples of valid field masks include `display_name`, `documentation`,
`documentation.content`, `documentation.mime_type`, `user_labels`, `user_label.nameofkey`,
`enabled`, `conditions`, `combiner`, etc.
<p>If this field is empty, then the supplied alerting policy replaces the existing policy.
It is the same as deleting the existing policy and adding the supplied policy, except for
the following:
<p>+ The new policy will have the same `[ALERT_POLICY_ID]` as the former policy. This gives
you continuity with the former policy in your notifications and incidents. + Conditions in
the new policy will keep their former `[CONDITION_ID]` if the supplied condition includes
the `name` field with that `[CONDITION_ID]`. If the supplied condition omits the `name`
field, then a new `[CONDITION_ID]` is created.
@param alertPolicy Required. The updated alerting policy or the updated values for the fields
listed in `update_mask`. If `update_mask` is not empty, any fields in this policy that are
not in `update_mask` are ignored.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Updates",
"an",
"alerting",
"policy",
".",
"You",
"can",
"either",
"replace",
"the",
"entire",
"policy",
"with",
"a",
"new",
"one",
"or",
"replace",
"only",
"certain",
"fields",
"in",
"the",
"current",
"alerting",
"policy",
"by",
"specifying",
"the",
"fields",
"to",
"be",
"updated",
"via",
"updateMask",
".",
"Returns",
"the",
"updated",
"alerting",
"policy",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java#L653-L661
|
12,496
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
|
WebRiskServiceV1Beta1Client.computeThreatListDiff
|
public final ComputeThreatListDiffResponse computeThreatListDiff(
ThreatType threatType,
ByteString versionToken,
ComputeThreatListDiffRequest.Constraints constraints) {
ComputeThreatListDiffRequest request =
ComputeThreatListDiffRequest.newBuilder()
.setThreatType(threatType)
.setVersionToken(versionToken)
.setConstraints(constraints)
.build();
return computeThreatListDiff(request);
}
|
java
|
public final ComputeThreatListDiffResponse computeThreatListDiff(
ThreatType threatType,
ByteString versionToken,
ComputeThreatListDiffRequest.Constraints constraints) {
ComputeThreatListDiffRequest request =
ComputeThreatListDiffRequest.newBuilder()
.setThreatType(threatType)
.setVersionToken(versionToken)
.setConstraints(constraints)
.build();
return computeThreatListDiff(request);
}
|
[
"public",
"final",
"ComputeThreatListDiffResponse",
"computeThreatListDiff",
"(",
"ThreatType",
"threatType",
",",
"ByteString",
"versionToken",
",",
"ComputeThreatListDiffRequest",
".",
"Constraints",
"constraints",
")",
"{",
"ComputeThreatListDiffRequest",
"request",
"=",
"ComputeThreatListDiffRequest",
".",
"newBuilder",
"(",
")",
".",
"setThreatType",
"(",
"threatType",
")",
".",
"setVersionToken",
"(",
"versionToken",
")",
".",
"setConstraints",
"(",
"constraints",
")",
".",
"build",
"(",
")",
";",
"return",
"computeThreatListDiff",
"(",
"request",
")",
";",
"}"
] |
Gets the most recent threat list diffs.
<p>Sample code:
<pre><code>
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ThreatType threatType = ThreatType.THREAT_TYPE_UNSPECIFIED;
ByteString versionToken = ByteString.copyFromUtf8("");
ComputeThreatListDiffRequest.Constraints constraints = ComputeThreatListDiffRequest.Constraints.newBuilder().build();
ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client.computeThreatListDiff(threatType, versionToken, constraints);
}
</code></pre>
@param threatType Required. The ThreatList to update.
@param versionToken The current version token of the client for the requested list (the client
version that was received from the last successful diff).
@param constraints The constraints associated with this request.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"the",
"most",
"recent",
"threat",
"list",
"diffs",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java#L181-L193
|
12,497
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
|
WebRiskServiceV1Beta1Client.searchUris
|
public final SearchUrisResponse searchUris(String uri, List<ThreatType> threatTypes) {
SearchUrisRequest request =
SearchUrisRequest.newBuilder().setUri(uri).addAllThreatTypes(threatTypes).build();
return searchUris(request);
}
|
java
|
public final SearchUrisResponse searchUris(String uri, List<ThreatType> threatTypes) {
SearchUrisRequest request =
SearchUrisRequest.newBuilder().setUri(uri).addAllThreatTypes(threatTypes).build();
return searchUris(request);
}
|
[
"public",
"final",
"SearchUrisResponse",
"searchUris",
"(",
"String",
"uri",
",",
"List",
"<",
"ThreatType",
">",
"threatTypes",
")",
"{",
"SearchUrisRequest",
"request",
"=",
"SearchUrisRequest",
".",
"newBuilder",
"(",
")",
".",
"setUri",
"(",
"uri",
")",
".",
"addAllThreatTypes",
"(",
"threatTypes",
")",
".",
"build",
"(",
")",
";",
"return",
"searchUris",
"(",
"request",
")",
";",
"}"
] |
This method is used to check whether a URI is on a given threatList.
<p>Sample code:
<pre><code>
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
String uri = "";
List<ThreatType> threatTypes = new ArrayList<>();
SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(uri, threatTypes);
}
</code></pre>
@param uri The URI to be checked for matches.
@param threatTypes Required. The ThreatLists to search in.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"This",
"method",
"is",
"used",
"to",
"check",
"whether",
"a",
"URI",
"is",
"on",
"a",
"given",
"threatList",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java#L264-L269
|
12,498
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
|
WebRiskServiceV1Beta1Client.searchHashes
|
public final SearchHashesResponse searchHashes(
ByteString hashPrefix, List<ThreatType> threatTypes) {
SearchHashesRequest request =
SearchHashesRequest.newBuilder()
.setHashPrefix(hashPrefix)
.addAllThreatTypes(threatTypes)
.build();
return searchHashes(request);
}
|
java
|
public final SearchHashesResponse searchHashes(
ByteString hashPrefix, List<ThreatType> threatTypes) {
SearchHashesRequest request =
SearchHashesRequest.newBuilder()
.setHashPrefix(hashPrefix)
.addAllThreatTypes(threatTypes)
.build();
return searchHashes(request);
}
|
[
"public",
"final",
"SearchHashesResponse",
"searchHashes",
"(",
"ByteString",
"hashPrefix",
",",
"List",
"<",
"ThreatType",
">",
"threatTypes",
")",
"{",
"SearchHashesRequest",
"request",
"=",
"SearchHashesRequest",
".",
"newBuilder",
"(",
")",
".",
"setHashPrefix",
"(",
"hashPrefix",
")",
".",
"addAllThreatTypes",
"(",
"threatTypes",
")",
".",
"build",
"(",
")",
";",
"return",
"searchHashes",
"(",
"request",
")",
";",
"}"
] |
Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is
looked up in a threatList and there is a match. The client side threatList only holds partial
hashes so the client must query this method to determine if there is a full hash match of a
threat.
<p>Sample code:
<pre><code>
try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) {
ByteString hashPrefix = ByteString.copyFromUtf8("");
List<ThreatType> threatTypes = new ArrayList<>();
SearchHashesResponse response = webRiskServiceV1Beta1Client.searchHashes(hashPrefix, threatTypes);
}
</code></pre>
@param hashPrefix A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
hash. For JSON requests, this field is base64-encoded.
@param threatTypes Required. The ThreatLists to search in.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Gets",
"the",
"full",
"hashes",
"that",
"match",
"the",
"requested",
"hash",
"prefix",
".",
"This",
"is",
"used",
"after",
"a",
"hash",
"prefix",
"is",
"looked",
"up",
"in",
"a",
"threatList",
"and",
"there",
"is",
"a",
"match",
".",
"The",
"client",
"side",
"threatList",
"only",
"holds",
"partial",
"hashes",
"so",
"the",
"client",
"must",
"query",
"this",
"method",
"to",
"determine",
"if",
"there",
"is",
"a",
"full",
"hash",
"match",
"of",
"a",
"threat",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java#L342-L351
|
12,499
|
googleapis/google-cloud-java
|
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentClient.java
|
InterconnectAttachmentClient.patchInterconnectAttachment
|
@BetaApi
public final Operation patchInterconnectAttachment(
ProjectRegionInterconnectAttachmentName interconnectAttachment,
InterconnectAttachment interconnectAttachmentResource,
List<String> fieldMask) {
PatchInterconnectAttachmentHttpRequest request =
PatchInterconnectAttachmentHttpRequest.newBuilder()
.setInterconnectAttachment(
interconnectAttachment == null ? null : interconnectAttachment.toString())
.setInterconnectAttachmentResource(interconnectAttachmentResource)
.addAllFieldMask(fieldMask)
.build();
return patchInterconnectAttachment(request);
}
|
java
|
@BetaApi
public final Operation patchInterconnectAttachment(
ProjectRegionInterconnectAttachmentName interconnectAttachment,
InterconnectAttachment interconnectAttachmentResource,
List<String> fieldMask) {
PatchInterconnectAttachmentHttpRequest request =
PatchInterconnectAttachmentHttpRequest.newBuilder()
.setInterconnectAttachment(
interconnectAttachment == null ? null : interconnectAttachment.toString())
.setInterconnectAttachmentResource(interconnectAttachmentResource)
.addAllFieldMask(fieldMask)
.build();
return patchInterconnectAttachment(request);
}
|
[
"@",
"BetaApi",
"public",
"final",
"Operation",
"patchInterconnectAttachment",
"(",
"ProjectRegionInterconnectAttachmentName",
"interconnectAttachment",
",",
"InterconnectAttachment",
"interconnectAttachmentResource",
",",
"List",
"<",
"String",
">",
"fieldMask",
")",
"{",
"PatchInterconnectAttachmentHttpRequest",
"request",
"=",
"PatchInterconnectAttachmentHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setInterconnectAttachment",
"(",
"interconnectAttachment",
"==",
"null",
"?",
"null",
":",
"interconnectAttachment",
".",
"toString",
"(",
")",
")",
".",
"setInterconnectAttachmentResource",
"(",
"interconnectAttachmentResource",
")",
".",
"addAllFieldMask",
"(",
"fieldMask",
")",
".",
"build",
"(",
")",
";",
"return",
"patchInterconnectAttachment",
"(",
"request",
")",
";",
"}"
] |
Updates the specified interconnect attachment with the data included in the request. This
method supports PATCH semantics and uses the JSON merge patch format and processing rules.
<p>Sample code:
<pre><code>
try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
InterconnectAttachment interconnectAttachmentResource = InterconnectAttachment.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = interconnectAttachmentClient.patchInterconnectAttachment(interconnectAttachment, interconnectAttachmentResource, fieldMask);
}
</code></pre>
@param interconnectAttachment Name of the interconnect attachment to patch.
@param interconnectAttachmentResource Represents an InterconnectAttachment (VLAN attachment)
resource. For more information, see Creating VLAN Attachments. (== resource_for
beta.interconnectAttachments ==) (== resource_for v1.interconnectAttachments ==)
@param fieldMask The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
|
[
"Updates",
"the",
"specified",
"interconnect",
"attachment",
"with",
"the",
"data",
"included",
"in",
"the",
"request",
".",
"This",
"method",
"supports",
"PATCH",
"semantics",
"and",
"uses",
"the",
"JSON",
"merge",
"patch",
"format",
"and",
"processing",
"rules",
"."
] |
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
|
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentClient.java#L795-L809
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.