Skip to content
Permalink
Browse files
feat!: switch to ResourceName for IAM methods (#125)
BREAKING CHANGE: This is binary breaking change as the method signatures for the IAM methods have been relaxed from IamResourceName to com.google.api.resourcenames.ResourceName (its parent).

* enable gapic v2 for containeranalysis.
committer: @hzyi-google

PiperOrigin-RevId: 303821111

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Mar 30 14:17:14 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: ad895ce95f1f6d2261fbbc3e8897958294e4f017
Source-Link: googleapis/googleapis@ad895ce

* fix: change config_schema_version to 2.0.0 for containeranalysis v1 gapic config.

committer: @hzyi-google
PiperOrigin-RevId: 304672648

Source-Author: Google APIs <noreply@google.com>
Source-Date: Fri Apr 3 12:40:16 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 0f7b1509a9a452808c3d07fe90fedfcea763d7d5
Source-Link: googleapis/googleapis@0f7b150

* chore: regenerate

* chore: allow resource name change for IAM methods

* chore: allow not using classes from proto-google-cloud-containeranalysis-v1

Co-authored-by: Jeff Ching <chingor@google.com>
  • Loading branch information
yoshi-automation and chingor13 committed Apr 20, 2020
1 parent b9af328 commit 3946bd5e5787bd2f8c3933b00c386b854def2f8b
@@ -11,7 +11,7 @@
<version>0.5.0</version>
</parent>

<name>Google Cloud containeranalysis BOM</name>
<name>Google Cloud Container Analysis BOM</name>
<url>https://github.com/googleapis/java-containeranalysis</url>
<description>
BOM for Google Cloud Container Analysis
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<!-- TODO: remove after 0.120.0 -->
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/devtools/containeranalysis/v1/ContainerAnalysisClient</className>
<method>com.google.iam.v1.* *Iam*(com.google.containeranalysis.v1.IamResourceName*)</method>
<to>com.google.iam.v1.* *Iam*(com.google.api.resourcenames.ResourceName*)</to>
</difference>
</differences>
@@ -115,4 +115,18 @@
</dependencies>
</profile>
</profiles>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<ignoredUnusedDeclaredDependencies>com.google.api.grpc:proto-google-cloud-containeranalysis-v1</ignoredUnusedDeclaredDependencies>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
@@ -18,9 +18,9 @@
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.resourcenames.ResourceName;
import com.google.cloud.devtools.containeranalysis.v1.stub.ContainerAnalysisStub;
import com.google.cloud.devtools.containeranalysis.v1.stub.ContainerAnalysisStubSettings;
import com.google.containeranalysis.v1.IamResourceName;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
@@ -52,7 +52,7 @@
* <pre>
* <code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy policy = Policy.newBuilder().build();
* Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
* }
@@ -185,7 +185,7 @@ public ContainerAnalysisStub getStub() {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy policy = Policy.newBuilder().build();
* Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
* }
@@ -198,7 +198,7 @@ public ContainerAnalysisStub getStub() {
* 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) {
public final Policy setIamPolicy(ResourceName resource, Policy policy) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(resource == null ? null : resource.toString())
@@ -220,7 +220,7 @@ public final Policy setIamPolicy(IamResourceName resource, Policy policy) {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy policy = Policy.newBuilder().build();
* Policy response = containerAnalysisClient.setIamPolicy(resource.toString(), policy);
* }
@@ -252,7 +252,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* ResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy policy = Policy.newBuilder().build();
* SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
* .setResource(resource.toString())
@@ -282,7 +282,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* ResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy policy = Policy.newBuilder().build();
* SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
* .setResource(resource.toString())
@@ -311,7 +311,7 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy response = containerAnalysisClient.getIamPolicy(resource);
* }
* </code></pre>
@@ -320,7 +320,7 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
* operation documentation for the appropriate value for this field.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Policy getIamPolicy(IamResourceName resource) {
public final Policy getIamPolicy(ResourceName resource) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(resource == null ? null : resource.toString())
@@ -341,7 +341,7 @@ public final Policy getIamPolicy(IamResourceName resource) {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy response = containerAnalysisClient.getIamPolicy(resource.toString());
* }
* </code></pre>
@@ -368,7 +368,7 @@ public final Policy getIamPolicy(String resource) {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* ResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
* .setResource(resource.toString())
* .build();
@@ -396,7 +396,7 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* ResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
* .setResource(resource.toString())
* .build();
@@ -422,7 +422,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* List&lt;String&gt; permissions = new ArrayList&lt;&gt;();
* TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(resource, permissions);
* }
@@ -436,7 +436,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TestIamPermissionsResponse testIamPermissions(
IamResourceName resource, List<String> permissions) {
ResourceName resource, List<String> permissions) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(resource == null ? null : resource.toString())
@@ -457,7 +457,7 @@ public final TestIamPermissionsResponse testIamPermissions(
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* List&lt;String&gt; permissions = new ArrayList&lt;&gt;();
* TestIamPermissionsResponse response = containerAnalysisClient.testIamPermissions(resource.toString(), permissions);
* }
@@ -492,7 +492,7 @@ public final TestIamPermissionsResponse testIamPermissions(
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* ResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* List&lt;String&gt; permissions = new ArrayList&lt;&gt;();
* TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
* .setResource(resource.toString())
@@ -521,7 +521,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
*
* <pre><code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* ResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* List&lt;String&gt; permissions = new ArrayList&lt;&gt;();
* TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
* .setResource(resource.toString())
@@ -38,7 +38,7 @@
* <pre>
* <code>
* try (ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.create()) {
* IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
* String resource = "";
* Policy policy = Policy.newBuilder().build();
* Policy response = containerAnalysisClient.setIamPolicy(resource, policy);
* }
@@ -22,8 +22,6 @@
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.containeranalysis.v1.IamResourceName;
import com.google.containeranalysis.v1.NoteName;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
@@ -92,7 +90,7 @@ public void setIamPolicyTest() {
Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build();
mockContainerAnalysis.addResponse(expectedResponse);

IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
String resource = "resource-341064690";
Policy policy = Policy.newBuilder().build();

Policy actualResponse = client.setIamPolicy(resource, policy);
@@ -117,7 +115,7 @@ public void setIamPolicyExceptionTest() throws Exception {
mockContainerAnalysis.addException(exception);

try {
IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
String resource = "resource-341064690";
Policy policy = Policy.newBuilder().build();

client.setIamPolicy(resource, policy);
@@ -135,7 +133,7 @@ public void getIamPolicyTest() {
Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build();
mockContainerAnalysis.addResponse(expectedResponse);

IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
String resource = "resource-341064690";

Policy actualResponse = client.getIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
@@ -158,7 +156,7 @@ public void getIamPolicyExceptionTest() throws Exception {
mockContainerAnalysis.addException(exception);

try {
IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
String resource = "resource-341064690";

client.getIamPolicy(resource);
Assert.fail("No exception raised");
@@ -173,7 +171,7 @@ public void testIamPermissionsTest() {
TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build();
mockContainerAnalysis.addResponse(expectedResponse);

IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
String resource = "resource-341064690";
List<String> permissions = new ArrayList<>();

TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions);
@@ -198,7 +196,7 @@ public void testIamPermissionsExceptionTest() throws Exception {
mockContainerAnalysis.addException(exception);

try {
IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]");
String resource = "resource-341064690";
List<String> permissions = new ArrayList<>();

client.testIamPermissions(resource, permissions);
@@ -3,31 +3,31 @@
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-containeranalysis.git",
"sha": "4962d7de12b02f57cb4b3caeee9d9b57ce09ba78"
"remote": "git@github.com:googleapis/java-containeranalysis.git",
"sha": "e1cb830688e4c1efd3f1be1cbae49cd8a5a326ee"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "0e07113e776bdd8fcc0783372e08bb6e76cb1b5b",
"internalRef": "302892245"
"sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab",
"internalRef": "307114445"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "0e07113e776bdd8fcc0783372e08bb6e76cb1b5b",
"internalRef": "302892245"
"sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab",
"internalRef": "307114445"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "f8a9933e5e98202b04ef427f28d1d79221190fa4"
"sha": "f5e4c17dc78a966dbf29961dd01f9bbd63e20a04"
}
}
],

0 comments on commit 3946bd5

Please sign in to comment.