createLocationObjectStorage method
Creates an endpoint for a self-managed object storage bucket. For more information about self-managed object storage locations, see create-object-location.
May throw InvalidRequestException. May throw InternalException.
Parameter agentArns
:
The Amazon Resource Name (ARN) of the agents associated with the
self-managed object storage server location.
Parameter bucketName
:
The bucket on the self-managed object storage server that is used to read
data from.
Parameter serverHostname
:
The name of the self-managed object storage server. This value is the IP
address or Domain Name Service (DNS) name of the object storage server. An
agent uses this host name to mount the object storage server in a network.
Parameter accessKey
:
Optional. The access key is used if credentials are required to access the
self-managed object storage server. If your object storage requires a user
name and password to authenticate, use AccessKey
and
SecretKey
to provide the user name and password,
respectively.
Parameter secretKey
:
Optional. The secret key is used if credentials are required to access the
self-managed object storage server. If your object storage requires a user
name and password to authenticate, use AccessKey
and
SecretKey
to provide the user name and password,
respectively.
Parameter serverPort
:
The port that your self-managed object storage server accepts inbound
network traffic on. The server port is set by default to TCP 80 (HTTP) or
TCP 443 (HTTPS). You can specify a custom port if your self-managed object
storage server requires one.
Parameter serverProtocol
:
The protocol that the object storage server uses to communicate. Valid
values are HTTP or HTTPS.
Parameter subdirectory
:
The subdirectory in the self-managed object storage server that is used to
read data from.
Parameter tags
:
The key-value pair that represents the tag that you want to add to the
location. The value can be an empty string. We recommend using tags to
name your resources.
Implementation
Future<CreateLocationObjectStorageResponse> createLocationObjectStorage({
required List<String> agentArns,
required String bucketName,
required String serverHostname,
String? accessKey,
String? secretKey,
int? serverPort,
ObjectStorageServerProtocol? serverProtocol,
String? subdirectory,
List<TagListEntry>? tags,
}) async {
ArgumentError.checkNotNull(agentArns, 'agentArns');
ArgumentError.checkNotNull(bucketName, 'bucketName');
_s.validateStringLength(
'bucketName',
bucketName,
3,
63,
isRequired: true,
);
ArgumentError.checkNotNull(serverHostname, 'serverHostname');
_s.validateStringLength(
'serverHostname',
serverHostname,
0,
255,
isRequired: true,
);
_s.validateStringLength(
'accessKey',
accessKey,
8,
200,
);
_s.validateStringLength(
'secretKey',
secretKey,
8,
200,
);
_s.validateNumRange(
'serverPort',
serverPort,
1,
65536,
);
_s.validateStringLength(
'subdirectory',
subdirectory,
0,
4096,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'FmrsService.CreateLocationObjectStorage'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AgentArns': agentArns,
'BucketName': bucketName,
'ServerHostname': serverHostname,
if (accessKey != null) 'AccessKey': accessKey,
if (secretKey != null) 'SecretKey': secretKey,
if (serverPort != null) 'ServerPort': serverPort,
if (serverProtocol != null) 'ServerProtocol': serverProtocol.toValue(),
if (subdirectory != null) 'Subdirectory': subdirectory,
if (tags != null) 'Tags': tags,
},
);
return CreateLocationObjectStorageResponse.fromJson(jsonResponse.body);
}