list method
Lists all instances in the given project.
Request parameters:
parent
- Required. The name of the project for which a list of instances
is requested. Values are of the form projects/
.
Value must have pattern ^projects/\[^/\]+$
.
filter
- An expression for filtering the results of the request. Filter
rules are case insensitive. The fields eligible for filtering are: *
name
* display_name
* labels.key
where key is the name of a label
Some examples of using filters are: * name:*
--> The instance has a
name. * name:Howl
--> The instance's name contains the string "howl". *
name:HOWL
--> Equivalent to above. * NAME:howl
--> Equivalent to
above. * labels.env:*
--> The instance has the label "env". *
labels.env:dev
--> The instance has the label "env" and the value of
the label contains the string "dev". * name:howl labels.env:dev
--> The
instance's name contains "howl" and it has the label "env" with its value
containing "dev".
instanceDeadline
- Deadline used while retrieving metadata for
instances. Instances whose metadata cannot be retrieved within this
deadline will be added to unreachable in ListInstancesResponse.
pageSize
- Number of instances to be returned in the response. If 0 or
less, defaults to the server's maximum allowed page size.
pageToken
- If non-empty, page_token
should contain a next_page_token
from a previous ListInstancesResponse.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ListInstancesResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<ListInstancesResponse> list(
core.String parent, {
core.String? filter,
core.String? instanceDeadline,
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (filter != null) 'filter': [filter],
if (instanceDeadline != null) 'instanceDeadline': [instanceDeadline],
if (pageSize != null) 'pageSize': ['${pageSize}'],
if (pageToken != null) 'pageToken': [pageToken],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/instances';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListInstancesResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}