1
- /*
2
- * Copyright 2019, Google, LLC.
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * https://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
1
+ // Copyright 2019 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
15
14
'use strict' ;
16
15
17
16
/**
@@ -28,16 +27,19 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
28
27
/*
29
28
* TODO(developer): Uncomment the following lines
30
29
*/
31
- // const organizationId = "1234567777";
32
- const orgName = client . organizationPath ( organizationId ) ;
30
+ // parent: must be in one of the following formats:
31
+ // `organizations/${organization_id}`
32
+ // `projects/${project_id}`
33
+ // `folders/${folder_id}`
34
+ const parent = `organizations/${ organizationId } ` ;
33
35
34
36
const oneDayAgo = new Date ( ) ;
35
37
oneDayAgo . setDate ( oneDayAgo . getDate ( ) - 1 ) ;
36
38
37
39
// Call the API with automatic pagination.
38
40
async function listAssetsAtTime ( ) {
39
41
const [ response ] = await client . listAssets ( {
40
- parent : orgName ,
42
+ parent : parent ,
41
43
filter :
42
44
'security_center_properties.resource_type="google.cloud.resourcemanager.Project"' ,
43
45
// readTime must be in the form of a google.protobuf.Timestamp object
0 commit comments