create_group
¶
create_group(
directory_id: DirectoryId,
sam_account_name: GroupName,
*,
config_overrides: Optional[DirectoryServiceDataClientConfig] = None,
group_type: Optional[GroupType] = None,
group_scope: Optional[GroupScope] = None,
other_attributes: Optional[Attributes] = None,
client_token: Optional[ClientToken] = None,
) -> CreateGroupResult
Creates a new group.
Parameters:
-
directory_id(DirectoryId) –The identifier (ID) of the directory that's associated with the group.
-
sam_account_name(GroupName) –The name of the group.
-
group_type(Optional[GroupType], default:None) –The AD group type. For details, see Active Directory security group type.
-
group_scope(Optional[GroupScope], default:None) –The scope of the AD group. For details, see Active Directory security group scope.
-
other_attributes(Optional[Attributes], default:None) –An expression that defines one or more attributes with the data type and value of each attribute.
-
client_token(Optional[ClientToken], default:None) –A unique and case-sensitive identifier that you provide to make sure the idempotency of the request, so multiple identical calls have the same effect as one single call.
A client token is valid for 8 hours after the first request that uses it completes. After 8 hours, any request with the same client token is treated as a new request. If the request succeeds, any future uses of that token will be idempotent for another 8 hours.
If you submit a request with the same client token but change one of the other parameters within the 8-hour idempotency window, Directory Service Data returns an
ConflictException.This parameter is optional when using the CLI or SDK.
Raises:
-
AccessDeniedException–You don't have permission to perform the request or access the directory. It can also occur when the
DirectoryIddoesn't exist or the user, member, or group might be outside of your organizational unit (OU).Make sure that you have the authentication and authorization to perform the action. Review the directory information in the request, and make sure that the object isn't outside of your OU.
-
ConflictException–This error will occur when you try to create a resource that conflicts with an existing object. It can also occur when adding a member to a group that the member is already in.
This error can be caused by a request sent within the 8-hour idempotency window with the same client token but different input parameters. Client tokens should not be re-used across different requests. After 8 hours, any request with the same client token is treated as a new request.
-
DirectoryUnavailableException–The request could not be completed due to a problem in the configuration or current state of the specified directory.
-
InternalServerException–The operation didn't succeed because an internal error occurred. Try again later.
-
ThrottlingException–The limit on the number of requests per second has been exceeded.
-
ValidationException–The request isn't valid. Review the details in the error message to update the invalid parameters or values in your request.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a group The following command creates a distribution list group named AcctngMail.
>>> client.create_group(client_token='550e8400-e29b-41d4-a716-446655440000', directory_id='d-12233abcde', group_scope='DomainLocal', group_type='Distribution', other_attributes={'displayName': {'S': 'Acctng-mailing-list'}, 'description': {'S': 'Accounting dept mailing list'}}, sam_account_name='AcctngMail')
Source code in docs_src/capo_directory_service_data/_services/directory_service_data.py
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 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |