create method

Future<GoogleCloudApigeeV1Alias> create(
  1. GoogleApiHttpBody request,
  2. String parent, {
  3. String? P_password,
  4. String? alias,
  5. String? format,
  6. bool? ignoreExpiryValidation,
  7. bool? ignoreNewlineValidation,
  8. String? $fields,
})

Creates an alias from a key/certificate pair.

The structure of the request is controlled by the format query parameter: - keycertfile - Separate PEM-encoded key and certificate files are uploaded. Set Content-Type: multipart/form-data and include the keyFile, certFile, and password (if keys are encrypted) fields in the request body. If uploading to a truststore, omit keyFile. - pkcs12 - A PKCS12 file is uploaded. Set Content-Type: multipart/form-data, provide the file in the file field, and include the password field if the file is encrypted in the request body. - selfsignedcert - A new private key and certificate are generated. Set Content-Type: application/json and include CertificateGenerationSpec in the request body.

request - The metadata request object.

Request parameters:

parent - Required. Name of the keystore. Use the following format in your request: organizations/{org}/environments/{env}/keystores/{keystore}. Value must have pattern ^organizations/\[^/\]+/environments/\[^/\]+/keystores/\[^/\]+$.

P_password - DEPRECATED: For improved security, specify the password in the request body instead of using the query parameter. To specify the password in the request body, set Content-type: multipart/form-data part with name password. Password for the private key file, if required.

alias - Alias for the key/certificate pair. Values must match the regular expression [\w\s-.]{1,255}. This must be provided for all formats except selfsignedcert; self-signed certs may specify the alias in either this parameter or the JSON body.

format - Required. Format of the data. Valid values include: selfsignedcert, keycertfile, or pkcs12

ignoreExpiryValidation - Flag that specifies whether to ignore expiry validation. If set to true, no expiry validation will be performed.

ignoreNewlineValidation - Flag that specifies whether to ignore newline validation. If set to true, no error is thrown when the file contains a certificate chain with no newline between each certificate. Defaults to false.

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

Completes with a GoogleCloudApigeeV1Alias.

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<GoogleCloudApigeeV1Alias> create(
  GoogleApiHttpBody request,
  core.String parent, {
  core.String? P_password,
  core.String? alias,
  core.String? format,
  core.bool? ignoreExpiryValidation,
  core.bool? ignoreNewlineValidation,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (P_password != null) '_password': [P_password],
    if (alias != null) 'alias': [alias],
    if (format != null) 'format': [format],
    if (ignoreExpiryValidation != null)
      'ignoreExpiryValidation': ['${ignoreExpiryValidation}'],
    if (ignoreNewlineValidation != null)
      'ignoreNewlineValidation': ['${ignoreNewlineValidation}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/aliases';

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