updateKeyGroup2020_05_31 method

Future<UpdateKeyGroupResult> updateKeyGroup2020_05_31({
  1. required String id,
  2. required KeyGroupConfig keyGroupConfig,
  3. String? ifMatch,
})

Updates a key group.

When you update a key group, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a key group:

  1. Get the current key group with GetKeyGroup or GetKeyGroupConfig.
  2. Locally modify the fields in the key group that you want to update. For example, add or remove public key IDs.
  3. Call UpdateKeyGroup with the entire key group object, including the fields that you modified and those that you didn’t.

May throw InvalidIfMatchVersion. May throw NoSuchResource. May throw PreconditionFailed. May throw KeyGroupAlreadyExists. May throw InvalidArgument. May throw TooManyPublicKeysInKeyGroup.

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

Parameter keyGroupConfig : The key group configuration.

Parameter ifMatch : The version of the key group that you are updating. The version is the key group’s ETag value.

Implementation

Future<UpdateKeyGroupResult> updateKeyGroup2020_05_31({
  required String id,
  required KeyGroupConfig keyGroupConfig,
  String? ifMatch,
}) async {
  ArgumentError.checkNotNull(id, 'id');
  ArgumentError.checkNotNull(keyGroupConfig, 'keyGroupConfig');
  final headers = <String, String>{
    if (ifMatch != null) 'If-Match': ifMatch.toString(),
  };
  final $result = await _protocol.sendRaw(
    method: 'PUT',
    requestUri: '/2020-05-31/key-group/${Uri.encodeComponent(id)}',
    headers: headers,
    payload: keyGroupConfig.toXml('KeyGroupConfig'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return UpdateKeyGroupResult(
    keyGroup: KeyGroup.fromXml($elem),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}