createCluster method

Future<CreateClusterResult> createCluster({
  1. required String addressId,
  2. required JobType jobType,
  3. required JobResource resources,
  4. required String roleARN,
  5. required ShippingOption shippingOption,
  6. String? description,
  7. String? forwardingAddressId,
  8. String? kmsKeyARN,
  9. Notification? notification,
  10. SnowballType? snowballType,
  11. TaxDocuments? taxDocuments,
})

Creates an empty cluster. Each cluster supports five nodes. You use the CreateJob action separately to create the jobs for each of these nodes. The cluster does not ship until these five node jobs have been created.

May throw InvalidResourceException. May throw KMSRequestFailedException. May throw InvalidInputCombinationException. May throw Ec2RequestFailedException.

Parameter addressId : The ID for the address that you want the cluster shipped to.

Parameter jobType : The type of job for this cluster. Currently, the only job type supported for clusters is LOCAL_USE.

Parameter resources : The resources associated with the cluster job. These resources include Amazon S3 buckets and optional AWS Lambda functions written in the Python language.

Parameter roleARN : The RoleARN that you want to associate with this cluster. RoleArn values are created by using the CreateRole API action in AWS Identity and Access Management (IAM).

Parameter shippingOption : The shipping speed for each node in this cluster. This speed doesn't dictate how soon you'll get each Snowball Edge device, rather it represents how quickly each device moves to its destination while in transit. Regional shipping speeds are as follows:

  • In Australia, you have access to express shipping. Typically, Snow devices shipped express are delivered in about a day.
  • In the European Union (EU), you have access to express shipping. Typically, Snow devices shipped express are delivered in about a day. In addition, most countries in the EU have access to standard shipping, which typically takes less than a week, one way.
  • In India, Snow device are delivered in one to seven days.
  • In the United States of America (US), you have access to one-day shipping and two-day shipping.
  • In Australia, you have access to express shipping. Typically, devices shipped express are delivered in about a day.
  • In the European Union (EU), you have access to express shipping. Typically, Snow devices shipped express are delivered in about a day. In addition, most countries in the EU have access to standard shipping, which typically takes less than a week, one way.
  • In India, Snow device are delivered in one to seven days.
  • In the US, you have access to one-day shipping and two-day shipping.

Parameter description : An optional description of this specific cluster, for example Environmental Data Cluster-01.

Parameter forwardingAddressId : The forwarding address ID for a cluster. This field is not supported in most regions.

Parameter kmsKeyARN : The KmsKeyARN value that you want to associate with this cluster. KmsKeyARN values are created by using the CreateKey API action in AWS Key Management Service (AWS KMS).

Parameter notification : The Amazon Simple Notification Service (Amazon SNS) notification settings for this cluster.

Parameter snowballType : The type of AWS Snow Family device to use for this cluster.

Parameter taxDocuments : The tax documents required in your AWS Region.

Implementation

Future<CreateClusterResult> createCluster({
  required String addressId,
  required JobType jobType,
  required JobResource resources,
  required String roleARN,
  required ShippingOption shippingOption,
  String? description,
  String? forwardingAddressId,
  String? kmsKeyARN,
  Notification? notification,
  SnowballType? snowballType,
  TaxDocuments? taxDocuments,
}) async {
  ArgumentError.checkNotNull(addressId, 'addressId');
  _s.validateStringLength(
    'addressId',
    addressId,
    40,
    40,
    isRequired: true,
  );
  ArgumentError.checkNotNull(jobType, 'jobType');
  ArgumentError.checkNotNull(resources, 'resources');
  ArgumentError.checkNotNull(roleARN, 'roleARN');
  _s.validateStringLength(
    'roleARN',
    roleARN,
    0,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(shippingOption, 'shippingOption');
  _s.validateStringLength(
    'description',
    description,
    1,
    1152921504606846976,
  );
  _s.validateStringLength(
    'forwardingAddressId',
    forwardingAddressId,
    40,
    40,
  );
  _s.validateStringLength(
    'kmsKeyARN',
    kmsKeyARN,
    0,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSIESnowballJobManagementService.CreateCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AddressId': addressId,
      'JobType': jobType.toValue(),
      'Resources': resources,
      'RoleARN': roleARN,
      'ShippingOption': shippingOption.toValue(),
      if (description != null) 'Description': description,
      if (forwardingAddressId != null)
        'ForwardingAddressId': forwardingAddressId,
      if (kmsKeyARN != null) 'KmsKeyARN': kmsKeyARN,
      if (notification != null) 'Notification': notification,
      if (snowballType != null) 'SnowballType': snowballType.toValue(),
      if (taxDocuments != null) 'TaxDocuments': taxDocuments,
    },
  );

  return CreateClusterResult.fromJson(jsonResponse.body);
}