createAgent method
Activates an DataSync agent that you deploy in your storage environment. The activation process associates the agent with your Amazon Web Services account.
If you haven't deployed an agent yet, see Do I need a DataSync agent?
May throw InternalException.
May throw InvalidRequestException.
Parameter activationKey :
Specifies your DataSync agent's activation key. If you don't have an
activation key, see Activating
your agent.
Parameter agentName :
Specifies a name for your agent. We recommend specifying a name that you
can remember.
Parameter securityGroupArns :
Specifies the Amazon Resource Name (ARN) of the security group that allows
traffic between your agent and VPC service endpoint. You can only specify
one ARN.
Parameter subnetArns :
Specifies the ARN of the subnet where your VPC service endpoint is
located. You can only specify one ARN.
Parameter tags :
Specifies labels that help you categorize, filter, and search for your
Amazon Web Services resources. We recommend creating at least one tag for
your agent.
Parameter vpcEndpointId :
Specifies the ID of the VPC
service endpoint that you're using. For example, a VPC endpoint ID
looks like vpce-01234d5aff67890e1.
Implementation
Future<CreateAgentResponse> createAgent({
required String activationKey,
String? agentName,
List<String>? securityGroupArns,
List<String>? subnetArns,
List<TagListEntry>? tags,
String? vpcEndpointId,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'FmrsService.CreateAgent'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ActivationKey': activationKey,
if (agentName != null) 'AgentName': agentName,
if (securityGroupArns != null) 'SecurityGroupArns': securityGroupArns,
if (subnetArns != null) 'SubnetArns': subnetArns,
if (tags != null) 'Tags': tags,
if (vpcEndpointId != null) 'VpcEndpointId': vpcEndpointId,
},
);
return CreateAgentResponse.fromJson(jsonResponse.body);
}