getSerialPortOutput method
Returns the last 1 MB of serial port output from the specified instance.
Request parameters:
project - Project ID for this request.
Value must have pattern
(?:(?:\[-a-z0-9\]{1,63}\.)*(?:\[a-z\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?):)?(?:\[0-9\]{1,19}|(?:\[a-z0-9\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?)).
zone - The name of the zone for this request.
Value must have pattern \[a-z\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?.
instance - Name of the instance for this request.
Value must have pattern
\[a-z\](?:\[-a-z0-9\]{0,61}\[a-z0-9\])?|\[1-9\]\[0-9\]{0,19}.
port - Specifies which COM or serial port to retrieve data from.
Value must be between "1" and "4".
start_1 - Specifies the starting byte position of the output to return.
To start with
the first byte of output to the specified port, omit this field or set it
to 0.
If the output for that byte position is available, this field matches the
start parameter sent with the request. If the amount of serial console
output exceeds the size of the buffer (1 MB), the oldest output is
discarded and is no longer available. If the requested start position
refers to discarded output, the start position is adjusted to the oldest
output still available, and the adjusted start position is returned as the
start property value.
You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console. Note that the negative start is bounded by the retained buffer size, and the returned serial console output will not exceed the max buffer size.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a SerialPortOutput.
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<SerialPortOutput> getSerialPortOutput(
core.String project,
core.String zone,
core.String instance, {
core.int? port,
core.String? start_1,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'port': ?port == null ? null : ['${port}'],
'start': ?start_1 == null ? null : [start_1],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'projects/' +
commons.escapeVariable('$project') +
'/zones/' +
commons.escapeVariable('$zone') +
'/instances/' +
commons.escapeVariable('$instance') +
'/serialPort';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return SerialPortOutput.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}