create method

Future<AppProfile> create(
  1. AppProfile request,
  2. String parent, {
  3. String? appProfileId,
  4. bool? ignoreWarnings,
  5. String? $fields,
})

Creates an app profile within an instance.

request - The metadata request object.

Request parameters:

parent - Required. The unique name of the instance in which to create the new app profile. Values are of the form projects/{project}/instances/{instance}. Value must have pattern ^projects/\[^/\]+/instances/\[^/\]+$.

appProfileId - Required. The ID to be used when referring to the new app profile within its instance, e.g., just myprofile rather than projects/myproject/instances/myinstance/appProfiles/myprofile.

ignoreWarnings - If true, ignore safety checks when creating the app profile.

$fields - Selector specifying which fields to include in a partial response.

Completes with a AppProfile.

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

  final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/appProfiles';

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