UNPKG

5.96 kBTypeScriptView Raw
1import * as gax from './gax';
2import { GrpcClient } from './grpc';
3import { GrpcClient as FallbackGrpcClient } from './fallback';
4import { GoogleAuth, OAuth2Client } from 'google-auth-library';
5import { ProjectIdCallback } from 'google-auth-library/build/src/auth/googleauth';
6import * as protos from '../protos/iam_service';
7import { Descriptors, ClientOptions, Callback } from './clientInterface';
8/**
9 * Google Cloud IAM Client.
10 * This is manually written for providing methods [setIamPolicy, getIamPolicy, testIamPerssion] to the generated client.
11 */
12export declare class IamClient {
13 private _terminated;
14 private _opts;
15 private _defaults;
16 private _protos;
17 private _gaxGrpc;
18 auth?: GoogleAuth | OAuth2Client;
19 descriptors: Descriptors;
20 innerApiCalls: {
21 [name: string]: Function;
22 };
23 iamPolicyStub?: Promise<{
24 [name: string]: Function;
25 }>;
26 gaxGrpc: GrpcClient | FallbackGrpcClient;
27 constructor(gaxGrpc: GrpcClient | FallbackGrpcClient, options: ClientOptions);
28 /**
29 * Initialize the client.
30 * Performs asynchronous operations (such as authentication) and prepares the client.
31 * This function will be called automatically when any class method is called for the
32 * first time, but if you need to initialize it before calling an actual method,
33 * feel free to call initialize() directly.
34 *
35 * You can await on this method if you want to make sure the client is initialized.
36 *
37 * @returns {Promise} A promise that resolves to an authenticated service stub.
38 */
39 initialize(): Promise<{
40 [name: string]: Function;
41 }>;
42 /**
43 * The DNS address for this API service.
44 */
45 static get servicePath(): string;
46 /**
47 * The DNS address for this API service - same as servicePath(),
48 * exists for compatibility reasons.
49 */
50 static get apiEndpoint(): string;
51 /**
52 * The port for this API service.
53 */
54 static get port(): number;
55 /**
56 * The scopes needed to make gRPC calls for every method defined
57 * in this service.
58 */
59 static get scopes(): string[];
60 /**
61 * Get the project ID used by this class.
62 * @param {function(Error, string)} callback - the callback to be called with
63 * the current project Id.
64 */
65 getProjectId(): Promise<string>;
66 getProjectId(callback: ProjectIdCallback): void;
67 getIamPolicy(request: protos.google.iam.v1.GetIamPolicyRequest, options?: gax.CallOptions): Promise<protos.google.iam.v1.Policy>;
68 getIamPolicy(request: protos.google.iam.v1.GetIamPolicyRequest, options: gax.CallOptions, callback: Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
69 getIamPolicy(request: protos.google.iam.v1.GetIamPolicyRequest, callback: Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
70 setIamPolicy(request: protos.google.iam.v1.SetIamPolicyRequest, options?: gax.CallOptions): Promise<protos.google.iam.v1.Policy>;
71 setIamPolicy(request: protos.google.iam.v1.SetIamPolicyRequest, options: gax.CallOptions, callback: Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
72 setIamPolicy(request: protos.google.iam.v1.SetIamPolicyRequest, callback: Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
73 testIamPermissions(request: protos.google.iam.v1.TestIamPermissionsRequest, options?: gax.CallOptions): Promise<protos.google.iam.v1.TestIamPermissionsResponse>;
74 testIamPermissions(request: protos.google.iam.v1.TestIamPermissionsRequest, callback: Callback<protos.google.iam.v1.TestIamPermissionsResponse, protos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
75 testIamPermissions(request: protos.google.iam.v1.TestIamPermissionsRequest, options: gax.CallOptions, callback: Callback<protos.google.iam.v1.TestIamPermissionsResponse, protos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
76 /**
77 * Terminate the GRPC channel and close the client.
78 *
79 * The client will no longer be usable and all future behavior is undefined.
80 */
81 close(): Promise<void>;
82}
83export interface IamClient {
84 getIamPolicy(request: protos.google.iam.v1.GetIamPolicyRequest): void;
85 getIamPolicy(request: protos.google.iam.v1.GetIamPolicyRequest, options?: gax.CallOptions | Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<protos.google.iam.v1.Policy>;
86 setIamPolicy(request: protos.google.iam.v1.SetIamPolicyRequest): void;
87 setIamPolicy(request: protos.google.iam.v1.SetIamPolicyRequest, options?: gax.CallOptions | Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<protos.google.iam.v1.Policy, protos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<protos.google.iam.v1.Policy>;
88 testIamPermissions(request: protos.google.iam.v1.TestIamPermissionsRequest): void;
89 testIamPermissions(request: protos.google.iam.v1.TestIamPermissionsRequest, options?: gax.CallOptions | Callback<protos.google.iam.v1.TestIamPermissionsResponse, protos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>, callback?: Callback<protos.google.iam.v1.TestIamPermissionsResponse, protos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): Promise<protos.google.iam.v1.TestIamPermissionsResponse>;
90}