DefinitelyTyped/types/gapi.client.clouduseraccounts/gapi.client.clouduseraccounts-tests.ts
Alexey Bolisov 4f8a3d571b Add Google APIs typings (#19083)
* Add Google APIs typings

* [gapi.cliebt.* ] Add version as part of typings name and fix gapi.client tslint errors

* versions should not get their own folders
fixing a few typos
using /** syntax so comments show up in editors
export only actual (last) version for now

* export only actual (last) version for now

* merge namespaces and remove unnecessary namespace qualifiers

* remove namespace qualifier for gapi.client.Request from nested namespaces and change Request base interface to Promise

* disable await-promise rule

* fix collision between gapi.client.Request and Request from nested namespace
disable no-irregular-whitespace rule

* sort properties and namespace resources

* remove empty comments
sort resources amd methods in tests and readme.md

* update 'this is autogenerated file' banner to remove this text from gapi.client namespace hint
use multiline comments when comment has several lines

* implement no-trailing-whitespace, no-padding, max-line-length, await-promise, no-irregular-whitespace rules

* add strictFunctionTypes to tsconfig

* fix "Whitespace within parentheses is not allowed" rule

* fix ts-lint rules

* fixes

* remove deprecated replicapool and replicapoolupdater api

* fix no-irregular-whitespace

* fix no-irregular-whitespace
2017-10-09 14:55:04 -07:00

170 lines
6.7 KiB
TypeScript

/* This is stub file for gapi.client.{{=it.name}} definition tests */
/* IMPORTANT.
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
**/
gapi.load('client', () => {
/** now we can use gapi.client */
gapi.client.load('clouduseraccounts', 'vm_alpha', () => {
/** now we can use gapi.client.clouduseraccounts */
/** don't forget to authenticate your client before sending any request to resources: */
/** declare client_id registered in Google Developers Console */
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
const scope = [
/** View and manage your data across Google Cloud Platform services */
'https://www.googleapis.com/auth/cloud-platform',
/** View your data across Google Cloud Platform services */
'https://www.googleapis.com/auth/cloud-platform.read-only',
/** Manage your Google Cloud User Accounts */
'https://www.googleapis.com/auth/cloud.useraccounts',
/** View your Google Cloud User Accounts */
'https://www.googleapis.com/auth/cloud.useraccounts.readonly',
];
const immediate = true;
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
if (authResult && !authResult.error) {
/** handle succesfull authorization */
run();
} else {
/** handle authorization error */
}
});
run();
});
async function run() {
/** Deletes the specified operation resource. */
await gapi.client.globalAccountsOperations.delete({
operation: "operation",
project: "project",
});
/** Retrieves the specified operation resource. */
await gapi.client.globalAccountsOperations.get({
operation: "operation",
project: "project",
});
/** Retrieves the list of operation resources contained within the specified project. */
await gapi.client.globalAccountsOperations.list({
filter: "filter",
maxResults: 2,
orderBy: "orderBy",
pageToken: "pageToken",
project: "project",
});
/** Adds users to the specified group. */
await gapi.client.groups.addMember({
groupName: "groupName",
project: "project",
});
/** Deletes the specified Group resource. */
await gapi.client.groups.delete({
groupName: "groupName",
project: "project",
});
/** Returns the specified Group resource. */
await gapi.client.groups.get({
groupName: "groupName",
project: "project",
});
/** Gets the access control policy for a resource. May be empty if no such policy or resource exists. */
await gapi.client.groups.getIamPolicy({
project: "project",
resource: "resource",
});
/** Creates a Group resource in the specified project using the data included in the request. */
await gapi.client.groups.insert({
project: "project",
});
/** Retrieves the list of groups contained within the specified project. */
await gapi.client.groups.list({
filter: "filter",
maxResults: 2,
orderBy: "orderBy",
pageToken: "pageToken",
project: "project",
});
/** Removes users from the specified group. */
await gapi.client.groups.removeMember({
groupName: "groupName",
project: "project",
});
/** Sets the access control policy on the specified resource. Replaces any existing policy. */
await gapi.client.groups.setIamPolicy({
project: "project",
resource: "resource",
});
/** Returns permissions that a caller has on the specified resource. */
await gapi.client.groups.testIamPermissions({
project: "project",
resource: "resource",
});
/** Returns a list of authorized public keys for a specific user account. */
await gapi.client.linux.getAuthorizedKeysView({
instance: "instance",
login: true,
project: "project",
user: "user",
zone: "zone",
});
/** Retrieves a list of user accounts for an instance within a specific project. */
await gapi.client.linux.getLinuxAccountViews({
filter: "filter",
instance: "instance",
maxResults: 3,
orderBy: "orderBy",
pageToken: "pageToken",
project: "project",
zone: "zone",
});
/** Adds a public key to the specified User resource with the data included in the request. */
await gapi.client.users.addPublicKey({
project: "project",
user: "user",
});
/** Deletes the specified User resource. */
await gapi.client.users.delete({
project: "project",
user: "user",
});
/** Returns the specified User resource. */
await gapi.client.users.get({
project: "project",
user: "user",
});
/** Gets the access control policy for a resource. May be empty if no such policy or resource exists. */
await gapi.client.users.getIamPolicy({
project: "project",
resource: "resource",
});
/** Creates a User resource in the specified project using the data included in the request. */
await gapi.client.users.insert({
project: "project",
});
/** Retrieves a list of users contained within the specified project. */
await gapi.client.users.list({
filter: "filter",
maxResults: 2,
orderBy: "orderBy",
pageToken: "pageToken",
project: "project",
});
/** Removes the specified public key from the user. */
await gapi.client.users.removePublicKey({
fingerprint: "fingerprint",
project: "project",
user: "user",
});
/** Sets the access control policy on the specified resource. Replaces any existing policy. */
await gapi.client.users.setIamPolicy({
project: "project",
resource: "resource",
});
/** Returns permissions that a caller has on the specified resource. */
await gapi.client.users.testIamPermissions({
project: "project",
resource: "resource",
});
}
});