batch_create_user
async
¶
batch_create_user(
network_id: NetworkId,
users: BatchCreateUserRequestItems,
*,
config_overrides: Optional[AsyncWickrClientConfig] = None,
client_token: Optional[ClientToken] = None,
) -> BatchCreateUserResponse
Creates multiple users in a specified Wickr network. This operation allows you to provision multiple user accounts simultaneously, optionally specifying security groups, and validation requirements for each user.
codeValidation, inviteCode, and inviteCodeTtl are restricted to networks under preview only.
Parameters:
-
network_id(NetworkId) –The ID of the Wickr network where users will be created.
-
users(BatchCreateUserRequestItems) –A list of user objects containing the details for each user to be created, including username, name, security groups, and optional invite codes. Maximum 50 users per batch request.
-
client_token(Optional[ClientToken], default:None) –A unique identifier for this request to ensure idempotency. If you retry a request with the same client token, the service will return the same response without creating duplicate users.
Raises:
-
BadRequestError–The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.
-
ForbiddenError–Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.
-
InternalServerError–An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.
-
RateLimitError–The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.
-
ResourceNotFoundError–The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.
-
UnauthorizedError–The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.
-
ValidationError–One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create multiple users
>>> await client.batch_create_user(network_id='12345678', users=[{'firstName': 'John', 'lastName': 'Doe', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe'], 'inviteCode': 'INVITE123', 'inviteCodeTtl': 7, 'codeValidation': True}, {'firstName': 'Jane', 'lastName': 'Smith', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe']}], client_token='550e8400-e29b-41d4-a716-446655440000')
Partial failure - duplicate user
>>> await client.batch_create_user(network_id='12345678', users=[{'firstName': 'Alice', 'lastName': 'Johnson', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe']}, {'firstName': 'Bob', 'lastName': 'Wilson', 'username': '[email protected]', 'securityGroupIds': ['BCTY8Qhe']}])
Source code in docs_src/capo_wickr/_services/async_wickr.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |