Std.Ai.Cloud.Google
Std.Ai.Cloud.Google — the Google Cloud calls the AI lifecycle makes, in
Types
type alias KeyFile = { kind : String , clientEmail : String , privateKey : String , tokenUri : String }
type alias External = { audience : String , subjectTokenType : String , tokenUrl : String , impersonationUrl : String , sourceFile : String , sourceUrl : String , sourceAuthorization : String , formatType : String , formatField : String }
type alias ApiResponse = { status : Int , body : String , request : String }
type alias JobSpec = { displayName : String , machine : String , image : String , args : List String , env : List ( String, String ) , serviceAccount : String , timeoutSeconds : Int , spot : Bool , bootDiskGb : Int , labels : List ( String, String ) }
type alias CustomJob = { name : String , displayName : String , state : String , createMs : Int , startMs : Int , endMs : Int , labels : List ( String, String ) , errorCode : Int , errorMessage : String }
type alias Service = { name : String , uri : String , latestReady : String , latestCreated : String , reconciling : Bool , ready : String , message : String , etag : String , labels : List ( String, String ) }
type alias Operation = { name : String , done : Bool , errorMessage : String }
type alias Binding = { role : String , members : List String }
type alias QuotaReading = { quotaId : String , region : String , limit : Maybe Int , note : String }
type alias ImageBuild = { project : String , region : String , bucket : String , object : String , dockerfile : String , image : String , timeoutSeconds : Int }
type alias Packed = { sha256 : String , size : Int }
type alias Sku = { service : String , description : String , regions : List String , unit : String , usd : String }
Values
accelerator : String -> ( String, Int )
The accelerator a Vertex machine type carries: `( "NVIDIA_L4", n )` for
accessToken : List String -> Task Error Secret
An access token for these scopes: from the service-account key file, else
artifactExists : String -> Task Error Bool
Whether an Artifact Registry image exists, by its reference
bucketLocation : String -> Task Error String
A bucket's location, upper case as Google reports it (`US-CENTRAL1`, or
buildImage : ImageBuild -> Task Error String
Build an image with Cloud Build (Docker with BuildKit) and return its
cancelCustomJob : String -> Task Error ()
Ask Vertex to cancel a job. The job's container gets SIGTERM; the job
cloudPlatform : String
The scope every Vertex AI, Cloud Run and Artifact Registry call needs.
createCustomJob : String -> String -> String -> Task Error CustomJob
Create a custom job from its JSON (`customJobJson`) and return it.
createService : String -> String -> String -> String -> Task Error (Maybe Operation)
Create a service (`serviceId` is its short name) from its JSON. A 409
customJobDecoder : JsonD.Decoder CustomJob
Decode a `CustomJob` resource.
customJobJson : JobSpec -> String
The `CustomJob` resource for a spec (Vertex AI v1). Pure: the same spec
deleteCustomJob : String -> Task Error ()
Delete a job's record (only an ended job can be deleted). A job that is
deleteService : String -> Task Error ()
Delete a service. One that is already gone counts as deleted.
endpointOverride : () -> Task Error String
The emulator's base URL from `SKY_AI_GCP_ENDPOINT` (under the project's
ensureRepository : String -> String -> String -> Task Error ()
Create a Docker repository in Artifact Registry (labelled
getCustomJob : String -> Task Error CustomJob
A custom job by its resource name.
getOperation : String -> Task Error Operation
A long-running operation by name (`projects/…/operations/…`).
getService : String -> Task Error (Maybe Service)
A service by its resource name, `Nothing` when it does not exist.
grantInvoker : String -> List String -> Task Error ()
Give these members (`serviceAccount:a@p.iam.gserviceaccount.com`,
idToken : String -> Task Error Secret
An ID token for an audience (a Cloud Run service's URL): a signed
jobFailure : String -> CustomJob -> Maybe Error
A failed job's typed failure: a stockout is `CapacityUnavailable`, a
listCustomJobs : String -> String -> String -> Task Error (List CustomJob)
The custom jobs that match a filter (`labels.sky-run="<key>"`), newest
listServices : String -> String -> Task Error (List Service)
The services in a region.
logTail : String -> String -> Int -> Task Error String
The last `n` log lines of a Vertex custom job (Cloud Logging), oldest
packDirectory : String -> String -> Task Error { sha256 : String, size : Int }
Pack a directory into a gzipped tar at `out`, reproducibly (sorted
patchService : String -> String -> Task Error Operation
Replace a service's spec, guarded by its etag (the JSON carries it).
quota : String -> String -> String -> String -> Task Error QuotaReading
Read a quota for a region: `quota project service quotaId region`
refused : String -> String -> ApiResponse -> Error
The typed failure for a non-2xx answer: a quota error is `QuotaExceeded`
serviceBase : String -> String -> Task Error String
The base URL of one Google service: `aiplatform` (for a region),
skus : String -> String -> List String -> Task Error (List Sku)
The catalogue's prices of a service (by its display name: `Vertex AI`,
storageReadWrite : String
The scope a GCS read and write needs (what `Std.Ai.Store` asks for).
validLabel : String -> Bool
A label key or value Google accepts: 1 to 63 characters of lower-case