Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate code from googleapis/nodejs-asset #2856

Merged
merged 115 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
2ffddaa
initialize repo
jkwlui Aug 25, 2018
e0ceb0a
add a samples/package.json
jkwlui Aug 25, 2018
49a6b8e
chore: do a little lint cleanup (#53)
JustinBeckwith Nov 19, 2018
05612ff
docs(samples): add quickstart code for ExportAssets (#50)
peter-zheng-g Nov 20, 2018
f26e142
refactor(samples): convert sample tests from ava to mocha (#56)
nareshqlogic Nov 21, 2018
dd0c739
fix: fix the lint rules (#58)
JustinBeckwith Nov 22, 2018
2836bd2
sample: Add quickstart sample code for BatchGetAsstesHistory. (#59)
peter-zheng-g Nov 27, 2018
5d36e18
Release v0.1.1 (#67)
jkwlui Dec 4, 2018
532d97b
fix: fix sample tests (#79)
JustinBeckwith Dec 13, 2018
cc970c2
Release v0.2.0 (#95)
JustinBeckwith Jan 31, 2019
3e661de
fix(deps): update dependency yargs to v13 (#105)
renovate[bot] Feb 12, 2019
d500d5c
chore(deps): update dependency mocha to v6
renovate[bot] Feb 19, 2019
6397357
Release v0.2.1 (#117)
JustinBeckwith Mar 14, 2019
fe0a166
Release @google-cloud/asset v0.3.0 (#121)
jkwlui Mar 20, 2019
03b3d4d
refactor: use execSync for tests (#127)
JustinBeckwith Apr 5, 2019
b76124d
feat: introduces 'expression text', deprecates version field (#143)
yoshi-automation May 10, 2019
7514b4e
docs: use repo-meta to generate README (#130)
JustinBeckwith May 13, 2019
e0ba3bc
chore: release 1.0.0 (#146)
github-actions[bot] May 13, 2019
fe497f6
chore: release 1.1.0 (#158)
yoshi-automation Jun 5, 2019
833ff54
chore: release 1.1.1 (#161)
yoshi-automation Jun 14, 2019
bcad0fb
chore: release 1.1.2 (#164)
yoshi-automation Jun 26, 2019
eeb829a
fix(deps): update dependency @google-cloud/storage to v3 (#168)
renovate-bot Jul 26, 2019
371485d
chore: release 1.1.3 (#169)
yoshi-automation Jul 29, 2019
748fa39
chore: release 1.1.4 (#176)
yoshi-automation Aug 5, 2019
7fdfb53
fix(deps): update dependency yargs to v14
renovate-bot Aug 20, 2019
4baa8b6
feat: introduce v1p2beta1 client (#181)
bcoe Aug 20, 2019
0a5d105
chore: release 1.2.0 (#182)
yoshi-automation Aug 20, 2019
b29c82d
docs: add real time feed api sample code (#184)
cwxie-google Aug 26, 2019
1ae1402
chore: release 1.2.1 (#186)
yoshi-automation Aug 26, 2019
12fb055
chore: release 1.3.0 (#191)
yoshi-automation Sep 16, 2019
55efae4
chore: release 1.4.1 (#209)
release-please[bot] Oct 22, 2019
0f83444
fix(deps): update dependency @google-cloud/storage to v4 (#207)
renovate-bot Nov 8, 2019
8454ad5
chore: release 1.4.2 (#215)
release-please[bot] Nov 13, 2019
68f6336
fix(deps): update dependency yargs to v15 (#222)
renovate-bot Nov 18, 2019
8cf70cc
chore: update license headers
JustinBeckwith Nov 25, 2019
3ae75de
chore: release 1.5.0 (#225)
release-please[bot] Dec 6, 2019
6ba74a4
feat(samples): update real time feed api sample code to use v1 API su…
cwxie-google Dec 18, 2019
94ab045
chore(deps): update dependency mocha to v7 (#241)
renovate-bot Jan 6, 2020
a81fb9f
chore: release 1.6.0
release-please[bot] Jan 6, 2020
6ef7b9c
chore: release 1.6.1 (#252)
release-please[bot] Jan 28, 2020
2ee2b8e
feat!: converts library to TypeScript adding v1p1beta1 surface (#250)
bcoe Jan 30, 2020
54868be
chore: release 2.0.0 (#254)
release-please[bot] Jan 30, 2020
43ba1e9
chore: release 2.0.1 (#262)
release-please[bot] Feb 10, 2020
60f03e1
chore: release 2.1.0 (#265)
release-please[bot] Feb 13, 2020
aeb270e
fix(deps): update dependency uuid to v7
renovate-bot Feb 26, 2020
4f96f43
chore: release 2.2.0 (#271)
release-please[bot] Feb 28, 2020
1f0c895
fix: in rare cases test can take longer than 180,000 timeout (#307)
bcoe Apr 6, 2020
6f88517
chore: linting (#309)
yoshi-automation Apr 10, 2020
2a5aec2
chore: release 3.0.0 (#280)
release-please[bot] Apr 10, 2020
9d42a5a
fix(deps): update dependency uuid to v8 (#325)
renovate-bot May 1, 2020
cec9c24
fix(deps): update dependency @google-cloud/storage to v5 (#330)
renovate-bot May 15, 2020
7f778dd
chore: release 3.1.0 (#324)
release-please[bot] Jun 4, 2020
98ef932
chore(deps): update dependency mocha to v8 (#341)
renovate-bot Jun 11, 2020
26fd32e
docs(samples): add sample code for SearchAllResources and SearchAllIa…
yuyifan-google Jun 16, 2020
106f597
chore: release 3.2.0 (#338)
release-please[bot] Jun 16, 2020
e2d4186
chore: release 3.3.0 (#347)
release-please[bot] Jun 17, 2020
9cd370a
chore: release 3.4.0 (#350)
release-please[bot] Jun 26, 2020
48e6176
feat(samples): add sample code for ListAssets v1p5beta1 (#355)
Larittic-GG Jul 8, 2020
37b2503
chore: release 3.5.0 (#356)
release-please[bot] Jul 10, 2020
a6e073a
chore: release 3.5.1 (#372)
release-please[bot] Jul 27, 2020
a3ea101
chore: release 3.6.0 (#382)
release-please[bot] Aug 14, 2020
440892e
chore: release 3.7.0 (#387)
release-please[bot] Aug 25, 2020
061cbeb
fix(deps): update dependency yargs to v16 (#391)
renovate-bot Sep 9, 2020
86f9508
chore: release 3.7.1 (#396)
release-please[bot] Sep 14, 2020
bfc1d57
chore: release 3.8.0 (#399)
release-please[bot] Sep 17, 2020
57c3140
chore: release 3.9.0 (#413)
release-please[bot] Nov 3, 2020
aef114f
chore: release 3.9.1 (#425)
release-please[bot] Nov 12, 2020
92e3e15
chore: release 3.10.0 (#437)
release-please[bot] Dec 2, 2020
5345aaf
chore: release 3.11.0 (#446)
release-please[bot] Jan 12, 2021
a8a19b8
feat(samples): add samples for analyzeIamPolicy and analyzeIamPolicyL…
donghez-google Jan 28, 2021
8306b02
docs: fix yaml parsing error in comments (#452)
bcoe Feb 8, 2021
c7739a8
chore: release 3.12.0 (#450)
release-please[bot] Feb 9, 2021
b5a147c
chore: release 3.12.1 (#482)
release-please[bot] May 13, 2021
8b09333
chore: release 3.12.2 (#493)
release-please[bot] May 25, 2021
7bc04b3
chore: release 3.13.0 (#494)
release-please[bot] May 26, 2021
06b310b
chore: release 3.14.0 (#506)
release-please[bot] Jun 21, 2021
50f6811
samples: Update asset lib to v1 for ListAssets sample code (#505)
peter-zheng-g Jun 21, 2021
82bd21a
chore: release 3.14.1 (#508)
release-please[bot] Jun 22, 2021
6a9edcf
chore: release 3.15.0 (#516)
release-please[bot] Jun 30, 2021
602371d
chore: release 3.15.1 (#519)
release-please[bot] Jun 30, 2021
fc3b81d
chore: release 3.15.2 (#521)
release-please[bot] Jul 12, 2021
3b79af4
chore: release 3.15.3 (#523)
release-please[bot] Jul 16, 2021
10f2753
chore: release 3.15.4 (#535)
release-please[bot] Aug 11, 2021
f46eab8
chore: release 3.15.5 (#536)
release-please[bot] Aug 13, 2021
3cec5b8
chore: release 3.16.0 (#539)
release-please[bot] Aug 16, 2021
9a4465a
chore: release 3.16.1 (#540)
release-please[bot] Aug 17, 2021
e2a6837
chore: release 3.17.0 (#543)
release-please[bot] Aug 24, 2021
4745ac9
chore: release 3.18.0 (#549)
release-please[bot] Aug 31, 2021
271c50e
chore: release 3.19.0 (#552)
release-please[bot] Sep 7, 2021
caf64d8
samples: add relationship support samples (#560)
lvvvvvf Sep 28, 2021
338b0e0
docs(samples): add auto-generated samples for Node with api short nam…
gcf-owl-bot[bot] Sep 28, 2021
aaff031
test: extend timeout for flaky tests (#567)
bcoe Oct 13, 2021
f0b7f00
chore: release 3.20.0 (#570)
release-please[bot] Oct 19, 2021
8b3f91c
chore: release 3.21.0 (#576)
release-please[bot] Nov 9, 2021
f99111b
chore: release 3.22.0 (#579)
release-please[bot] Nov 12, 2021
d5d79a4
samples: Move sample code end tag to the correct line for GetFeed (#583)
peter-zheng-g Dec 20, 2021
0176b55
chore(main): release 3.23.0 (#603)
release-please[bot] Feb 9, 2022
a692cca
chore(main): release 3.23.1 (#605)
release-please[bot] Feb 15, 2022
c5ea9ad
build!: update library to use Node 12 (#625)
alexander-fenster May 17, 2022
ce5a172
test: increase sample test timeout (#628)
alexander-fenster May 19, 2022
27ff366
fix(deps): update dependency @google-cloud/bigquery to v6 (#630)
renovate-bot Jun 7, 2022
76d415f
fix(deps): update dependency @google-cloud/storage to v6 (#629)
renovate-bot Jun 7, 2022
130f26b
samples: fix compute test, update dependency to V3 (#634)
sofisl Jun 16, 2022
e60c13a
chore(main): release 4.0.0 (#626)
release-please[bot] Jun 17, 2022
a861295
chore(main): release 4.1.0 (#636)
release-please[bot] Jun 30, 2022
1e20b1a
chore(main): release 4.2.0 (#645)
release-please[bot] Aug 23, 2022
231b118
feat: add batchGetEffectiveIamPolicies sample code. (#654)
aaronlichen-hp Sep 2, 2022
3eab51d
fix(deps): update dependency uuid to v9 (#657)
renovate-bot Sep 9, 2022
03272c7
chore(main): release 4.3.0 (#652)
release-please[bot] Sep 13, 2022
d41974f
chore(main): release 4.4.0 (#659)
release-please[bot] Sep 26, 2022
dec876b
chore(main): release 4.5.0 (#671)
release-please[bot] Nov 11, 2022
2b46d8c
Adds workflows config for nodejs-asset
ahrarmonsur Nov 16, 2022
0fab9fe
Removes workflow for asset samples to unblock CI failing due to badly…
ahrarmonsur Nov 17, 2022
96531f0
Merge branch 'main' into nodejs-asset-migration
ahrarmonsur Nov 17, 2022
430d47d
Merge branch 'main' into nodejs-asset-migration
ahrarmonsur Nov 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"appengine/hello-world/flexible",
"appengine/hello-world/standard",
"appengine/memcached",
"apengine/metadata/flexible",
"appengine/metadata/flexible",
"appengine/metadata/standard",
"appengine/pubsub",
"appengine/static-files",
Expand Down
57 changes: 57 additions & 0 deletions asset/snippets/analyzeIamPolicy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2021 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.

'use strict';

// sample-metadata:
// title: Analyze Iam Policy
// description: Analyzes accessible IAM policies that match a request.
// usage: node analyzeIamPolicy

async function main() {
// [START asset_quickstart_analyze_iam_policy]
const util = require('util');
const {AssetServiceClient} = require('@google-cloud/asset');

const client = new AssetServiceClient();
const projectId = await client.getProjectId();

async function analyzeIamPolicy() {
const request = {
analysisQuery: {
scope: `projects/${projectId}`,
resourceSelector: {
fullResourceName: `//cloudresourcemanager.googleapis.com/projects/${projectId}`,
},
options: {
expandGroups: true,
outputGroupEdges: true,
},
},
};

// Handle the operation using the promise pattern.
const result = await client.analyzeIamPolicy(request);
// Do things with with the response.
console.log(util.inspect(result, {depth: null}));
}
// [END asset_quickstart_analyze_iam_policy]
analyzeIamPolicy();
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
71 changes: 71 additions & 0 deletions asset/snippets/analyzeIamPolicyLongrunningBigquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright 2021 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.

'use strict';

// sample-metadata:
// title: Analyze Iam Policy Longrunning and write results to Bigquery
// description: Analyzes accessible IAM policies that match a request.
// usage: node analyzeIamPolicyLongrunningBigquery <dataset_id> <table_prefix>

async function main(datasetId, tablePrefix) {
// [START asset_quickstart_analyze_iam_policy_longrunning_bigquery]
const util = require('util');
const {AssetServiceClient} = require('@google-cloud/asset');

const client = new AssetServiceClient();
const projectId = await client.getProjectId();

async function analyzeIamPolicyLongrunningBigquery() {
// TODO(developer): choose the dataset and table prefix
// const datasetId = ''
// const tablePrefix = ''

const request = {
analysisQuery: {
scope: `projects/${projectId}`,
resourceSelector: {
fullResourceName: `//cloudresourcemanager.googleapis.com/projects/${projectId}`,
},
options: {
expandGroups: true,
outputGroupEdges: true,
},
},
outputConfig: {
bigqueryDestination: {
dataset: `projects/${projectId}/datasets/${datasetId}`,
tablePrefix: tablePrefix,
},
},
};

// Handle the operation using the promise pattern.
const [operation] = await client.analyzeIamPolicyLongrunning(request);

// Operation#promise starts polling for the completion of the operation.
const [result] = await operation.promise();

// Do things with with the response.
console.log(util.inspect(result, {depth: null}));
}
// [END asset_quickstart_analyze_iam_policy_longrunning_bigquery]
analyzeIamPolicyLongrunningBigquery();
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
69 changes: 69 additions & 0 deletions asset/snippets/analyzeIamPolicyLongrunningGcs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2021 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.

'use strict';

// sample-metadata:
// title: Analyze Iam Policy Longrunning and write results to GCS
// description: Analyzes accessible IAM policies that match a request.
// usage: node analyzeIamPolicyLongrunningGcs <gs://my-bucket/my-analysis.json>

async function main(gcsUri) {
// [START asset_quickstart_analyze_iam_policy_longrunning_gcs]
const util = require('util');
const {AssetServiceClient} = require('@google-cloud/asset');

const client = new AssetServiceClient();
const projectId = await client.getProjectId();

async function analyzeIamPolicyLongrunningGcs() {
// TODO(developer): choose the gcs path uri
// const gcsUri = 'Gcs path uri, e.g.: gs://<my_bucket>/<my_analysis_file>'

const request = {
analysisQuery: {
scope: `projects/${projectId}`,
resourceSelector: {
fullResourceName: `//cloudresourcemanager.googleapis.com/projects/${projectId}`,
},
options: {
expandGroups: true,
outputGroupEdges: true,
},
},
outputConfig: {
gcsDestination: {
uri: gcsUri,
},
},
};

// Handle the operation using the promise pattern.
const [operation] = await client.analyzeIamPolicyLongrunning(request);

// Operation#promise starts polling for the completion of the operation.
const [result] = await operation.promise();

// Do things with with the response.
console.log(util.inspect(result, {depth: null}));
}
// [END asset_quickstart_analyze_iam_policy_longrunning_gcs]
analyzeIamPolicyLongrunningGcs();
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
68 changes: 68 additions & 0 deletions asset/snippets/createFeed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2021 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.

'use strict';

// sample-metadata:
// title: Create Feed
// description: Create Feed.
// usage: node createFeed <FEED_ID> "//storage.googleapis.com/<BUCKET_NAME>", projects/<PROJECT_ID>/topics/<TOPIC_ID>, "RESOURCE"

async function main(feedId, assetNames, topicName, contentType) {
// [START asset_quickstart_create_feed]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const feedId = 'my feed';
// const assetNames = '//storage.googleapis.com/<BUCKET_NAME1>,//storage.googleapis.com/<BUCKET_NAME2>';
// const topicName = 'projects/<PROJECT_ID>/topics/<TOPIC_ID>'
// const contentType = 'RESOURCE';

const util = require('util');
const {AssetServiceClient} = require('@google-cloud/asset');

const client = new AssetServiceClient();

async function createFeed() {
const projectId = await client.getProjectId();
// TODO(developer): Choose asset names, such as //storage.googleapis.com/[YOUR_BUCKET_NAME].
// const assetNames = ['ASSET_NAME1', 'ASSET_NAME2', ...];

const request = {
parent: `projects/${projectId}`,
feedId: feedId,
feed: {
assetNames: assetNames.split(','),
contentType: contentType,
feedOutputConfig: {
pubsubDestination: {
topic: topicName,
},
},
},
};

// Handle the operation using the promise pattern.
const result = await client.createFeed(request);
// Do things with with the response.
console.log(util.inspect(result, {depth: null}));
// [END asset_quickstart_create_feed]
}
createFeed();
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
46 changes: 46 additions & 0 deletions asset/snippets/deleteFeed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2019 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.

'use strict';

// sample-metadata:
// title: Delete Feed
// description: Delete Feed.
// usage: node deleteFeed "project/<PROJECT_NUMBER>/feeds/<FEED_ID>"

async function main(feedName) {
// [START asset_quickstart_delete_feed]
const util = require('util');
const {AssetServiceClient} = require('@google-cloud/asset');

const client = new AssetServiceClient();

async function deleteFeed() {
const request = {
name: feedName,
};

// Handle the operation using the promise pattern.
const result = await client.deleteFeed(request);
// Do things with with the response.
console.log(util.inspect(result, {depth: null}));
// [END asset_quickstart_delete_feed]
}
deleteFeed();
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
67 changes: 67 additions & 0 deletions asset/snippets/exportAssets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2021 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.

'use strict';

// sample-metadata:
// title: Export Assets
// description: Export asserts to specified dump file path.
// usage: node exportAssets.js <gs://my-bucket/my-assets.txt> <content_type>

async function main(dumpFilePath, contentType) {
// [START asset_quickstart_export_assets]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const dumpFilePath = 'gs://my-bucket/my-assets.txt';
// const contentType = 'RESOURCE';

const {AssetServiceClient} = require('@google-cloud/asset');
const client = new AssetServiceClient();

async function exportAssets() {
const projectId = await client.getProjectId();
const projectResource = `projects/${projectId}`;

// TODO(developer): choose the dump file path
// const dumpFilePath = 'Dump file path, e.g.: gs://<my_bucket>/<my_asset_file>'
const request = {
parent: projectResource,
contentType: contentType,
outputConfig: {
gcsDestination: {
uri: dumpFilePath,
},
},
};

// Handle the operation using the promise pattern.
const [operation] = await client.exportAssets(request);

// Operation#promise starts polling for the completion of the operation.
const [result] = await operation.promise();

// Do things with with the response.
console.log(result);
}
exportAssets().catch(err => {
throw err;
});
// [END asset_quickstart_export_assets]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
Loading