insert method

Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

Future<Operation> insert(InsertMachineImageRequest request) async {
  final url = _endPoint.replace(
    path: '/compute/v1/projects/${request.project}/global/machineImages',
    queryParameters: {
      'requestId': ?request.requestId,
      'sourceInstance': ?request.sourceInstance,
    },
  );
  final response = await _client.post(
    url,
    body: request.machineImageResource,
  );
  return Operation.fromJson(response);
}