create method

Future<Operation> create(
  1. DomainMapping request,
  2. String appsId, {
  3. String? overrideStrategy,
  4. String? $fields,
})

Maps a domain to an application.

A user must be authorized to administer a domain in order to map it to an application. For a list of available authorized domains, see AuthorizedDomains.ListAuthorizedDomains.

request - The metadata request object.

Request parameters:

appsId - Part of parent. Name of the parent Application resource. Example: apps/myapp.

overrideStrategy - Whether the domain creation should override any existing mappings for this domain. By default, overrides are rejected. Possible string values are:

  • "UNSPECIFIED_DOMAIN_OVERRIDE_STRATEGY" : Strategy unspecified. Defaults to STRICT.
  • "STRICT" : Overrides not allowed. If a mapping already exists for the specified domain, the request will return an ALREADY_EXISTS (409).
  • "OVERRIDE" : Overrides allowed. If a mapping already exists for the specified domain, the request will overwrite it. Note that this might stop another Google product from serving. For example, if the domain is mapped to another App Engine application, that app will no longer serve from that domain.

$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(
  DomainMapping request,
  core.String appsId, {
  core.String? overrideStrategy,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (overrideStrategy != null) 'overrideStrategy': [overrideStrategy],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'v1/apps/' + commons.escapeVariable('$appsId') + '/domainMappings';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}