updatePackage method

Future<void> updatePackage({
  1. required String packageName,
  2. String? clientToken,
  3. String? defaultVersionName,
  4. String? description,
  5. bool? unsetDefaultVersion,
})

Updates the supported fields for a specific software package.

Requires permission to access the UpdatePackage and GetIndexingConfiguration actions.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter packageName : The name of the target software package.

Parameter clientToken : A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

Parameter defaultVersionName : The name of the default package version.

Note: You cannot name a defaultVersion and set unsetDefaultVersion equal to true at the same time.

Parameter description : The package description.

Parameter unsetDefaultVersion : Indicates whether you want to remove the named default package version from the software package. Set as true to remove the default package version.

Note: You cannot name a defaultVersion and set unsetDefaultVersion equal to true at the same time.

Implementation

Future<void> updatePackage({
  required String packageName,
  String? clientToken,
  String? defaultVersionName,
  String? description,
  bool? unsetDefaultVersion,
}) async {
  final $query = <String, List<String>>{
    if (clientToken != null) 'clientToken': [clientToken],
  };
  final $payload = <String, dynamic>{
    if (defaultVersionName != null) 'defaultVersionName': defaultVersionName,
    if (description != null) 'description': description,
    if (unsetDefaultVersion != null)
      'unsetDefaultVersion': unsetDefaultVersion,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/packages/${Uri.encodeComponent(packageName)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}