Pyjo.GCP - Google Cloud for Pyjoyment¶
import Pyjo.GCP.Call
import Pyjo.GCP.Client
storage = Pyjo.GCP.Client.new(service='storage')
print(storage.call(Pyjo.GCP.Call.new('GET', '/storage/v1/b', query={'project': 'myproject'})))
storage.call_p(Pyjo.GCP.Call.new('GET', '/storage/v1/b/mybucket/o')).then(lambda objects: print(objects)).wait()
Pyjo.GCP is the namespace of the APIs of Google Cloud for
Pyjoyment, which Pyjo.UserAgent calls, without an SDK:
Pyjo.GCP.Client calls the JSON APIs, blocking and non-blocking, with
the calls of Pyjo.GCP.Call, with the access tokens of
Pyjo.GCP.Credentials, which Pyjo.GCP.Credentials.Chain finds as
the Application Default Credentials, and Pyjo.GCP.Config reads the
configuration of gcloud and of the environment.
It is for a program that needs a few calls of Google Cloud and no dependency for them, not a replacement of the client libraries of Google, which have every API. What it has is what such a program needs:
the Application Default Credentials of AIP-4110, in the order of google-auth, of
Pyjo.GCP.Credentials.Chain: the file ofGOOGLE_APPLICATION_CREDENTIALS, the one ofgcloud auth application-default login, and the metadata server of Compute Engine, GKE, Cloud Run and Cloud Functions;the credentials of each
typeof a file of google-auth, whichPyjo.GCP.Credentialslists: a user of gcloud, the key of a service account, with a self-signed JWT or the domain-wide delegation, an impersonated service account, Workload Identity Federation of a file, a URL, an executable, AWS or a certificate of X.509, and a user of a workforce pool;the project and the quota project of the credentials, of the environment and of the configuration of gcloud, which
Pyjo.GCP.Configreads without gcloud;the endpoints of a universe domain, of the emulators of
<SERVICE>_EMULATOR_HOST, and of mTLS with the certificate of a workload, with the tokens bound to the certificate of an agent identity ofPyjo.GCP.X509;the errors of the JSON APIs as
Pyjo.GCP.Error, with their status of HTTP, their status ofgoogle.rpc.Statusand their reason;blocking and non-blocking calls alike, of
Pyjo.Steps, so that an action of Pyjoyment awaits them in its event loop;no dependency but Pyjoyment: the RS256 of the keys of the service accounts is signed by
Pyjo.GCP.RSAin Python, or with the packagecryptographyof the extracryptographywhen it is installed.
gRPC, the generated clients of the discovery documents, retries, long-running operations and resumable uploads are left out, until something needs them.
See also¶
Pyjo.GCP.Client, Pyjo.GCP.Credentials, Pyjo.GCP.Config,
Pyjo.UserAgent, Pyjoyment, https://github.com/pyjoyment/Pyjoyment.
API
- Pyjo.GCP.Call - Call of a JSON API of Google Cloud
- Pyjo.GCP.Client - Client of a JSON API of Google Cloud
- Pyjo.GCP.Config - Configuration of gcloud and the environment of Google Cloud
- Pyjo.GCP.Credentials - Credentials of Google Cloud
- Pyjo.GCP.Credentials.AWS - Credentials of an external account of AWS
- Pyjo.GCP.Credentials.AuthorizedUser - Credentials of a user of gcloud
- Pyjo.GCP.Credentials.Chain - Application Default Credentials
- Pyjo.GCP.Credentials.ExternalAccount - Credentials of an external account
- Pyjo.GCP.Credentials.ExternalAccountAuthorizedUser - Credentials of a user of a workforce pool
- Pyjo.GCP.Credentials.File - Credentials of a file
- Pyjo.GCP.Credentials.IdentityPool - Credentials of an identity pool of a file, a URL or a certificate
- Pyjo.GCP.Credentials.Impersonated - Credentials of an impersonated service account
- Pyjo.GCP.Credentials.Metadata - Credentials of the metadata server
- Pyjo.GCP.Credentials.Pluggable - Credentials of an external account of an executable
- Pyjo.GCP.Credentials.Provider - Base class of the providers of credentials
- Pyjo.GCP.Credentials.ServiceAccount - Credentials of the key of a service account
- Pyjo.GCP.Error - Error of an API of Google Cloud
- Pyjo.GCP.RSA - Signatures of RS256 of a key of RSA
- Pyjo.GCP.X509 - Certificates of X.509 of the workloads