Skip to content

Commit 775376c

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

File tree

4 files changed

+78
-23
lines changed

4 files changed

+78
-23
lines changed

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

+1-1
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
}
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() {
18+
// [START policytroubleshooter_v1_generated_IamChecker_TroubleshootIamPolicy_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* The information to use for checking whether a member has a permission for a
24+
* resource.
25+
*/
26+
// const accessTuple = {}
27+
28+
// Imports the Policytroubleshooter library
29+
const {IamCheckerClient} = require('@google-cloud/policy-troubleshooter').v1;
30+
31+
// Instantiates a client
32+
const policytroubleshooterClient = new IamCheckerClient();
33+
34+
async function callTroubleshootIamPolicy() {
35+
// Construct request
36+
const request = {};
37+
38+
// Run request
39+
const response = await policytroubleshooterClient.troubleshootIamPolicy(
40+
request
41+
);
42+
console.log(response);
43+
}
44+
45+
callTroubleshootIamPolicy();
46+
// [END policytroubleshooter_v1_generated_IamChecker_TroubleshootIamPolicy_async]
47+
}
48+
49+
process.on('unhandledRejection', err => {
50+
console.error(err.message);
51+
process.exitCode = 1;
52+
});
53+
main(...process.argv.slice(2));

packages/google-cloud-policytroubleshooter/src/v1/iam_checker_client.ts

+21-19
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,25 @@ export class IamCheckerClient {
283283
// -------------------
284284
// -- Service calls --
285285
// -------------------
286+
/**
287+
* Checks whether a member has a specific permission for a specific resource,
288+
* and explains why the member does or does not have that permission.
289+
*
290+
* @param {Object} request
291+
* The request object that will be sent.
292+
* @param {google.cloud.policytroubleshooter.v1.AccessTuple} request.accessTuple
293+
* The information to use for checking whether a member has a permission for a
294+
* resource.
295+
* @param {object} [options]
296+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
297+
* @returns {Promise} - The promise which resolves to an array.
298+
* The first element of the array is an object representing [TroubleshootIamPolicyResponse]{@link google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse}.
299+
* Please see the
300+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
301+
* for more details and examples.
302+
* @example <caption>include:samples/generated/v1/iam_checker.troubleshoot_iam_policy.js</caption>
303+
* region_tag:policytroubleshooter_v1_generated_IamChecker_TroubleshootIamPolicy_async
304+
*/
286305
troubleshootIamPolicy(
287306
request?: protos.google.cloud.policytroubleshooter.v1.ITroubleshootIamPolicyRequest,
288307
options?: CallOptions
@@ -317,25 +336,6 @@ export class IamCheckerClient {
317336
{} | null | undefined
318337
>
319338
): void;
320-
/**
321-
* Checks whether a member has a specific permission for a specific resource,
322-
* and explains why the member does or does not have that permission.
323-
*
324-
* @param {Object} request
325-
* The request object that will be sent.
326-
* @param {google.cloud.policytroubleshooter.v1.AccessTuple} request.accessTuple
327-
* The information to use for checking whether a member has a permission for a
328-
* resource.
329-
* @param {object} [options]
330-
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
331-
* @returns {Promise} - The promise which resolves to an array.
332-
* The first element of the array is an object representing [TroubleshootIamPolicyResponse]{@link google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse}.
333-
* Please see the
334-
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
335-
* for more details and examples.
336-
* @example
337-
* const [response] = await client.troubleshootIamPolicy(request);
338-
*/
339339
troubleshootIamPolicy(
340340
request?: protos.google.cloud.policytroubleshooter.v1.ITroubleshootIamPolicyRequest,
341341
optionsOrCallback?:
@@ -373,6 +373,8 @@ export class IamCheckerClient {
373373
options = optionsOrCallback as CallOptions;
374374
}
375375
options = options || {};
376+
options.otherArgs = options.otherArgs || {};
377+
options.otherArgs.headers = options.otherArgs.headers || {};
376378
this.initialize();
377379
return this.innerApiCalls.troubleshootIamPolicy(request, options, callback);
378380
}

packages/google-cloud-policytroubleshooter/test/gapic_iam_checker_v1.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('v1.IamCheckerClient', () => {
140140
const request = generateSampleMessage(
141141
new protos.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyRequest()
142142
);
143-
const expectedOptions = {};
143+
const expectedOptions = {otherArgs: {headers: {}}};
144144
const expectedResponse = generateSampleMessage(
145145
new protos.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse()
146146
);
@@ -164,7 +164,7 @@ describe('v1.IamCheckerClient', () => {
164164
const request = generateSampleMessage(
165165
new protos.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyRequest()
166166
);
167-
const expectedOptions = {};
167+
const expectedOptions = {otherArgs: {headers: {}}};
168168
const expectedResponse = generateSampleMessage(
169169
new protos.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse()
170170
);
@@ -203,7 +203,7 @@ describe('v1.IamCheckerClient', () => {
203203
const request = generateSampleMessage(
204204
new protos.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyRequest()
205205
);
206-
const expectedOptions = {};
206+
const expectedOptions = {otherArgs: {headers: {}}};
207207
const expectedError = new Error('expected');
208208
client.innerApiCalls.troubleshootIamPolicy = stubSimpleCall(
209209
undefined,

0 commit comments

Comments
 (0)