createNetworkProfile method
Creates a network profile with the specified details.
May throw AlreadyExistsException. May throw LimitExceededException. May throw ConcurrentModificationException. May throw InvalidCertificateAuthorityException. May throw InvalidServiceLinkedRoleStateException.
Parameter networkProfileName
:
The name of the network profile associated with a device.
Parameter securityType
:
The security type of the Wi-Fi network. This can be WPA2_ENTERPRISE,
WPA2_PSK, WPA_PSK, WEP, or OPEN.
Parameter ssid
:
The SSID of the Wi-Fi network.
Parameter certificateAuthorityArn
:
The ARN of the Private Certificate Authority (PCA) created in AWS
Certificate Manager (ACM). This is used to issue certificates to the
devices.
Parameter currentPassword
:
The current password of the Wi-Fi network.
Parameter description
:
Detailed information about a device's network profile.
Parameter eapMethod
:
The authentication standard that is used in the EAP framework. Currently,
EAP_TLS is supported.
Parameter nextPassword
:
The next, or subsequent, password of the Wi-Fi network. This password is
asynchronously transmitted to the device and is used when the password of
the network changes to NextPassword.
Parameter trustAnchors
:
The root certificates of your authentication server that is installed on
your devices and used to trust your authentication server during EAP
negotiation.
Implementation
Future<CreateNetworkProfileResponse> createNetworkProfile({
required String networkProfileName,
required NetworkSecurityType securityType,
required String ssid,
String? certificateAuthorityArn,
String? clientRequestToken,
String? currentPassword,
String? description,
NetworkEapMethod? eapMethod,
String? nextPassword,
List<String>? trustAnchors,
}) async {
ArgumentError.checkNotNull(networkProfileName, 'networkProfileName');
_s.validateStringLength(
'networkProfileName',
networkProfileName,
1,
100,
isRequired: true,
);
ArgumentError.checkNotNull(securityType, 'securityType');
ArgumentError.checkNotNull(ssid, 'ssid');
_s.validateStringLength(
'ssid',
ssid,
1,
32,
isRequired: true,
);
_s.validateStringLength(
'clientRequestToken',
clientRequestToken,
10,
150,
);
_s.validateStringLength(
'currentPassword',
currentPassword,
5,
128,
);
_s.validateStringLength(
'description',
description,
0,
200,
);
_s.validateStringLength(
'nextPassword',
nextPassword,
0,
128,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AlexaForBusiness.CreateNetworkProfile'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'NetworkProfileName': networkProfileName,
'SecurityType': securityType.toValue(),
'Ssid': ssid,
if (certificateAuthorityArn != null)
'CertificateAuthorityArn': certificateAuthorityArn,
'ClientRequestToken':
clientRequestToken ?? _s.generateIdempotencyToken(),
if (currentPassword != null) 'CurrentPassword': currentPassword,
if (description != null) 'Description': description,
if (eapMethod != null) 'EapMethod': eapMethod.toValue(),
if (nextPassword != null) 'NextPassword': nextPassword,
if (trustAnchors != null) 'TrustAnchors': trustAnchors,
},
);
return CreateNetworkProfileResponse.fromJson(jsonResponse.body);
}