
    tni              1          d Z ddlmZmZ 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#dededee         d	ed
ededee         dee         dee         dee         dee         dee         dee         dee         dee         dee         dee         dee         dee         deee                  dee         dee         dee         def0dZdedefd Z	dededefd!Z
dedefd"ZdS )$z)
Runpod | API Wrapper | Mutations | Pods
    )ListOptionalNALLTname
image_namegpu_type_id
cloud_typesupport_public_ip	start_sshdata_center_idcountry_code	gpu_countvolume_in_gbcontainer_disk_in_gbmin_vcpu_countmin_memory_in_gbdocker_argsportsvolume_mount_pathenvtemplate_idnetwork_volume_idallowed_cuda_versionsmin_download
min_uploadinstance_idreturnc                    g }|                     d|  dd| dd| g           |r|                    d           ||                    d| d           |                    dt          |                                                      ||                    d	|            |	|                    d
|	            ||                    d|            ||                    d|            ||                    d| d           |8d                    d |D                       }|                    d| d           n||                    d| d           |pd}||                    d| d           n|                    d           ||                    d| d           |
|                    d|
            |-|                    d|                    dd           d           ||                    d| d           |Jd |                                D             }|                    dd                    |           d           ||                    d| d           ||                    d| d           ||                    d |            ||                    d!|            |rd"nd#}d                    |          }d$| d%| d&S )'a  
    Generates a mutation to deploy a pod on demand.
    
    Args:
        name: Name of the pod
        image_name: Docker image name
        gpu_type_id: GPU type ID for GPU pods, None for CPU pods
        cloud_type: Cloud type (ALL, COMMUNITY, or SECURE)
        support_public_ip: Whether to support public IP
        start_ssh: Whether to start SSH service
        data_center_id: Data center ID
        country_code: Country code for pod location
        gpu_count: Number of GPUs (for GPU pods)
        volume_in_gb: Volume size in GB
        container_disk_in_gb: Container disk size in GB
        min_vcpu_count: Minimum vCPU count
        min_memory_in_gb: Minimum memory in GB
        docker_args: Docker arguments
        ports: Port mappings (e.g. "8080/tcp,22/tcp")
        volume_mount_path: Volume mount path
        env: Environment variables dict
        template_id: Template ID
        network_volume_id: Network volume ID
        allowed_cuda_versions: List of allowed CUDA versions
        min_download: Minimum download speed in Mbps
        min_upload: Minimum upload speed in Mbps
        instance_id: Instance ID for CPU pods

    Returns:
        str: GraphQL mutation string
    zname: ""zimageName: "zcloudType: zstartSsh: trueNzgpuTypeId: "zsupportPublicIp: z
gpuCount: zvolumeInGb: zminVcpuCount: zminMemoryInGb: zdockerArgs: "z, c              3   "   K   | ]
}d | d V  dS )r   N ).0vs     V/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/runpod/api/mutations/pods.py	<genexpr>z3generate_pod_deployment_mutation.<locals>.<genexpr>^   s*      %N%N1h!hhh%N%N%N%N%N%N    zallowedCudaVersions: []zinstanceId: "zrunpod-ubuntuzdataCenterId: "zdataCenterId: nullzcountryCode: "zcontainerDiskInGb: zports: "  zvolumeMountPath: "c                 &    g | ]\  }}d | d| dS )z{ key: "z", value: "z" }r!   )r"   kr#   s      r$   
<listcomp>z4generate_pod_deployment_mutation.<locals>.<listcomp>v   s0    OOO41a666q666OOOr&   zenv: [ztemplateId: "znetworkVolumeId: "zminDownload: zminUpload: podFindAndDeployOnDemanddeployCpuPodz
    mutation {
      z(
        input: {
          z
        }
      ) {
        id
        imageName
        env
        machineId
        machine {
          podHostId
        }
      }
    }
    )extendappendstrlowerjoinreplaceitems)r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   input_fieldscuda_versions	env_itemsmutation_typeinput_strings                               r$    generate_pod_deployment_mutationr;   
   s   p L $$z$$$"j""     .,--- 9;999:::P4E0F0F0L0L0N0NPPQQQ  8Y 8 8999# =| = =>>>% A A ABBB' D2B D DEEE" > > > >??? , II%N%N8M%N%N%NNNM I I I IJJJ " > > > >???!4_ !?n???@@@@0111<\<<<==='H2FHHIII@u}}S"'='=@@@AAA$E1BEEEFFF
OO399;;OOO	<TYYy%9%9<<<===:K:::;;;$E1BEEEFFF:L::;;;6*667772=Q..>M99\**L  	   r&   pod_idc                     d|  dS )z-
    Generates a mutation to stop a pod.
    z1
    mutation {
        podStop(input: { podId: "zD" }) {
            id
            desiredStatus
        }
    }
    r!   r<   s    r$   generate_pod_stop_mutationr?      s    #)   r&   c                     d|  d| dS )z/
    Generates a mutation to resume a pod.
    z3
    mutation {
        podResume(input: { podId: "z", gpuCount: z }) {
            id
            desiredStatus
            imageName
            env
            machineId
            machine {
                podHostId
            }
        }
    }
    r!   )r<   r   s     r$   generate_pod_resume_mutationrA      s+    %+ :C   r&   c                     d|  dS )z2
    Generates a mutation to terminate a pod.
    z6
    mutation {
        podTerminate(input: { podId: "z" })
    }
    r!   r>   s    r$   generate_pod_terminate_mutationrC      s    (.   r&   )Nr   TTNNNNNNNNNNNNNNNNN)__doc__typingr   r   r1   boolintdictr;   r?   rA   rC   r!   r&   r$   <module>rI      sQ    " ! ! ! ! ! ! ! "&"$("&#"&*.$(&*!%'+!%'+15"& $!%/J J
JJ #J 	J
 J J SMJ 3-J }J 3-J #3-J SMJ smJ #J C=J   }!J" 
$#J$ #%J&  }'J( $DI.)J* 3-+J, -J. #/J0 	1J J J JZs s          (C C      r&   