create method
Creates a new function.
If a function with the given name already exists in the specified project,
the long running operation will return ALREADY_EXISTS
error.
request
- The metadata request object.
Request parameters:
location
- Required. The project and location in which the function
should be created, specified in the format projects / * /locations / *
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Operation.
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<Operation> create(
CloudFunction request,
core.String location, {
core.String? $fields,
}) async {
final _body = convert.json.encode(request);
final _queryParams = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final _url = 'v1/' + core.Uri.encodeFull('$location') + '/functions';
final _response = await _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
);
return Operation.fromJson(_response as core.Map<core.String, core.dynamic>);
}