updatePublicKey2020_05_31 method

Future<UpdatePublicKeyResult> updatePublicKey2020_05_31({
  1. required String id,
  2. required PublicKeyConfig publicKeyConfig,
  3. String? ifMatch,
})

Update public key information. Note that the only value you can change is the comment.

May throw AccessDenied. May throw CannotChangeImmutablePublicKeyFields. May throw InvalidArgument. May throw InvalidIfMatchVersion. May throw IllegalUpdate. May throw NoSuchPublicKey. May throw PreconditionFailed.

Parameter id : The identifier of the public key that you are updating.

Parameter publicKeyConfig : A public key configuration.

Parameter ifMatch : The value of the ETag header that you received when retrieving the public key to update. For example: E2QWRUHAPOMQZL.

Implementation

Future<UpdatePublicKeyResult> updatePublicKey2020_05_31({
  required String id,
  required PublicKeyConfig publicKeyConfig,
  String? ifMatch,
}) async {
  ArgumentError.checkNotNull(id, 'id');
  ArgumentError.checkNotNull(publicKeyConfig, 'publicKeyConfig');
  final headers = <String, String>{
    if (ifMatch != null) 'If-Match': ifMatch.toString(),
  };
  final $result = await _protocol.sendRaw(
    method: 'PUT',
    requestUri: '/2020-05-31/public-key/${Uri.encodeComponent(id)}/config',
    headers: headers,
    payload: publicKeyConfig.toXml('PublicKeyConfig'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return UpdatePublicKeyResult(
    publicKey: PublicKey.fromXml($elem),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}