How to Rescale an Instance in OCI Compute Classic

API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;

public final class ComputeSample {

  public static void main(final String[] args) {
    final Client client = ClientBuilder.newClient();

    final Response res = client.target("https://host/instance/sampleInstance").request("application/oracle-compute-v3+json").header("cookie", ...).put(Entity.entity("{ \"shape\": \"sampleShape\" }", "application/oracle-compute-v3+json"));

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

API w/ Node.js

const https = require('https');

const req = https.request({ headers: { accept: 'application/oracle-compute-v3+json', 'content-type', 'application/oracle-compute-v3+json', cookie: ... }, hostname: 'host', method: 'PUT', path: '/instance/sampleInstance' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';

    res.on('data', (chunk) => {
      body += chunk.toString();
    });

    res.on('end', () => {
      console.log(body);
    });

  }

});

req.write('{ "shape": "shapeName" }');

req.end();

API w/ Python

import requests

res = requests.put('https://host/instance/sampleInstance', headers = { 'accept': 'application/oracle-compute-v3+json', 'content-type': 'application/oracle-compute-v3+json', 'cookie': ... }, json = { 'shape': 'shapeName' })

if res.ok:
  print(res.text)

API w/ Ruby

require 'rest-client'

res = RestClient.get 'https://host/instance/sampleInstance', '{ "shape": "shapeName" }', { :accept => 'application/oracle-compute-v3+json', :content_type => 'application/oracle-compute-v3+json', :cookies => ... }

if res.code == 200
 puts res.body
end

CLI

Not supported.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s