insert method

Future<Operation> insert(
  1. InsertDiskRequest request
)

Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, orsourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.

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(InsertDiskRequest request) async {
  final url = _endPoint.replace(
    path:
        '/compute/v1/projects/${request.project}/zones/${request.zone}/disks',
    queryParameters: {
      'requestId': ?request.requestId,
      'sourceImage': ?request.sourceImage,
    },
  );
  final response = await _client.post(url, body: request.diskResource);
  return Operation.fromJson(response);
}