from datetime import datetime
from typing import Any, Union,
def record_server(
activity_type_id: int,
ip: str,
name: str,
project_id: int,
role_id: int,
provider_id: int,
) -> str:
track_server_mutation = gql(
"""
mutation InsertCloudServer($activityTypeId: bigint, $auxAddress: [inet], $ipAddress: inet, $name: String, $note: String, $projectId: bigint, $serverRoleId: bigint, $serverProviderId: bigint) {
insert_cloudServer_one(object: { activityTypeId: $activityTypeId, auxAddress: $auxAddress, ipAddress: $ipAddress, name: $name, note: $note, projectId: $projectId, serverRoleId: $serverRoleId, serverProviderId: $serverProviderId }) {
id
}
}
"""
)
variables: dict[str, Union[int, str]] = {
"activityTypeId": activity_type_id,
"auxAddress": f"{{{ip}}}",
"ipAddress": ip,
"name": name,
"note": f"Deployed at {datetime.utcnow().strftime('%F %H:%M:%S')} UTC",
"projectId": project_id,
"serverRoleId": role_id,
"serverProviderId": provider_id,
}
res = authenticated_client.execute(track_server_mutation, variable_values=variables)
return res