Git Product home page Git Product logo

Comments (2)

monsterzz avatar monsterzz commented on August 11, 2024

А далее основная проблема, в 'update_mask' надо указать поля, которые будут заменены. Главный вопрос, из каких доков по API яндекса брать названия, из REST(там поле называется "resourcesSpec") или из gRPC(там "resources_spec"), или так, как указано в ответе Operation(get/list, "resources")?

Правильно брать названия полей из gRPC.

Это не срабатывает, опять же, не понятно, в каком именно формате указывать поля и значения. В ответ ошибка:
(node:2587) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT: Request validation error: Unable to update selected parameters at once.

Не все параметры могут быть изменены вместе. Пришлите, пожалуйста, всё тело запроса, чтобы понять что именно идет не так. Как вариант можно открыть кейс в техническую поддержку и они передадут информацию команде сервиса Compute Cloud

from nodejs-sdk.

wsnnn avatar wsnnn commented on August 11, 2024

Ниже код упрощен, суть - сначала получаем instance, потом изменяем его(опущены все условности, типа проверки состояния и т.п.)

const {Session} = require('yandex-cloud');
let _session = new Session({oauthToken: "TOKEN"})
const {InstanceService} = require('yandex-cloud/api/compute/v1')
let instanceService = new InstanceService(_session)
let _instanceId = "ID"
let self = this;

instanceService.get({instanceId: _instanceId, view: "FULL"}).then((instance) => {
    console.log(instance);
  
    self.instanceService.update({
        'update_mask': 'resources_spec',
                    
        instanceId: instance.id,
        platformId: instance.platformId,
        name: instance.name,
        serviceAccountId: instance.serviceAccountId,
        //resourcesSpec:{core_fraction:100},
        resourcesSpec:{memory: 4*1024*1024*1024, cores: 4, core_fraction: 100},

    }).then((r) => {
        console.log(r); 
    })
 })

Если попробовать менять только один параметр за раз, например 'core_fraction', то в ошибке потребует указать обязательное значение "cores" Error: 3 INVALID_ARGUMENT: resourcesSpec.cores: Int value should be greater than or equal to 1. А так ошибка, описанная постом выше.

from nodejs-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.