From 48de8a53fa5d39fcbee18deb8ad0bd1652d9e69c Mon Sep 17 00:00:00 2001 From: Michael Darakananda Date: Wed, 22 Aug 2018 15:12:27 -0700 Subject: [PATCH] refresh clients --- .../v1beta1/IamResourceName.java | 23 + .../v1beta1/IamResourceNames.java | 33 + .../containeranalysis/v1beta1/NoteName.java | 2 +- .../v1beta1/OccurrenceName.java | 2 +- .../v1beta1/UntypedIamResourceName.java | 103 +++ .../io/grafeas/v1beta1/IamResourceName.java | 23 + .../io/grafeas/v1beta1/IamResourceNames.java | 33 + .../java/io/grafeas/v1beta1/NoteName.java | 2 +- .../io/grafeas/v1beta1/OccurrenceName.java | 2 +- .../v1beta1/UntypedIamResourceName.java | 103 +++ .../v1beta1/attestation/IamResourceName.java | 23 + .../v1beta1/attestation/IamResourceNames.java | 33 + .../grafeas/v1beta1/attestation/NoteName.java | 2 +- .../v1beta1/attestation/OccurrenceName.java | 2 +- .../attestation/UntypedIamResourceName.java | 103 +++ .../v1beta1/build/IamResourceName.java | 23 + .../v1beta1/build/IamResourceNames.java | 33 + .../io/grafeas/v1beta1/build/NoteName.java | 2 +- .../grafeas/v1beta1/build/OccurrenceName.java | 2 +- .../v1beta1/build/UntypedIamResourceName.java | 103 +++ .../v1beta1/common/IamResourceName.java | 23 + .../v1beta1/common/IamResourceNames.java | 33 + .../io/grafeas/v1beta1/common/NoteName.java | 2 +- .../v1beta1/common/OccurrenceName.java | 2 +- .../common/UntypedIamResourceName.java | 103 +++ .../v1beta1/deployment/IamResourceName.java | 23 + .../v1beta1/deployment/IamResourceNames.java | 33 + .../grafeas/v1beta1/deployment/NoteName.java | 2 +- .../v1beta1/deployment/OccurrenceName.java | 2 +- .../deployment/UntypedIamResourceName.java | 103 +++ .../v1beta1/discovery/IamResourceName.java | 23 + .../v1beta1/discovery/IamResourceNames.java | 33 + .../grafeas/v1beta1/discovery/NoteName.java | 2 +- .../v1beta1/discovery/OccurrenceName.java | 2 +- .../discovery/UntypedIamResourceName.java | 103 +++ .../v1beta1/image/IamResourceName.java | 23 + .../v1beta1/image/IamResourceNames.java | 33 + .../io/grafeas/v1beta1/image/NoteName.java | 2 +- .../grafeas/v1beta1/image/OccurrenceName.java | 2 +- .../v1beta1/image/UntypedIamResourceName.java | 103 +++ .../grafeas/v1beta1/pkg/IamResourceName.java | 23 + .../grafeas/v1beta1/pkg/IamResourceNames.java | 33 + .../java/io/grafeas/v1beta1/pkg/NoteName.java | 2 +- .../grafeas/v1beta1/pkg/OccurrenceName.java | 2 +- .../v1beta1/pkg/UntypedIamResourceName.java | 103 +++ .../v1beta1/provenance/IamResourceName.java | 23 + .../v1beta1/provenance/IamResourceNames.java | 33 + .../grafeas/v1beta1/provenance/NoteName.java | 2 +- .../v1beta1/provenance/OccurrenceName.java | 2 +- .../provenance/UntypedIamResourceName.java | 103 +++ .../v1beta1/source/IamResourceName.java | 23 + .../v1beta1/source/IamResourceNames.java | 33 + .../io/grafeas/v1beta1/source/NoteName.java | 2 +- .../v1beta1/source/OccurrenceName.java | 2 +- .../source/UntypedIamResourceName.java | 103 +++ .../vulnerability/IamResourceName.java | 23 + .../vulnerability/IamResourceNames.java | 33 + .../v1beta1/vulnerability/NoteName.java | 2 +- .../v1beta1/vulnerability/OccurrenceName.java | 2 +- .../vulnerability/UntypedIamResourceName.java | 103 +++ .../ContainerAnalysisV1Beta1Client.java | 342 ++++++--- .../v1beta1/GrafeasV1Beta1Client.java | 674 +++++++++++++----- .../v1beta1/package-info.java | 8 +- .../ContainerAnalysisV1Beta1ClientTest.java | 82 +-- .../v1beta1/GrafeasV1Beta1ClientTest.java | 176 ++--- 65 files changed, 2807 insertions(+), 431 deletions(-) create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/UntypedIamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceName.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceNames.java create mode 100644 google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/UntypedIamResourceName.java diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceName.java new file mode 100644 index 000000000000..53ba6cb90d95 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.containeranalysis.v1beta1; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceNames.java new file mode 100644 index 000000000000..de9c4c11d502 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.containeranalysis.v1beta1; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/NoteName.java index 105199e7c536..a8f3e86ec929 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/OccurrenceName.java index 74b1215c7bf1..75536f0b8aa4 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/UntypedIamResourceName.java new file mode 100644 index 000000000000..e4b14511d3eb --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/com/google/containeranalysis/v1beta1/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.containeranalysis.v1beta1; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceName.java new file mode 100644 index 000000000000..09c7d9366234 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceNames.java new file mode 100644 index 000000000000..603f5fb7f2c7 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/NoteName.java index 373388991494..68137de468f4 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/OccurrenceName.java index 481f48bb96a6..b2b39ed010d7 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/UntypedIamResourceName.java new file mode 100644 index 000000000000..4c6d8880b493 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceName.java new file mode 100644 index 000000000000..ce3df6406c97 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.attestation; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceNames.java new file mode 100644 index 000000000000..71de687b2ba6 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.attestation; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/NoteName.java index 04b6cf013183..75523bb2401e 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/OccurrenceName.java index cb62c7ec61d1..aee6b35066df 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/UntypedIamResourceName.java new file mode 100644 index 000000000000..b5cc35fd438f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/attestation/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.attestation; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceName.java new file mode 100644 index 000000000000..91a46c384f53 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.build; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceNames.java new file mode 100644 index 000000000000..6f057839fea2 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.build; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/NoteName.java index 4694312921d2..1183206b05c2 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/OccurrenceName.java index 788f083c49f5..b48eb627775d 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/UntypedIamResourceName.java new file mode 100644 index 000000000000..455228d50198 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/build/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.build; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceName.java new file mode 100644 index 000000000000..264ca3cb2bb5 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.common; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceNames.java new file mode 100644 index 000000000000..2d44054b6887 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.common; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/NoteName.java index 812442fa6567..103a84e96405 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/OccurrenceName.java index 0d3e7fc3d95d..a6f95e00d31e 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/UntypedIamResourceName.java new file mode 100644 index 000000000000..9d313f43f1d3 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/common/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.common; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceName.java new file mode 100644 index 000000000000..962637d33c95 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.deployment; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceNames.java new file mode 100644 index 000000000000..4264b2a05871 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.deployment; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/NoteName.java index 54f37ff75125..dfb82a65ed6e 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/OccurrenceName.java index eb52dc3acf71..b0c48685f3b5 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/UntypedIamResourceName.java new file mode 100644 index 000000000000..211031491df1 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/deployment/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.deployment; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceName.java new file mode 100644 index 000000000000..464a7be91277 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.discovery; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceNames.java new file mode 100644 index 000000000000..c56f0f229cf1 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.discovery; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/NoteName.java index 5f72776048cf..545db1f72538 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/OccurrenceName.java index 754d5465ddd1..c05b57f1cea3 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/UntypedIamResourceName.java new file mode 100644 index 000000000000..4ae699a6187f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/discovery/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.discovery; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceName.java new file mode 100644 index 000000000000..4c6decbf15a1 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.image; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceNames.java new file mode 100644 index 000000000000..5f264b888b07 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.image; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/NoteName.java index a476c4ab8455..a6878495aae3 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/OccurrenceName.java index d1f0ffec2a59..5d7fb594b90b 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/UntypedIamResourceName.java new file mode 100644 index 000000000000..8a71b014b564 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/image/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.image; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceName.java new file mode 100644 index 000000000000..1db5dba00e9f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.pkg; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceNames.java new file mode 100644 index 000000000000..1f7a381e0e5a --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.pkg; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/NoteName.java index aa9df7fb1667..d9ed719515ea 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/OccurrenceName.java index a98eb3d66a0a..7c9364821f17 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/UntypedIamResourceName.java new file mode 100644 index 000000000000..af5b65a2fd5d --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/pkg/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.pkg; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceName.java new file mode 100644 index 000000000000..d0e52ebf3572 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.provenance; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceNames.java new file mode 100644 index 000000000000..ad5328117412 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.provenance; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/NoteName.java index f680ab9f4ccb..5a427f06b791 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/OccurrenceName.java index b07489a578dd..533b17c33b95 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/UntypedIamResourceName.java new file mode 100644 index 000000000000..7f1ecb22ff87 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/provenance/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.provenance; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceName.java new file mode 100644 index 000000000000..3b25c4e11ee3 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.source; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceNames.java new file mode 100644 index 000000000000..f1d5386368c8 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.source; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/NoteName.java index b5ed572b5010..12a74ed1f586 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/OccurrenceName.java index 74a9f9fdba29..093b3924fb0e 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/UntypedIamResourceName.java new file mode 100644 index 000000000000..2c01fb3f68dd --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/source/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.source; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceName.java new file mode 100644 index 000000000000..5f8ec2256160 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.vulnerability; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class IamResourceName implements ResourceName { + protected IamResourceName() {} +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceNames.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceNames.java new file mode 100644 index 000000000000..2dff0f789771 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/IamResourceNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.vulnerability; + +import com.google.api.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class IamResourceNames { + private IamResourceNames() {} + + public static IamResourceName parse(String resourceNameString) { + if (NoteName.isParsableFrom(resourceNameString)) { + return NoteName.parse(resourceNameString); + } + if (OccurrenceName.isParsableFrom(resourceNameString)) { + return OccurrenceName.parse(resourceNameString); + } + return UntypedIamResourceName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/NoteName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/NoteName.java index ae7aeccf2cd9..b1e67892ad27 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/NoteName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/NoteName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class NoteName implements ResourceName { +public class NoteName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/OccurrenceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/OccurrenceName.java index c298ab50c2aa..f2c123e530c2 100644 --- a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/OccurrenceName.java +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/OccurrenceName.java @@ -24,7 +24,7 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS @javax.annotation.Generated("by GAPIC protoc plugin") -public class OccurrenceName implements ResourceName { +public class OccurrenceName extends IamResourceName { private static final PathTemplate PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); diff --git a/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/UntypedIamResourceName.java b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/UntypedIamResourceName.java new file mode 100644 index 000000000000..e4081a149075 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src/main/java/io/grafeas/v1beta1/vulnerability/UntypedIamResourceName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package io.grafeas.v1beta1.vulnerability; + +import com.google.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedIamResourceName extends IamResourceName { + + private final String rawValue; + private Map valueMap; + + private UntypedIamResourceName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedIamResourceName from(ResourceName resourceName) { + return new UntypedIamResourceName(resourceName.toString()); + } + + public static UntypedIamResourceName parse(String formattedString) { + return new UntypedIamResourceName(formattedString); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (UntypedIamResourceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedIamResourceName) { + UntypedIamResourceName that = (UntypedIamResourceName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java b/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java index e26caf301914..cbb4a1271182 100644 --- a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java +++ b/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java @@ -25,13 +25,15 @@ import com.google.api.gax.paging.AbstractPagedListResponse; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; -import com.google.api.pathtemplate.PathTemplate; import com.google.cloud.devtools.containeranalysis.v1beta1.stub.ContainerAnalysisV1Beta1Stub; import com.google.cloud.devtools.containeranalysis.v1beta1.stub.ContainerAnalysisV1Beta1StubSettings; import com.google.containeranalysis.v1beta1.GetScanConfigRequest; +import com.google.containeranalysis.v1beta1.IamResourceName; import com.google.containeranalysis.v1beta1.ListScanConfigsRequest; import com.google.containeranalysis.v1beta1.ListScanConfigsResponse; +import com.google.containeranalysis.v1beta1.ProjectName; import com.google.containeranalysis.v1beta1.ScanConfig; +import com.google.containeranalysis.v1beta1.ScanConfigName; import com.google.containeranalysis.v1beta1.UpdateScanConfigRequest; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; @@ -63,9 +65,9 @@ *
  * 
  * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
- *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+ *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
  *   Policy policy = Policy.newBuilder().build();
- *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(formattedResource, policy);
+ *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(resource, policy);
  * }
  * 
  * 
@@ -127,64 +129,6 @@ public class ContainerAnalysisV1Beta1Client implements BackgroundResource { private final ContainerAnalysisV1Beta1Settings settings; private final ContainerAnalysisV1Beta1Stub stub; - private static final PathTemplate PROJECT_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}"); - - private static final PathTemplate NOTE_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); - - private static final PathTemplate SCAN_CONFIG_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}/scanConfigs/{scan_config}"); - - /** Formats a string containing the fully-qualified path to represent a project resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); - } - - /** Formats a string containing the fully-qualified path to represent a note resource. */ - public static final String formatNoteName(String project, String note) { - return NOTE_PATH_TEMPLATE.instantiate( - "project", project, - "note", note); - } - - /** Formats a string containing the fully-qualified path to represent a scan_config resource. */ - public static final String formatScanConfigName(String project, String scanConfig) { - return SCAN_CONFIG_PATH_TEMPLATE.instantiate( - "project", project, - "scan_config", scanConfig); - } - - /** Parses the project from the given fully-qualified path which represents a project resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); - } - - /** Parses the project from the given fully-qualified path which represents a note resource. */ - public static final String parseProjectFromNoteName(String noteName) { - return NOTE_PATH_TEMPLATE.parse(noteName).get("project"); - } - - /** Parses the note from the given fully-qualified path which represents a note resource. */ - public static final String parseNoteFromNoteName(String noteName) { - return NOTE_PATH_TEMPLATE.parse(noteName).get("note"); - } - - /** - * Parses the project from the given fully-qualified path which represents a scan_config resource. - */ - public static final String parseProjectFromScanConfigName(String scanConfigName) { - return SCAN_CONFIG_PATH_TEMPLATE.parse(scanConfigName).get("project"); - } - - /** - * Parses the scan_config from the given fully-qualified path which represents a scan_config - * resource. - */ - public static final String parseScanConfigFromScanConfigName(String scanConfigName) { - return SCAN_CONFIG_PATH_TEMPLATE.parse(scanConfigName).get("scan_config"); - } - /** Constructs an instance of ContainerAnalysisV1Beta1Client with default settings. */ public static final ContainerAnalysisV1Beta1Client create() throws IOException { return create(ContainerAnalysisV1Beta1Settings.newBuilder().build()); @@ -248,9 +192,46 @@ public ContainerAnalysisV1Beta1Stub getStub() { * *

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(resource, policy);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. `resource` is + * usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(IamResourceName resource, Policy policy) { + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setPolicy(policy) + .build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified note or occurrence. Requires + * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` + * permission if the resource is a note or an occurrence, respectively. + * + *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. + * + *

Sample code: + * + *


+   * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(formattedResource, policy);
+   *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(resource.toString(), policy);
    * }
    * 
* @@ -263,7 +244,7 @@ public ContainerAnalysisV1Beta1Stub getStub() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy setIamPolicy(String resource, Policy policy) { - NOTE_PATH_TEMPLATE.validate(resource, "setIamPolicy"); + SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); return setIamPolicy(request); @@ -282,10 +263,10 @@ public final Policy setIamPolicy(String resource, Policy policy) { * *

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   Policy policy = Policy.newBuilder().build();
    *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(formattedResource)
+   *     .setResource(resource.toString())
    *     .setPolicy(policy)
    *     .build();
    *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(request);
@@ -312,10 +293,10 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   Policy policy = Policy.newBuilder().build();
    *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(formattedResource)
+   *     .setResource(resource.toString())
    *     .setPolicy(policy)
    *     .build();
    *   ApiFuture<Policy> future = containerAnalysisV1Beta1Client.setIamPolicyCallable().futureCall(request);
@@ -341,8 +322,40 @@ public final UnaryCallable setIamPolicyCallable() {
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
-   *   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(formattedResource);
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
+   *   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(resource);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is + * usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(IamResourceName resource) { + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a note or an occurrence resource. Requires + * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` + * permission if the resource is a note or occurrence, respectively. + * + *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. + * + *

Sample code: + * + *


+   * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
+   *   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(resource.toString());
    * }
    * 
* @@ -352,7 +365,7 @@ public final UnaryCallable setIamPolicyCallable() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(String resource) { - NOTE_PATH_TEMPLATE.validate(resource, "getIamPolicy"); + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); return getIamPolicy(request); } @@ -370,9 +383,9 @@ public final Policy getIamPolicy(String resource) { * *

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(formattedResource)
+   *     .setResource(resource.toString())
    *     .build();
    *   Policy response = containerAnalysisV1Beta1Client.getIamPolicy(request);
    * }
@@ -398,9 +411,9 @@ private final Policy getIamPolicy(GetIamPolicyRequest request) {
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(formattedResource)
+   *     .setResource(resource.toString())
    *     .build();
    *   ApiFuture<Policy> future = containerAnalysisV1Beta1Client.getIamPolicyCallable().futureCall(request);
    *   // Do something
@@ -424,9 +437,46 @@ public final UnaryCallable getIamPolicyCallable() {
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(resource, permissions);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. + * `resource` is usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + IamResourceName resource, List permissions) { + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the permissions that a caller has on the specified note or occurrence. Requires list + * permission on the project (for example, `containeranalysis.notes.list`). + * + *

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. + * + *

Sample code: + * + *


+   * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(formattedResource, permissions);
+   *   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(resource.toString(), permissions);
    * }
    * 
* @@ -440,7 +490,7 @@ public final UnaryCallable getIamPolicyCallable() { */ public final TestIamPermissionsResponse testIamPermissions( String resource, List permissions) { - NOTE_PATH_TEMPLATE.validate(resource, "testIamPermissions"); + TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(resource) @@ -461,10 +511,10 @@ public final TestIamPermissionsResponse testIamPermissions( * *

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   List<String> permissions = new ArrayList<>();
    *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(formattedResource)
+   *     .setResource(resource.toString())
    *     .addAllPermissions(permissions)
    *     .build();
    *   TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.testIamPermissions(request);
@@ -490,10 +540,10 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
    *   List<String> permissions = new ArrayList<>();
    *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(formattedResource)
+   *     .setResource(resource.toString())
    *     .addAllPermissions(permissions)
    *     .build();
    *   ApiFuture<TestIamPermissionsResponse> future = containerAnalysisV1Beta1Client.testIamPermissionsCallable().futureCall(request);
@@ -515,8 +565,32 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedName = ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
-   *   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(formattedName);
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(name);
+   * }
+   * 
+ * + * @param name The name of the scan configuration in the form of + * `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ScanConfig getScanConfig(ScanConfigName name) { + + GetScanConfigRequest request = + GetScanConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getScanConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the specified scan configuration. + * + *

Sample code: + * + *


+   * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(name.toString());
    * }
    * 
* @@ -525,7 +599,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ScanConfig getScanConfig(String name) { - SCAN_CONFIG_PATH_TEMPLATE.validate(name, "getScanConfig"); + GetScanConfigRequest request = GetScanConfigRequest.newBuilder().setName(name).build(); return getScanConfig(request); } @@ -538,9 +612,9 @@ public final ScanConfig getScanConfig(String name) { * *

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedName = ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
    *   GetScanConfigRequest request = GetScanConfigRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ScanConfig response = containerAnalysisV1Beta1Client.getScanConfig(request);
    * }
@@ -561,9 +635,9 @@ private final ScanConfig getScanConfig(GetScanConfigRequest request) {
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedName = ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
    *   GetScanConfigRequest request = GetScanConfigRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<ScanConfig> future = containerAnalysisV1Beta1Client.getScanConfigCallable().futureCall(request);
    *   // Do something
@@ -583,9 +657,39 @@ public final UnaryCallable getScanConfigCallab
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedParent = ContainerAnalysisV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent The name of the project to list scan configurations for in the form of + * `projects/[PROJECT_ID]`. + * @param filter The filter expression. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent, String filter) { + ListScanConfigsRequest request = + ListScanConfigsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setFilter(filter) + .build(); + return listScanConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists scan configurations for the specified project. + * + *

Sample code: + * + *


+   * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   String filter = "";
-   *   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(formattedParent, filter).iterateAll()) {
+   *   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent.toString(), filter).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -597,7 +701,6 @@ public final UnaryCallable getScanConfigCallab
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListScanConfigsPagedResponse listScanConfigs(String parent, String filter) {
-    PROJECT_PATH_TEMPLATE.validate(parent, "listScanConfigs");
     ListScanConfigsRequest request =
         ListScanConfigsRequest.newBuilder().setParent(parent).setFilter(filter).build();
     return listScanConfigs(request);
@@ -611,9 +714,9 @@ public final ListScanConfigsPagedResponse listScanConfigs(String parent, String
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedParent = ContainerAnalysisV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -636,9 +739,9 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedParent = ContainerAnalysisV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListScanConfigsPagedResponse> future = containerAnalysisV1Beta1Client.listScanConfigsPagedCallable().futureCall(request);
    *   // Do something
@@ -661,9 +764,9 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedParent = ContainerAnalysisV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListScanConfigsResponse response = containerAnalysisV1Beta1Client.listScanConfigsCallable().call(request);
@@ -693,9 +796,38 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedName = ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(name, scanConfig);
+   * }
+   * 
+ * + * @param name The name of the scan configuration in the form of + * `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. + * @param scanConfig The updated scan configuration. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ScanConfig updateScanConfig(ScanConfigName name, ScanConfig scanConfig) { + + UpdateScanConfigRequest request = + UpdateScanConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setScanConfig(scanConfig) + .build(); + return updateScanConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified scan configuration. + * + *

Sample code: + * + *


+   * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
    *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
-   *   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(formattedName, scanConfig);
+   *   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(name.toString(), scanConfig);
    * }
    * 
* @@ -705,7 +837,7 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ScanConfig updateScanConfig(String name, ScanConfig scanConfig) { - SCAN_CONFIG_PATH_TEMPLATE.validate(name, "updateScanConfig"); + UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder().setName(name).setScanConfig(scanConfig).build(); return updateScanConfig(request); @@ -719,10 +851,10 @@ public final ScanConfig updateScanConfig(String name, ScanConfig scanConfig) { * *

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedName = ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
    *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
    *   UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .setScanConfig(scanConfig)
    *     .build();
    *   ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(request);
@@ -744,10 +876,10 @@ public final ScanConfig updateScanConfig(UpdateScanConfigRequest request) {
    *
    * 

    * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
-   *   String formattedName = ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
    *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
    *   UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .setScanConfig(scanConfig)
    *     .build();
    *   ApiFuture<ScanConfig> future = containerAnalysisV1Beta1Client.updateScanConfigCallable().futureCall(request);
diff --git a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java b/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
index c55919ba658b..6a36be91cdcd 100644
--- a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
+++ b/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
@@ -25,9 +25,11 @@
 import com.google.api.gax.paging.AbstractPagedListResponse;
 import com.google.api.gax.rpc.PageContext;
 import com.google.api.gax.rpc.UnaryCallable;
-import com.google.api.pathtemplate.PathTemplate;
 import com.google.cloud.devtools.containeranalysis.v1beta1.stub.GrafeasV1Beta1Stub;
 import com.google.cloud.devtools.containeranalysis.v1beta1.stub.GrafeasV1Beta1StubSettings;
+import com.google.containeranalysis.v1beta1.NoteName;
+import com.google.containeranalysis.v1beta1.OccurrenceName;
+import com.google.containeranalysis.v1beta1.ProjectName;
 import com.google.protobuf.Empty;
 import com.google.protobuf.FieldMask;
 import io.grafeas.v1beta1.BatchCreateNotesRequest;
@@ -80,8 +82,8 @@
  * 
  * 
  * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
- *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
- *   Occurrence response = grafeasV1Beta1Client.getOccurrence(formattedName);
+ *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+ *   Occurrence response = grafeasV1Beta1Client.getOccurrence(name);
  * }
  * 
  * 
@@ -142,64 +144,6 @@ public class GrafeasV1Beta1Client implements BackgroundResource { private final GrafeasV1Beta1Settings settings; private final GrafeasV1Beta1Stub stub; - private static final PathTemplate PROJECT_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}"); - - private static final PathTemplate NOTE_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}/notes/{note}"); - - private static final PathTemplate OCCURRENCE_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}/occurrences/{occurrence}"); - - /** Formats a string containing the fully-qualified path to represent a project resource. */ - public static final String formatProjectName(String project) { - return PROJECT_PATH_TEMPLATE.instantiate("project", project); - } - - /** Formats a string containing the fully-qualified path to represent a note resource. */ - public static final String formatNoteName(String project, String note) { - return NOTE_PATH_TEMPLATE.instantiate( - "project", project, - "note", note); - } - - /** Formats a string containing the fully-qualified path to represent a occurrence resource. */ - public static final String formatOccurrenceName(String project, String occurrence) { - return OCCURRENCE_PATH_TEMPLATE.instantiate( - "project", project, - "occurrence", occurrence); - } - - /** Parses the project from the given fully-qualified path which represents a project resource. */ - public static final String parseProjectFromProjectName(String projectName) { - return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); - } - - /** Parses the project from the given fully-qualified path which represents a note resource. */ - public static final String parseProjectFromNoteName(String noteName) { - return NOTE_PATH_TEMPLATE.parse(noteName).get("project"); - } - - /** Parses the note from the given fully-qualified path which represents a note resource. */ - public static final String parseNoteFromNoteName(String noteName) { - return NOTE_PATH_TEMPLATE.parse(noteName).get("note"); - } - - /** - * Parses the project from the given fully-qualified path which represents a occurrence resource. - */ - public static final String parseProjectFromOccurrenceName(String occurrenceName) { - return OCCURRENCE_PATH_TEMPLATE.parse(occurrenceName).get("project"); - } - - /** - * Parses the occurrence from the given fully-qualified path which represents a occurrence - * resource. - */ - public static final String parseOccurrenceFromOccurrenceName(String occurrenceName) { - return OCCURRENCE_PATH_TEMPLATE.parse(occurrenceName).get("occurrence"); - } - /** Constructs an instance of GrafeasV1Beta1Client with default settings. */ public static final GrafeasV1Beta1Client create() throws IOException { return create(GrafeasV1Beta1Settings.newBuilder().build()); @@ -256,8 +200,32 @@ public GrafeasV1Beta1Stub getStub() { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
-   *   Occurrence response = grafeasV1Beta1Client.getOccurrence(formattedName);
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   Occurrence response = grafeasV1Beta1Client.getOccurrence(name);
+   * }
+   * 
+ * + * @param name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Occurrence getOccurrence(OccurrenceName name) { + + GetOccurrenceRequest request = + GetOccurrenceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getOccurrence(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the specified occurrence. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   Occurrence response = grafeasV1Beta1Client.getOccurrence(name.toString());
    * }
    * 
* @@ -266,7 +234,7 @@ public GrafeasV1Beta1Stub getStub() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Occurrence getOccurrence(String name) { - OCCURRENCE_PATH_TEMPLATE.validate(name, "getOccurrence"); + GetOccurrenceRequest request = GetOccurrenceRequest.newBuilder().setName(name).build(); return getOccurrence(request); } @@ -279,9 +247,9 @@ public final Occurrence getOccurrence(String name) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   GetOccurrenceRequest request = GetOccurrenceRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   Occurrence response = grafeasV1Beta1Client.getOccurrence(request);
    * }
@@ -302,9 +270,9 @@ private final Occurrence getOccurrence(GetOccurrenceRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   GetOccurrenceRequest request = GetOccurrenceRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Occurrence> future = grafeasV1Beta1Client.getOccurrenceCallable().futureCall(request);
    *   // Do something
@@ -324,7 +292,7 @@ public final UnaryCallable getOccurrenceCallab
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   String formattedParent = ProjectName.format("[PROJECT]");
    *   String filter = "";
    *   for (Occurrence element : grafeasV1Beta1Client.listOccurrences(formattedParent, filter).iterateAll()) {
    *     // doThingsWith(element);
@@ -338,7 +306,6 @@ public final UnaryCallable getOccurrenceCallab
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListOccurrencesPagedResponse listOccurrences(String parent, String filter) {
-    PROJECT_PATH_TEMPLATE.validate(parent, "listOccurrences");
     ListOccurrencesRequest request =
         ListOccurrencesRequest.newBuilder().setParent(parent).setFilter(filter).build();
     return listOccurrences(request);
@@ -352,7 +319,7 @@ public final ListOccurrencesPagedResponse listOccurrences(String parent, String
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   String formattedParent = ProjectName.format("[PROJECT]");
    *   ListOccurrencesRequest request = ListOccurrencesRequest.newBuilder()
    *     .setParent(formattedParent)
    *     .build();
@@ -377,7 +344,7 @@ public final ListOccurrencesPagedResponse listOccurrences(ListOccurrencesRequest
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   String formattedParent = ProjectName.format("[PROJECT]");
    *   ListOccurrencesRequest request = ListOccurrencesRequest.newBuilder()
    *     .setParent(formattedParent)
    *     .build();
@@ -402,7 +369,7 @@ public final ListOccurrencesPagedResponse listOccurrences(ListOccurrencesRequest
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   String formattedParent = ProjectName.format("[PROJECT]");
    *   ListOccurrencesRequest request = ListOccurrencesRequest.newBuilder()
    *     .setParent(formattedParent)
    *     .build();
@@ -435,8 +402,33 @@ public final ListOccurrencesPagedResponse listOccurrences(ListOccurrencesRequest
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
-   *   grafeasV1Beta1Client.deleteOccurrence(formattedName);
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   grafeasV1Beta1Client.deleteOccurrence(name);
+   * }
+   * 
+ * + * @param name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteOccurrence(OccurrenceName name) { + + DeleteOccurrenceRequest request = + DeleteOccurrenceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteOccurrence(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified occurrence. For example, use this method to delete an occurrence when the + * occurrence is no longer applicable for the given resource. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   grafeasV1Beta1Client.deleteOccurrence(name.toString());
    * }
    * 
* @@ -445,7 +437,7 @@ public final ListOccurrencesPagedResponse listOccurrences(ListOccurrencesRequest * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteOccurrence(String name) { - OCCURRENCE_PATH_TEMPLATE.validate(name, "deleteOccurrence"); + DeleteOccurrenceRequest request = DeleteOccurrenceRequest.newBuilder().setName(name).build(); deleteOccurrence(request); } @@ -459,9 +451,9 @@ public final void deleteOccurrence(String name) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   DeleteOccurrenceRequest request = DeleteOccurrenceRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   grafeasV1Beta1Client.deleteOccurrence(request);
    * }
@@ -483,9 +475,9 @@ private final void deleteOccurrence(DeleteOccurrenceRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   DeleteOccurrenceRequest request = DeleteOccurrenceRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = grafeasV1Beta1Client.deleteOccurrenceCallable().futureCall(request);
    *   // Do something
@@ -505,9 +497,38 @@ public final UnaryCallable deleteOccurrenceCalla
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Occurrence occurrence = Occurrence.newBuilder().build();
-   *   Occurrence response = grafeasV1Beta1Client.createOccurrence(formattedParent, occurrence);
+   *   Occurrence response = grafeasV1Beta1Client.createOccurrence(parent, occurrence);
+   * }
+   * 
+ * + * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the + * occurrence is to be created. + * @param occurrence The occurrence to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Occurrence createOccurrence(ProjectName parent, Occurrence occurrence) { + + CreateOccurrenceRequest request = + CreateOccurrenceRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setOccurrence(occurrence) + .build(); + return createOccurrence(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new occurrence. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Occurrence occurrence = Occurrence.newBuilder().build();
+   *   Occurrence response = grafeasV1Beta1Client.createOccurrence(parent.toString(), occurrence);
    * }
    * 
* @@ -517,7 +538,7 @@ public final UnaryCallable deleteOccurrenceCalla * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Occurrence createOccurrence(String parent, Occurrence occurrence) { - PROJECT_PATH_TEMPLATE.validate(parent, "createOccurrence"); + CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder().setParent(parent).setOccurrence(occurrence).build(); return createOccurrence(request); @@ -531,10 +552,10 @@ public final Occurrence createOccurrence(String parent, Occurrence occurrence) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Occurrence occurrence = Occurrence.newBuilder().build();
    *   CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setOccurrence(occurrence)
    *     .build();
    *   Occurrence response = grafeasV1Beta1Client.createOccurrence(request);
@@ -556,10 +577,10 @@ public final Occurrence createOccurrence(CreateOccurrenceRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Occurrence occurrence = Occurrence.newBuilder().build();
    *   CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setOccurrence(occurrence)
    *     .build();
    *   ApiFuture<Occurrence> future = grafeasV1Beta1Client.createOccurrenceCallable().futureCall(request);
@@ -580,9 +601,39 @@ public final UnaryCallable createOccurrence
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   List<Occurrence> occurrences = new ArrayList<>();
+   *   BatchCreateOccurrencesResponse response = grafeasV1Beta1Client.batchCreateOccurrences(parent, occurrences);
+   * }
+   * 
+ * + * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the + * occurrences are to be created. + * @param occurrences The occurrences to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BatchCreateOccurrencesResponse batchCreateOccurrences( + ProjectName parent, List occurrences) { + + BatchCreateOccurrencesRequest request = + BatchCreateOccurrencesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .addAllOccurrences(occurrences) + .build(); + return batchCreateOccurrences(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates new occurrences in batch. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   List<Occurrence> occurrences = new ArrayList<>();
-   *   BatchCreateOccurrencesResponse response = grafeasV1Beta1Client.batchCreateOccurrences(formattedParent, occurrences);
+   *   BatchCreateOccurrencesResponse response = grafeasV1Beta1Client.batchCreateOccurrences(parent.toString(), occurrences);
    * }
    * 
* @@ -593,7 +644,7 @@ public final UnaryCallable createOccurrence */ public final BatchCreateOccurrencesResponse batchCreateOccurrences( String parent, List occurrences) { - PROJECT_PATH_TEMPLATE.validate(parent, "batchCreateOccurrences"); + BatchCreateOccurrencesRequest request = BatchCreateOccurrencesRequest.newBuilder() .setParent(parent) @@ -610,10 +661,10 @@ public final BatchCreateOccurrencesResponse batchCreateOccurrences( * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   List<Occurrence> occurrences = new ArrayList<>();
    *   BatchCreateOccurrencesRequest request = BatchCreateOccurrencesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .addAllOccurrences(occurrences)
    *     .build();
    *   BatchCreateOccurrencesResponse response = grafeasV1Beta1Client.batchCreateOccurrences(request);
@@ -636,10 +687,10 @@ public final BatchCreateOccurrencesResponse batchCreateOccurrences(
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   List<Occurrence> occurrences = new ArrayList<>();
    *   BatchCreateOccurrencesRequest request = BatchCreateOccurrencesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .addAllOccurrences(occurrences)
    *     .build();
    *   ApiFuture<BatchCreateOccurrencesResponse> future = grafeasV1Beta1Client.batchCreateOccurrencesCallable().futureCall(request);
@@ -661,10 +712,43 @@ public final BatchCreateOccurrencesResponse batchCreateOccurrences(
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   Occurrence occurrence = Occurrence.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Occurrence response = grafeasV1Beta1Client.updateOccurrence(name, occurrence, updateMask);
+   * }
+   * 
+ * + * @param name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @param occurrence The updated occurrence. + * @param updateMask The fields to update. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Occurrence updateOccurrence( + OccurrenceName name, Occurrence occurrence, FieldMask updateMask) { + + UpdateOccurrenceRequest request = + UpdateOccurrenceRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setOccurrence(occurrence) + .setUpdateMask(updateMask) + .build(); + return updateOccurrence(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified occurrence. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   Occurrence occurrence = Occurrence.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Occurrence response = grafeasV1Beta1Client.updateOccurrence(formattedName, occurrence, updateMask);
+   *   Occurrence response = grafeasV1Beta1Client.updateOccurrence(name.toString(), occurrence, updateMask);
    * }
    * 
* @@ -676,7 +760,7 @@ public final BatchCreateOccurrencesResponse batchCreateOccurrences( */ public final Occurrence updateOccurrence( String name, Occurrence occurrence, FieldMask updateMask) { - OCCURRENCE_PATH_TEMPLATE.validate(name, "updateOccurrence"); + UpdateOccurrenceRequest request = UpdateOccurrenceRequest.newBuilder() .setName(name) @@ -694,10 +778,10 @@ public final Occurrence updateOccurrence( * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   Occurrence occurrence = Occurrence.newBuilder().build();
    *   UpdateOccurrenceRequest request = UpdateOccurrenceRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .setOccurrence(occurrence)
    *     .build();
    *   Occurrence response = grafeasV1Beta1Client.updateOccurrence(request);
@@ -719,10 +803,10 @@ public final Occurrence updateOccurrence(UpdateOccurrenceRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   Occurrence occurrence = Occurrence.newBuilder().build();
    *   UpdateOccurrenceRequest request = UpdateOccurrenceRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .setOccurrence(occurrence)
    *     .build();
    *   ApiFuture<Occurrence> future = grafeasV1Beta1Client.updateOccurrenceCallable().futureCall(request);
@@ -744,8 +828,35 @@ public final UnaryCallable updateOccurrence
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
-   *   Note response = grafeasV1Beta1Client.getOccurrenceNote(formattedName);
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   Note response = grafeasV1Beta1Client.getOccurrenceNote(name);
+   * }
+   * 
+ * + * @param name The name of the occurrence in the form of + * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Note getOccurrenceNote(OccurrenceName name) { + + GetOccurrenceNoteRequest request = + GetOccurrenceNoteRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getOccurrenceNote(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the note attached to the specified occurrence. Consumer projects can use this method to + * get a note that belongs to a provider project. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+   *   Note response = grafeasV1Beta1Client.getOccurrenceNote(name.toString());
    * }
    * 
* @@ -754,7 +865,7 @@ public final UnaryCallable updateOccurrence * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Note getOccurrenceNote(String name) { - OCCURRENCE_PATH_TEMPLATE.validate(name, "getOccurrenceNote"); + GetOccurrenceNoteRequest request = GetOccurrenceNoteRequest.newBuilder().setName(name).build(); return getOccurrenceNote(request); } @@ -768,9 +879,9 @@ public final Note getOccurrenceNote(String name) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   GetOccurrenceNoteRequest request = GetOccurrenceNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   Note response = grafeasV1Beta1Client.getOccurrenceNote(request);
    * }
@@ -792,9 +903,9 @@ private final Note getOccurrenceNote(GetOccurrenceNoteRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
+   *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    *   GetOccurrenceNoteRequest request = GetOccurrenceNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Note> future = grafeasV1Beta1Client.getOccurrenceNoteCallable().futureCall(request);
    *   // Do something
@@ -814,8 +925,31 @@ public final UnaryCallable getOccurrenceNoteCall
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
-   *   Note response = grafeasV1Beta1Client.getNote(formattedName);
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
+   *   Note response = grafeasV1Beta1Client.getNote(name);
+   * }
+   * 
+ * + * @param name The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Note getNote(NoteName name) { + + GetNoteRequest request = + GetNoteRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getNote(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the specified note. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
+   *   Note response = grafeasV1Beta1Client.getNote(name.toString());
    * }
    * 
* @@ -823,7 +957,7 @@ public final UnaryCallable getOccurrenceNoteCall * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Note getNote(String name) { - NOTE_PATH_TEMPLATE.validate(name, "getNote"); + GetNoteRequest request = GetNoteRequest.newBuilder().setName(name).build(); return getNote(request); } @@ -836,9 +970,9 @@ public final Note getNote(String name) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   GetNoteRequest request = GetNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   Note response = grafeasV1Beta1Client.getNote(request);
    * }
@@ -859,9 +993,9 @@ private final Note getNote(GetNoteRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   GetNoteRequest request = GetNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Note> future = grafeasV1Beta1Client.getNoteCallable().futureCall(request);
    *   // Do something
@@ -881,9 +1015,38 @@ public final UnaryCallable getNoteCallable() {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   String filter = "";
-   *   for (Note element : grafeasV1Beta1Client.listNotes(formattedParent, filter).iterateAll()) {
+   *   for (Note element : grafeasV1Beta1Client.listNotes(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent The name of the project to list notes for in the form of `projects/[PROJECT_ID]`. + * @param filter The filter expression. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotesPagedResponse listNotes(ProjectName parent, String filter) { + ListNotesRequest request = + ListNotesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setFilter(filter) + .build(); + return listNotes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists notes for the specified project. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   for (Note element : grafeasV1Beta1Client.listNotes(parent.toString(), filter).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -894,7 +1057,6 @@ public final UnaryCallable getNoteCallable() {
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListNotesPagedResponse listNotes(String parent, String filter) {
-    PROJECT_PATH_TEMPLATE.validate(parent, "listNotes");
     ListNotesRequest request =
         ListNotesRequest.newBuilder().setParent(parent).setFilter(filter).build();
     return listNotes(request);
@@ -908,9 +1070,9 @@ public final ListNotesPagedResponse listNotes(String parent, String filter) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListNotesRequest request = ListNotesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (Note element : grafeasV1Beta1Client.listNotes(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -933,9 +1095,9 @@ public final ListNotesPagedResponse listNotes(ListNotesRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListNotesRequest request = ListNotesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListNotesPagedResponse> future = grafeasV1Beta1Client.listNotesPagedCallable().futureCall(request);
    *   // Do something
@@ -957,9 +1119,9 @@ public final UnaryCallable listNotesPa
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListNotesRequest request = ListNotesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListNotesResponse response = grafeasV1Beta1Client.listNotesCallable().call(request);
@@ -988,8 +1150,31 @@ public final UnaryCallable listNotesCallabl
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
-   *   grafeasV1Beta1Client.deleteNote(formattedName);
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
+   *   grafeasV1Beta1Client.deleteNote(name);
+   * }
+   * 
+ * + * @param name The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteNote(NoteName name) { + + DeleteNoteRequest request = + DeleteNoteRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteNote(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes the specified note. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
+   *   grafeasV1Beta1Client.deleteNote(name.toString());
    * }
    * 
* @@ -997,7 +1182,7 @@ public final UnaryCallable listNotesCallabl * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteNote(String name) { - NOTE_PATH_TEMPLATE.validate(name, "deleteNote"); + DeleteNoteRequest request = DeleteNoteRequest.newBuilder().setName(name).build(); deleteNote(request); } @@ -1010,9 +1195,9 @@ public final void deleteNote(String name) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   DeleteNoteRequest request = DeleteNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   grafeasV1Beta1Client.deleteNote(request);
    * }
@@ -1033,9 +1218,9 @@ private final void deleteNote(DeleteNoteRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   DeleteNoteRequest request = DeleteNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = grafeasV1Beta1Client.deleteNoteCallable().futureCall(request);
    *   // Do something
@@ -1055,10 +1240,42 @@ public final UnaryCallable deleteNoteCallable() {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   String noteId = "";
    *   Note note = Note.newBuilder().build();
-   *   Note response = grafeasV1Beta1Client.createNote(formattedParent, noteId, note);
+   *   Note response = grafeasV1Beta1Client.createNote(parent, noteId, note);
+   * }
+   * 
+ * + * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the + * note is to be created. + * @param noteId The ID to use for this note. + * @param note The note to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Note createNote(ProjectName parent, String noteId, Note note) { + + CreateNoteRequest request = + CreateNoteRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setNoteId(noteId) + .setNote(note) + .build(); + return createNote(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new note. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   String noteId = "";
+   *   Note note = Note.newBuilder().build();
+   *   Note response = grafeasV1Beta1Client.createNote(parent.toString(), noteId, note);
    * }
    * 
* @@ -1069,7 +1286,7 @@ public final UnaryCallable deleteNoteCallable() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Note createNote(String parent, String noteId, Note note) { - PROJECT_PATH_TEMPLATE.validate(parent, "createNote"); + CreateNoteRequest request = CreateNoteRequest.newBuilder().setParent(parent).setNoteId(noteId).setNote(note).build(); return createNote(request); @@ -1083,11 +1300,11 @@ public final Note createNote(String parent, String noteId, Note note) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   String noteId = "";
    *   Note note = Note.newBuilder().build();
    *   CreateNoteRequest request = CreateNoteRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setNoteId(noteId)
    *     .setNote(note)
    *     .build();
@@ -1110,11 +1327,11 @@ public final Note createNote(CreateNoteRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   String noteId = "";
    *   Note note = Note.newBuilder().build();
    *   CreateNoteRequest request = CreateNoteRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setNoteId(noteId)
    *     .setNote(note)
    *     .build();
@@ -1136,9 +1353,39 @@ public final UnaryCallable createNoteCallable() {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Map<String, Note> notes = new HashMap<>();
-   *   BatchCreateNotesResponse response = grafeasV1Beta1Client.batchCreateNotes(formattedParent, notes);
+   *   BatchCreateNotesResponse response = grafeasV1Beta1Client.batchCreateNotes(parent, notes);
+   * }
+   * 
+ * + * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the + * notes are to be created. + * @param notes The notes to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BatchCreateNotesResponse batchCreateNotes( + ProjectName parent, Map notes) { + + BatchCreateNotesRequest request = + BatchCreateNotesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .putAllNotes(notes) + .build(); + return batchCreateNotes(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates new notes in batch. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Map<String, Note> notes = new HashMap<>();
+   *   BatchCreateNotesResponse response = grafeasV1Beta1Client.batchCreateNotes(parent.toString(), notes);
    * }
    * 
* @@ -1148,7 +1395,7 @@ public final UnaryCallable createNoteCallable() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BatchCreateNotesResponse batchCreateNotes(String parent, Map notes) { - PROJECT_PATH_TEMPLATE.validate(parent, "batchCreateNotes"); + BatchCreateNotesRequest request = BatchCreateNotesRequest.newBuilder().setParent(parent).putAllNotes(notes).build(); return batchCreateNotes(request); @@ -1162,10 +1409,10 @@ public final BatchCreateNotesResponse batchCreateNotes(String parent, Map * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { - * String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + * ProjectName parent = ProjectName.of("[PROJECT]"); * Map<String, Note> notes = new HashMap<>(); * BatchCreateNotesRequest request = BatchCreateNotesRequest.newBuilder() - * .setParent(formattedParent) + * .setParent(parent.toString()) * .putAllNotes(notes) * .build(); * BatchCreateNotesResponse response = grafeasV1Beta1Client.batchCreateNotes(request); @@ -1187,10 +1434,10 @@ public final BatchCreateNotesResponse batchCreateNotes(BatchCreateNotesRequest r * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   Map<String, Note> notes = new HashMap<>();
    *   BatchCreateNotesRequest request = BatchCreateNotesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .putAllNotes(notes)
    *     .build();
    *   ApiFuture<BatchCreateNotesResponse> future = grafeasV1Beta1Client.batchCreateNotesCallable().futureCall(request);
@@ -1212,10 +1459,41 @@ public final BatchCreateNotesResponse batchCreateNotes(BatchCreateNotesRequest r
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   Note note = Note.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Note response = grafeasV1Beta1Client.updateNote(formattedName, note, updateMask);
+   *   Note response = grafeasV1Beta1Client.updateNote(name, note, updateMask);
+   * }
+   * 
+ * + * @param name The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param note The updated note. + * @param updateMask The fields to update. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Note updateNote(NoteName name, Note note, FieldMask updateMask) { + + UpdateNoteRequest request = + UpdateNoteRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setNote(note) + .setUpdateMask(updateMask) + .build(); + return updateNote(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates the specified note. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
+   *   Note note = Note.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Note response = grafeasV1Beta1Client.updateNote(name.toString(), note, updateMask);
    * }
    * 
* @@ -1225,7 +1503,7 @@ public final BatchCreateNotesResponse batchCreateNotes(BatchCreateNotesRequest r * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Note updateNote(String name, Note note, FieldMask updateMask) { - NOTE_PATH_TEMPLATE.validate(name, "updateNote"); + UpdateNoteRequest request = UpdateNoteRequest.newBuilder() .setName(name) @@ -1243,10 +1521,10 @@ public final Note updateNote(String name, Note note, FieldMask updateMask) { * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   Note note = Note.newBuilder().build();
    *   UpdateNoteRequest request = UpdateNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .setNote(note)
    *     .build();
    *   Note response = grafeasV1Beta1Client.updateNote(request);
@@ -1268,10 +1546,10 @@ public final Note updateNote(UpdateNoteRequest request) {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   Note note = Note.newBuilder().build();
    *   UpdateNoteRequest request = UpdateNoteRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .setNote(note)
    *     .build();
    *   ApiFuture<Note> future = grafeasV1Beta1Client.updateNoteCallable().futureCall(request);
@@ -1293,9 +1571,40 @@ public final UnaryCallable updateNoteCallable() {
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   String filter = "";
-   *   for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(formattedName, filter).iterateAll()) {
+   *   for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The name of the note to list occurrences for in the form of + * `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + * @param filter The filter expression. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNoteOccurrencesPagedResponse listNoteOccurrences(NoteName name, String filter) { + ListNoteOccurrencesRequest request = + ListNoteOccurrencesRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setFilter(filter) + .build(); + return listNoteOccurrences(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists occurrences referencing the specified note. Provider projects can use this method to get + * all occurrences across consumer projects referencing the specified note. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
+   *   String filter = "";
+   *   for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name.toString(), filter).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -1307,7 +1616,6 @@ public final UnaryCallable updateNoteCallable() {
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, String filter) {
-    NOTE_PATH_TEMPLATE.validate(name, "listNoteOccurrences");
     ListNoteOccurrencesRequest request =
         ListNoteOccurrencesRequest.newBuilder().setName(name).setFilter(filter).build();
     return listNoteOccurrences(request);
@@ -1322,9 +1630,9 @@ public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, S
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -1349,9 +1657,9 @@ public final ListNoteOccurrencesPagedResponse listNoteOccurrences(
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<ListNoteOccurrencesPagedResponse> future = grafeasV1Beta1Client.listNoteOccurrencesPagedCallable().futureCall(request);
    *   // Do something
@@ -1375,9 +1683,9 @@ public final ListNoteOccurrencesPagedResponse listNoteOccurrences(
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+   *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
    *   ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   while (true) {
    *     ListNoteOccurrencesResponse response = grafeasV1Beta1Client.listNoteOccurrencesCallable().call(request);
@@ -1407,9 +1715,39 @@ public final ListNoteOccurrencesPagedResponse listNoteOccurrences(
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   VulnerabilityOccurrencesSummary response = grafeasV1Beta1Client.getVulnerabilityOccurrencesSummary(parent, filter);
+   * }
+   * 
+ * + * @param parent The name of the project to get a vulnerability summary for in the form of + * `projects/[PROJECT_ID]`. + * @param filter The filter expression. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( + ProjectName parent, String filter) { + + GetVulnerabilityOccurrencesSummaryRequest request = + GetVulnerabilityOccurrencesSummaryRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setFilter(filter) + .build(); + return getVulnerabilityOccurrencesSummary(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a summary of the number and severity of occurrences. + * + *

Sample code: + * + *


+   * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   String filter = "";
-   *   VulnerabilityOccurrencesSummary response = grafeasV1Beta1Client.getVulnerabilityOccurrencesSummary(formattedParent, filter);
+   *   VulnerabilityOccurrencesSummary response = grafeasV1Beta1Client.getVulnerabilityOccurrencesSummary(parent.toString(), filter);
    * }
    * 
* @@ -1420,7 +1758,7 @@ public final ListNoteOccurrencesPagedResponse listNoteOccurrences( */ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( String parent, String filter) { - PROJECT_PATH_TEMPLATE.validate(parent, "getVulnerabilityOccurrencesSummary"); + GetVulnerabilityOccurrencesSummaryRequest request = GetVulnerabilityOccurrencesSummaryRequest.newBuilder() .setParent(parent) @@ -1437,9 +1775,9 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( * *

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   GetVulnerabilityOccurrencesSummaryRequest request = GetVulnerabilityOccurrencesSummaryRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   VulnerabilityOccurrencesSummary response = grafeasV1Beta1Client.getVulnerabilityOccurrencesSummary(request);
    * }
@@ -1461,9 +1799,9 @@ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary(
    *
    * 

    * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
-   *   String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]");
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   GetVulnerabilityOccurrencesSummaryRequest request = GetVulnerabilityOccurrencesSummaryRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<VulnerabilityOccurrencesSummary> future = grafeasV1Beta1Client.getVulnerabilityOccurrencesSummaryCallable().futureCall(request);
    *   // Do something
diff --git a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/package-info.java b/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/package-info.java
index 4ac289a01a7e..f80cbd0599e9 100644
--- a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/package-info.java
+++ b/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/package-info.java
@@ -38,9 +38,9 @@
  * 
  * 
  * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) {
- *   String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]");
+ *   IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
  *   Policy policy = Policy.newBuilder().build();
- *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(formattedResource, policy);
+ *   Policy response = containerAnalysisV1Beta1Client.setIamPolicy(resource, policy);
  * }
  * 
  * 
@@ -65,8 +65,8 @@ *
  * 
  * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
- *   String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]");
- *   Occurrence response = grafeasV1Beta1Client.getOccurrence(formattedName);
+ *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
+ *   Occurrence response = grafeasV1Beta1Client.getOccurrence(name);
  * }
  * 
  * 
diff --git a/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1ClientTest.java b/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1ClientTest.java index d681b1406768..8f4fda8b057a 100644 --- a/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1ClientTest.java +++ b/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1ClientTest.java @@ -26,9 +26,14 @@ import com.google.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.Lists; import com.google.containeranalysis.v1beta1.GetScanConfigRequest; +import com.google.containeranalysis.v1beta1.IamResourceName; +import com.google.containeranalysis.v1beta1.IamResourceNames; import com.google.containeranalysis.v1beta1.ListScanConfigsRequest; import com.google.containeranalysis.v1beta1.ListScanConfigsResponse; +import com.google.containeranalysis.v1beta1.NoteName; +import com.google.containeranalysis.v1beta1.ProjectName; import com.google.containeranalysis.v1beta1.ScanConfig; +import com.google.containeranalysis.v1beta1.ScanConfigName; import com.google.containeranalysis.v1beta1.UpdateScanConfigRequest; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; @@ -99,17 +104,17 @@ public void setIamPolicyTest() { Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); - String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); Policy policy = Policy.newBuilder().build(); - Policy actualResponse = client.setIamPolicy(formattedResource, policy); + Policy actualResponse = client.setIamPolicy(resource, policy); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); - Assert.assertEquals(formattedResource, actualRequest.getResource()); + Assert.assertEquals(resource, IamResourceNames.parse(actualRequest.getResource())); Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -124,11 +129,10 @@ public void setIamPolicyExceptionTest() throws Exception { mockContainerAnalysisV1Beta1.addException(exception); try { - String formattedResource = - ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); Policy policy = Policy.newBuilder().build(); - client.setIamPolicy(formattedResource, policy); + client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -143,16 +147,16 @@ public void getIamPolicyTest() { Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); - String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); - Policy actualResponse = client.getIamPolicy(formattedResource); + Policy actualResponse = client.getIamPolicy(resource); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); - Assert.assertEquals(formattedResource, actualRequest.getResource()); + Assert.assertEquals(resource, IamResourceNames.parse(actualRequest.getResource())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -166,10 +170,9 @@ public void getIamPolicyExceptionTest() throws Exception { mockContainerAnalysisV1Beta1.addException(exception); try { - String formattedResource = - ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); - client.getIamPolicy(formattedResource); + client.getIamPolicy(resource); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -182,18 +185,17 @@ public void testIamPermissionsTest() { TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); - String formattedResource = ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); List permissions = new ArrayList<>(); - TestIamPermissionsResponse actualResponse = - client.testIamPermissions(formattedResource, permissions); + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); - Assert.assertEquals(formattedResource, actualRequest.getResource()); + Assert.assertEquals(resource, IamResourceNames.parse(actualRequest.getResource())); Assert.assertEquals(permissions, actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -208,11 +210,10 @@ public void testIamPermissionsExceptionTest() throws Exception { mockContainerAnalysisV1Beta1.addException(exception); try { - String formattedResource = - ContainerAnalysisV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); List permissions = new ArrayList<>(); - client.testIamPermissions(formattedResource, permissions); + client.testIamPermissions(resource, permissions); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -222,28 +223,27 @@ public void testIamPermissionsExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getScanConfigTest() { - String name2 = "name2-1052831874"; + ScanConfigName name2 = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); String description = "description-1724546052"; boolean enabled = false; ScanConfig expectedResponse = ScanConfig.newBuilder() - .setName(name2) + .setName(name2.toString()) .setDescription(description) .setEnabled(enabled) .build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); - String formattedName = - ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]"); + ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); - ScanConfig actualResponse = client.getScanConfig(formattedName); + ScanConfig actualResponse = client.getScanConfig(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetScanConfigRequest actualRequest = (GetScanConfigRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -257,10 +257,9 @@ public void getScanConfigExceptionTest() throws Exception { mockContainerAnalysisV1Beta1.addException(exception); try { - String formattedName = - ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]"); + ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); - client.getScanConfig(formattedName); + client.getScanConfig(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -280,11 +279,10 @@ public void listScanConfigsTest() { .build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); - String formattedParent = ContainerAnalysisV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; - ListScanConfigsPagedResponse pagedListResponse = - client.listScanConfigs(formattedParent, filter); + ListScanConfigsPagedResponse pagedListResponse = client.listScanConfigs(parent, filter); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -294,7 +292,7 @@ public void listScanConfigsTest() { Assert.assertEquals(1, actualRequests.size()); ListScanConfigsRequest actualRequest = (ListScanConfigsRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(filter, actualRequest.getFilter()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -309,10 +307,10 @@ public void listScanConfigsExceptionTest() throws Exception { mockContainerAnalysisV1Beta1.addException(exception); try { - String formattedParent = ContainerAnalysisV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; - client.listScanConfigs(formattedParent, filter); + client.listScanConfigs(parent, filter); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -322,29 +320,28 @@ public void listScanConfigsExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void updateScanConfigTest() { - String name2 = "name2-1052831874"; + ScanConfigName name2 = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); String description = "description-1724546052"; boolean enabled = false; ScanConfig expectedResponse = ScanConfig.newBuilder() - .setName(name2) + .setName(name2.toString()) .setDescription(description) .setEnabled(enabled) .build(); mockContainerAnalysisV1Beta1.addResponse(expectedResponse); - String formattedName = - ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]"); + ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); - ScanConfig actualResponse = client.updateScanConfig(formattedName, scanConfig); + ScanConfig actualResponse = client.updateScanConfig(name, scanConfig); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockContainerAnalysisV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateScanConfigRequest actualRequest = (UpdateScanConfigRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ScanConfigName.parse(actualRequest.getName())); Assert.assertEquals(scanConfig, actualRequest.getScanConfig()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -359,11 +356,10 @@ public void updateScanConfigExceptionTest() throws Exception { mockContainerAnalysisV1Beta1.addException(exception); try { - String formattedName = - ContainerAnalysisV1Beta1Client.formatScanConfigName("[PROJECT]", "[SCAN_CONFIG]"); + ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); - client.updateScanConfig(formattedName, scanConfig); + client.updateScanConfig(name, scanConfig); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception diff --git a/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1ClientTest.java b/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1ClientTest.java index 05dd175b5266..2c59d0dec931 100644 --- a/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1ClientTest.java +++ b/google-cloud-clients/google-cloud-containeranalysis/src/test/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1ClientTest.java @@ -27,6 +27,9 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.common.collect.Lists; +import com.google.containeranalysis.v1beta1.NoteName; +import com.google.containeranalysis.v1beta1.OccurrenceName; +import com.google.containeranalysis.v1beta1.ProjectName; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.GeneratedMessageV3; @@ -112,27 +115,27 @@ public void tearDown() throws Exception { @Test @SuppressWarnings("all") public void getOccurrenceTest() { - String name2 = "name2-1052831874"; + OccurrenceName name2 = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); String noteName = "noteName1780787896"; String remediation = "remediation779381797"; Occurrence expectedResponse = Occurrence.newBuilder() - .setName(name2) + .setName(name2.toString()) .setNoteName(noteName) .setRemediation(remediation) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); - Occurrence actualResponse = client.getOccurrence(formattedName); + Occurrence actualResponse = client.getOccurrence(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetOccurrenceRequest actualRequest = (GetOccurrenceRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, OccurrenceName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -146,9 +149,9 @@ public void getOccurrenceExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); - client.getOccurrence(formattedName); + client.getOccurrence(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -168,7 +171,7 @@ public void listOccurrencesTest() { .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + String formattedParent = ProjectName.format("[PROJECT]"); String filter = "filter-1274492040"; ListOccurrencesPagedResponse pagedListResponse = @@ -197,7 +200,7 @@ public void listOccurrencesExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + String formattedParent = ProjectName.format("[PROJECT]"); String filter = "filter-1274492040"; client.listOccurrences(formattedParent, filter); @@ -213,15 +216,15 @@ public void deleteOccurrenceTest() { Empty expectedResponse = Empty.newBuilder().build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); - client.deleteOccurrence(formattedName); + client.deleteOccurrence(name); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteOccurrenceRequest actualRequest = (DeleteOccurrenceRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, OccurrenceName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -235,9 +238,9 @@ public void deleteOccurrenceExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); - client.deleteOccurrence(formattedName); + client.deleteOccurrence(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -247,28 +250,28 @@ public void deleteOccurrenceExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void createOccurrenceTest() { - String name = "name3373707"; + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); String noteName = "noteName1780787896"; String remediation = "remediation779381797"; Occurrence expectedResponse = Occurrence.newBuilder() - .setName(name) + .setName(name.toString()) .setNoteName(noteName) .setRemediation(remediation) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); Occurrence occurrence = Occurrence.newBuilder().build(); - Occurrence actualResponse = client.createOccurrence(formattedParent, occurrence); + Occurrence actualResponse = client.createOccurrence(parent, occurrence); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateOccurrenceRequest actualRequest = (CreateOccurrenceRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(occurrence, actualRequest.getOccurrence()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -283,10 +286,10 @@ public void createOccurrenceExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); Occurrence occurrence = Occurrence.newBuilder().build(); - client.createOccurrence(formattedParent, occurrence); + client.createOccurrence(parent, occurrence); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -300,11 +303,11 @@ public void batchCreateOccurrencesTest() { BatchCreateOccurrencesResponse.newBuilder().build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); List occurrences = new ArrayList<>(); BatchCreateOccurrencesResponse actualResponse = - client.batchCreateOccurrences(formattedParent, occurrences); + client.batchCreateOccurrences(parent, occurrences); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); @@ -312,7 +315,7 @@ public void batchCreateOccurrencesTest() { BatchCreateOccurrencesRequest actualRequest = (BatchCreateOccurrencesRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(occurrences, actualRequest.getOccurrencesList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -327,10 +330,10 @@ public void batchCreateOccurrencesExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); List occurrences = new ArrayList<>(); - client.batchCreateOccurrences(formattedParent, occurrences); + client.batchCreateOccurrences(parent, occurrences); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -340,29 +343,29 @@ public void batchCreateOccurrencesExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void updateOccurrenceTest() { - String name2 = "name2-1052831874"; + OccurrenceName name2 = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); String noteName = "noteName1780787896"; String remediation = "remediation779381797"; Occurrence expectedResponse = Occurrence.newBuilder() - .setName(name2) + .setName(name2.toString()) .setNoteName(noteName) .setRemediation(remediation) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); Occurrence occurrence = Occurrence.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - Occurrence actualResponse = client.updateOccurrence(formattedName, occurrence, updateMask); + Occurrence actualResponse = client.updateOccurrence(name, occurrence, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateOccurrenceRequest actualRequest = (UpdateOccurrenceRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, OccurrenceName.parse(actualRequest.getName())); Assert.assertEquals(occurrence, actualRequest.getOccurrence()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( @@ -378,11 +381,11 @@ public void updateOccurrenceExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); Occurrence occurrence = Occurrence.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateOccurrence(formattedName, occurrence, updateMask); + client.updateOccurrence(name, occurrence, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -392,27 +395,27 @@ public void updateOccurrenceExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getOccurrenceNoteTest() { - String name2 = "name2-1052831874"; + NoteName name2 = NoteName.of("[PROJECT]", "[NOTE]"); String shortDescription = "shortDescription-235369287"; String longDescription = "longDescription-1747792199"; Note expectedResponse = Note.newBuilder() - .setName(name2) + .setName(name2.toString()) .setShortDescription(shortDescription) .setLongDescription(longDescription) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); - Note actualResponse = client.getOccurrenceNote(formattedName); + Note actualResponse = client.getOccurrenceNote(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetOccurrenceNoteRequest actualRequest = (GetOccurrenceNoteRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, OccurrenceName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -426,9 +429,9 @@ public void getOccurrenceNoteExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatOccurrenceName("[PROJECT]", "[OCCURRENCE]"); + OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]"); - client.getOccurrenceNote(formattedName); + client.getOccurrenceNote(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -438,27 +441,27 @@ public void getOccurrenceNoteExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getNoteTest() { - String name2 = "name2-1052831874"; + NoteName name2 = NoteName.of("[PROJECT]", "[NOTE]"); String shortDescription = "shortDescription-235369287"; String longDescription = "longDescription-1747792199"; Note expectedResponse = Note.newBuilder() - .setName(name2) + .setName(name2.toString()) .setShortDescription(shortDescription) .setLongDescription(longDescription) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); - Note actualResponse = client.getNote(formattedName); + Note actualResponse = client.getNote(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetNoteRequest actualRequest = (GetNoteRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, NoteName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -472,9 +475,9 @@ public void getNoteExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); - client.getNote(formattedName); + client.getNote(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -491,10 +494,10 @@ public void listNotesTest() { ListNotesResponse.newBuilder().setNextPageToken(nextPageToken).addAllNotes(notes).build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; - ListNotesPagedResponse pagedListResponse = client.listNotes(formattedParent, filter); + ListNotesPagedResponse pagedListResponse = client.listNotes(parent, filter); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -504,7 +507,7 @@ public void listNotesTest() { Assert.assertEquals(1, actualRequests.size()); ListNotesRequest actualRequest = (ListNotesRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(filter, actualRequest.getFilter()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -519,10 +522,10 @@ public void listNotesExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; - client.listNotes(formattedParent, filter); + client.listNotes(parent, filter); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -535,15 +538,15 @@ public void deleteNoteTest() { Empty expectedResponse = Empty.newBuilder().build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); - client.deleteNote(formattedName); + client.deleteNote(name); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteNoteRequest actualRequest = (DeleteNoteRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, NoteName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -557,9 +560,9 @@ public void deleteNoteExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); - client.deleteNote(formattedName); + client.deleteNote(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -569,29 +572,29 @@ public void deleteNoteExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void createNoteTest() { - String name = "name3373707"; + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); String shortDescription = "shortDescription-235369287"; String longDescription = "longDescription-1747792199"; Note expectedResponse = Note.newBuilder() - .setName(name) + .setName(name.toString()) .setShortDescription(shortDescription) .setLongDescription(longDescription) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String noteId = "noteId2129224840"; Note note = Note.newBuilder().build(); - Note actualResponse = client.createNote(formattedParent, noteId, note); + Note actualResponse = client.createNote(parent, noteId, note); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateNoteRequest actualRequest = (CreateNoteRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(noteId, actualRequest.getNoteId()); Assert.assertEquals(note, actualRequest.getNote()); Assert.assertTrue( @@ -607,11 +610,11 @@ public void createNoteExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String noteId = "noteId2129224840"; Note note = Note.newBuilder().build(); - client.createNote(formattedParent, noteId, note); + client.createNote(parent, noteId, note); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -624,17 +627,17 @@ public void batchCreateNotesTest() { BatchCreateNotesResponse expectedResponse = BatchCreateNotesResponse.newBuilder().build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); Map notes = new HashMap<>(); - BatchCreateNotesResponse actualResponse = client.batchCreateNotes(formattedParent, notes); + BatchCreateNotesResponse actualResponse = client.batchCreateNotes(parent, notes); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); BatchCreateNotesRequest actualRequest = (BatchCreateNotesRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(notes, actualRequest.getNotesMap()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -649,10 +652,10 @@ public void batchCreateNotesExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); Map notes = new HashMap<>(); - client.batchCreateNotes(formattedParent, notes); + client.batchCreateNotes(parent, notes); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -662,29 +665,29 @@ public void batchCreateNotesExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void updateNoteTest() { - String name2 = "name2-1052831874"; + NoteName name2 = NoteName.of("[PROJECT]", "[NOTE]"); String shortDescription = "shortDescription-235369287"; String longDescription = "longDescription-1747792199"; Note expectedResponse = Note.newBuilder() - .setName(name2) + .setName(name2.toString()) .setShortDescription(shortDescription) .setLongDescription(longDescription) .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); Note note = Note.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - Note actualResponse = client.updateNote(formattedName, note, updateMask); + Note actualResponse = client.updateNote(name, note, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateNoteRequest actualRequest = (UpdateNoteRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, NoteName.parse(actualRequest.getName())); Assert.assertEquals(note, actualRequest.getNote()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( @@ -700,11 +703,11 @@ public void updateNoteExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); Note note = Note.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateNote(formattedName, note, updateMask); + client.updateNote(name, note, updateMask); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -724,11 +727,10 @@ public void listNoteOccurrencesTest() { .build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); String filter = "filter-1274492040"; - ListNoteOccurrencesPagedResponse pagedListResponse = - client.listNoteOccurrences(formattedName, filter); + ListNoteOccurrencesPagedResponse pagedListResponse = client.listNoteOccurrences(name, filter); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -738,7 +740,7 @@ public void listNoteOccurrencesTest() { Assert.assertEquals(1, actualRequests.size()); ListNoteOccurrencesRequest actualRequest = (ListNoteOccurrencesRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, NoteName.parse(actualRequest.getName())); Assert.assertEquals(filter, actualRequest.getFilter()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -753,10 +755,10 @@ public void listNoteOccurrencesExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedName = GrafeasV1Beta1Client.formatNoteName("[PROJECT]", "[NOTE]"); + NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); String filter = "filter-1274492040"; - client.listNoteOccurrences(formattedName, filter); + client.listNoteOccurrences(name, filter); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -770,11 +772,11 @@ public void getVulnerabilityOccurrencesSummaryTest() { VulnerabilityOccurrencesSummary.newBuilder().build(); mockGrafeasV1Beta1.addResponse(expectedResponse); - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; VulnerabilityOccurrencesSummary actualResponse = - client.getVulnerabilityOccurrencesSummary(formattedParent, filter); + client.getVulnerabilityOccurrencesSummary(parent, filter); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockGrafeasV1Beta1.getRequests(); @@ -782,7 +784,7 @@ public void getVulnerabilityOccurrencesSummaryTest() { GetVulnerabilityOccurrencesSummaryRequest actualRequest = (GetVulnerabilityOccurrencesSummaryRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); Assert.assertEquals(filter, actualRequest.getFilter()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -797,10 +799,10 @@ public void getVulnerabilityOccurrencesSummaryExceptionTest() throws Exception { mockGrafeasV1Beta1.addException(exception); try { - String formattedParent = GrafeasV1Beta1Client.formatProjectName("[PROJECT]"); + ProjectName parent = ProjectName.of("[PROJECT]"); String filter = "filter-1274492040"; - client.getVulnerabilityOccurrencesSummary(formattedParent, filter); + client.getVulnerabilityOccurrencesSummary(parent, filter); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception