getAssociatedPackageGroup method

Future<GetAssociatedPackageGroupResult> getAssociatedPackageGroup({
  1. required String domain,
  2. required PackageFormat format,
  3. required String package,
  4. String? domainOwner,
  5. String? namespace,
})

Returns the most closely associated package group to the specified package. This API does not require that the package exist in any repository in the domain. As such, GetAssociatedPackageGroup can be used to see which package group's origin configuration applies to a package before that package is in a repository. This can be helpful to check if public packages are blocked without ingesting them.

For information package group association and matching, see Package group definition syntax and matching behavior in the CodeArtifact User Guide.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter domain : The name of the domain that contains the package from which to get the associated package group.

Parameter format : The format of the package from which to get the associated package group.

Parameter package : The package from which to get the associated package group.

Parameter domainOwner : The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

Parameter namespace : The namespace of the package from which to get the associated package group. The package component that specifies its namespace depends on its type. For example:

  • Maven
  • Swift
  • generic
  • The namespace of a Maven package version is its groupId.
  • The namespace of an npm or Swift package version is its scope.
  • The namespace of a generic package is its namespace.
  • Python, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace.

Implementation

Future<GetAssociatedPackageGroupResult> getAssociatedPackageGroup({
  required String domain,
  required PackageFormat format,
  required String package,
  String? domainOwner,
  String? namespace,
}) async {
  final $query = <String, List<String>>{
    'domain': [domain],
    'format': [format.value],
    'package': [package],
    if (domainOwner != null) 'domain-owner': [domainOwner],
    if (namespace != null) 'namespace': [namespace],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/v1/get-associated-package-group',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetAssociatedPackageGroupResult.fromJson(response);
}