Skip to content

Commit

Permalink
feat: [cloudasset] Add client library support for AssetService v1 Sav…
Browse files Browse the repository at this point in the history
…edQuery APIs (#8426)

- [ ] Regenerate this pull request now.

Committer: jeffreyai@

PiperOrigin-RevId: 475366952

Source-Link: googleapis/googleapis@7428dad

Source-Link: googleapis/googleapis-gen@5629e2a
Copy-Tag: eyJwIjoiamF2YS1hc3NldC8uT3dsQm90LnlhbWwiLCJoIjoiNTYyOWUyYWI3Mjg0NDNhMWE2YWJiMDNmMzRmOTI1ZDVjZDRlMGM0NyJ9
  • Loading branch information
gcf-owl-bot[bot] committed Sep 20, 2022
1 parent 1b2c275 commit a25f16a
Show file tree
Hide file tree
Showing 7 changed files with 358 additions and 67 deletions.
61 changes: 4 additions & 57 deletions java-asset/README.md
Expand Up @@ -11,59 +11,28 @@ Java idiomatic client for [Cloud Asset Inventory][product-docs].

## Quickstart

If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:

```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.1.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-asset</artifactId>
</dependency>
</dependencies>

```

If you are using Maven without BOM, add this to your dependencies:
If you are using Maven, add this to your pom.xml file:


```xml
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-asset</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</dependency>

```

If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.1.1')
implementation 'com.google.cloud:google-cloud-asset'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-asset:3.5.0'
implementation 'com.google.cloud:google-cloud-asset:3.6.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-asset" % "3.5.0"
libraryDependencies += "com.google.cloud" % "google-cloud-asset" % "3.6.0"
```

## Authentication
Expand Down Expand Up @@ -101,28 +70,6 @@ use this Cloud Asset Inventory Client Library.



## Samples

Samples are in the [`samples/`](https://github.com/googleapis/java-asset/tree/main/samples) directory.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Analyze Iam Policy Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/AnalyzeIamPolicyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/AnalyzeIamPolicyExample.java) |
| Analyze Iam Policy Longrunning Bigquery Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/AnalyzeIamPolicyLongrunningBigqueryExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/AnalyzeIamPolicyLongrunningBigqueryExample.java) |
| Analyze Iam Policy Longrunning Gcs Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/AnalyzeIamPolicyLongrunningGcsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/AnalyzeIamPolicyLongrunningGcsExample.java) |
| Batch Get Assets History Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java) |
| Create Feed Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/CreateFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/CreateFeedExample.java) |
| Delete Feed Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/DeleteFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/DeleteFeedExample.java) |
| Export Assets Bigquery Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/ExportAssetsBigqueryExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ExportAssetsBigqueryExample.java) |
| Export Assets Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/ExportAssetsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ExportAssetsExample.java) |
| Get Feed Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/GetFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/GetFeedExample.java) |
| List Assets Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/ListAssetsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ListAssetsExample.java) |
| List Feeds Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/ListFeedsExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/ListFeedsExample.java) |
| Search All Iam Policies Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/SearchAllIamPoliciesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/SearchAllIamPoliciesExample.java) |
| Search All Resources Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/SearchAllResourcesExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/SearchAllResourcesExample.java) |
| Update Feed Example | [source code](https://github.com/googleapis/java-asset/blob/main/samples/snippets/src/main/java/com/example/asset/UpdateFeedExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-asset&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/asset/UpdateFeedExample.java) |



## Troubleshooting

Expand Down
Expand Up @@ -1050,28 +1050,28 @@ private static Builder initDefaults(Builder builder) {

builder
.createSavedQuerySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));

builder
.getSavedQuerySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.listSavedQueriesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.updateSavedQuerySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));

builder
.deleteSavedQuerySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.batchGetEffectiveIamPoliciesSettings()
Expand Down
74 changes: 74 additions & 0 deletions java-asset/renovate.json
@@ -0,0 +1,74 @@
{
"extends": [
":separateMajorReleases",
":combinePatchMinorReleases",
":ignoreUnstable",
":prImmediately",
":updateNotScheduled",
":automergeDisabled",
":ignoreModulesAndTests",
":maintainLockFilesDisabled",
":autodetectPinVersions"
],
"packageRules": [
{
"packagePatterns": [
"^com.google.guava:"
],
"versionScheme": "docker"
},
{
"packagePatterns": [
"*"
],
"semanticCommitType": "deps",
"semanticCommitScope": null
},
{
"packagePatterns": [
"^org.apache.maven",
"^org.jacoco:",
"^org.codehaus.mojo:",
"^org.sonatype.plugins:",
"^com.coveo:",
"^com.google.cloud:google-cloud-shared-config"
],
"semanticCommitType": "build",
"semanticCommitScope": "deps"
},
{
"packagePatterns": [
"^com.google.cloud:google-cloud-asset",
"^com.google.cloud:libraries-bom",
"^com.google.cloud.samples:shared-configuration"
],
"semanticCommitType": "chore",
"semanticCommitScope": "deps"
},
{
"packagePatterns": [
"^junit:junit",
"^com.google.truth:truth",
"^org.mockito:mockito-core",
"^org.objenesis:objenesis",
"^com.google.cloud:google-cloud-conformance-tests"
],
"semanticCommitType": "test",
"semanticCommitScope": "deps"
},
{
"packagePatterns": [
"^com.google.cloud:google-cloud-"
],
"ignoreUnstable": false
},
{
"packagePatterns": [
"^com.fasterxml.jackson.core"
],
"groupName": "jackson dependencies"
}
],
"semanticCommits": true,
"dependencyDashboard": true
}
84 changes: 84 additions & 0 deletions java-asset/samples/install-without-bom/pom.xml
@@ -0,0 +1,84 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>-install-without-bom</artifactId>
<packaging>jar</packaging>
<name>Google Cloud Asset Inventory Install Without Bom</name>
<url>https://github.com/googleapis/java-asset</url>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.2.0</version>
</parent>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<dependencies>
<!-- [START _install_without_bom] -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-asset</artifactId>
<version>3.6.0</version>
</dependency>
<!-- [END _install_without_bom] -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>1.1.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<!-- compile and run all snippet tests -->
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-snippets-source</id>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../snippets/src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-snippets-tests</id>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>../snippets/src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
56 changes: 56 additions & 0 deletions java-asset/samples/pom.xml
@@ -0,0 +1,56 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud--samples</artifactId>
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->
<packaging>pom</packaging>
<name>Google Cloud Asset Inventory Samples Parent</name>
<url>https://github.com/googleapis/java-asset</url>
<description>
Java idiomatic client for Google Cloud Platform services.
</description>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in any way.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.2.0</version>
</parent>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>install-without-bom</module>
<module>snapshot</module>
<module>snippets</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<configuration>
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit a25f16a

Please sign in to comment.