### Get Instance Request Example Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Demonstrates a GET request to retrieve a specific instance by its ID and the expected JSON response structure. ```json // Request GET /compute/v1/instances/epdxxxxxxxxxx // Response { "id": "epdxxxxxxxxxx", "folder_id": "b1g123456789", "created_at": "2024-01-15T10:30:00Z", "name": "my-instance", "status": "RUNNING", "zone_id": "ru-central1-a", "platform_id": "standard-v3", "resources": { "cores": 2, "memory": "4294967296", "core_fraction": 100, "gpus": 0 } } ``` -------------------------------- ### Example Resources Specification Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md An example of how to specify resources for an instance, such as 2 cores with 50% baseline and 4 GB RAM. ```proto resources_spec = { memory: 4294967296, // 4 GB cores: 2, core_fraction: 50, gpus: 0 } ``` -------------------------------- ### Start Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Starts a stopped compute instance. ```APIDOC ## Start Instance ### Description Starts a stopped compute instance. ### Method POST ### Endpoint /compute/v1/instances/{instance_id}:start ### Parameters #### Path Parameters - **instance_id** (string) - Required - The ID of the instance to start. ### Request Example ```bash curl -X POST -H "Authorization: Bearer $IAM_TOKEN" \ https://api.yandex.cloud/compute/v1/instances/epdxxxxxxxxxx:start ``` ``` -------------------------------- ### RPC Signature with HTTP Binding Example Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/README.md Illustrates an RPC service method signature, including its HTTP binding for RESTful access. Shows how to define GET requests with path parameters. ```proto service InstanceService { rpc Get(GetInstanceRequest) returns (Instance) { option (google.api.http) = { get: "/compute/v1/instances/{instance_id}" }; }; } ``` -------------------------------- ### Start Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Use this RPC to start a stopped instance. This is a long-running operation. ```proto rpc Start(StartInstanceRequest) returns (operation.Operation) { option (api.operation) = { metadata: "StartInstanceMetadata" response: "Instance" }; option (google.api.http) = { body: "*" post: "/compute/v1/instances/{instance_id}:start" }; } ``` ```proto message StartInstanceRequest { string instance_id = 1; // Required. Instance ID } ``` -------------------------------- ### Node.js SDK Installation Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/README.md Install the Node.js SDK for Yandex Cloud. ```bash npm install @yandex-cloud/nodejs-sdk ``` -------------------------------- ### Start Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Starts a stopped compute instance. This is a long-running asynchronous operation. ```APIDOC ## POST /compute/v1/instances/{instance_id}:start ### Description Start a stopped instance. Long-running async operation. ### Method POST ### Endpoint /compute/v1/instances/{instance_id}:start ### Parameters #### Path Parameters - **instance_id** (string) - Required - Instance ID #### Request Body - **instance_id** (string) - Required. Instance ID ``` -------------------------------- ### Start Compute Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Initiate the startup process for a specified compute instance. ```bash curl -X POST -H "Authorization: Bearer $IAM_TOKEN" \ https://api.yandex.cloud/compute/v1/instances/epdxxxxxxxxxx:start ``` -------------------------------- ### List Instances Filter Examples Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Provides examples of filter expressions that can be used when listing instances to narrow down results by status, name, zone, or platform. ```text status="RUNNING" name="web-*" zone_id="ru-central1-a" AND status="STOPPED" platform_id="gpu-v100" ``` -------------------------------- ### Async Operations & Patterns Guide Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/README.md Guide to understanding and implementing asynchronous operations, pagination, filtering, and error recovery patterns in the Yandex Cloud API. ```APIDOC ## Async Operations & Patterns Guide ### Description This guide explains the asynchronous operation workflow in the Yandex Cloud API, including how to poll for operation completion, implement pagination, filtering, and sorting, and handle errors and idempotency. ### Content - Asynchronous operation workflow - Polling for operation completion - Pagination patterns - Filtering and sorting syntax - Field masking for updates - Error recovery and idempotency - Resource cleanup patterns ``` -------------------------------- ### List IAM Bindings for an Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Use this RPC to list IAM bindings for a specific compute instance. It defines the HTTP GET endpoint for the request. ```proto rpc ListAccessBindings(access.ListAccessBindingsRequest) returns (access.ListAccessBindingsResponse) { option (google.api.http) = { get: "/compute/v1/instances/{resource_id}:listAccessBindings" }; } ``` -------------------------------- ### GetInstance RPC Signature Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/README.md Example of an RPC signature for the GetInstance method, including its HTTP binding. ```APIDOC ## GET /compute/v1/instances/{instance_id} ### Description Retrieves information about a specific instance. ### Method GET ### Endpoint /compute/v1/instances/{instance_id} ### Parameters #### Path Parameters - **instance_id** (string) - Required - The ID of the instance to retrieve. #### Query Parameters - **view** (enum) - Optional - The response format. Defaults to BASIC. ### Response #### Success Response (200) - **id** (string) - The instance ID. - **status** (Status) - The current status of the instance. - **disks** (array) - A list of disks attached to the instance. ### Response Example ```json { "id": "some-instance-id", "status": "RUNNING", "disks": [ { "disk_id": "some-disk-id" } ] } ``` ``` -------------------------------- ### Operations Guide Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/DOCUMENTATION-SUMMARY.txt Guidance on handling asynchronous operations, including polling strategies, pagination, and error recovery. ```APIDOC ## Operations Guide ### Description Explains the workflow for asynchronous operations within the Yandex Cloud API, including best practices for implementation. ### Key Concepts - Async operation workflow - Polling strategies and code patterns - Pagination implementation - Filtering and sorting syntax - Field masking for updates - Error recovery and idempotency - Resource cleanup patterns ### Usage Provides patterns and strategies for effectively managing long-running operations. ``` -------------------------------- ### Get Compute Instance Details Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Retrieve detailed information about a specific compute instance using its ID. ```bash curl -H "Authorization: Bearer $IAM_TOKEN" \ https://api.yandex.cloud/compute/v1/instances/epdxxxxxxxxxx ``` -------------------------------- ### Get Instance Details Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Fetches detailed information about a specific compute instance using its ID. ```APIDOC ## Get Instance Details ### Description Fetches detailed information about a specific compute instance using its ID. ### Method GET ### Endpoint /compute/v1/instances/{instance_id} ### Parameters #### Path Parameters - **instance_id** (string) - Required - The ID of the instance to retrieve details for. ### Request Example ```bash curl -H "Authorization: Bearer $IAM_TOKEN" \ https://api.yandex.cloud/compute/v1/instances/epdxxxxxxxxxx ``` ``` -------------------------------- ### Create PostgreSQL Cluster Request Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/05-database-services.md Example JSON payload for creating a new PostgreSQL cluster, specifying environment, configuration, and host specifications. ```json POST /mdb/postgresql/v1/clusters { "folder_id": "b1g123456789", "name": "prod-db", "environment": "PRODUCTION", "config_spec": { "version": "15", "postgresql_config": { "config": { "max_connections": 200, "shared_buffers": "4096", "effective_cache_size": "12288" } }, "resources": { "resource_preset_id": "db1.medium", "disk_size": "107374182400", "disk_type_id": "network-ssd" } }, "host_specs": [ { "zone_id": "ru-central1-a", "subnet_id": "e9b5f1rjd9j8", "type": "MASTER" }, { "zone_id": "ru-central1-b", "subnet_id": "e2lujq3nev0f", "type": "REPLICA" } ], "network_id": "enp123456789", "backup_window_start": "03:00", "deletion_protection": true } ``` -------------------------------- ### List All Roles with Permissions Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/04-iam-identity.md Use this GET request to retrieve a list of all available roles, optionally including their associated permissions. The `page_size` parameter controls the number of results per page. ```json GET /iam/v1/roles?include_permissions=true&page_size=100 ``` -------------------------------- ### LoadBalancerService Operations Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/08-endpoints-reference.md Operations for managing Load Balancers, including Get, List, Create, Update, Delete, Start, and Stop. ```APIDOC ## LoadBalancerService.Get ### Description Retrieves a specific Load Balancer by its ID. ### Method GET ### Endpoint `/apploadbalancer/v1/loadBalancers/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Load Balancer to retrieve. ### Response #### Success Response (200) - **loadBalancer** (LoadBalancer) - Details of the requested Load Balancer. ``` ```APIDOC ## LoadBalancerService.List ### Description Lists all Load Balancers available in the specified folder or project. ### Method GET ### Endpoint `/apploadbalancer/v1/loadBalancers` ### Parameters #### Query Parameters - **folderId** (string) - Optional - The ID of the folder to list Load Balancers from. - **pageSize** (integer) - Optional - The maximum number of items to return. - **pageToken** (string) - Optional - A page token to retrieve the next page of results. ### Response #### Success Response (200) - **loadBalancers** (array) - A list of Load Balancers. - **nextPageToken** (string) - Token for the next page of results. ``` ```APIDOC ## LoadBalancerService.Create ### Description Creates a new Load Balancer. ### Method POST ### Endpoint `/apploadbalancer/v1/loadBalancers` ### Parameters #### Request Body - **name** (string) - Required - Name of the Load Balancer. - **folderId** (string) - Required - ID of the folder to create the Load Balancer in. - **regionId** (string) - Required - ID of the region where the Load Balancer will be created. - **networkId** (string) - Required - ID of the network to attach the Load Balancer to. - **allocationPolicy** (AllocationPolicy) - Optional - Allocation policy for the Load Balancer. - **labels** (object) - Optional - Labels to assign to the Load Balancer. ### Response #### Success Response (200) - **id** (string) - The ID of the newly created Load Balancer. - **done** (boolean) - Indicates if the operation is completed. - **error** (Status) - Information about an error, if any. ``` ```APIDOC ## LoadBalancerService.Update ### Description Updates a specific Load Balancer. ### Method PATCH ### Endpoint `/apploadbalancer/v1/loadBalancers/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Load Balancer to update. #### Request Body - **loadBalancerId** (string) - Required - The ID of the Load Balancer to update. - **updateMask** (FieldMask) - Required - Fields to update. - **name** (string) - Optional - New name for the Load Balancer. - **networkId** (string) - Optional - New network ID. - **allocationPolicy** (AllocationPolicy) - Optional - New allocation policy. - **labels** (object) - Optional - New labels for the Load Balancer. ### Response #### Success Response (200) - **id** (string) - The ID of the updated Load Balancer. - **done** (boolean) - Indicates if the operation is completed. - **error** (Status) - Information about an error, if any. ``` ```APIDOC ## LoadBalancerService.Delete ### Description Deletes a specific Load Balancer. ### Method DELETE ### Endpoint `/apploadbalancer/v1/loadBalancers/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Load Balancer to delete. ### Response #### Success Response (200) - **id** (string) - The ID of the deleted Load Balancer. - **done** (boolean) - Indicates if the operation is completed. - **error** (Status) - Information about an error, if any. ``` ```APIDOC ## LoadBalancerService.Start ### Description Starts a stopped Load Balancer. ### Method POST ### Endpoint `/apploadbalancer/v1/loadBalancers/{id}:start` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Load Balancer to start. #### Request Body - **loadBalancerId** (string) - Required - The ID of the Load Balancer to start. ### Response #### Success Response (200) - **id** (string) - The ID of the Load Balancer. - **done** (boolean) - Indicates if the operation is completed. - **error** (Status) - Information about an error, if any. ``` ```APIDOC ## LoadBalancerService.Stop ### Description Stops a running Load Balancer. ### Method POST ### Endpoint `/apploadbalancer/v1/loadBalancers/{id}:stop` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Load Balancer to stop. #### Request Body - **loadBalancerId** (string) - Required - The ID of the Load Balancer to stop. ### Response #### Success Response (200) - **id** (string) - The ID of the Load Balancer. - **done** (boolean) - Indicates if the operation is completed. - **error** (Status) - Information about an error, if any. ``` -------------------------------- ### Create VM Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Provisions a VM instance with specified resources, boot disk, and network interface. Requires folder ID, name, zone, platform, resources, boot disk details, and subnet ID. ```bash curl -X POST https://api.yandex.cloud/compute/v1/instances \ -H "Authorization: Bearer $IAM_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "folder_id": "b1g123456789", "name": "web-server", "zone_id": "ru-central1-a", "platform_id": "standard-v3", "resources_spec": { "memory": "2147483648", "cores": 2, "core_fraction": 100 }, "boot_disk_spec": { "disk_spec": { "name": "boot-disk", "type_id": "network-ssd", "size": "21474836480", "image_id": "fd8gxj92dfj2" } }, "network_interface_specs": [ { "subnet_id": "e2lxxxxxxxxxx", "primary_v4_address_spec": {} } ] }' ``` -------------------------------- ### Poll for Operation Completion Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/10-operations-guide.md Example of an HTTP GET request to poll the status of a long-running operation using its unique ID. ```http GET /operation/v1/operations/operation-id-123 ``` -------------------------------- ### Create Instance Request Example Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Shows a JSON payload for creating a new compute instance, specifying details like name, zone, platform, resources, boot disk, and network interfaces. ```json { "folder_id": "b1g123456789", "name": "web-server", "zone_id": "ru-central1-a", "platform_id": "standard-v3", "resources_spec": { "memory": "2147483648", "cores": 2, "core_fraction": 100 }, "boot_disk_spec": { "disk_spec": { "name": "boot-disk", "type_id": "network-ssd", "size": "21474836480", "image_id": "fd8gxj92dfj2" }, "auto_delete": true }, "network_interface_specs": [{ "subnet_id": "e9b5f1rjd9j8", "primary_v4_address_spec": {} }] } ``` -------------------------------- ### Create VM Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md This is the final step to create a VM instance, specifying its configuration including resources, boot disk, and network interfaces. ```APIDOC ## POST /compute/v1/instances ### Description Creates a new VM instance with specified configuration. ### Method POST ### Endpoint https://api.yandex.cloud/compute/v1/instances ### Parameters #### Request Body - **folder_id** (string) - Required - The ID of the folder. - **name** (string) - Required - The name of the VM instance. - **zone_id** (string) - Required - The ID of the zone where the VM will be created. - **platform_id** (string) - Required - The ID of the platform for the VM. - **resources_spec** (object) - Required - Specifies the resources for the VM. - **memory** (string) - Required - Amount of memory in bytes. - **cores** (integer) - Required - Number of CPU cores. - **core_fraction** (integer) - Required - CPU fraction. - **boot_disk_spec** (object) - Required - Specifies the boot disk configuration. - **disk_spec** (object) - Required - Disk specification. - **name** (string) - Required - Name of the disk. - **type_id** (string) - Required - Type of the disk (e.g., "network-ssd"). - **size** (string) - Required - Size of the disk in bytes. - **image_id** (string) - Required - ID of the boot image. - **network_interface_specs** (array) - Required - List of network interface specifications. - **subnet_id** (string) - Required - The ID of the subnet for the network interface. - **primary_v4_address_spec** (object) - Optional - Primary IPv4 address specification. ### Request Example ```json { "folder_id": "b1g123456789", "name": "web-server", "zone_id": "ru-central1-a", "platform_id": "standard-v3", "resources_spec": { "memory": "2147483648", "cores": 2, "core_fraction": 100 }, "boot_disk_spec": { "disk_spec": { "name": "boot-disk", "type_id": "network-ssd", "size": "21474836480", "image_id": "fd8gxj92dfj2" } }, "network_interface_specs": [ { "subnet_id": "e2lxxxxxxxxxx", "primary_v4_address_spec": {} } ] } ``` ### Response Response includes an operation ID. Poll for completion using the operation ID. #### Polling for Operation Status ```bash curl -H "Authorization: Bearer $IAM_TOKEN" \ https://api.yandex.cloud/operation/v1/operations/{operation_id} ``` ``` -------------------------------- ### Get Subnet RPC Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/03-vpc-networking.md RPC method to retrieve a specific subnet by its ID. It uses an HTTP GET request to the /vpc/v1/subnets/{subnet_id} endpoint. ```proto rpc Get(GetSubnetRequest) returns (Subnet) { option (google.api.http) = { get: "/vpc/v1/subnets/{subnet_id}" }; } ``` -------------------------------- ### Instance Status Transitions Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Illustrates the lifecycle and possible status transitions for a compute instance. ```APIDOC ### Instance Status Transitions ``` ┌─────────────────────────────────────────────┐ │ PROVISIONING (resource allocation) │ └──────────────┬──────────────────────────────┘ │ resources ready ▼ ┌──────────────────────────────────────────────┐ │ RUNNING (normal operation) │ │ ├─ UPDATING (config change) │ │ ├─ STOPPING (shutdown in progress) │ │ ├─ RESTARTING (restart in progress) │ │ ├─ CRASHED (unexpected failure) │ │ └─ ERROR (fault state) │ └──────────────┬──────────────────────────────┘ │ stop/delete ▼ ┌──────────────────────────────────────────────┐ │ STOPPED (shutdown state) │ │ ├─ STARTING (startup in progress) │ │ └─ DELETING (removal in progress) │ └──────────────────────────────────────────────┘ ``` ``` -------------------------------- ### Get RouteTable RPC Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/03-vpc-networking.md RPC method to retrieve a specific route table by its ID. It uses an HTTP GET request to the /vpc/v1/route_tables/{route_table_id} endpoint. ```proto rpc Get(GetRouteTableRequest) returns (RouteTable) { option (google.api.http) = { get: "/vpc/v1/route_tables/{route_table_id}" }; } ``` -------------------------------- ### Instance Status Transitions Diagram Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Visualizes the lifecycle and possible status transitions for a compute instance. ```text ┌─────────────────────────────────────────────┐ │ PROVISIONING (resource allocation) │ └──────────────┬──────────────────────────────┘ │ resources ready ▼ ┌──────────────────────────────────────────────┐ │ RUNNING (normal operation) │ │ ├─ UPDATING (config change) │ │ ├─ STOPPING (shutdown in progress) │ │ ├─ RESTARTING (restart in progress) │ │ └─ CRASHED (unexpected failure) │ │ └─ ERROR (fault state) │ └──────────────┬──────────────────────────────┘ │ stop/delete ▼ ┌──────────────────────────────────────────────┐ │ STOPPED (shutdown state) │ │ ├─ STARTING (startup in progress) │ │ └─ DELETING (removal in progress) │ └──────────────────────────────────────────────┘ ``` -------------------------------- ### Get Key RPC Method Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/04-iam-identity.md Retrieves a specific IAM key using its ID. The HTTP GET method maps to the /iam/v1/keys/{key_id} endpoint. ```proto rpc Get(GetKeyRequest) returns (Key) { option (google.api.http) = { get: "/iam/v1/keys/{key_id}" }; } message GetKeyRequest { string key_id = 1; // Required } ``` -------------------------------- ### List Endpoints with Pagination Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/08-endpoints-reference.md Demonstrates how to list resources with support for pagination, filtering, and sorting. ```APIDOC ## GET /api/v1/resources ### Description Lists resources with support for pagination, filtering, and sorting. ### Method GET ### Endpoint /api/v1/resources ### Query Parameters - **folder_id** (string) - Required - Resource folder - **page_size** (integer) - Optional - Max 1000, default varies - **page_token** (string) - Optional - Opaque pagination token - **filter** (string) - Optional - Filter expression - **order_by** (string) - Optional - Sort order ``` -------------------------------- ### List All Compute Instances Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Use this command to retrieve a list of all compute instances within a specified folder. Pagination is supported with `page_size`. ```bash curl -H "Authorization: Bearer $IAM_TOKEN" \ "https://api.yandex.cloud/compute/v1/instances?folder_id=b1g123&page_size=100" ``` -------------------------------- ### Get Security Group RPC Definition Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/03-vpc-networking.md Defines the RPC method for retrieving a specific security group by its ID. The HTTP mapping specifies a GET request to the /vpc/v1/security_groups/{security_group_id} endpoint. ```proto rpc Get(GetSecurityGroupRequest) returns (SecurityGroup) { option (google.api.http) = { get: "/vpc/v1/security_groups/{security_group_id}" }; } ``` -------------------------------- ### Get Network Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/03-vpc-networking.md Retrieves details of a specific network by its ID. ```APIDOC ## Get Network ### Description Retrieve a network by ID. ### Method GET ### Endpoint /vpc/v1/networks/{network_id} ### Parameters #### Path Parameters - **network_id** (string) - Required - The ID of the network to retrieve. ### Response #### Success Response (200) - **Network** (object) - Contains the details of the network. - id (string) - folder_id (string) - created_at (google.protobuf.Timestamp) - name (string) - description (string) - labels (map) - status (enum: STATUS_UNSPECIFIED, CREATING, ACTIVE, DELETING) - default_security_group_id (boolean) ``` -------------------------------- ### BackupService - Get Backup Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/05-database-services.md Retrieves information about a specific backup. ```APIDOC ## GET /mdb/postgresql/v1/backups/{backup_id} ### Description Retrieves details of a specific backup using its ID. ### Method GET ### Endpoint /mdb/postgresql/v1/backups/{backup_id} ### Parameters #### Path Parameters - **backup_id** (string) - Required - The ID of the backup to retrieve. ``` -------------------------------- ### Attach Disk to Instance Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Use this RPC to attach a secondary disk to a running instance. This is a long-running operation. ```proto rpc AttachDisk(AttachInstanceDiskRequest) returns (operation.Operation) { option (google.api.http) = { body: "*" post: "/compute/v1/instances/{instance_id}:attachDisk" }; } message AttachInstanceDiskRequest { string instance_id = 1; // Required AttachedDiskSpec attached_disk_spec = 2; // Required } ``` -------------------------------- ### Go SDK Import Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/README.md Import the Go SDK for Yandex Cloud Compute V1. ```go import "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1" ``` -------------------------------- ### Get Cluster Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/05-database-services.md Retrieves information about a specific database cluster. ```APIDOC ## Get Cluster ### Description Retrieves information about a specific database cluster. ### Method GET ### Endpoint /mdb/{service_type}/v1/clusters/{cluster_id} ### Parameters #### Path Parameters - **cluster_id** (string) - Required - The ID of the cluster to retrieve. - **service_type** (string) - Required - The type of database service (e.g., postgresql, mysql, clickhouse). ### Response #### Success Response (200) - **Cluster** (object) - Detailed information about the cluster. ``` -------------------------------- ### ThreadService - Get Thread Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/07-ai-services.md Retrieves a specific conversation thread by its ID. ```APIDOC ## Get Thread ### Description Retrieves the details of a specific conversation thread using its unique identifier. ### Method GET ### Endpoint /ai/assistants/v1/threads/{thread_id} ### Parameters #### Path Parameters - **thread_id** (string) - Required - The ID of the thread to retrieve. ### Response #### Success Response (200) - **Thread** (object) - The details of the thread. - **id** (string) - **assistant_id** (string) - **created_at** (google.protobuf.Timestamp) - **updated_at** (google.protobuf.Timestamp) - **metadata** (map) ### Response Example { "id": "thread_xyz789", "assistant_id": "asst_abc123", "created_at": "2023-10-27T12:00:00Z", "updated_at": "2023-10-27T12:00:00Z", "metadata": {"user_id": "user-xyz"} } ``` -------------------------------- ### KeyService.Create Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/08-endpoints-reference.md Creates a new key for a service account. ```APIDOC ## POST /iam/v1/keys ### Description Creates a new key for a specified service account. ### Method POST ### Endpoint `/iam/v1/keys` ### Parameters #### Request Body - **serviceAccountId** (string) - Required - The ID of the service account for which to create the key. - **description** (string) - Optional - A description for the key. ``` -------------------------------- ### Add Database and User to PostgreSQL Cluster Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md After cluster creation, use these commands to add a new database and a new user with specified permissions to an existing PostgreSQL cluster. ```bash # Create database curl -X POST https://api.yandex.cloud/mdb/postgresql/v1/clusters/{cluster_id}/databases \ -H "Authorization: Bearer $IAM_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "database_name": "appdb" }' # Create user curl -X POST https://api.yandex.cloud/mdb/postgresql/v1/clusters/{cluster_id}/users \ -H "Authorization: Bearer $IAM_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "user_name": "appuser", "password": "strong-password", "permissions": [ { "database_name": "appdb", "roles": ["ALL"] } ] }' ``` -------------------------------- ### AssistantService - Get Assistant Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/07-ai-services.md Retrieves a specific AI assistant by its ID. ```APIDOC ## Get Assistant ### Description Retrieves the details of a specific AI assistant using its unique identifier. ### Method GET ### Endpoint /ai/assistants/v1/assistants/{assistant_id} ### Parameters #### Path Parameters - **assistant_id** (string) - Required - The ID of the assistant to retrieve. ### Response #### Success Response (200) - **Assistant** (object) - The details of the assistant. - **id** (string) - **name** (string) - **description** (string) - **system_prompt** (string) - **model** (string) - **labels** (map) - **created_at** (google.protobuf.Timestamp) - **updated_at** (google.protobuf.Timestamp) - **tools** (array of Tool) - **name** (string) - **description** (string) - **function_name** (string) - **parameters** (map) - **type** (string) - **description** (string) - **enum_values** (array of string) ### Response Example { "id": "asst_abc123", "name": "My Assistant", "description": "A helpful assistant.", "system_prompt": "You are a helpful assistant.", "model": "gpt-4", "labels": {"env": "prod"}, "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z", "tools": [] } ``` -------------------------------- ### List Instances Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/02-compute-instances.md Lists compute instances within a specified folder. Supports filtering, sorting, and pagination to manage large sets of instances. ```APIDOC ## GET /compute/v1/instances ### Description List instances in a folder with optional filtering and pagination. ### Method GET ### Endpoint /compute/v1/instances ### Parameters #### Query Parameters - **folder_id** (string) - Required - Folder ID - **page_size** (int64) - Optional - Max 1000, default unspecified - **page_token** (string) - Optional - Pagination token - **filter** (string) - Optional - Filter expression - **order_by** (string) - Optional - Sort order (e.g., "created_at desc") ### Response #### Success Response (200) - **ListInstancesResponse** (object) - **instances** (array) - List of instances - **next_page_token** (string) - Token for next page ### Filter Examples ``` status="RUNNING" name="web-*" zone_id="ru-central1-a" AND status="STOPPED" platform_id="gpu-v100" ``` ``` -------------------------------- ### Get Route Table Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/03-vpc-networking.md Retrieves a specific route table by its ID. ```APIDOC ## Get Route Table ### Description Retrieves a specific route table by its ID. ### Method GET ### Endpoint /vpc/v1/route_tables/{route_table_id} ``` -------------------------------- ### Get Security Group Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/03-vpc-networking.md Retrieves a specific security group by its ID. ```APIDOC ## Get Security Group ### Description Retrieves a security group. ### Method GET ### Endpoint /vpc/v1/security_groups/{security_group_id} ``` -------------------------------- ### Create Chatbot Assistant Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Create a new chatbot assistant by providing a folder ID, name, model, and system prompt. This sets up the core behavior of your assistant. ```bash curl -X POST https://api.yandex.cloud/ai/assistants/v1/assistants \ -H "Authorization: Bearer $IAM_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "folder_id": "b1g123456789", "name": "support-bot", "model": "yandexgpt-3", "system_prompt": "You are a helpful support assistant." }' ``` -------------------------------- ### Compute Instance Service Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/DOCUMENTATION-SUMMARY.txt Documentation for the Instance Service, including 15 RPC methods for managing virtual machine instances, disks, and network interfaces. ```APIDOC ## Compute Instance Service ### Description Provides methods for managing virtual machine instances, including their lifecycle, disks, and network configurations. ### Methods - Instance Service (15 RPC methods) - Disk operations (attach, detach) - Network interface management ### Examples Complete request/response examples are available in the detailed documentation. ``` -------------------------------- ### Get CDN Distribution Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/06-storage-cdn-loadbalancer.md Retrieves information about a specific CDN distribution by its ID. ```APIDOC ## GET /cdn/v1/distributions/{distribution_id} ### Description Retrieves details of a specific CDN distribution. ### Method GET ### Endpoint /cdn/v1/distributions/{distribution_id} ### Parameters #### Path Parameters - **distribution_id** (string) - Required - The ID of the distribution to retrieve. ``` -------------------------------- ### List All Instances Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Retrieves a list of all compute instances within a specified folder, with optional pagination. ```APIDOC ## List All Instances ### Description Retrieves a list of all compute instances within a specified folder, with optional pagination. ### Method GET ### Endpoint /compute/v1/instances ### Query Parameters - **folder_id** (string) - Required - The ID of the folder to list instances from. - **page_size** (integer) - Optional - The maximum number of instances to return per page. ### Request Example ```bash curl -H "Authorization: Bearer $IAM_TOKEN" \ "https://api.yandex.cloud/compute/v1/instances?folder_id=b1g123&page_size=100" ``` ``` -------------------------------- ### Get Key Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/04-iam-identity.md Retrieves the details of a specific authentication key using its ID. ```APIDOC ## Get Key ### Description Retrieve a key by its ID. ### Method GET ### Endpoint /iam/v1/keys/{key_id} ### Parameters #### Path Parameters - **key_id** (string) - Required - The ID of the key to retrieve. ### Response #### Success Response (200) - **Key** (object) - The Key object containing details about the key. - **id** (string) - Key ID. - **service_account_id** (string) - Associated service account. - **key_type** (enum) - Type of key (USER_ACCOUNT, SERVICE_ACCOUNT_STATIC, SERVICE_ACCOUNT_API). - **status** (enum) - Key status (ACTIVE, INACTIVE). - **created_at** (google.protobuf.Timestamp) - Timestamp of creation. - **last_used_at** (google.protobuf.Timestamp) - Timestamp of last usage. - **description** (string) - Key description. ``` -------------------------------- ### ResourcePresetService Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/05-database-services.md Provides information about available hardware configurations for clusters. ```APIDOC ## Get Resource Preset ### Description Retrieves information about a specific resource preset. ### Method GET ### Endpoint /mdb/postgresql/v1/resourcePresets/{resource_preset_id} ## List Resource Presets ### Description Retrieves a list of available resource presets. ### Method GET ### Endpoint /mdb/postgresql/v1/resourcePresets ``` -------------------------------- ### Get Service Account Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/04-iam-identity.md Retrieves the details of a specific service account by its ID. ```APIDOC ## Get Service Account ### Description Retrieves the details of a specific service account. ### Method GET ### Endpoint /iam/v1/serviceAccounts/{service_account_id} ### Parameters #### Path Parameters - **service_account_id** (string) - Required - The ID of the service account to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the service account. - **folder_id** (string) - The ID of the folder the service account belongs to. - **created_at** (google.protobuf.Timestamp) - The timestamp when the service account was created. - **name** (string) - The name of the service account. - **description** (string) - A description of the service account. - **labels** (map) - Resource labels associated with the service account. - **status** (Status) - The current status of the service account (ACTIVE or DELETED). ``` -------------------------------- ### Complex Filter Examples Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/10-operations-guide.md Demonstrates combining multiple conditions with AND and NOT IN operators for more specific filtering. ```text status="RUNNING" AND zone_id="ru-central1-a" AND platform_id IN ("standard-v3", "gpu-v100") name!="test-*" AND created_at>"2024-01-01T00:00:00Z" ``` -------------------------------- ### RoleService.List Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/04-iam-identity.md Lists all available roles in the system. ```APIDOC ## GET /iam/v1/roles ### Description List available roles. ### Method GET ### Endpoint /iam/v1/roles ### Parameters #### Query Parameters - **page_size** (int64) - Optional - The maximum number of roles to return per page. - **page_token** (string) - Optional - A page token, received from a previous ListRoles call to get the next page of results. - **filter** (string) - Optional - A filter expression to narrow down the roles returned. - **include_permissions** (bool) - Optional - Whether to include the list of permissions for each role. ### Response #### Success Response (200) - **roles** (array) - A list of Role objects. - **next_page_token** (string) - A token to retrieve the next page of results. If not specified, there are no more pages. ### Response Example { "roles": [ { "id": "editor", "name": "Editor", "description": "Grants permissions to edit resources.", "include_permissions": true, "permissions": [ { "id": "compute.instances.get" } ] } ], "next_page_token": "" } ``` -------------------------------- ### Set Up Proper IAM Permissions Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/00-quick-start.md Use `curl` to grant specific IAM roles to service accounts on resources like folders. Ensure you have the correct `resource_id` and `role_id`. ```bash # Grant editor role to service account on folder curl -X POST \ https://api.yandex.cloud/iam/v1/serviceAccounts/ajexxxxxxxxxx:updateAccessBindings \ -H "Authorization: Bearer $IAM_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "resource_id": "b1g123456789", "additions": [ { "role_id": "editor", "service_account_id": "ajexxxxxxxxxx" } ] }' ``` -------------------------------- ### Get Tuning Job Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/07-ai-services.md Retrieves the details of a specific tuning job using its ID. ```APIDOC ## GET /ai/tuning/v1/tuningJobs/{tuning_job_id} ### Description Retrieves the details of a specific tuning job using its ID. ### Method GET ### Endpoint /ai/tuning/v1/tuningJobs/{tuning_job_id} ### Parameters #### Path Parameters - **tuning_job_id** (string) - Required - The ID of the tuning job to retrieve. ### Response #### Success Response (200) - **TuningJob** (object) - The details of the tuning job. - **id** (string) - The ID of the tuning job. - **folder_id** (string) - The ID of the folder the job belongs to. - **status** (enum) - The current status of the tuning job (PENDING, RUNNING, COMPLETED, FAILED, CANCELLED). - **base_model_id** (string) - The ID of the base model that was fine-tuned. - **tuned_model_id** (string) - The ID of the resulting fine-tuned model. - **training_data** (object) - Information about the training data used. - **parameters** (object) - The tuning parameters used for the job. - **created_at** (google.protobuf.Timestamp) - The timestamp when the job was created. - **updated_at** (google.protobuf.Timestamp) - The timestamp when the job was last updated. - **error_message** (string) - Error details if the job failed. #### Response Example { "id": "tuning-job-123", "folder_id": "your_folder_id", "status": "COMPLETED", "base_model_id": "your_base_model_id", "tuned_model_id": "tuned-model-456", "training_data": { "dataset_id": "your_dataset_id" }, "parameters": { "learning_rate": 1e-4, "batch_size": 32, "num_epochs": 3 }, "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T11:00:00Z" } ``` -------------------------------- ### Get Load Balancer Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/06-storage-cdn-loadbalancer.md Retrieves information about a specific Application Load Balancer by its ID. ```APIDOC ## Get Load Balancer ### Description Retrieves information about a specific Application Load Balancer. ### Method GET ### Endpoint /apploadbalancer/v1/loadBalancers/{load_balancer_id} ### Parameters #### Path Parameters - **load_balancer_id** (string) - Required - The ID of the load balancer to retrieve. ``` -------------------------------- ### List Resources with Pagination Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/08-endpoints-reference.md Use these query parameters to paginate through lists of resources. Ensure to adhere to the specified limits for page size and use the provided token for subsequent requests. ```http GET /api/v1/resources?folder_id=...&page_size=100&page_token=...&filter=...&order_by=... ``` -------------------------------- ### AssistantService - Create Assistant Source: https://github.com/yandex-cloud/cloudapi/blob/master/_autodocs/07-ai-services.md Creates a new AI assistant with specified configurations. ```APIDOC ## Create Assistant ### Description Creates a new AI assistant, allowing configuration of its name, description, system prompt, model, and tools. ### Method POST ### Endpoint /ai/assistants/v1/assistants ### Parameters #### Request Body - **folder_id** (string) - Required - The ID of the folder to create the assistant in. - **name** (string) - Required - The name of the assistant. - **description** (string) - Optional - A description for the assistant. - **system_prompt** (string) - Optional - Instructions for the assistant's behavior. - **model** (string) - Required - The ID of the model to use (e.g., "gpt-3.5-turbo"). - **labels** (map) - Optional - Custom labels for the assistant. - **tools** (array of ToolSpec) - Optional - A list of tools the assistant can use. ### Request Example { "folder_id": "folder-123", "name": "Code Helper", "description": "Assists with coding tasks.", "system_prompt": "You are a helpful coding assistant.", "model": "gpt-4", "labels": {"project": "alpha"}, "tools": [] } ### Response #### Success Response (200) - **Assistant** (object) - The newly created assistant's details. - **id** (string) - **name** (string) - **description** (string) - **system_prompt** (string) - **model** (string) - **labels** (map) - **created_at** (google.protobuf.Timestamp) - **updated_at** (google.protobuf.Timestamp) - **tools** (array of Tool) ### Response Example { "id": "asst_def456", "name": "Code Helper", "description": "Assists with coding tasks.", "system_prompt": "You are a helpful coding assistant.", "model": "gpt-4", "labels": {"project": "alpha"}, "created_at": "2023-10-27T11:00:00Z", "updated_at": "2023-10-27T11:00:00Z", "tools": [] } ```