Replica Pool
POST
replicapool.pools.delete
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName
QUERY PARAMS
projectName
zone
poolName
BODY json
{
"abandonInstances": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"abandonInstances\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName" {:content-type :json
:form-params {:abandonInstances []}})
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"abandonInstances\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"),
Content = new StringContent("{\n \"abandonInstances\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"abandonInstances\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
payload := strings.NewReader("{\n \"abandonInstances\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectName/zones/:zone/pools/:poolName HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 28
{
"abandonInstances": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.setHeader("content-type", "application/json")
.setBody("{\n \"abandonInstances\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"abandonInstances\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"abandonInstances\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.header("content-type", "application/json")
.body("{\n \"abandonInstances\": []\n}")
.asString();
const data = JSON.stringify({
abandonInstances: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName',
headers: {'content-type': 'application/json'},
data: {abandonInstances: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"abandonInstances":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "abandonInstances": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"abandonInstances\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({abandonInstances: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName',
headers: {'content-type': 'application/json'},
body: {abandonInstances: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
abandonInstances: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName',
headers: {'content-type': 'application/json'},
data: {abandonInstances: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"abandonInstances":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"abandonInstances": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"abandonInstances\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'abandonInstances' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName', [
'body' => '{
"abandonInstances": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'abandonInstances' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'abandonInstances' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"abandonInstances": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"abandonInstances": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"abandonInstances\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectName/zones/:zone/pools/:poolName", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
payload = { "abandonInstances": [] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
payload <- "{\n \"abandonInstances\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"abandonInstances\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/:projectName/zones/:zone/pools/:poolName') do |req|
req.body = "{\n \"abandonInstances\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName";
let payload = json!({"abandonInstances": ()});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName \
--header 'content-type: application/json' \
--data '{
"abandonInstances": []
}'
echo '{
"abandonInstances": []
}' | \
http POST {{baseUrl}}/:projectName/zones/:zone/pools/:poolName \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "abandonInstances": []\n}' \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["abandonInstances": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
replicapool.pools.get
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName
QUERY PARAMS
projectName
zone
poolName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/:projectName/zones/:zone/pools/:poolName HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:projectName/zones/:zone/pools/:poolName")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/:projectName/zones/:zone/pools/:poolName') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName
http GET {{baseUrl}}/:projectName/zones/:zone/pools/:poolName
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
replicapool.pools.insert
{{baseUrl}}/:projectName/zones/:zone/pools
QUERY PARAMS
projectName
zone
BODY json
{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectName/zones/:zone/pools" {:content-type :json
:form-params {:autoRestart false
:baseInstanceName ""
:currentNumReplicas 0
:description ""
:healthChecks [{:checkIntervalSec 0
:description ""
:healthyThreshold 0
:host ""
:name ""
:path ""
:port 0
:timeoutSec 0
:unhealthyThreshold 0}]
:initialNumReplicas 0
:labels [{:key ""
:value ""}]
:name ""
:numReplicas 0
:resourceViews []
:selfLink ""
:targetPool ""
:targetPools []
:template {:action {:commands []
:envVariables [{:hidden false
:name ""
:value ""}]
:timeoutMilliSeconds 0}
:healthChecks [{}]
:version ""
:vmParams {:baseInstanceName ""
:canIpForward false
:description ""
:disksToAttach [{:attachment {:deviceName ""
:index 0}
:source ""}]
:disksToCreate [{:attachment {}
:autoDelete false
:boot false
:initializeParams {:diskSizeGb ""
:diskType ""
:sourceImage ""}}]
:machineType ""
:metadata {:fingerPrint ""
:items [{:key ""
:value ""}]}
:networkInterfaces [{:accessConfigs [{:name ""
:natIp ""
:type ""}]
:network ""
:networkIp ""}]
:onHostMaintenance ""
:serviceAccounts [{:email ""
:scopes []}]
:tags {:fingerPrint ""
:items []}}}
:type ""}})
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools"),
Content = new StringContent("{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools"
payload := strings.NewReader("{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectName/zones/:zone/pools HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2034
{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectName/zones/:zone/pools")
.setHeader("content-type", "application/json")
.setBody("{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectName/zones/:zone/pools")
.header("content-type", "application/json")
.body("{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
autoRestart: false,
baseInstanceName: '',
currentNumReplicas: 0,
description: '',
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
initialNumReplicas: 0,
labels: [
{
key: '',
value: ''
}
],
name: '',
numReplicas: 0,
resourceViews: [],
selfLink: '',
targetPool: '',
targetPools: [],
template: {
action: {
commands: [],
envVariables: [
{
hidden: false,
name: '',
value: ''
}
],
timeoutMilliSeconds: 0
},
healthChecks: [
{}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [
{
attachment: {
deviceName: '',
index: 0
},
source: ''
}
],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {
diskSizeGb: '',
diskType: '',
sourceImage: ''
}
}
],
machineType: '',
metadata: {
fingerPrint: '',
items: [
{
key: '',
value: ''
}
]
},
networkInterfaces: [
{
accessConfigs: [
{
name: '',
natIp: '',
type: ''
}
],
network: '',
networkIp: ''
}
],
onHostMaintenance: '',
serviceAccounts: [
{
email: '',
scopes: []
}
],
tags: {
fingerPrint: '',
items: []
}
}
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectName/zones/:zone/pools');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools',
headers: {'content-type': 'application/json'},
data: {
autoRestart: false,
baseInstanceName: '',
currentNumReplicas: 0,
description: '',
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
initialNumReplicas: 0,
labels: [{key: '', value: ''}],
name: '',
numReplicas: 0,
resourceViews: [],
selfLink: '',
targetPool: '',
targetPools: [],
template: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [{}],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"autoRestart":false,"baseInstanceName":"","currentNumReplicas":0,"description":"","healthChecks":[{"checkIntervalSec":0,"description":"","healthyThreshold":0,"host":"","name":"","path":"","port":0,"timeoutSec":0,"unhealthyThreshold":0}],"initialNumReplicas":0,"labels":[{"key":"","value":""}],"name":"","numReplicas":0,"resourceViews":[],"selfLink":"","targetPool":"","targetPools":[],"template":{"action":{"commands":[],"envVariables":[{"hidden":false,"name":"","value":""}],"timeoutMilliSeconds":0},"healthChecks":[{}],"version":"","vmParams":{"baseInstanceName":"","canIpForward":false,"description":"","disksToAttach":[{"attachment":{"deviceName":"","index":0},"source":""}],"disksToCreate":[{"attachment":{},"autoDelete":false,"boot":false,"initializeParams":{"diskSizeGb":"","diskType":"","sourceImage":""}}],"machineType":"","metadata":{"fingerPrint":"","items":[{"key":"","value":""}]},"networkInterfaces":[{"accessConfigs":[{"name":"","natIp":"","type":""}],"network":"","networkIp":""}],"onHostMaintenance":"","serviceAccounts":[{"email":"","scopes":[]}],"tags":{"fingerPrint":"","items":[]}}},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "autoRestart": false,\n "baseInstanceName": "",\n "currentNumReplicas": 0,\n "description": "",\n "healthChecks": [\n {\n "checkIntervalSec": 0,\n "description": "",\n "healthyThreshold": 0,\n "host": "",\n "name": "",\n "path": "",\n "port": 0,\n "timeoutSec": 0,\n "unhealthyThreshold": 0\n }\n ],\n "initialNumReplicas": 0,\n "labels": [\n {\n "key": "",\n "value": ""\n }\n ],\n "name": "",\n "numReplicas": 0,\n "resourceViews": [],\n "selfLink": "",\n "targetPool": "",\n "targetPools": [],\n "template": {\n "action": {\n "commands": [],\n "envVariables": [\n {\n "hidden": false,\n "name": "",\n "value": ""\n }\n ],\n "timeoutMilliSeconds": 0\n },\n "healthChecks": [\n {}\n ],\n "version": "",\n "vmParams": {\n "baseInstanceName": "",\n "canIpForward": false,\n "description": "",\n "disksToAttach": [\n {\n "attachment": {\n "deviceName": "",\n "index": 0\n },\n "source": ""\n }\n ],\n "disksToCreate": [\n {\n "attachment": {},\n "autoDelete": false,\n "boot": false,\n "initializeParams": {\n "diskSizeGb": "",\n "diskType": "",\n "sourceImage": ""\n }\n }\n ],\n "machineType": "",\n "metadata": {\n "fingerPrint": "",\n "items": [\n {\n "key": "",\n "value": ""\n }\n ]\n },\n "networkInterfaces": [\n {\n "accessConfigs": [\n {\n "name": "",\n "natIp": "",\n "type": ""\n }\n ],\n "network": "",\n "networkIp": ""\n }\n ],\n "onHostMaintenance": "",\n "serviceAccounts": [\n {\n "email": "",\n "scopes": []\n }\n ],\n "tags": {\n "fingerPrint": "",\n "items": []\n }\n }\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
autoRestart: false,
baseInstanceName: '',
currentNumReplicas: 0,
description: '',
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
initialNumReplicas: 0,
labels: [{key: '', value: ''}],
name: '',
numReplicas: 0,
resourceViews: [],
selfLink: '',
targetPool: '',
targetPools: [],
template: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [{}],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools',
headers: {'content-type': 'application/json'},
body: {
autoRestart: false,
baseInstanceName: '',
currentNumReplicas: 0,
description: '',
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
initialNumReplicas: 0,
labels: [{key: '', value: ''}],
name: '',
numReplicas: 0,
resourceViews: [],
selfLink: '',
targetPool: '',
targetPools: [],
template: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [{}],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
},
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectName/zones/:zone/pools');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
autoRestart: false,
baseInstanceName: '',
currentNumReplicas: 0,
description: '',
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
initialNumReplicas: 0,
labels: [
{
key: '',
value: ''
}
],
name: '',
numReplicas: 0,
resourceViews: [],
selfLink: '',
targetPool: '',
targetPools: [],
template: {
action: {
commands: [],
envVariables: [
{
hidden: false,
name: '',
value: ''
}
],
timeoutMilliSeconds: 0
},
healthChecks: [
{}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [
{
attachment: {
deviceName: '',
index: 0
},
source: ''
}
],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {
diskSizeGb: '',
diskType: '',
sourceImage: ''
}
}
],
machineType: '',
metadata: {
fingerPrint: '',
items: [
{
key: '',
value: ''
}
]
},
networkInterfaces: [
{
accessConfigs: [
{
name: '',
natIp: '',
type: ''
}
],
network: '',
networkIp: ''
}
],
onHostMaintenance: '',
serviceAccounts: [
{
email: '',
scopes: []
}
],
tags: {
fingerPrint: '',
items: []
}
}
},
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools',
headers: {'content-type': 'application/json'},
data: {
autoRestart: false,
baseInstanceName: '',
currentNumReplicas: 0,
description: '',
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
initialNumReplicas: 0,
labels: [{key: '', value: ''}],
name: '',
numReplicas: 0,
resourceViews: [],
selfLink: '',
targetPool: '',
targetPools: [],
template: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [{}],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"autoRestart":false,"baseInstanceName":"","currentNumReplicas":0,"description":"","healthChecks":[{"checkIntervalSec":0,"description":"","healthyThreshold":0,"host":"","name":"","path":"","port":0,"timeoutSec":0,"unhealthyThreshold":0}],"initialNumReplicas":0,"labels":[{"key":"","value":""}],"name":"","numReplicas":0,"resourceViews":[],"selfLink":"","targetPool":"","targetPools":[],"template":{"action":{"commands":[],"envVariables":[{"hidden":false,"name":"","value":""}],"timeoutMilliSeconds":0},"healthChecks":[{}],"version":"","vmParams":{"baseInstanceName":"","canIpForward":false,"description":"","disksToAttach":[{"attachment":{"deviceName":"","index":0},"source":""}],"disksToCreate":[{"attachment":{},"autoDelete":false,"boot":false,"initializeParams":{"diskSizeGb":"","diskType":"","sourceImage":""}}],"machineType":"","metadata":{"fingerPrint":"","items":[{"key":"","value":""}]},"networkInterfaces":[{"accessConfigs":[{"name":"","natIp":"","type":""}],"network":"","networkIp":""}],"onHostMaintenance":"","serviceAccounts":[{"email":"","scopes":[]}],"tags":{"fingerPrint":"","items":[]}}},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"autoRestart": @NO,
@"baseInstanceName": @"",
@"currentNumReplicas": @0,
@"description": @"",
@"healthChecks": @[ @{ @"checkIntervalSec": @0, @"description": @"", @"healthyThreshold": @0, @"host": @"", @"name": @"", @"path": @"", @"port": @0, @"timeoutSec": @0, @"unhealthyThreshold": @0 } ],
@"initialNumReplicas": @0,
@"labels": @[ @{ @"key": @"", @"value": @"" } ],
@"name": @"",
@"numReplicas": @0,
@"resourceViews": @[ ],
@"selfLink": @"",
@"targetPool": @"",
@"targetPools": @[ ],
@"template": @{ @"action": @{ @"commands": @[ ], @"envVariables": @[ @{ @"hidden": @NO, @"name": @"", @"value": @"" } ], @"timeoutMilliSeconds": @0 }, @"healthChecks": @[ @{ } ], @"version": @"", @"vmParams": @{ @"baseInstanceName": @"", @"canIpForward": @NO, @"description": @"", @"disksToAttach": @[ @{ @"attachment": @{ @"deviceName": @"", @"index": @0 }, @"source": @"" } ], @"disksToCreate": @[ @{ @"attachment": @{ }, @"autoDelete": @NO, @"boot": @NO, @"initializeParams": @{ @"diskSizeGb": @"", @"diskType": @"", @"sourceImage": @"" } } ], @"machineType": @"", @"metadata": @{ @"fingerPrint": @"", @"items": @[ @{ @"key": @"", @"value": @"" } ] }, @"networkInterfaces": @[ @{ @"accessConfigs": @[ @{ @"name": @"", @"natIp": @"", @"type": @"" } ], @"network": @"", @"networkIp": @"" } ], @"onHostMaintenance": @"", @"serviceAccounts": @[ @{ @"email": @"", @"scopes": @[ ] } ], @"tags": @{ @"fingerPrint": @"", @"items": @[ ] } } },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'autoRestart' => null,
'baseInstanceName' => '',
'currentNumReplicas' => 0,
'description' => '',
'healthChecks' => [
[
'checkIntervalSec' => 0,
'description' => '',
'healthyThreshold' => 0,
'host' => '',
'name' => '',
'path' => '',
'port' => 0,
'timeoutSec' => 0,
'unhealthyThreshold' => 0
]
],
'initialNumReplicas' => 0,
'labels' => [
[
'key' => '',
'value' => ''
]
],
'name' => '',
'numReplicas' => 0,
'resourceViews' => [
],
'selfLink' => '',
'targetPool' => '',
'targetPools' => [
],
'template' => [
'action' => [
'commands' => [
],
'envVariables' => [
[
'hidden' => null,
'name' => '',
'value' => ''
]
],
'timeoutMilliSeconds' => 0
],
'healthChecks' => [
[
]
],
'version' => '',
'vmParams' => [
'baseInstanceName' => '',
'canIpForward' => null,
'description' => '',
'disksToAttach' => [
[
'attachment' => [
'deviceName' => '',
'index' => 0
],
'source' => ''
]
],
'disksToCreate' => [
[
'attachment' => [
],
'autoDelete' => null,
'boot' => null,
'initializeParams' => [
'diskSizeGb' => '',
'diskType' => '',
'sourceImage' => ''
]
]
],
'machineType' => '',
'metadata' => [
'fingerPrint' => '',
'items' => [
[
'key' => '',
'value' => ''
]
]
],
'networkInterfaces' => [
[
'accessConfigs' => [
[
'name' => '',
'natIp' => '',
'type' => ''
]
],
'network' => '',
'networkIp' => ''
]
],
'onHostMaintenance' => '',
'serviceAccounts' => [
[
'email' => '',
'scopes' => [
]
]
],
'tags' => [
'fingerPrint' => '',
'items' => [
]
]
]
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectName/zones/:zone/pools', [
'body' => '{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'autoRestart' => null,
'baseInstanceName' => '',
'currentNumReplicas' => 0,
'description' => '',
'healthChecks' => [
[
'checkIntervalSec' => 0,
'description' => '',
'healthyThreshold' => 0,
'host' => '',
'name' => '',
'path' => '',
'port' => 0,
'timeoutSec' => 0,
'unhealthyThreshold' => 0
]
],
'initialNumReplicas' => 0,
'labels' => [
[
'key' => '',
'value' => ''
]
],
'name' => '',
'numReplicas' => 0,
'resourceViews' => [
],
'selfLink' => '',
'targetPool' => '',
'targetPools' => [
],
'template' => [
'action' => [
'commands' => [
],
'envVariables' => [
[
'hidden' => null,
'name' => '',
'value' => ''
]
],
'timeoutMilliSeconds' => 0
],
'healthChecks' => [
[
]
],
'version' => '',
'vmParams' => [
'baseInstanceName' => '',
'canIpForward' => null,
'description' => '',
'disksToAttach' => [
[
'attachment' => [
'deviceName' => '',
'index' => 0
],
'source' => ''
]
],
'disksToCreate' => [
[
'attachment' => [
],
'autoDelete' => null,
'boot' => null,
'initializeParams' => [
'diskSizeGb' => '',
'diskType' => '',
'sourceImage' => ''
]
]
],
'machineType' => '',
'metadata' => [
'fingerPrint' => '',
'items' => [
[
'key' => '',
'value' => ''
]
]
],
'networkInterfaces' => [
[
'accessConfigs' => [
[
'name' => '',
'natIp' => '',
'type' => ''
]
],
'network' => '',
'networkIp' => ''
]
],
'onHostMaintenance' => '',
'serviceAccounts' => [
[
'email' => '',
'scopes' => [
]
]
],
'tags' => [
'fingerPrint' => '',
'items' => [
]
]
]
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'autoRestart' => null,
'baseInstanceName' => '',
'currentNumReplicas' => 0,
'description' => '',
'healthChecks' => [
[
'checkIntervalSec' => 0,
'description' => '',
'healthyThreshold' => 0,
'host' => '',
'name' => '',
'path' => '',
'port' => 0,
'timeoutSec' => 0,
'unhealthyThreshold' => 0
]
],
'initialNumReplicas' => 0,
'labels' => [
[
'key' => '',
'value' => ''
]
],
'name' => '',
'numReplicas' => 0,
'resourceViews' => [
],
'selfLink' => '',
'targetPool' => '',
'targetPools' => [
],
'template' => [
'action' => [
'commands' => [
],
'envVariables' => [
[
'hidden' => null,
'name' => '',
'value' => ''
]
],
'timeoutMilliSeconds' => 0
],
'healthChecks' => [
[
]
],
'version' => '',
'vmParams' => [
'baseInstanceName' => '',
'canIpForward' => null,
'description' => '',
'disksToAttach' => [
[
'attachment' => [
'deviceName' => '',
'index' => 0
],
'source' => ''
]
],
'disksToCreate' => [
[
'attachment' => [
],
'autoDelete' => null,
'boot' => null,
'initializeParams' => [
'diskSizeGb' => '',
'diskType' => '',
'sourceImage' => ''
]
]
],
'machineType' => '',
'metadata' => [
'fingerPrint' => '',
'items' => [
[
'key' => '',
'value' => ''
]
]
],
'networkInterfaces' => [
[
'accessConfigs' => [
[
'name' => '',
'natIp' => '',
'type' => ''
]
],
'network' => '',
'networkIp' => ''
]
],
'onHostMaintenance' => '',
'serviceAccounts' => [
[
'email' => '',
'scopes' => [
]
]
],
'tags' => [
'fingerPrint' => '',
'items' => [
]
]
]
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectName/zones/:zone/pools", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools"
payload = {
"autoRestart": False,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": False,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [{}],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": False,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": False,
"boot": False,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools"
payload <- "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/:projectName/zones/:zone/pools') do |req|
req.body = "{\n \"autoRestart\": false,\n \"baseInstanceName\": \"\",\n \"currentNumReplicas\": 0,\n \"description\": \"\",\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"initialNumReplicas\": 0,\n \"labels\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"name\": \"\",\n \"numReplicas\": 0,\n \"resourceViews\": [],\n \"selfLink\": \"\",\n \"targetPool\": \"\",\n \"targetPools\": [],\n \"template\": {\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {}\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools";
let payload = json!({
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": (
json!({
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
})
),
"initialNumReplicas": 0,
"labels": (
json!({
"key": "",
"value": ""
})
),
"name": "",
"numReplicas": 0,
"resourceViews": (),
"selfLink": "",
"targetPool": "",
"targetPools": (),
"template": json!({
"action": json!({
"commands": (),
"envVariables": (
json!({
"hidden": false,
"name": "",
"value": ""
})
),
"timeoutMilliSeconds": 0
}),
"healthChecks": (json!({})),
"version": "",
"vmParams": json!({
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": (
json!({
"attachment": json!({
"deviceName": "",
"index": 0
}),
"source": ""
})
),
"disksToCreate": (
json!({
"attachment": json!({}),
"autoDelete": false,
"boot": false,
"initializeParams": json!({
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
})
})
),
"machineType": "",
"metadata": json!({
"fingerPrint": "",
"items": (
json!({
"key": "",
"value": ""
})
)
}),
"networkInterfaces": (
json!({
"accessConfigs": (
json!({
"name": "",
"natIp": "",
"type": ""
})
),
"network": "",
"networkIp": ""
})
),
"onHostMaintenance": "",
"serviceAccounts": (
json!({
"email": "",
"scopes": ()
})
),
"tags": json!({
"fingerPrint": "",
"items": ()
})
})
}),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectName/zones/:zone/pools \
--header 'content-type: application/json' \
--data '{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}'
echo '{
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"initialNumReplicas": 0,
"labels": [
{
"key": "",
"value": ""
}
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": {
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
},
"type": ""
}' | \
http POST {{baseUrl}}/:projectName/zones/:zone/pools \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "autoRestart": false,\n "baseInstanceName": "",\n "currentNumReplicas": 0,\n "description": "",\n "healthChecks": [\n {\n "checkIntervalSec": 0,\n "description": "",\n "healthyThreshold": 0,\n "host": "",\n "name": "",\n "path": "",\n "port": 0,\n "timeoutSec": 0,\n "unhealthyThreshold": 0\n }\n ],\n "initialNumReplicas": 0,\n "labels": [\n {\n "key": "",\n "value": ""\n }\n ],\n "name": "",\n "numReplicas": 0,\n "resourceViews": [],\n "selfLink": "",\n "targetPool": "",\n "targetPools": [],\n "template": {\n "action": {\n "commands": [],\n "envVariables": [\n {\n "hidden": false,\n "name": "",\n "value": ""\n }\n ],\n "timeoutMilliSeconds": 0\n },\n "healthChecks": [\n {}\n ],\n "version": "",\n "vmParams": {\n "baseInstanceName": "",\n "canIpForward": false,\n "description": "",\n "disksToAttach": [\n {\n "attachment": {\n "deviceName": "",\n "index": 0\n },\n "source": ""\n }\n ],\n "disksToCreate": [\n {\n "attachment": {},\n "autoDelete": false,\n "boot": false,\n "initializeParams": {\n "diskSizeGb": "",\n "diskType": "",\n "sourceImage": ""\n }\n }\n ],\n "machineType": "",\n "metadata": {\n "fingerPrint": "",\n "items": [\n {\n "key": "",\n "value": ""\n }\n ]\n },\n "networkInterfaces": [\n {\n "accessConfigs": [\n {\n "name": "",\n "natIp": "",\n "type": ""\n }\n ],\n "network": "",\n "networkIp": ""\n }\n ],\n "onHostMaintenance": "",\n "serviceAccounts": [\n {\n "email": "",\n "scopes": []\n }\n ],\n "tags": {\n "fingerPrint": "",\n "items": []\n }\n }\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"autoRestart": false,
"baseInstanceName": "",
"currentNumReplicas": 0,
"description": "",
"healthChecks": [
[
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
]
],
"initialNumReplicas": 0,
"labels": [
[
"key": "",
"value": ""
]
],
"name": "",
"numReplicas": 0,
"resourceViews": [],
"selfLink": "",
"targetPool": "",
"targetPools": [],
"template": [
"action": [
"commands": [],
"envVariables": [
[
"hidden": false,
"name": "",
"value": ""
]
],
"timeoutMilliSeconds": 0
],
"healthChecks": [[]],
"version": "",
"vmParams": [
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
[
"attachment": [
"deviceName": "",
"index": 0
],
"source": ""
]
],
"disksToCreate": [
[
"attachment": [],
"autoDelete": false,
"boot": false,
"initializeParams": [
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
]
]
],
"machineType": "",
"metadata": [
"fingerPrint": "",
"items": [
[
"key": "",
"value": ""
]
]
],
"networkInterfaces": [
[
"accessConfigs": [
[
"name": "",
"natIp": "",
"type": ""
]
],
"network": "",
"networkIp": ""
]
],
"onHostMaintenance": "",
"serviceAccounts": [
[
"email": "",
"scopes": []
]
],
"tags": [
"fingerPrint": "",
"items": []
]
]
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
replicapool.pools.list
{{baseUrl}}/:projectName/zones/:zone/pools
QUERY PARAMS
projectName
zone
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:projectName/zones/:zone/pools")
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/:projectName/zones/:zone/pools HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:projectName/zones/:zone/pools")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:projectName/zones/:zone/pools")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/:projectName/zones/:zone/pools');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:projectName/zones/:zone/pools');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/:projectName/zones/:zone/pools');
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:projectName/zones/:zone/pools")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/:projectName/zones/:zone/pools') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/:projectName/zones/:zone/pools
http GET {{baseUrl}}/:projectName/zones/:zone/pools
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
replicapool.pools.resize
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize
QUERY PARAMS
projectName
zone
poolName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectName/zones/:zone/pools/:poolName/resize HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName/resize',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize');
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/:projectName/zones/:zone/pools/:poolName/resize")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/:projectName/zones/:zone/pools/:poolName/resize') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize
http POST {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/resize")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
replicapool.pools.updatetemplate
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate
QUERY PARAMS
projectName
zone
poolName
BODY json
{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate" {:content-type :json
:form-params {:action {:commands []
:envVariables [{:hidden false
:name ""
:value ""}]
:timeoutMilliSeconds 0}
:healthChecks [{:checkIntervalSec 0
:description ""
:healthyThreshold 0
:host ""
:name ""
:path ""
:port 0
:timeoutSec 0
:unhealthyThreshold 0}]
:version ""
:vmParams {:baseInstanceName ""
:canIpForward false
:description ""
:disksToAttach [{:attachment {:deviceName ""
:index 0}
:source ""}]
:disksToCreate [{:attachment {}
:autoDelete false
:boot false
:initializeParams {:diskSizeGb ""
:diskType ""
:sourceImage ""}}]
:machineType ""
:metadata {:fingerPrint ""
:items [{:key ""
:value ""}]}
:networkInterfaces [{:accessConfigs [{:name ""
:natIp ""
:type ""}]
:network ""
:networkIp ""}]
:onHostMaintenance ""
:serviceAccounts [{:email ""
:scopes []}]
:tags {:fingerPrint ""
:items []}}}})
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"),
Content = new StringContent("{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"
payload := strings.NewReader("{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectName/zones/:zone/pools/:poolName/updateTemplate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1511
{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate")
.setHeader("content-type", "application/json")
.setBody("{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate")
.header("content-type", "application/json")
.body("{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}")
.asString();
const data = JSON.stringify({
action: {
commands: [],
envVariables: [
{
hidden: false,
name: '',
value: ''
}
],
timeoutMilliSeconds: 0
},
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [
{
attachment: {
deviceName: '',
index: 0
},
source: ''
}
],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {
diskSizeGb: '',
diskType: '',
sourceImage: ''
}
}
],
machineType: '',
metadata: {
fingerPrint: '',
items: [
{
key: '',
value: ''
}
]
},
networkInterfaces: [
{
accessConfigs: [
{
name: '',
natIp: '',
type: ''
}
],
network: '',
networkIp: ''
}
],
onHostMaintenance: '',
serviceAccounts: [
{
email: '',
scopes: []
}
],
tags: {
fingerPrint: '',
items: []
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate',
headers: {'content-type': 'application/json'},
data: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"action":{"commands":[],"envVariables":[{"hidden":false,"name":"","value":""}],"timeoutMilliSeconds":0},"healthChecks":[{"checkIntervalSec":0,"description":"","healthyThreshold":0,"host":"","name":"","path":"","port":0,"timeoutSec":0,"unhealthyThreshold":0}],"version":"","vmParams":{"baseInstanceName":"","canIpForward":false,"description":"","disksToAttach":[{"attachment":{"deviceName":"","index":0},"source":""}],"disksToCreate":[{"attachment":{},"autoDelete":false,"boot":false,"initializeParams":{"diskSizeGb":"","diskType":"","sourceImage":""}}],"machineType":"","metadata":{"fingerPrint":"","items":[{"key":"","value":""}]},"networkInterfaces":[{"accessConfigs":[{"name":"","natIp":"","type":""}],"network":"","networkIp":""}],"onHostMaintenance":"","serviceAccounts":[{"email":"","scopes":[]}],"tags":{"fingerPrint":"","items":[]}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "action": {\n "commands": [],\n "envVariables": [\n {\n "hidden": false,\n "name": "",\n "value": ""\n }\n ],\n "timeoutMilliSeconds": 0\n },\n "healthChecks": [\n {\n "checkIntervalSec": 0,\n "description": "",\n "healthyThreshold": 0,\n "host": "",\n "name": "",\n "path": "",\n "port": 0,\n "timeoutSec": 0,\n "unhealthyThreshold": 0\n }\n ],\n "version": "",\n "vmParams": {\n "baseInstanceName": "",\n "canIpForward": false,\n "description": "",\n "disksToAttach": [\n {\n "attachment": {\n "deviceName": "",\n "index": 0\n },\n "source": ""\n }\n ],\n "disksToCreate": [\n {\n "attachment": {},\n "autoDelete": false,\n "boot": false,\n "initializeParams": {\n "diskSizeGb": "",\n "diskType": "",\n "sourceImage": ""\n }\n }\n ],\n "machineType": "",\n "metadata": {\n "fingerPrint": "",\n "items": [\n {\n "key": "",\n "value": ""\n }\n ]\n },\n "networkInterfaces": [\n {\n "accessConfigs": [\n {\n "name": "",\n "natIp": "",\n "type": ""\n }\n ],\n "network": "",\n "networkIp": ""\n }\n ],\n "onHostMaintenance": "",\n "serviceAccounts": [\n {\n "email": "",\n "scopes": []\n }\n ],\n "tags": {\n "fingerPrint": "",\n "items": []\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName/updateTemplate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate',
headers: {'content-type': 'application/json'},
body: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
action: {
commands: [],
envVariables: [
{
hidden: false,
name: '',
value: ''
}
],
timeoutMilliSeconds: 0
},
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [
{
attachment: {
deviceName: '',
index: 0
},
source: ''
}
],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {
diskSizeGb: '',
diskType: '',
sourceImage: ''
}
}
],
machineType: '',
metadata: {
fingerPrint: '',
items: [
{
key: '',
value: ''
}
]
},
networkInterfaces: [
{
accessConfigs: [
{
name: '',
natIp: '',
type: ''
}
],
network: '',
networkIp: ''
}
],
onHostMaintenance: '',
serviceAccounts: [
{
email: '',
scopes: []
}
],
tags: {
fingerPrint: '',
items: []
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate',
headers: {'content-type': 'application/json'},
data: {
action: {
commands: [],
envVariables: [{hidden: false, name: '', value: ''}],
timeoutMilliSeconds: 0
},
healthChecks: [
{
checkIntervalSec: 0,
description: '',
healthyThreshold: 0,
host: '',
name: '',
path: '',
port: 0,
timeoutSec: 0,
unhealthyThreshold: 0
}
],
version: '',
vmParams: {
baseInstanceName: '',
canIpForward: false,
description: '',
disksToAttach: [{attachment: {deviceName: '', index: 0}, source: ''}],
disksToCreate: [
{
attachment: {},
autoDelete: false,
boot: false,
initializeParams: {diskSizeGb: '', diskType: '', sourceImage: ''}
}
],
machineType: '',
metadata: {fingerPrint: '', items: [{key: '', value: ''}]},
networkInterfaces: [{accessConfigs: [{name: '', natIp: '', type: ''}], network: '', networkIp: ''}],
onHostMaintenance: '',
serviceAccounts: [{email: '', scopes: []}],
tags: {fingerPrint: '', items: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"action":{"commands":[],"envVariables":[{"hidden":false,"name":"","value":""}],"timeoutMilliSeconds":0},"healthChecks":[{"checkIntervalSec":0,"description":"","healthyThreshold":0,"host":"","name":"","path":"","port":0,"timeoutSec":0,"unhealthyThreshold":0}],"version":"","vmParams":{"baseInstanceName":"","canIpForward":false,"description":"","disksToAttach":[{"attachment":{"deviceName":"","index":0},"source":""}],"disksToCreate":[{"attachment":{},"autoDelete":false,"boot":false,"initializeParams":{"diskSizeGb":"","diskType":"","sourceImage":""}}],"machineType":"","metadata":{"fingerPrint":"","items":[{"key":"","value":""}]},"networkInterfaces":[{"accessConfigs":[{"name":"","natIp":"","type":""}],"network":"","networkIp":""}],"onHostMaintenance":"","serviceAccounts":[{"email":"","scopes":[]}],"tags":{"fingerPrint":"","items":[]}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"action": @{ @"commands": @[ ], @"envVariables": @[ @{ @"hidden": @NO, @"name": @"", @"value": @"" } ], @"timeoutMilliSeconds": @0 },
@"healthChecks": @[ @{ @"checkIntervalSec": @0, @"description": @"", @"healthyThreshold": @0, @"host": @"", @"name": @"", @"path": @"", @"port": @0, @"timeoutSec": @0, @"unhealthyThreshold": @0 } ],
@"version": @"",
@"vmParams": @{ @"baseInstanceName": @"", @"canIpForward": @NO, @"description": @"", @"disksToAttach": @[ @{ @"attachment": @{ @"deviceName": @"", @"index": @0 }, @"source": @"" } ], @"disksToCreate": @[ @{ @"attachment": @{ }, @"autoDelete": @NO, @"boot": @NO, @"initializeParams": @{ @"diskSizeGb": @"", @"diskType": @"", @"sourceImage": @"" } } ], @"machineType": @"", @"metadata": @{ @"fingerPrint": @"", @"items": @[ @{ @"key": @"", @"value": @"" } ] }, @"networkInterfaces": @[ @{ @"accessConfigs": @[ @{ @"name": @"", @"natIp": @"", @"type": @"" } ], @"network": @"", @"networkIp": @"" } ], @"onHostMaintenance": @"", @"serviceAccounts": @[ @{ @"email": @"", @"scopes": @[ ] } ], @"tags": @{ @"fingerPrint": @"", @"items": @[ ] } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => [
'commands' => [
],
'envVariables' => [
[
'hidden' => null,
'name' => '',
'value' => ''
]
],
'timeoutMilliSeconds' => 0
],
'healthChecks' => [
[
'checkIntervalSec' => 0,
'description' => '',
'healthyThreshold' => 0,
'host' => '',
'name' => '',
'path' => '',
'port' => 0,
'timeoutSec' => 0,
'unhealthyThreshold' => 0
]
],
'version' => '',
'vmParams' => [
'baseInstanceName' => '',
'canIpForward' => null,
'description' => '',
'disksToAttach' => [
[
'attachment' => [
'deviceName' => '',
'index' => 0
],
'source' => ''
]
],
'disksToCreate' => [
[
'attachment' => [
],
'autoDelete' => null,
'boot' => null,
'initializeParams' => [
'diskSizeGb' => '',
'diskType' => '',
'sourceImage' => ''
]
]
],
'machineType' => '',
'metadata' => [
'fingerPrint' => '',
'items' => [
[
'key' => '',
'value' => ''
]
]
],
'networkInterfaces' => [
[
'accessConfigs' => [
[
'name' => '',
'natIp' => '',
'type' => ''
]
],
'network' => '',
'networkIp' => ''
]
],
'onHostMaintenance' => '',
'serviceAccounts' => [
[
'email' => '',
'scopes' => [
]
]
],
'tags' => [
'fingerPrint' => '',
'items' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate', [
'body' => '{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'action' => [
'commands' => [
],
'envVariables' => [
[
'hidden' => null,
'name' => '',
'value' => ''
]
],
'timeoutMilliSeconds' => 0
],
'healthChecks' => [
[
'checkIntervalSec' => 0,
'description' => '',
'healthyThreshold' => 0,
'host' => '',
'name' => '',
'path' => '',
'port' => 0,
'timeoutSec' => 0,
'unhealthyThreshold' => 0
]
],
'version' => '',
'vmParams' => [
'baseInstanceName' => '',
'canIpForward' => null,
'description' => '',
'disksToAttach' => [
[
'attachment' => [
'deviceName' => '',
'index' => 0
],
'source' => ''
]
],
'disksToCreate' => [
[
'attachment' => [
],
'autoDelete' => null,
'boot' => null,
'initializeParams' => [
'diskSizeGb' => '',
'diskType' => '',
'sourceImage' => ''
]
]
],
'machineType' => '',
'metadata' => [
'fingerPrint' => '',
'items' => [
[
'key' => '',
'value' => ''
]
]
],
'networkInterfaces' => [
[
'accessConfigs' => [
[
'name' => '',
'natIp' => '',
'type' => ''
]
],
'network' => '',
'networkIp' => ''
]
],
'onHostMaintenance' => '',
'serviceAccounts' => [
[
'email' => '',
'scopes' => [
]
]
],
'tags' => [
'fingerPrint' => '',
'items' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'action' => [
'commands' => [
],
'envVariables' => [
[
'hidden' => null,
'name' => '',
'value' => ''
]
],
'timeoutMilliSeconds' => 0
],
'healthChecks' => [
[
'checkIntervalSec' => 0,
'description' => '',
'healthyThreshold' => 0,
'host' => '',
'name' => '',
'path' => '',
'port' => 0,
'timeoutSec' => 0,
'unhealthyThreshold' => 0
]
],
'version' => '',
'vmParams' => [
'baseInstanceName' => '',
'canIpForward' => null,
'description' => '',
'disksToAttach' => [
[
'attachment' => [
'deviceName' => '',
'index' => 0
],
'source' => ''
]
],
'disksToCreate' => [
[
'attachment' => [
],
'autoDelete' => null,
'boot' => null,
'initializeParams' => [
'diskSizeGb' => '',
'diskType' => '',
'sourceImage' => ''
]
]
],
'machineType' => '',
'metadata' => [
'fingerPrint' => '',
'items' => [
[
'key' => '',
'value' => ''
]
]
],
'networkInterfaces' => [
[
'accessConfigs' => [
[
'name' => '',
'natIp' => '',
'type' => ''
]
],
'network' => '',
'networkIp' => ''
]
],
'onHostMaintenance' => '',
'serviceAccounts' => [
[
'email' => '',
'scopes' => [
]
]
],
'tags' => [
'fingerPrint' => '',
'items' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectName/zones/:zone/pools/:poolName/updateTemplate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"
payload = {
"action": {
"commands": [],
"envVariables": [
{
"hidden": False,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": False,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": False,
"boot": False,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate"
payload <- "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/:projectName/zones/:zone/pools/:poolName/updateTemplate') do |req|
req.body = "{\n \"action\": {\n \"commands\": [],\n \"envVariables\": [\n {\n \"hidden\": false,\n \"name\": \"\",\n \"value\": \"\"\n }\n ],\n \"timeoutMilliSeconds\": 0\n },\n \"healthChecks\": [\n {\n \"checkIntervalSec\": 0,\n \"description\": \"\",\n \"healthyThreshold\": 0,\n \"host\": \"\",\n \"name\": \"\",\n \"path\": \"\",\n \"port\": 0,\n \"timeoutSec\": 0,\n \"unhealthyThreshold\": 0\n }\n ],\n \"version\": \"\",\n \"vmParams\": {\n \"baseInstanceName\": \"\",\n \"canIpForward\": false,\n \"description\": \"\",\n \"disksToAttach\": [\n {\n \"attachment\": {\n \"deviceName\": \"\",\n \"index\": 0\n },\n \"source\": \"\"\n }\n ],\n \"disksToCreate\": [\n {\n \"attachment\": {},\n \"autoDelete\": false,\n \"boot\": false,\n \"initializeParams\": {\n \"diskSizeGb\": \"\",\n \"diskType\": \"\",\n \"sourceImage\": \"\"\n }\n }\n ],\n \"machineType\": \"\",\n \"metadata\": {\n \"fingerPrint\": \"\",\n \"items\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"networkInterfaces\": [\n {\n \"accessConfigs\": [\n {\n \"name\": \"\",\n \"natIp\": \"\",\n \"type\": \"\"\n }\n ],\n \"network\": \"\",\n \"networkIp\": \"\"\n }\n ],\n \"onHostMaintenance\": \"\",\n \"serviceAccounts\": [\n {\n \"email\": \"\",\n \"scopes\": []\n }\n ],\n \"tags\": {\n \"fingerPrint\": \"\",\n \"items\": []\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate";
let payload = json!({
"action": json!({
"commands": (),
"envVariables": (
json!({
"hidden": false,
"name": "",
"value": ""
})
),
"timeoutMilliSeconds": 0
}),
"healthChecks": (
json!({
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
})
),
"version": "",
"vmParams": json!({
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": (
json!({
"attachment": json!({
"deviceName": "",
"index": 0
}),
"source": ""
})
),
"disksToCreate": (
json!({
"attachment": json!({}),
"autoDelete": false,
"boot": false,
"initializeParams": json!({
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
})
})
),
"machineType": "",
"metadata": json!({
"fingerPrint": "",
"items": (
json!({
"key": "",
"value": ""
})
)
}),
"networkInterfaces": (
json!({
"accessConfigs": (
json!({
"name": "",
"natIp": "",
"type": ""
})
),
"network": "",
"networkIp": ""
})
),
"onHostMaintenance": "",
"serviceAccounts": (
json!({
"email": "",
"scopes": ()
})
),
"tags": json!({
"fingerPrint": "",
"items": ()
})
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate \
--header 'content-type: application/json' \
--data '{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}'
echo '{
"action": {
"commands": [],
"envVariables": [
{
"hidden": false,
"name": "",
"value": ""
}
],
"timeoutMilliSeconds": 0
},
"healthChecks": [
{
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
}
],
"version": "",
"vmParams": {
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
{
"attachment": {
"deviceName": "",
"index": 0
},
"source": ""
}
],
"disksToCreate": [
{
"attachment": {},
"autoDelete": false,
"boot": false,
"initializeParams": {
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
}
}
],
"machineType": "",
"metadata": {
"fingerPrint": "",
"items": [
{
"key": "",
"value": ""
}
]
},
"networkInterfaces": [
{
"accessConfigs": [
{
"name": "",
"natIp": "",
"type": ""
}
],
"network": "",
"networkIp": ""
}
],
"onHostMaintenance": "",
"serviceAccounts": [
{
"email": "",
"scopes": []
}
],
"tags": {
"fingerPrint": "",
"items": []
}
}
}' | \
http POST {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "action": {\n "commands": [],\n "envVariables": [\n {\n "hidden": false,\n "name": "",\n "value": ""\n }\n ],\n "timeoutMilliSeconds": 0\n },\n "healthChecks": [\n {\n "checkIntervalSec": 0,\n "description": "",\n "healthyThreshold": 0,\n "host": "",\n "name": "",\n "path": "",\n "port": 0,\n "timeoutSec": 0,\n "unhealthyThreshold": 0\n }\n ],\n "version": "",\n "vmParams": {\n "baseInstanceName": "",\n "canIpForward": false,\n "description": "",\n "disksToAttach": [\n {\n "attachment": {\n "deviceName": "",\n "index": 0\n },\n "source": ""\n }\n ],\n "disksToCreate": [\n {\n "attachment": {},\n "autoDelete": false,\n "boot": false,\n "initializeParams": {\n "diskSizeGb": "",\n "diskType": "",\n "sourceImage": ""\n }\n }\n ],\n "machineType": "",\n "metadata": {\n "fingerPrint": "",\n "items": [\n {\n "key": "",\n "value": ""\n }\n ]\n },\n "networkInterfaces": [\n {\n "accessConfigs": [\n {\n "name": "",\n "natIp": "",\n "type": ""\n }\n ],\n "network": "",\n "networkIp": ""\n }\n ],\n "onHostMaintenance": "",\n "serviceAccounts": [\n {\n "email": "",\n "scopes": []\n }\n ],\n "tags": {\n "fingerPrint": "",\n "items": []\n }\n }\n}' \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"action": [
"commands": [],
"envVariables": [
[
"hidden": false,
"name": "",
"value": ""
]
],
"timeoutMilliSeconds": 0
],
"healthChecks": [
[
"checkIntervalSec": 0,
"description": "",
"healthyThreshold": 0,
"host": "",
"name": "",
"path": "",
"port": 0,
"timeoutSec": 0,
"unhealthyThreshold": 0
]
],
"version": "",
"vmParams": [
"baseInstanceName": "",
"canIpForward": false,
"description": "",
"disksToAttach": [
[
"attachment": [
"deviceName": "",
"index": 0
],
"source": ""
]
],
"disksToCreate": [
[
"attachment": [],
"autoDelete": false,
"boot": false,
"initializeParams": [
"diskSizeGb": "",
"diskType": "",
"sourceImage": ""
]
]
],
"machineType": "",
"metadata": [
"fingerPrint": "",
"items": [
[
"key": "",
"value": ""
]
]
],
"networkInterfaces": [
[
"accessConfigs": [
[
"name": "",
"natIp": "",
"type": ""
]
],
"network": "",
"networkIp": ""
]
],
"onHostMaintenance": "",
"serviceAccounts": [
[
"email": "",
"scopes": []
]
],
"tags": [
"fingerPrint": "",
"items": []
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/updateTemplate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
replicapool.replicas.delete
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName
QUERY PARAMS
projectName
zone
poolName
replicaName
BODY json
{
"abandonInstance": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"abandonInstance\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName" {:content-type :json
:form-params {:abandonInstance false}})
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"abandonInstance\": false\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"),
Content = new StringContent("{\n \"abandonInstance\": false\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"abandonInstance\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
payload := strings.NewReader("{\n \"abandonInstance\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 30
{
"abandonInstance": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.setHeader("content-type", "application/json")
.setBody("{\n \"abandonInstance\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"abandonInstance\": false\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"abandonInstance\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.header("content-type", "application/json")
.body("{\n \"abandonInstance\": false\n}")
.asString();
const data = JSON.stringify({
abandonInstance: false
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
headers: {'content-type': 'application/json'},
data: {abandonInstance: false}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"abandonInstance":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "abandonInstance": false\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"abandonInstance\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({abandonInstance: false}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
headers: {'content-type': 'application/json'},
body: {abandonInstance: false},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
abandonInstance: false
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
headers: {'content-type': 'application/json'},
data: {abandonInstance: false}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"abandonInstance":false}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"abandonInstance": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"abandonInstance\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'abandonInstance' => null
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName', [
'body' => '{
"abandonInstance": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'abandonInstance' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'abandonInstance' => null
]));
$request->setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"abandonInstance": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"abandonInstance": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"abandonInstance\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
payload = { "abandonInstance": False }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
payload <- "{\n \"abandonInstance\": false\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"abandonInstance\": false\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName') do |req|
req.body = "{\n \"abandonInstance\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName";
let payload = json!({"abandonInstance": false});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName \
--header 'content-type: application/json' \
--data '{
"abandonInstance": false
}'
echo '{
"abandonInstance": false
}' | \
http POST {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "abandonInstance": false\n}' \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["abandonInstance": false] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
replicapool.replicas.get
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName
QUERY PARAMS
projectName
zone
poolName
replicaName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName
http GET {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
replicapool.replicas.list
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas
QUERY PARAMS
projectName
zone
poolName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/:projectName/zones/:zone/pools/:poolName/replicas HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas');
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas
http GET {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
replicapool.replicas.restart
{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart
QUERY PARAMS
projectName
zone
poolName
replicaName
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
require "http/client"
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart');
echo $response->getBody();
setUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart
http POST {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectName/zones/:zone/pools/:poolName/replicas/:replicaName/restart")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()