Modifies the set of security groups in effect for a mount target.
When you create a mount target, Amazon EFS also creates a new network interface. For more information, see CreateMountTarget. This operation replaces the security groups in effect for the network interface associated with a mount target, with the SecurityGroups provided in the request. This operation requires that the network interface of the mount target has been created and the lifecycle state of the mount target is not deleted.
The operation requires permissions for the following actions:
Parameters:
-
mount_target_id
(MountTargetId)
–
The ID of the mount target whose security groups you want to modify.
-
security_groups
(Optional[SecurityGroups], default:
None
)
–
An array of VPC security group IDs.
Raises:
-
BadRequest
–
Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.
-
IncorrectMountTargetState
–
Returned if the mount target is not in the correct state for the operation.
-
InternalServerError
–
Returned if an error occurred on the server side.
-
MountTargetNotFound
–
Returned if there is no mount target with the specified ID found in the caller's Amazon Web Services account.
-
SecurityGroupLimitExceeded
–
Returned if the number of SecurityGroups specified in the request is greater than the limit, which is based on account quota. Either delete some security groups or request that the account quota be raised. For more information, see Amazon VPC Quotas in the Amazon VPC User Guide (see the Security Groups table).
-
SecurityGroupNotFound
–
Returned if one of the specified security groups doesn't exist in the subnet's virtual private cloud (VPC).
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To modify the security groups associated with a mount target for a file system
This operation modifies the security groups associated with a mount target for a file system.
>>> await client.modify_mount_target_security_groups(mount_target_id='fsmt-12340abc', security_groups=['sg-abcd1234'])
Source code in docs_src/capo_efs/_services/async_efs.py
| async def modify_mount_target_security_groups(
self,
mount_target_id: "capo_efs.types.mount_target_id.MountTargetId",
*,
config_overrides: Optional[AsyncEFSClientConfig] = None,
security_groups: Optional[
"capo_efs.types.security_groups.SecurityGroups"
] = None,
) -> None:
"""<p>Modifies the set of security groups in effect for a mount target.</p> <p>When you create a mount target, Amazon EFS also creates a new network interface. For more information, see <a>CreateMountTarget</a>. This operation replaces the security groups in effect for the network interface associated with a mount target, with the <code>SecurityGroups</code> provided in the request. This operation requires that the network interface of the mount target has been created and the lifecycle state of the mount target is not <code>deleted</code>. </p> <p>The operation requires permissions for the following actions:</p> <ul> <li> <p> <code>elasticfilesystem:ModifyMountTargetSecurityGroups</code> action on the mount target's file system. </p> </li> <li> <p> <code>ec2:ModifyNetworkInterfaceAttribute</code> action on the mount target's network interface. </p> </li> </ul>
Args:
mount_target_id: <p>The ID of the mount target whose security groups you want to modify.</p>
security_groups: <p>An array of VPC security group IDs. </p>
Raises:
capo_efs.errors.bad_request.BadRequest: <p>Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.</p>
capo_efs.errors.incorrect_mount_target_state.IncorrectMountTargetState: <p>Returned if the mount target is not in the correct state for the operation.</p>
capo_efs.errors.internal_server_error.InternalServerError: <p>Returned if an error occurred on the server side.</p>
capo_efs.errors.mount_target_not_found.MountTargetNotFound: <p>Returned if there is no mount target with the specified ID found in the caller's Amazon Web Services account.</p>
capo_efs.errors.security_group_limit_exceeded.SecurityGroupLimitExceeded: <p>Returned if the number of <code>SecurityGroups</code> specified in the request is greater than the limit, which is based on account quota. Either delete some security groups or request that the account quota be raised. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html">Amazon VPC Quotas</a> in the <i>Amazon VPC User Guide</i> (see the <b>Security Groups</b> table). </p>
capo_efs.errors.security_group_not_found.SecurityGroupNotFound: <p>Returned if one of the specified security groups doesn't exist in the subnet's virtual private cloud (VPC).</p>
capo_efs.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To modify the security groups associated with a mount target for a file system
This operation modifies the security groups associated with a mount target for a file system.
>>> await client.modify_mount_target_security_groups(mount_target_id='fsmt-12340abc', security_groups=['sg-abcd1234'])
"""
async def _handler(
req: "AsyncOperationRequest[capo_efs.types.modify_mount_target_security_groups_request.ModifyMountTargetSecurityGroupsRequest]",
) -> AsyncOperationResponse[None]:
import capo_efs._operations.magnolio_api_service_v20150201.modify_mount_target_security_groups
(
output,
http_response,
) = await capo_efs._operations.magnolio_api_service_v20150201.modify_mount_target_security_groups.async_modify_mount_target_security_groups(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ModifyMountTargetSecurityGroups")
)
input_: capo_efs.types.modify_mount_target_security_groups_request.ModifyMountTargetSecurityGroupsRequest = {
"mount_target_id": mount_target_id
}
if security_groups is not None:
input_["security_groups"] = security_groups
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|