@@ -1162,122 +1162,6 @@ Compute.prototype.getFirewalls = function(options, callback) {
11621162 } ) ;
11631163} ;
11641164
1165- /**
1166- * Get a list of subnetworks in this project.
1167- *
1168- * @resource [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
1169- * @resource [Subnetworks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
1170- *
1171- * @param {object= } options - Subnetwork search options.
1172- * @param {boolean } options.autoPaginate - Have pagination handled
1173- * automatically. Default: true.
1174- * @param {string } options.filter - Search filter in the format of
1175- * `{name} {comparison} {filterString}`.
1176- * - **`name`**: the name of the field to compare
1177- * - **`comparison`**: the comparison operator, `eq` (equal) or `ne`
1178- * (not equal)
1179- * - **`filterString`**: the string to filter to. For string fields, this
1180- * can be a regular expression.
1181- * @param {number } options.maxApiCalls - Maximum number of API calls to make.
1182- * @param {number } options.maxResults - Maximum number of subnetworks to return.
1183- * @param {string } options.pageToken - A previously-returned page token
1184- * representing part of the larger set of results to view.
1185- * @param {function } callback - The callback function.
1186- * @param {?error } callback.err - An error returned while making this request.
1187- * @param {module:compute/subnetwork } callback.subnetworks - Subnetwork objects
1188- * from your project.
1189- * @param {?object } callback.nextQuery - If present, query with this object to
1190- * check for more results.
1191- * @param {object } callback.apiResponse - The full API response.
1192- *
1193- * @example
1194- * gce.getSubnetworks(function(err, subnetworks) {
1195- * // `subnetworks` is an array of `Subnetworks` objects.
1196- * });
1197- *
1198- * //-
1199- * // To control how many API requests are made and page through the results
1200- * // manually, set `autoPaginate` to `false`.
1201- * //-
1202- * function callback(err, subnetworks, nextQuery, apiResponse) {
1203- * if (nextQuery) {
1204- * // More results exist.
1205- * gce.getSubnetworks(nextQuery, callback);
1206- * }
1207- * }
1208- *
1209- * gce.getSubnetworks({
1210- * autoPaginate: false
1211- * }, callback);
1212- *
1213- * //-
1214- * // Get the subnetworks from your project as a readable object stream.
1215- * //-
1216- * gce.getSubnetworks()
1217- * .on('error', console.error)
1218- * .on('data', function(subnetwork) {
1219- * // `subnetwork` is a `Subnetwork` object.
1220- * })
1221- * .on('end', function() {
1222- * // All subnetworks retrieved.
1223- * });
1224- *
1225- * //-
1226- * // If you anticipate many results, you can end a stream early to prevent
1227- * // unnecessary processing and API requests.
1228- * //-
1229- * gce.getSubnetworks()
1230- * .on('data', function(subnetwork) {
1231- * this.end();
1232- * });
1233- */
1234- Compute . prototype . getSubnetworks = function ( options , callback ) {
1235- var self = this ;
1236-
1237- if ( is . fn ( options ) ) {
1238- callback = options ;
1239- options = { } ;
1240- }
1241-
1242- options = options || { } ;
1243-
1244- this . request ( {
1245- uri : '/aggregated/subnetworks' ,
1246- qs : options
1247- } , function ( err , resp ) {
1248-
1249- if ( err ) {
1250- callback ( err , null , null , resp ) ;
1251- return ;
1252- }
1253-
1254- var nextQuery = null ;
1255-
1256- if ( resp . nextPageToken ) {
1257- nextQuery = extend ( { } , options , {
1258- pageToken : resp . nextPageToken
1259- } ) ;
1260- }
1261-
1262- var regions = resp . items || { } ;
1263-
1264- var subnetworks = Object . keys ( regions ) . reduce ( function ( acc , regionName ) {
1265- var region = self . region ( regionName . replace ( 'regions/' , '' ) ) ;
1266- var subnetworks = regions [ regionName ] . subnetworks || [ ] ;
1267-
1268- subnetworks . forEach ( function ( subnetwork ) {
1269- var subnetworkInstance = region . subnetwork ( subnetwork . name ) ;
1270- subnetworkInstance . metadata = subnetwork ;
1271- acc . push ( subnetworkInstance ) ;
1272- } ) ;
1273-
1274- return acc ;
1275- } , [ ] ) ;
1276-
1277- callback ( null , subnetworks , nextQuery , resp ) ;
1278- } ) ;
1279- } ;
1280-
12811165/**
12821166 * Get a list of health checks.
12831167 *
@@ -2024,6 +1908,121 @@ Compute.prototype.getSnapshots = function(options, callback) {
20241908 } ) ;
20251909} ;
20261910
1911+ /**
1912+ * Get a list of subnetworks in this project.
1913+ *
1914+ * @resource [Subnetworks Overview]{@link https://cloud.google.com/compute/docs/subnetworks}
1915+ * @resource [Subnetworks: list API Documentation]{@link https://cloud.google.com/compute/docs/reference/v1/subnetworks}
1916+ *
1917+ * @param {object= } options - Subnetwork search options.
1918+ * @param {boolean } options.autoPaginate - Have pagination handled
1919+ * automatically. Default: true.
1920+ * @param {string } options.filter - Search filter in the format of
1921+ * `{name} {comparison} {filterString}`.
1922+ * - **`name`**: the name of the field to compare
1923+ * - **`comparison`**: the comparison operator, `eq` (equal) or `ne`
1924+ * (not equal)
1925+ * - **`filterString`**: the string to filter to. For string fields, this
1926+ * can be a regular expression.
1927+ * @param {number } options.maxApiCalls - Maximum number of API calls to make.
1928+ * @param {number } options.maxResults - Maximum number of subnetworks to return.
1929+ * @param {string } options.pageToken - A previously-returned page token
1930+ * representing part of the larger set of results to view.
1931+ * @param {function } callback - The callback function.
1932+ * @param {?error } callback.err - An error returned while making this request.
1933+ * @param {module:compute/subnetwork } callback.subnetworks - Subnetwork objects
1934+ * from your project.
1935+ * @param {?object } callback.nextQuery - If present, query with this object to
1936+ * check for more results.
1937+ * @param {object } callback.apiResponse - The full API response.
1938+ *
1939+ * @example
1940+ * gce.getSubnetworks(function(err, subnetworks) {
1941+ * // `subnetworks` is an array of `Subnetworks` objects.
1942+ * });
1943+ *
1944+ * //-
1945+ * // To control how many API requests are made and page through the results
1946+ * // manually, set `autoPaginate` to `false`.
1947+ * //-
1948+ * function callback(err, subnetworks, nextQuery, apiResponse) {
1949+ * if (nextQuery) {
1950+ * // More results exist.
1951+ * gce.getSubnetworks(nextQuery, callback);
1952+ * }
1953+ * }
1954+ *
1955+ * gce.getSubnetworks({
1956+ * autoPaginate: false
1957+ * }, callback);
1958+ *
1959+ * //-
1960+ * // Get the subnetworks from your project as a readable object stream.
1961+ * //-
1962+ * gce.getSubnetworks()
1963+ * .on('error', console.error)
1964+ * .on('data', function(subnetwork) {
1965+ * // `subnetwork` is a `Subnetwork` object.
1966+ * })
1967+ * .on('end', function() {
1968+ * // All subnetworks retrieved.
1969+ * });
1970+ *
1971+ * //-
1972+ * // If you anticipate many results, you can end a stream early to prevent
1973+ * // unnecessary processing and API requests.
1974+ * //-
1975+ * gce.getSubnetworks()
1976+ * .on('data', function(subnetwork) {
1977+ * this.end();
1978+ * });
1979+ */
1980+ Compute . prototype . getSubnetworks = function ( options , callback ) {
1981+ var self = this ;
1982+
1983+ if ( is . fn ( options ) ) {
1984+ callback = options ;
1985+ options = { } ;
1986+ }
1987+
1988+ options = options || { } ;
1989+
1990+ this . request ( {
1991+ uri : '/aggregated/subnetworks' ,
1992+ qs : options
1993+ } , function ( err , resp ) {
1994+ if ( err ) {
1995+ callback ( err , null , null , resp ) ;
1996+ return ;
1997+ }
1998+
1999+ var nextQuery = null ;
2000+
2001+ if ( resp . nextPageToken ) {
2002+ nextQuery = extend ( { } , options , {
2003+ pageToken : resp . nextPageToken
2004+ } ) ;
2005+ }
2006+
2007+ var regions = resp . items || { } ;
2008+
2009+ var subnetworks = Object . keys ( regions ) . reduce ( function ( acc , regionName ) {
2010+ var region = self . region ( regionName . replace ( 'regions/' , '' ) ) ;
2011+ var subnetworks = regions [ regionName ] . subnetworks || [ ] ;
2012+
2013+ subnetworks . forEach ( function ( subnetwork ) {
2014+ var subnetworkInstance = region . subnetwork ( subnetwork . name ) ;
2015+ subnetworkInstance . metadata = subnetwork ;
2016+ acc . push ( subnetworkInstance ) ;
2017+ } ) ;
2018+
2019+ return acc ;
2020+ } , [ ] ) ;
2021+
2022+ callback ( null , subnetworks , nextQuery , resp ) ;
2023+ } ) ;
2024+ } ;
2025+
20272026/**
20282027 * Get a list of virtual machine instances.
20292028 *
0 commit comments