Skip to content

Commit e952306

Browse files
docs(samples): add example tags to generated samples (#73)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 408439482 Source-Link: googleapis/googleapis@b9f6184 Source-Link: googleapis/googleapis-gen@eb888bc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9
1 parent 89d328f commit e952306

9 files changed

+601
-193
lines changed

packages/google-cloud-orgpolicy/linkinator.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"img.shields.io"
77
],
88
"silent": true,
9-
"concurrency": 10
9+
"concurrency": 5
1010
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2021 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.
14+
15+
'use strict';
16+
17+
function main(parent, policy) {
18+
// [START orgpolicy_v2_generated_OrgPolicy_CreatePolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The Cloud resource that will parent the new Policy. Must be in one of the
24+
* following forms:
25+
* * `projects/{project_number}`
26+
* * `projects/{project_id}`
27+
* * `folders/{folder_id}`
28+
* * `organizations/{organization_id}`
29+
*/
30+
// const parent = 'abc123'
31+
/**
32+
* Required. `Policy` to create.
33+
*/
34+
// const policy = {}
35+
36+
// Imports the Orgpolicy library
37+
const {OrgPolicyClient} = require('@google-cloud/org-policy').v2;
38+
39+
// Instantiates a client
40+
const orgpolicyClient = new OrgPolicyClient();
41+
42+
async function callCreatePolicy() {
43+
// Construct request
44+
const request = {
45+
parent,
46+
policy,
47+
};
48+
49+
// Run request
50+
const response = await orgpolicyClient.createPolicy(request);
51+
console.log(response);
52+
}
53+
54+
callCreatePolicy();
55+
// [END orgpolicy_v2_generated_OrgPolicy_CreatePolicy_async]
56+
}
57+
58+
process.on('unhandledRejection', err => {
59+
console.error(err.message);
60+
process.exitCode = 1;
61+
});
62+
main(...process.argv.slice(2));
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2021 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.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START orgpolicy_v2_generated_OrgPolicy_DeletePolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Name of the policy to delete.
24+
* See `Policy` for naming rules.
25+
*/
26+
// const name = 'abc123'
27+
28+
// Imports the Orgpolicy library
29+
const {OrgPolicyClient} = require('@google-cloud/org-policy').v2;
30+
31+
// Instantiates a client
32+
const orgpolicyClient = new OrgPolicyClient();
33+
34+
async function callDeletePolicy() {
35+
// Construct request
36+
const request = {
37+
name,
38+
};
39+
40+
// Run request
41+
const response = await orgpolicyClient.deletePolicy(request);
42+
console.log(response);
43+
}
44+
45+
callDeletePolicy();
46+
// [END orgpolicy_v2_generated_OrgPolicy_DeletePolicy_async]
47+
}
48+
49+
process.on('unhandledRejection', err => {
50+
console.error(err.message);
51+
process.exitCode = 1;
52+
});
53+
main(...process.argv.slice(2));
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2021 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.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START orgpolicy_v2_generated_OrgPolicy_GetEffectivePolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The effective policy to compute. See `Policy` for naming rules.
24+
*/
25+
// const name = 'abc123'
26+
27+
// Imports the Orgpolicy library
28+
const {OrgPolicyClient} = require('@google-cloud/org-policy').v2;
29+
30+
// Instantiates a client
31+
const orgpolicyClient = new OrgPolicyClient();
32+
33+
async function callGetEffectivePolicy() {
34+
// Construct request
35+
const request = {
36+
name,
37+
};
38+
39+
// Run request
40+
const response = await orgpolicyClient.getEffectivePolicy(request);
41+
console.log(response);
42+
}
43+
44+
callGetEffectivePolicy();
45+
// [END orgpolicy_v2_generated_OrgPolicy_GetEffectivePolicy_async]
46+
}
47+
48+
process.on('unhandledRejection', err => {
49+
console.error(err.message);
50+
process.exitCode = 1;
51+
});
52+
main(...process.argv.slice(2));
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2021 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.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START orgpolicy_v2_generated_OrgPolicy_GetPolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. Resource name of the policy. See `Policy` for naming requirements.
24+
*/
25+
// const name = 'abc123'
26+
27+
// Imports the Orgpolicy library
28+
const {OrgPolicyClient} = require('@google-cloud/org-policy').v2;
29+
30+
// Instantiates a client
31+
const orgpolicyClient = new OrgPolicyClient();
32+
33+
async function callGetPolicy() {
34+
// Construct request
35+
const request = {
36+
name,
37+
};
38+
39+
// Run request
40+
const response = await orgpolicyClient.getPolicy(request);
41+
console.log(response);
42+
}
43+
44+
callGetPolicy();
45+
// [END orgpolicy_v2_generated_OrgPolicy_GetPolicy_async]
46+
}
47+
48+
process.on('unhandledRejection', err => {
49+
console.error(err.message);
50+
process.exitCode = 1;
51+
});
52+
main(...process.argv.slice(2));
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright 2021 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.
14+
15+
'use strict';
16+
17+
function main(parent) {
18+
// [START orgpolicy_v2_generated_OrgPolicy_ListConstraints_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The Cloud resource that parents the constraint. Must be in one of the
24+
* following forms:
25+
* * `projects/{project_number}`
26+
* * `projects/{project_id}`
27+
* * `folders/{folder_id}`
28+
* * `organizations/{organization_id}`
29+
*/
30+
// const parent = 'abc123'
31+
/**
32+
* Size of the pages to be returned. This is currently unsupported and will
33+
* be ignored. The server may at any point start using this field to limit
34+
* page size.
35+
*/
36+
// const pageSize = 1234
37+
/**
38+
* Page token used to retrieve the next page. This is currently unsupported
39+
* and will be ignored. The server may at any point start using this field.
40+
*/
41+
// const pageToken = 'abc123'
42+
43+
// Imports the Orgpolicy library
44+
const {OrgPolicyClient} = require('@google-cloud/org-policy').v2;
45+
46+
// Instantiates a client
47+
const orgpolicyClient = new OrgPolicyClient();
48+
49+
async function callListConstraints() {
50+
// Construct request
51+
const request = {
52+
parent,
53+
};
54+
55+
// Run request
56+
const iterable = await orgpolicyClient.listConstraintsAsync(request);
57+
for await (const response of iterable) {
58+
console.log(response);
59+
}
60+
}
61+
62+
callListConstraints();
63+
// [END orgpolicy_v2_generated_OrgPolicy_ListConstraints_async]
64+
}
65+
66+
process.on('unhandledRejection', err => {
67+
console.error(err.message);
68+
process.exitCode = 1;
69+
});
70+
main(...process.argv.slice(2));
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Copyright 2021 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.
14+
15+
'use strict';
16+
17+
function main(parent) {
18+
// [START orgpolicy_v2_generated_OrgPolicy_ListPolicies_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The target Cloud resource that parents the set of constraints and policies
24+
* that will be returned from this call. Must be in one of the following
25+
* forms:
26+
* * `projects/{project_number}`
27+
* * `projects/{project_id}`
28+
* * `folders/{folder_id}`
29+
* * `organizations/{organization_id}`
30+
*/
31+
// const parent = 'abc123'
32+
/**
33+
* Size of the pages to be returned. This is currently unsupported and will
34+
* be ignored. The server may at any point start using this field to limit
35+
* page size.
36+
*/
37+
// const pageSize = 1234
38+
/**
39+
* Page token used to retrieve the next page. This is currently unsupported
40+
* and will be ignored. The server may at any point start using this field.
41+
*/
42+
// const pageToken = 'abc123'
43+
44+
// Imports the Orgpolicy library
45+
const {OrgPolicyClient} = require('@google-cloud/org-policy').v2;
46+
47+
// Instantiates a client
48+
const orgpolicyClient = new OrgPolicyClient();
49+
50+
async function callListPolicies() {
51+
// Construct request
52+
const request = {
53+
parent,
54+
};
55+
56+
// Run request
57+
const iterable = await orgpolicyClient.listPoliciesAsync(request);
58+
for await (const response of iterable) {
59+
console.log(response);
60+
}
61+
}
62+
63+
callListPolicies();
64+
// [END orgpolicy_v2_generated_OrgPolicy_ListPolicies_async]
65+
}
66+
67+
process.on('unhandledRejection', err => {
68+
console.error(err.message);
69+
process.exitCode = 1;
70+
});
71+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)