getComponentVersionArtifact method

Future<GetComponentVersionArtifactResponse> getComponentVersionArtifact({
  1. required String arn,
  2. required String artifactName,
  3. IotEndpointType? iotEndpointType,
  4. S3EndpointType? s3EndpointType,
})

Gets the pre-signed URL to download a public or a Lambda component artifact. Core devices call this operation to identify the URL that they can use to download an artifact to install.

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

Parameter arn : The ARN of the component version. Specify the ARN of a public or a Lambda component version.

Parameter artifactName : The name of the artifact.

You can use the GetComponent operation to download the component recipe, which includes the URI of the artifact. The artifact name is the section of the URI after the scheme. For example, in the artifact URI greengrass:SomeArtifact.zip, the artifact name is SomeArtifact.zip.

Parameter iotEndpointType : Determines if the Amazon S3 URL returned is a FIPS pre-signed URL endpoint. Specify fips if you want the returned Amazon S3 pre-signed URL to point to an Amazon S3 FIPS endpoint. If you don't specify a value, the default is standard.

Parameter s3EndpointType : Specifies the endpoint to use when getting Amazon S3 pre-signed URLs.

All Amazon Web Services Regions except US East (N. Virginia) use REGIONAL in all cases. In the US East (N. Virginia) Region the default is GLOBAL, but you can change it to REGIONAL with this parameter.

Implementation

Future<GetComponentVersionArtifactResponse> getComponentVersionArtifact({
  required String arn,
  required String artifactName,
  IotEndpointType? iotEndpointType,
  S3EndpointType? s3EndpointType,
}) async {
  final headers = <String, String>{
    if (iotEndpointType != null)
      'x-amz-iot-endpoint-type': iotEndpointType.value,
  };
  final $query = <String, List<String>>{
    if (s3EndpointType != null) 's3EndpointType': [s3EndpointType.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/greengrass/v2/components/${Uri.encodeComponent(arn)}/artifacts/${artifactName.split('/').map(Uri.encodeComponent).join('/')}',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetComponentVersionArtifactResponse.fromJson(response);
}