### Install from local wheel file Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Install the package efficiently using the generated wheel file after building it from source. ```sh pip install ./path-to-wheel-file.whl ``` -------------------------------- ### Add and run a new example Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Create a new Python file in the examples directory, make it executable, and then run it against your API. ```py # add an example to examples/.py #!/usr/bin/env -S rye run python … ``` ```sh chmod +x examples/.py # run the example against your api $ ./examples/.py ``` -------------------------------- ### Install Gcore Python Library Source: https://github.com/g-core/gcore-python/blob/main/README.md Install the library using pip. This command installs the base package. ```sh pip install gcore ``` -------------------------------- ### Install Gcore with aiohttp Support Source: https://github.com/g-core/gcore-python/blob/main/README.md Install the library with the aiohttp extra for improved concurrency performance in asynchronous operations. ```sh pip install gcore[aiohttp] ``` -------------------------------- ### Install from Git repository Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Install the gcore-python package directly from its Git repository using pip. ```sh pip install git+ssh://git@github.com/G-Core/gcore-python.git ``` -------------------------------- ### Start Inference Deployment Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Starts a stopped inference deployment. This action makes the deployment active and ready to process inference requests. ```APIDOC ## POST /cloud/v3/inference/{project_id}/deployments/{deployment_name}/start ### Description Starts a stopped inference deployment. ### Method POST ### Endpoint /cloud/v3/inference/{project_id}/deployments/{deployment_name}/start ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **deployment_name** (string) - Required - The name of the deployment to start. ``` -------------------------------- ### Install development dependencies with pip Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Install dependencies using pip if you are not using Rye. Ensure the Python version matches the one specified in .python-version. ```sh pip install -r requirements-dev.lock ``` -------------------------------- ### Get a Registry Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Fetch details of a specific registry by its ID, project, and region. ```python client.cloud.registries.get(registry_id, *, project_id, region_id) -> Registry ``` -------------------------------- ### Get Account Overview Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/dns/api.md Retrieves an overview of the DNS account status and configuration. ```APIDOC ## GET /dns/v2/platform/info ### Description Retrieves an overview of the DNS account. ### Method GET ### Endpoint /dns/v2/platform/info ### Response #### Success Response (200) - **response** (DNSGetAccountOverviewResponse) - The account overview details. ``` -------------------------------- ### Start mock server for tests Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Run this script to set up a mock server, which is often required for running tests against the OpenAPI spec. ```sh ./scripts/mock ``` -------------------------------- ### Run Sync Credentials Management Example Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Execute the synchronous Python script for managing credentials. Ensure the GCORE_API_KEY environment variable is set. ```bash python examples/storage/credentials.py ``` -------------------------------- ### Get Client Configuration Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves the client configuration for the CDN account. This method corresponds to a GET request to the /cdn/clients/me endpoint. ```APIDOC ## GET /cdn/clients/me ### Description Retrieves the client configuration for the CDN account. ### Method GET ### Endpoint /cdn/clients/me ### Response #### Success Response (200) - **client_config** (CDNAccount) - The CDN account configuration. ``` -------------------------------- ### Create Instance with Nested Parameters Source: https://github.com/g-core/gcore-python/blob/main/README.md Create a cloud instance with detailed nested parameters for volumes and interfaces. Ensure `Gcore` is imported. ```python from gcore import Gcore client = Gcore() task_id_list = client.cloud.instances.create( project_id=1, region_id=1, flavor="g2-standard-4-8", interfaces=[{"type": "external"}], volumes=[ { "source": "image", "image_id": "your-image-uuid", "size": 50, "type_name": "ssd_hiiops", "boot_index": 0, }, { "source": "new-volume", "size": 100, "type_name": "ssd_hiiops", }, ], user_data="IyEvYmluL2Jhc2gKZWNobyAiSGVsbG8sIFdvcmxkISIgPj4gL3RtcC9jbG91ZC1pbml0Lm91dAo=", name="my-instance", ) print(task_id_list.tasks) ``` -------------------------------- ### Get Origin Group Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves a specific origin group by its ID. Use this to get details of a single origin group. ```python client.cdn.origin_groups.get(origin_group_id) ``` -------------------------------- ### Create a Baremetal Server Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Create a new baremetal server instance with specified parameters. ```python client.cloud.baremetal.servers.create( project_id=project_id, region_id=region_id, **params ) ``` -------------------------------- ### Run Async Credentials Management Example Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Execute the asynchronous Python script for managing credentials. Ensure the GCORE_API_KEY environment variable is set. ```bash python examples/storage/credentials_async.py ``` -------------------------------- ### Get Aggregated Storage Usage Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/storage/api.md Retrieve aggregated storage usage data. This method is useful for getting a summary of total storage consumption. ```python client.storage.statistics.get_usage_aggregated(**params) -> UsageTotal ``` -------------------------------- ### Get Registry Credentials Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Fetch details of a specific registry credential by its name for a given project. ```python from gcore.types.cloud.inference import InferenceRegistryCredentials # Assuming 'client' is an initialized Gcore client instance # Example usage: # credential = client.cloud.inference.registry_credentials.get(credential_name='my-credential', project_id='your_project_id') ``` -------------------------------- ### Run Sync Basic Storage Operations Example Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Execute the synchronous Python script for basic storage operations. Ensure the GCORE_API_KEY environment variable is set. ```bash python examples/storage/basic.py ``` -------------------------------- ### Determine Installed gcore-python Version Source: https://github.com/g-core/gcore-python/blob/main/README.md Use this snippet to check the version of the gcore library installed in your Python environment. This is useful if you suspect an outdated version is being used. ```python import gcore print(gcore.__version__) ``` -------------------------------- ### Asynchronous Pagination Example Source: https://github.com/g-core/gcore-python/blob/main/README.md Asynchronously iterate through all projects using async for. This method fetches subsequent pages automatically as needed. ```python import asyncio from gcore import AsyncGcore client = AsyncGcore() async def main() -> None: all_projects = [] # Iterate through items across all pages, issuing requests as needed. async for project in client.cloud.projects.list( limit=10, offset=0, ): all_projects.append(project) print(all_projects) asyncio.run(main()) ``` -------------------------------- ### Bootstrap development environment with Rye Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Run this script to automatically set up the Python environment using Rye, including installing dependencies. ```sh ./scripts/bootstrap ``` -------------------------------- ### Statuses Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Get the status of load balancers. ```APIDOC ## GET /cloud/v1/loadbalancers/{project_id}/{region_id}/status ### Description Retrieves the status of all load balancers within a specified project and region. ### Method GET ### Endpoint /cloud/v1/loadbalancers/{project_id}/{region_id}/status ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. ### Response #### Success Response (200) - **LoadBalancerStatusList** (object) - A list of load balancer statuses. Refer to `src/gcore/types/cloud/load_balancer_status_list.py` for details. ``` ```APIDOC ## GET /cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status ### Description Retrieves the status of a specific load balancer. ### Method GET ### Endpoint /cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/status ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **load_balancer_id** (string) - Required - The ID of the load balancer. ### Response #### Success Response (200) - **LoadBalancerStatus** (object) - The status of the load balancer. Refer to `src/gcore/types/cloud/load_balancer_status.py` for details. ``` -------------------------------- ### Run Sync S3 Bucket Management Example Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Execute the synchronous Python script for managing S3 buckets. Ensure the GCORE_API_KEY environment variable is set. ```bash python examples/storage/s3_buckets.py ``` -------------------------------- ### Get Image Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific image. ```APIDOC ## GET /cloud/v1/images/{project_id}/{region_id}/{image_id} ### Description Retrieves details of a specific image. ### Method GET ### Endpoint /cloud/v1/images/{project_id}/{region_id}/{image_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **image_id** (string) - Required - The ID of the image. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving image details. ### Response #### Success Response (200) - **image** (Image) - The image object with its details. ``` -------------------------------- ### Get Binary Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Retrieves a specific binary by its ID. ```APIDOC ## GET /fastedge/v1/binaries/{binary_id} ### Description Retrieves a specific binary. ### Method GET ### Endpoint /fastedge/v1/binaries/{binary_id} ### Parameters #### Path Parameters - **binary_id** (string) - Required - The ID of the binary to retrieve. ### Response #### Success Response (200) - **binary** (Binary) - The binary object. ``` -------------------------------- ### List Available Storage Locations Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Demonstrates how to list available storage locations using the Gcore client. This requires the GCORE_API_KEY to be set. ```python from gcore import Gcore client = Gcore() locations = client.storage.locations.list() for location in locations: print(f"{location.code}: {location.name}") ``` -------------------------------- ### Run Async Basic Storage Operations Example Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Execute the asynchronous Python script for basic storage operations. Ensure the GCORE_API_KEY environment variable is set. ```bash python examples/storage/basic_async.py ``` -------------------------------- ### Get Secret Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Retrieves a specific secret by its ID. ```APIDOC ## GET /fastedge/v1/secrets/{secret_id} ### Description Retrieves a specific secret. ### Method GET ### Endpoint /fastedge/v1/secrets/{secret_id} ### Parameters #### Path Parameters - **secret_id** (string) - Required - The ID of the secret to retrieve. ### Response #### Success Response (200) - **secret** (Secret) - The secret object. ``` -------------------------------- ### Sync dependencies with Rye Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Use this command to synchronize project dependencies with all features enabled after manually installing Rye. ```sh rye sync --all-features ``` -------------------------------- ### Get Template Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Retrieves a specific template by its ID. ```APIDOC ## GET /fastedge/v1/template/{template_id} ### Description Retrieves a specific template. ### Method GET ### Endpoint /fastedge/v1/template/{template_id} ### Parameters #### Path Parameters - **template_id** (string) - Required - The ID of the template to retrieve. ### Response #### Success Response (200) - **template** (Template) - The full template object. ``` -------------------------------- ### Build distributable package Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Create a source distribution (.tar.gz) and a wheel file (.whl) for the library using Rye or Python's build module. ```sh rye build ``` ```sh python -m build ``` -------------------------------- ### Run Async S3 Bucket Management Example Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Execute the asynchronous Python script for managing S3 buckets. Ensure the GCORE_API_KEY environment variable is set. ```bash python examples/storage/s3_buckets_async.py ``` -------------------------------- ### Get Registry Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific container registry. ```APIDOC ## GET /cloud/v1/registries/{project_id}/{region_id}/{registry_id} ### Description Retrieves details of a specific container registry. ### Method GET ### Endpoint /cloud/v1/registries/{project_id}/{region_id}/{registry_id} ### Parameters #### Path Parameters - **registry_id** (string) - Required - The ID of the registry. - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. ### Response #### Success Response (200) - **registry** (Registry) - The registry details. ``` -------------------------------- ### Import Baremetal Server Types Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Import necessary types for working with baremetal servers. ```python from gcore.types.cloud.baremetal import ( BaremetalFixedAddress, BaremetalFloatingAddress, BaremetalServer, ) ``` -------------------------------- ### LoadBalancer Get Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details for a specific load balancer. ```APIDOC ## GET /cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id} ### Description Retrieves detailed information about a specific load balancer. ### Method GET ### Endpoint /cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **load_balancer_id** (string) - Required - The ID of the load balancer. #### Query Parameters - **params** (object) - Optional - Parameters for retrieving load balancer details. Refer to `src/gcore/types/cloud/load_balancer_get_params.py` for details. ### Response #### Success Response (200) - **load_balancer** (LoadBalancer) - The load balancer object with detailed information. ``` -------------------------------- ### Get Task Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific task by its ID. ```APIDOC ## GET /cloud/v1/tasks/{task_id} ### Description Retrieves details of a specific task by its ID. ### Method GET ### Endpoint /cloud/v1/tasks/{task_id} ### Parameters #### Path Parameters - **task_id** (string) - Required - The ID of the task to retrieve. ### Response #### Success Response (200) - **Task** - The Task object. ``` -------------------------------- ### Run all tests Source: https://github.com/g-core/gcore-python/blob/main/CONTRIBUTING.md Execute the project's test suite. Ensure the mock server is running if tests require it. ```sh ./scripts/test ``` -------------------------------- ### Create a Registry Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Use the client to create a new registry within a specific project and region. Requires project_id, region_id, and optional creation parameters. ```python client.cloud.registries.create(*, project_id, region_id, **params) -> Registry ``` -------------------------------- ### Get User Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/iam/api.md Retrieves details of a specific user by their ID. ```APIDOC ## GET /iam/users/{userId} ### Description Retrieves a specific user by their ID. ### Method GET ### Endpoint /iam/users/{userId} ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user to retrieve. ``` -------------------------------- ### Get Traffic Metrics Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/waap/api.md Retrieves WAAP traffic metrics. ```APIDOC ## GET /waap/v1/analytics/traffic ### Description Retrieves WAAP traffic metrics. ### Method GET ### Endpoint /waap/v1/analytics/traffic ### Parameters #### Query Parameters - **params** (object) - Optional. Parameters for filtering traffic metrics. - **start_time** (string) - Optional. The start of the time range. - **end_time** (string) - Optional. The end of the time range. - **interval** (string) - Optional. The interval for the traffic data (e.g., 'hour', 'day'). ### Response #### Success Response (200) - **total_requests** (integer) - The total number of requests. - **total_bandwidth** (integer) - The total bandwidth in bytes. - **unique_visitors** (integer) - The number of unique visitors. ``` -------------------------------- ### List Binaries Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Lists all available binaries. ```APIDOC ## GET /fastedge/v1/binaries ### Description Lists all available binaries. ### Method GET ### Endpoint /fastedge/v1/binaries ### Response #### Success Response (200) - **binary_list_response** (BinaryListResponse) - The response object containing a list of binaries. ``` -------------------------------- ### Synchronous Pagination Example Source: https://github.com/g-core/gcore-python/blob/main/README.md Iterate through all projects using the auto-paginating iterator provided by the list method. This simplifies fetching paginated results. ```python from gcore import Gcore client = Gcore() all_projects = [] # Automatically fetches more pages as needed. for project in client.cloud.projects.list( limit=10, offset=0, ): # Do something with project here all_projects.append(project) print(all_projects) ``` -------------------------------- ### Get Profile Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/security/api.md Retrieves a specific security profile by its ID. ```APIDOC ## GET /security/iaas/v2/profiles/{id} ### Description Retrieves a specific security profile by its ID. ### Method GET ### Endpoint /security/iaas/v2/profiles/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the profile to retrieve. ``` -------------------------------- ### Get Account Overview Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Retrieves an overview of the Fastedge account. ```APIDOC ## GET /fastedge/v1/me ### Description Retrieves an overview of the Fastedge account. ### Method GET ### Endpoint /fastedge/v1/me ### Response #### Success Response (200) - **account_overview** (Client) - Description of the account overview object. ``` -------------------------------- ### Postgres Clusters Get Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific PostgreSQL cluster. ```APIDOC ## GET /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name} ### Description Retrieves details of a PostgreSQL cluster. ### Method GET ### Endpoint /cloud/v1/dbaas/postgres/clusters/{project_id}/{region_id}/{cluster_name} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **cluster_name** (string) - Required - The name of the cluster to retrieve. ``` -------------------------------- ### Load GCORE_API_KEY from .env file (Linux/macOS) Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Load the GCORE_API_KEY from a .env file into the environment for authentication on Linux or macOS. ```bash export $(cat .env | xargs) ``` -------------------------------- ### Synchronous Client Usage Source: https://github.com/g-core/gcore-python/blob/main/README.md Instantiate the synchronous Gcore client and create a project. It's recommended to load the API key from environment variables. ```python import os from gcore import Gcore client = Gcore( api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted ) project = client.cloud.projects.create( name="my-project", ) print(project.id) ``` -------------------------------- ### Get Volume Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific cloud volume by its ID. ```APIDOC ## GET /cloud/v1/volumes/{project_id}/{region_id}/{volume_id} ### Description Retrieves details of a specific cloud volume. ### Method GET ### Endpoint /cloud/v1/volumes/{project_id}/{region_id}/{volume_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **volume_id** (string) - Required - The ID of the volume to retrieve. ### Response #### Success Response (200) - **id** (string) - The ID of the volume. - **name** (string) - The name of the volume. - **size** (integer) - The size of the volume in GB. - **type** (string) - The type of the volume. - **status** (string) - The current status of the volume. ``` -------------------------------- ### Asynchronous Client Usage Source: https://github.com/g-core/gcore-python/blob/main/README.md Instantiate the asynchronous Gcore client and create a project using await. Ensure you import AsyncGcore and use asyncio. ```python import os import asyncio from gcore import AsyncGcore client = AsyncGcore( api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted ) async def main() -> None: project = await client.cloud.projects.create( name="my-project", ) print(project.id) asyncio.run(main()) ``` -------------------------------- ### Get Region Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific cloud region by its ID. ```APIDOC ## GET /cloud/v1/regions/{region_id} ### Description Retrieves details of a specific cloud region by its ID. ### Method GET ### Endpoint /cloud/v1/regions/{region_id} ### Parameters #### Path Parameters - **region_id** (string) - Required - The ID of the region to retrieve. #### Query Parameters - **params** (object) - Optional - Additional parameters for retrieving region details. ### Response #### Success Response (200) - **Region** - The Region object. ``` -------------------------------- ### Get LogsUploader Policy Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieve a specific LogsUploader policy by its ID. ```python client.cdn.logs_uploader.policies.get(id) ``` -------------------------------- ### Async Client with aiohttp Backend Source: https://github.com/g-core/gcore-python/blob/main/README.md Instantiate the asynchronous client using DefaultAioHttpClient for the HTTP backend. This requires aiohttp to be installed. ```python import os import asyncio from gcore import DefaultAioHttpClient from gcore import AsyncGcore async def main() -> None: async with AsyncGcore( api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: project = await client.cloud.projects.create( name="my-project", ) print(project.id) asyncio.run(main()) ``` -------------------------------- ### Perform Instance Action Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Performs a specific action on a cloud instance, such as starting or stopping. Requires instance ID, project ID, and region ID. ```APIDOC ## POST /cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action ### Description Performs an action on a cloud instance. ### Method POST ### Endpoint /cloud/v2/instances/{project_id}/{region_id}/{instance_id}/action ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **instance_id** (string) - Required - The ID of the instance. #### Request Body - **params** (object) - Required - Action parameters. See `src/gcore/types/cloud/instance_action_params.py` for details. ### Response #### Success Response (200) - **task_id_list** (TaskIDList) - A list of task IDs for the action. ``` -------------------------------- ### Get DNSSEC Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/dns/api.md Retrieves the DNSSEC configuration for a specific DNS zone. ```APIDOC ## GET /dns/v2/zones/{name}/dnssec ### Description Retrieves the DNSSEC configuration for a zone. ### Method GET ### Endpoint /dns/v2/zones/{name}/dnssec ### Parameters #### Path Parameters - **name** (string) - Required - The name of the zone. ``` -------------------------------- ### Get Zone Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/dns/api.md Retrieves details of a specific DNS zone by its name. ```APIDOC ## GET /dns/v2/zones/{name} ### Description Retrieves a specific DNS zone. ### Method GET ### Endpoint /dns/v2/zones/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The name of the zone to retrieve. ``` -------------------------------- ### Create Project Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Creates a new cloud project. Accepts project creation parameters. ```APIDOC ## POST /cloud/v1/projects ### Description Creates a new cloud project. ### Method POST ### Endpoint /cloud/v1/projects ### Request Body - **params** (object) - Required - Project creation parameters. ### Request Example ```json { "example": "request body for project creation" } ``` ### Response #### Success Response (200) - **Project** (object) - Details of the created project. #### Response Example ```json { "example": "response body for created project" } ``` ``` -------------------------------- ### Create Binary Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Creates a new binary with the provided body and parameters. ```APIDOC ## POST /fastedge/v1/binaries/raw ### Description Creates a new binary. ### Method POST ### Endpoint /fastedge/v1/binaries/raw ### Parameters #### Request Body - **body** (any) - Required - The binary content. #### Query Parameters - **params** (BinaryCreateParams) - Optional - Parameters for creating the binary. ### Response #### Success Response (200) - **binary_short** (BinaryShort) - A short representation of the created binary. ``` -------------------------------- ### Get Domain Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/waap/api.md Retrieves detailed information about a specific WAAP domain. ```APIDOC ## GET /waap/v1/domains/{domain_id} ### Description Retrieves detailed information for a specified WAAP domain. ### Method GET ### Endpoint /waap/v1/domains/{domain_id} ### Parameters #### Path Parameters - **domain_id** (string) - Required - The ID of the domain to retrieve. ### Response #### Success Response (200) - **id** (string) - The ID of the domain. - **name** (string) - The name of the domain. - **waf_enabled** (boolean) - Whether WAF is enabled. - **ddos_enabled** (boolean) - Whether DDoS protection is enabled. ``` -------------------------------- ### Create a Placement Group Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Use the client to create a new placement group within a project and region. ```python client.cloud.placement_groups.create( project_id=project_id, region_id=region_id, **params ) ``` -------------------------------- ### Get Kubernetes Cluster Certificate Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves the certificate for a specific Kubernetes cluster. ```APIDOC ## GET /cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates ### Description Retrieves the certificate for a Kubernetes cluster. ### Method GET ### Endpoint /cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name}/certificates ### Parameters #### Path Parameters - **cluster_name** (string) - Required - The name of the cluster. - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. ### Response #### Success Response (200) - **certificate** (K8SClusterCertificate) - The cluster certificate. ``` -------------------------------- ### Create Registry Credentials Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Use this method to create new registry credentials for a project. Ensure you have the necessary project ID and parameters. ```python from gcore.types.cloud.inference import InferenceRegistryCredentials # Assuming 'client' is an initialized Gcore client instance # Example usage: # credentials = client.cloud.inference.registry_credentials.create(project_id='your_project_id', name='my-credential', username='user', password='password') ``` -------------------------------- ### Get Kubernetes Cluster Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves detailed information about a specific Kubernetes cluster. ```APIDOC ## GET /cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name} ### Description Retrieves details of a specific Kubernetes cluster. ### Method GET ### Endpoint /cloud/v2/k8s/clusters/{project_id}/{region_id}/{cluster_name} ### Parameters #### Path Parameters - **cluster_name** (string) - Required - The name of the cluster. - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. ### Response #### Success Response (200) - **cluster** (K8SCluster) - The details of the Kubernetes cluster. ``` -------------------------------- ### Create Instance Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Creates a new cloud instance within a specified project and region. Accepts various parameters for instance configuration. ```APIDOC ## POST /cloud/v2/instances/{project_id}/{region_id} ### Description Creates a new cloud instance. ### Method POST ### Endpoint /cloud/v2/instances/{project_id}/{region_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. #### Request Body - **params** (object) - Required - Instance creation parameters. See `src/gcore/types/cloud/instance_create_params.py` for details. ### Response #### Success Response (200) - **task_id_list** (TaskIDList) - A list of task IDs for the creation operation. ``` -------------------------------- ### Get Secret Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Fetch details of a specific secret by its name for a given project. ```python from gcore.types.cloud.inference import InferenceSecret # Assuming 'client' is an initialized Gcore client instance # Example usage: # secret = client.cloud.inference.secrets.get(secret_name='my-secret', project_id='your_project_id') ``` -------------------------------- ### Create Inference Application Deployment Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Create a new deployment for an inference application. Requires project ID and deployment parameters. ```python client.cloud.inference.applications.deployments.create( *, project_id, **params ) -> TaskIDList ``` -------------------------------- ### Get Floating IP Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific Floating IP address. ```APIDOC ## GET /cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id} ### Description Retrieves details of a specific Floating IP address. ### Method GET ### Endpoint /cloud/v1/floatingips/{project_id}/{region_id}/{floating_ip_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **floating_ip_id** (string) - Required - The ID of the Floating IP. ``` -------------------------------- ### Create CDN Logs Uploader Config Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Use this method to create a new CDN logs uploader configuration. Requires parameters for configuration. ```python client.cdn.logs_uploader.configs.create(**params) -> LogsUploaderConfig ``` -------------------------------- ### Import Baremetal Image Types Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Import necessary types for working with baremetal images. ```python from gcore.types.cloud.baremetal import BaremetalImage, BaremetalImageList ``` -------------------------------- ### get Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves details of a specific cloud router by its ID, project, and region. ```APIDOC ## GET /cloud/v1/routers/{project_id}/{region_id}/{router_id} ### Description Retrieves details of a specific cloud router. ### Method GET ### Endpoint /cloud/v1/routers/{project_id}/{region_id}/{router_id} ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **router_id** (string) - Required - The ID of the router. ### Response #### Success Response (200) - **Router** - The router object with its details. ``` -------------------------------- ### Get All Client Quotas Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves all quotas for the authenticated client. Requires no parameters. ```python from gcore.types.cloud import QuotaGetAllResponse quotas: QuotaGetAllResponse = client.cloud.quotas.get_all() ``` -------------------------------- ### Set GCORE_API_KEY Environment Variable (Windows Command Prompt) Source: https://github.com/g-core/gcore-python/blob/main/examples/storage/README.md Set the GCORE_API_KEY environment variable for authentication on Windows using the Command Prompt. ```cmd set GCORE_API_KEY=your_api_key_here ``` -------------------------------- ### Create LogsUploader Policy Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Create a new LogsUploader policy. Requires specifying policy creation parameters. ```python client.cdn.logs_uploader.policies.create(**params) ``` -------------------------------- ### Get Single Task Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieve details for a specific task using its ID. ```python client.cloud.tasks.get(task_id) -> Task ``` -------------------------------- ### Get Rule Template Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves a specific CDN Rule Template by its ID. ```APIDOC ## GET /cdn/resources/rule_templates/{rule_template_id} ### Description Retrieves a specific CDN Rule Template. ### Method GET ### Endpoint /cdn/resources/rule_templates/{rule_template_id} ### Parameters #### Path Parameters - **rule_template_id** (string) - Required - The ID of the rule template to retrieve. ``` -------------------------------- ### List Projects Source: https://github.com/g-core/gcore-python/blob/main/README.md Fetch a list of projects with pagination. Remove `await` for non-async usage. ```python first_page = await client.cloud.projects.list( limit=10, offset=0, ) for project in first_page.results: print(project.id) ``` -------------------------------- ### Get Instance Console Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves console access details for a cloud instance. Requires instance ID, project ID, and region ID. ```APIDOC ## GET /cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console ### Description Retrieves console access details for a cloud instance. ### Method GET ### Endpoint /cloud/v1/instances/{project_id}/{region_id}/{instance_id}/get_console ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. - **instance_id** (string) - Required - The ID of the instance. #### Query Parameters - **params** (object) - Optional - Console access parameters. See `src/gcore/types/cloud/instance_get_console_params.py` for details. ### Response #### Success Response (200) - **console** (Console) - The console access details. ``` -------------------------------- ### Get Origin Shielding Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves the origin shielding configuration for a CDN resource. ```APIDOC ## GET /cdn/resources/{resource_id}/shielding_v2 ### Description Retrieves the origin shielding configuration for a CDN resource. ### Method GET ### Endpoint /cdn/resources/{resource_id}/shielding_v2 ### Parameters #### Path Parameters - **resource_id** (string) - Required - The ID of the CDN resource. ### Response #### Success Response (200) - **OriginShielding** (object) - The origin shielding configuration. ### Response Example ```json { "example": "response body for origin shielding" } ``` ``` -------------------------------- ### Get CDN Resource Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves details of a specific CDN resource by its ID. ```APIDOC ## GET /cdn/resources/{resource_id} ### Description Retrieves details of a specific CDN resource. ### Method GET ### Endpoint /cdn/resources/{resource_id} ### Parameters #### Path Parameters - **resource_id** (string) - Required - The ID of the CDN resource to retrieve. ### Response #### Success Response (200) - **CDNResource** (object) - The CDN resource details. ### Response Example ```json { "example": "response body for CDN resource" } ``` ``` -------------------------------- ### List Registry Repositories Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieve a list of repositories within a specific registry, project, and region. ```python client.cloud.registries.repositories.list(registry_id, *, project_id, region_id) -> RegistryRepositoryList ``` -------------------------------- ### Get CDN Resource Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Fetch details of a specific CDN resource by its ID. ```python client.cdn.cdn_resources.get(resource_id) ``` -------------------------------- ### Create File Share Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Use this method to create a new file share. Requires project and region IDs, along with creation parameters. ```python client.cloud.file_shares.create(*, project_id, region_id, **params) -> TaskIDList ``` -------------------------------- ### Get Available Features Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves the list of available features for the CDN account. ```APIDOC ## GET /cdn/clients/me/features ### Description Retrieves the list of available features for the CDN account. ### Method GET ### Endpoint /cdn/clients/me/features ### Response #### Success Response (200) - **features** (CDNAvailableFeatures) - An object containing the available CDN features. ``` -------------------------------- ### Granular Pagination Control Source: https://github.com/g-core/gcore-python/blob/main/README.md Demonstrates how to manually control pagination using `.has_next_page()`, `.next_page_info()`, and `.get_next_page()` for more granular control over fetching pages. ```python first_page = await client.cloud.projects.list( limit=10, offset=0, ) if first_page.has_next_page(): print(f"will fetch next page using these details: {first_page.next_page_info()}") next_page = await first_page.get_next_page() print(f"number of items we just fetched: {len(next_page.results)}") ``` -------------------------------- ### Enable Logging Source: https://github.com/g-core/gcore-python/blob/main/README.md Enable logging for the Gcore SDK by setting the `GCORE_LOG` environment variable to 'info' or 'debug'. ```shell $ export GCORE_LOG=info ``` -------------------------------- ### Get Account Limits Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Retrieves the CDN account limits for the current client. ```APIDOC ## GET /cdn/clients/me/limits ### Description Retrieves the CDN account limits for the current client. ### Method GET ### Endpoint /cdn/clients/me/limits ### Response #### Success Response (200) - **limits** (CDNAccountLimits) - An object containing the CDN account limits. ``` -------------------------------- ### Get Views Heatmap Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/streaming/api.md Retrieves streaming view statistics in a heatmap format. ```APIDOC ## GET /streaming/statistics/heatmap ### Description Retrieves streaming view statistics in a heatmap format. ### Method GET ### Endpoint /streaming/statistics/heatmap ### Parameters #### Query Parameters - **params** (object) - Required - Parameters for filtering and paginating the results. ### Request Example ```json { "example": "client.streaming.statistics.get_views_heatmap(**params)" } ``` ### Response #### Success Response (200) - **ViewsHeatmap** - Object containing view statistics in a heatmap format. ### Response Example ```json { "example": "ViewsHeatmap object" } ``` ``` -------------------------------- ### Configure HTTP Client with Proxies and Transports Source: https://github.com/g-core/gcore-python/blob/main/README.md Customize the underlying `httpx` client by passing a `DefaultHttpxClient` instance to the `Gcore` constructor. This allows configuration of proxies, transports, and other advanced `httpx` features. ```python import httpx from gcore import Gcore, DefaultHttpxClient client = Gcore( # Or use the `GCORE_BASE_URL` env var base_url="http://my.test.server.example.com:8083", http_client=DefaultHttpxClient( proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) ``` -------------------------------- ### Get Views by Region Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/streaming/api.md Retrieves streaming view statistics broken down by region. ```APIDOC ## GET /streaming/statistics/regions ### Description Retrieves streaming view statistics broken down by region. ### Method GET ### Endpoint /streaming/statistics/regions ### Parameters #### Query Parameters - **params** (object) - Required - Parameters for filtering and paginating the results. ### Request Example ```json { "example": "client.streaming.statistics.get_views_by_region(**params)" } ``` ### Response #### Success Response (200) - **ViewsByRegion** - Object containing view statistics by region. ### Response Example ```json { "example": "ViewsByRegion object" } ``` ``` -------------------------------- ### Get Views by Referer Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/streaming/api.md Retrieves streaming view statistics broken down by referer. ```APIDOC ## GET /streaming/statistics/embeds ### Description Retrieves streaming view statistics broken down by referer. ### Method GET ### Endpoint /streaming/statistics/embeds ### Parameters #### Query Parameters - **params** (object) - Required - Parameters for filtering and paginating the results. ### Request Example ```json { "example": "client.streaming.statistics.get_views_by_referer(**params)" } ``` ### Response #### Success Response (200) - **ViewsByReferer** - Object containing view statistics by referer. ### Response Example ```json { "example": "ViewsByReferer object" } ``` ``` -------------------------------- ### Create SFTP Storage Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/storage/api.md Use this method to create a new SFTP storage. Requires SFTP storage creation parameters. ```python from gcore.types.storage import SftpStorage client.storage.sftp_storages.create(**params) -> SftpStorage ``` -------------------------------- ### Get Views by Hostname Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/streaming/api.md Retrieves streaming view statistics broken down by hostname. ```APIDOC ## GET /streaming/statistics/hosts ### Description Retrieves streaming view statistics broken down by hostname. ### Method GET ### Endpoint /streaming/statistics/hosts ### Parameters #### Query Parameters - **params** (object) - Required - Parameters for filtering and paginating the results. ### Request Example ```json { "example": "client.streaming.statistics.get_views_by_hostname(**params)" } ``` ### Response #### Success Response (200) - **ViewsByHostname** - Object containing view statistics by hostname. ### Response Example ```json { "example": "ViewsByHostname object" } ``` ``` -------------------------------- ### List GPU Baremetal Flavors Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Retrieves a list of available GPU baremetal flavors. Flavors define the hardware configurations for GPU baremetal servers. ```APIDOC ## GET /cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors ### Description Retrieves a list of available GPU baremetal flavors. ### Method GET ### Endpoint /cloud/v3/gpu/baremetal/{project_id}/{region_id}/flavors ### Parameters #### Path Parameters - **project_id** (string) - Required - The ID of the project. - **region_id** (string) - Required - The ID of the region. #### Query Parameters - **params** (object) - Optional - Parameters for filtering the flavor list. Refer to `src/gcore/types/cloud/gpu_baremetal/clusters/flavor_list_params.py` for details. ### Response #### Success Response (200) - **flavors** (GPUBaremetalFlavorList) - A list of available GPU baremetal flavors. ``` -------------------------------- ### Get Domain Settings Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/waap/api.md Retrieves the current settings for a specific WAAP domain. ```APIDOC ## GET /waap/v1/domains/{domain_id}/settings ### Description Retrieves the settings for a specified WAAP domain. ### Method GET ### Endpoint /waap/v1/domains/{domain_id}/settings ### Parameters #### Path Parameters - **domain_id** (string) - Required - The ID of the domain whose settings are to be retrieved. ### Response #### Success Response (200) - **name** (string) - The name of the domain. - **waf_enabled** (boolean) - Whether WAF is enabled. - **ddos_enabled** (boolean) - Whether DDoS protection is enabled. ``` -------------------------------- ### Create Cloud Project Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Creates a new cloud project using the client.cloud.projects.create method. Requires project creation parameters. ```python client.cloud.projects.create(**params) -> Project ``` -------------------------------- ### Get Video Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/streaming/api.md Use this method to retrieve a specific streaming video by its ID. ```python client.streaming.videos.get(video_id) -> Video ``` -------------------------------- ### client.cdn.logs_uploader.policies.create Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cdn/api.md Creates a new policy for the logs uploader. Requires parameters to define the policy. ```APIDOC ## POST /cdn/logs_uploader/policies ### Description Creates a new policy for the logs uploader. Requires parameters to define the policy. ### Method POST ### Endpoint /cdn/logs_uploader/policies ### Parameters #### Request Body - **params** (object) - Required - Parameters to define the logs uploader policy. ``` -------------------------------- ### Create Template Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/fastedge/api.md Creates a new template with the provided parameters. ```APIDOC ## POST /fastedge/v1/template ### Description Creates a new template. ### Method POST ### Endpoint /fastedge/v1/template ### Parameters #### Request Body - **params** (TemplateCreateParams) - Required - Parameters for creating a template. ### Response #### Success Response (200) - **template_short** (TemplateShort) - A short representation of the created template. ``` -------------------------------- ### Get Requests Summary Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/waap/api.md Retrieves a summary of WAAP requests, with support for pagination. ```APIDOC ## GET /waap/v1/analytics/requests ### Description Retrieves a summary of WAAP requests. ### Method GET ### Endpoint /waap/v1/analytics/requests ### Parameters #### Query Parameters - **params** (object) - Optional. Parameters for filtering and paginating requests. - **start_time** (string) - Optional. The start of the time range. - **end_time** (string) - Optional. The end of the time range. - **limit** (integer) - Optional. The maximum number of items to return. - **offset** (integer) - Optional. The number of items to skip. ### Response #### Success Response (200) - **items** (array) - A list of request summary items. - **timestamp** (string) - The timestamp of the request. - **ip_address** (string) - The IP address of the client. - **method** (string) - The HTTP method of the request. - **path** (string) - The requested path. - **status_code** (integer) - The HTTP status code of the response. ``` -------------------------------- ### Get DNS Zone Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/dns/api.md Retrieves details for a specific DNS zone by its name. ```python client.dns.zones.get(name) -> ZoneGetResponse ``` -------------------------------- ### Create Registry User Source: https://github.com/g-core/gcore-python/blob/main/src/gcore/resources/cloud/api.md Create a new user for a specific registry. Requires registry, project, and region IDs, along with user creation parameters. ```python client.cloud.registries.users.create(registry_id, *, project_id, region_id, **params) -> RegistryUserCreated ```