Sets the AWS account that serves as an AWS Network Security Manager administrator account, and optionally configures the scope of resources that the administrator can manage.
You can't set an administrator account again immediately after you remove it, or while the service creates its service-linked role. Retry the request after a few minutes.
Parameters:
-
account_id
(AccountId)
–
The AWS account ID to set as the AWS Network Security Manager administrator account.
-
priority
(AdminPriority)
–
The priority to assign to the administrator account.
-
admin_scope
(Optional[AdminScopeInput], default:
None
)
–
The scope of accounts, organizational units, and firewall types that the administrator can manage.
Raises:
-
AccessDeniedException
–
You do not have sufficient permissions to perform this action.
-
ConflictException
–
The request conflicts with the current state of the resource. For example, the resource was modified concurrently, or it is in a state that does not allow the requested operation.
-
InternalServerException
–
The request processing failed because of an internal error in the service. This is a retryable error.
-
ServiceQuotaExceededException
–
The request would exceed a service quota.
-
ServiceUnavailableException
–
The service is temporarily unavailable. This is a retryable error.
-
ThrottlingException
–
The request was denied because of request throttling. Reduce your request rate and try again.
-
ValidationException
–
The request failed validation. For details, see the reason and fieldList members of the response.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Designate an administrator account
Designates an account as a Network Security Manager administrator, scoped to a specific organizational unit and the WAF firewall type.
>>> await client.put_admin_account(account_id='234567890123', priority=2, admin_scope={'scopeFilter': {'includeOnly': {'organizationalUnits': ['ou-abcd-12345678']}}, 'firewallTypeScope': {'allFirewallTypesEnabled': False, 'firewallTypes': ['WAF']}})
Source code in docs_src/capo_network_security_manager/_services/async_network_security_manager.py
| async def put_admin_account(
self,
account_id: "capo_network_security_manager.types.account_id.AccountId",
priority: "capo_network_security_manager.types.admin_priority.AdminPriority",
*,
config_overrides: Optional[AsyncNetworkSecurityManagerClientConfig] = None,
admin_scope: Optional[
"capo_network_security_manager.types.admin_scope_input.AdminScopeInput"
] = None,
) -> "capo_network_security_manager.types.put_admin_account_response.PutAdminAccountResponse":
"""<p>Sets the AWS account that serves as an AWS Network Security Manager administrator account, and optionally configures the scope of resources that the administrator can manage.</p> <p>You can't set an administrator account again immediately after you remove it, or while the service creates its service-linked role. Retry the request after a few minutes.</p>
Args:
account_id: <p>The AWS account ID to set as the AWS Network Security Manager administrator account.</p>
priority: <p>The priority to assign to the administrator account.</p>
admin_scope: <p>The scope of accounts, organizational units, and firewall types that the administrator can manage.</p>
Raises:
capo_network_security_manager.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
capo_network_security_manager.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. For example, the resource was modified concurrently, or it is in a state that does not allow the requested operation.</p>
capo_network_security_manager.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an internal error in the service. This is a retryable error.</p>
capo_network_security_manager.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota.</p>
capo_network_security_manager.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable. This is a retryable error.</p>
capo_network_security_manager.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling. Reduce your request rate and try again.</p>
capo_network_security_manager.errors.validation_exception.ValidationException: <p>The request failed validation. For details, see the <code>reason</code> and <code>fieldList</code> members of the response.</p>
capo_network_security_manager.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Designate an administrator account
Designates an account as a Network Security Manager administrator, scoped to a specific organizational unit and the WAF firewall type.
>>> await client.put_admin_account(account_id='234567890123', priority=2, admin_scope={'scopeFilter': {'includeOnly': {'organizationalUnits': ['ou-abcd-12345678']}}, 'firewallTypeScope': {'allFirewallTypesEnabled': False, 'firewallTypes': ['WAF']}})
"""
async def _handler(
req: "AsyncOperationRequest[capo_network_security_manager.types.put_admin_account_request.PutAdminAccountRequest]",
) -> AsyncOperationResponse[
"capo_network_security_manager.types.put_admin_account_response.PutAdminAccountResponse"
]:
import capo_network_security_manager._operations.piccolo_customer_api_service.put_admin_account
(
output,
http_response,
) = await capo_network_security_manager._operations.piccolo_customer_api_service.put_admin_account.async_put_admin_account(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_network_security_manager.types.put_admin_account_response.PutAdminAccountResponse",
) -> dict[str, Any]:
import capo_network_security_manager.types.put_admin_account_response
return capo_network_security_manager.types.put_admin_account_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("PutAdminAccount", redact_output=_redact_output),
)
input_: capo_network_security_manager.types.put_admin_account_request.PutAdminAccountRequest = {
"account_id": account_id,
"priority": priority,
}
if admin_scope is not None:
input_["admin_scope"] = admin_scope
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|