@google-cloud/spanner 6.1.3 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import * as gax from 'google-gax';
3
- import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax';
2
+ import type * as gax from 'google-gax';
3
+ import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax';
4
4
  import { Transform } from 'stream';
5
5
  import * as protos from '../../protos/protos';
6
6
  /**
@@ -67,8 +67,15 @@ export declare class DatabaseAdminClient {
67
67
  * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
68
68
  * For more information, please check the
69
69
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
70
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
71
+ * need to avoid loading the default gRPC version and want to use the fallback
72
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
73
+ * ```
74
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
75
+ * const client = new DatabaseAdminClient({fallback: 'rest'}, gax);
76
+ * ```
70
77
  */
71
- constructor(opts?: ClientOptions);
78
+ constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
72
79
  /**
73
80
  * Initialize the client.
74
81
  * Performs asynchronous operations (such as authentication) and prepares the client.
@@ -1568,6 +1575,223 @@ export declare class DatabaseAdminClient {
1568
1575
  * region_tag:spanner_v1_generated_DatabaseAdmin_ListBackupOperations_async
1569
1576
  */
1570
1577
  listBackupOperationsAsync(request?: protos.google.spanner.admin.database.v1.IListBackupOperationsRequest, options?: CallOptions): AsyncIterable<protos.google.longrunning.IOperation>;
1578
+ /**
1579
+ * Lists Cloud Spanner database roles.
1580
+ *
1581
+ * @param {Object} request
1582
+ * The request object that will be sent.
1583
+ * @param {string} request.parent
1584
+ * Required. The database whose roles should be listed.
1585
+ * Values are of the form
1586
+ * `projects/<project>/instances/<instance>/databases/<database>/databaseRoles`.
1587
+ * @param {number} request.pageSize
1588
+ * Number of database roles to be returned in the response. If 0 or less,
1589
+ * defaults to the server's maximum allowed page size.
1590
+ * @param {string} request.pageToken
1591
+ * If non-empty, `page_token` should contain a
1592
+ * {@link google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token} from a
1593
+ * previous {@link google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
1594
+ * @param {object} [options]
1595
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1596
+ * @returns {Promise} - The promise which resolves to an array.
1597
+ * The first element of the array is Array of [DatabaseRole]{@link google.spanner.admin.database.v1.DatabaseRole}.
1598
+ * The client library will perform auto-pagination by default: it will call the API as many
1599
+ * times as needed and will merge results from all the pages into this array.
1600
+ * Note that it can affect your quota.
1601
+ * We recommend using `listDatabaseRolesAsync()`
1602
+ * method described below for async iteration which you can stop as needed.
1603
+ * Please see the
1604
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1605
+ * for more details and examples.
1606
+ */
1607
+ listDatabaseRoles(request?: protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, options?: CallOptions): Promise<[
1608
+ protos.google.spanner.admin.database.v1.IDatabaseRole[],
1609
+ protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest | null,
1610
+ protos.google.spanner.admin.database.v1.IListDatabaseRolesResponse
1611
+ ]>;
1612
+ listDatabaseRoles(request: protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, options: CallOptions, callback: PaginationCallback<protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, protos.google.spanner.admin.database.v1.IListDatabaseRolesResponse | null | undefined, protos.google.spanner.admin.database.v1.IDatabaseRole>): void;
1613
+ listDatabaseRoles(request: protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, callback: PaginationCallback<protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, protos.google.spanner.admin.database.v1.IListDatabaseRolesResponse | null | undefined, protos.google.spanner.admin.database.v1.IDatabaseRole>): void;
1614
+ /**
1615
+ * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
1616
+ * @param {Object} request
1617
+ * The request object that will be sent.
1618
+ * @param {string} request.parent
1619
+ * Required. The database whose roles should be listed.
1620
+ * Values are of the form
1621
+ * `projects/<project>/instances/<instance>/databases/<database>/databaseRoles`.
1622
+ * @param {number} request.pageSize
1623
+ * Number of database roles to be returned in the response. If 0 or less,
1624
+ * defaults to the server's maximum allowed page size.
1625
+ * @param {string} request.pageToken
1626
+ * If non-empty, `page_token` should contain a
1627
+ * {@link google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token} from a
1628
+ * previous {@link google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
1629
+ * @param {object} [options]
1630
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1631
+ * @returns {Stream}
1632
+ * An object stream which emits an object representing [DatabaseRole]{@link google.spanner.admin.database.v1.DatabaseRole} on 'data' event.
1633
+ * The client library will perform auto-pagination by default: it will call the API as many
1634
+ * times as needed. Note that it can affect your quota.
1635
+ * We recommend using `listDatabaseRolesAsync()`
1636
+ * method described below for async iteration which you can stop as needed.
1637
+ * Please see the
1638
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1639
+ * for more details and examples.
1640
+ */
1641
+ listDatabaseRolesStream(request?: protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, options?: CallOptions): Transform;
1642
+ /**
1643
+ * Equivalent to `listDatabaseRoles`, but returns an iterable object.
1644
+ *
1645
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1646
+ * @param {Object} request
1647
+ * The request object that will be sent.
1648
+ * @param {string} request.parent
1649
+ * Required. The database whose roles should be listed.
1650
+ * Values are of the form
1651
+ * `projects/<project>/instances/<instance>/databases/<database>/databaseRoles`.
1652
+ * @param {number} request.pageSize
1653
+ * Number of database roles to be returned in the response. If 0 or less,
1654
+ * defaults to the server's maximum allowed page size.
1655
+ * @param {string} request.pageToken
1656
+ * If non-empty, `page_token` should contain a
1657
+ * {@link google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token} from a
1658
+ * previous {@link google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
1659
+ * @param {object} [options]
1660
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1661
+ * @returns {Object}
1662
+ * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
1663
+ * When you iterate the returned iterable, each element will be an object representing
1664
+ * [DatabaseRole]{@link google.spanner.admin.database.v1.DatabaseRole}. The API will be called under the hood as needed, once per the page,
1665
+ * so you can stop the iteration when you don't need more results.
1666
+ * Please see the
1667
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1668
+ * for more details and examples.
1669
+ * @example <caption>include:samples/generated/v1/database_admin.list_database_roles.js</caption>
1670
+ * region_tag:spanner_v1_generated_DatabaseAdmin_ListDatabaseRoles_async
1671
+ */
1672
+ listDatabaseRolesAsync(request?: protos.google.spanner.admin.database.v1.IListDatabaseRolesRequest, options?: CallOptions): AsyncIterable<protos.google.spanner.admin.database.v1.IDatabaseRole>;
1673
+ /**
1674
+ * Gets the latest state of a long-running operation. Clients can use this
1675
+ * method to poll the operation result at intervals as recommended by the API
1676
+ * service.
1677
+ *
1678
+ * @param {Object} request - The request object that will be sent.
1679
+ * @param {string} request.name - The name of the operation resource.
1680
+ * @param {Object=} options
1681
+ * Optional parameters. You can override the default settings for this call,
1682
+ * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
1683
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
1684
+ * details.
1685
+ * @param {function(?Error, ?Object)=} callback
1686
+ * The function which will be called with the result of the API call.
1687
+ *
1688
+ * The second parameter to the callback is an object representing
1689
+ * [google.longrunning.Operation]{@link
1690
+ * external:"google.longrunning.Operation"}.
1691
+ * @return {Promise} - The promise which resolves to an array.
1692
+ * The first element of the array is an object representing
1693
+ * [google.longrunning.Operation]{@link
1694
+ * external:"google.longrunning.Operation"}. The promise has a method named
1695
+ * "cancel" which cancels the ongoing API call.
1696
+ *
1697
+ * @example
1698
+ * ```
1699
+ * const client = longrunning.operationsClient();
1700
+ * const name = '';
1701
+ * const [response] = await client.getOperation({name});
1702
+ * // doThingsWith(response)
1703
+ * ```
1704
+ */
1705
+ getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
1706
+ /**
1707
+ * Lists operations that match the specified filter in the request. If the
1708
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
1709
+ *
1710
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
1711
+ *
1712
+ * @param {Object} request - The request object that will be sent.
1713
+ * @param {string} request.name - The name of the operation collection.
1714
+ * @param {string} request.filter - The standard list filter.
1715
+ * @param {number=} request.pageSize -
1716
+ * The maximum number of resources contained in the underlying API
1717
+ * response. If page streaming is performed per-resource, this
1718
+ * parameter does not affect the return value. If page streaming is
1719
+ * performed per-page, this determines the maximum number of
1720
+ * resources in a page.
1721
+ * @param {Object=} options
1722
+ * Optional parameters. You can override the default settings for this call,
1723
+ * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
1724
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
1725
+ * details.
1726
+ * @returns {Object}
1727
+ * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
1728
+ *
1729
+ * @example
1730
+ * ```
1731
+ * const client = longrunning.operationsClient();
1732
+ * for await (const response of client.listOperationsAsync(request));
1733
+ * // doThingsWith(response)
1734
+ * ```
1735
+ */
1736
+ listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
1737
+ /**
1738
+ * Starts asynchronous cancellation on a long-running operation. The server
1739
+ * makes a best effort to cancel the operation, but success is not
1740
+ * guaranteed. If the server doesn't support this method, it returns
1741
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
1742
+ * {@link Operations.GetOperation} or
1743
+ * other methods to check whether the cancellation succeeded or whether the
1744
+ * operation completed despite cancellation. On successful cancellation,
1745
+ * the operation is not deleted; instead, it becomes an operation with
1746
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
1747
+ * 1, corresponding to `Code.CANCELLED`.
1748
+ *
1749
+ * @param {Object} request - The request object that will be sent.
1750
+ * @param {string} request.name - The name of the operation resource to be cancelled.
1751
+ * @param {Object=} options
1752
+ * Optional parameters. You can override the default settings for this call,
1753
+ * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
1754
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
1755
+ * details.
1756
+ * @param {function(?Error)=} callback
1757
+ * The function which will be called with the result of the API call.
1758
+ * @return {Promise} - The promise which resolves when API call finishes.
1759
+ * The promise has a method named "cancel" which cancels the ongoing API
1760
+ * call.
1761
+ *
1762
+ * @example
1763
+ * ```
1764
+ * const client = longrunning.operationsClient();
1765
+ * await client.cancelOperation({name: ''});
1766
+ * ```
1767
+ */
1768
+ cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
1769
+ /**
1770
+ * Deletes a long-running operation. This method indicates that the client is
1771
+ * no longer interested in the operation result. It does not cancel the
1772
+ * operation. If the server doesn't support this method, it returns
1773
+ * `google.rpc.Code.UNIMPLEMENTED`.
1774
+ *
1775
+ * @param {Object} request - The request object that will be sent.
1776
+ * @param {string} request.name - The name of the operation resource to be deleted.
1777
+ * @param {Object=} options
1778
+ * Optional parameters. You can override the default settings for this call,
1779
+ * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
1780
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
1781
+ * details.
1782
+ * @param {function(?Error)=} callback
1783
+ * The function which will be called with the result of the API call.
1784
+ * @return {Promise} - The promise which resolves when API call finishes.
1785
+ * The promise has a method named "cancel" which cancels the ongoing API
1786
+ * call.
1787
+ *
1788
+ * @example
1789
+ * ```
1790
+ * const client = longrunning.operationsClient();
1791
+ * await client.deleteOperation({name: ''});
1792
+ * ```
1793
+ */
1794
+ deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
1571
1795
  /**
1572
1796
  * Return a fully-qualified backup resource name string.
1573
1797
  *
@@ -1676,6 +1900,48 @@ export declare class DatabaseAdminClient {
1676
1900
  * @returns {string} A string representing the database.
1677
1901
  */
1678
1902
  matchDatabaseFromDatabaseName(databaseName: string): string | number;
1903
+ /**
1904
+ * Return a fully-qualified databaseRole resource name string.
1905
+ *
1906
+ * @param {string} project
1907
+ * @param {string} instance
1908
+ * @param {string} database
1909
+ * @param {string} role
1910
+ * @returns {string} Resource name string.
1911
+ */
1912
+ databaseRolePath(project: string, instance: string, database: string, role: string): string;
1913
+ /**
1914
+ * Parse the project from DatabaseRole resource.
1915
+ *
1916
+ * @param {string} databaseRoleName
1917
+ * A fully-qualified path representing DatabaseRole resource.
1918
+ * @returns {string} A string representing the project.
1919
+ */
1920
+ matchProjectFromDatabaseRoleName(databaseRoleName: string): string | number;
1921
+ /**
1922
+ * Parse the instance from DatabaseRole resource.
1923
+ *
1924
+ * @param {string} databaseRoleName
1925
+ * A fully-qualified path representing DatabaseRole resource.
1926
+ * @returns {string} A string representing the instance.
1927
+ */
1928
+ matchInstanceFromDatabaseRoleName(databaseRoleName: string): string | number;
1929
+ /**
1930
+ * Parse the database from DatabaseRole resource.
1931
+ *
1932
+ * @param {string} databaseRoleName
1933
+ * A fully-qualified path representing DatabaseRole resource.
1934
+ * @returns {string} A string representing the database.
1935
+ */
1936
+ matchDatabaseFromDatabaseRoleName(databaseRoleName: string): string | number;
1937
+ /**
1938
+ * Parse the role from DatabaseRole resource.
1939
+ *
1940
+ * @param {string} databaseRoleName
1941
+ * A fully-qualified path representing DatabaseRole resource.
1942
+ * @returns {string} A string representing the role.
1943
+ */
1944
+ matchRoleFromDatabaseRoleName(databaseRoleName: string): string | number;
1679
1945
  /**
1680
1946
  * Return a fully-qualified instance resource name string.
1681
1947
  *