Cloud TPU API
GET
tpu.projects.locations.acceleratorTypes.list
{{baseUrl}}/v2/:parent/acceleratorTypes
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:parent/acceleratorTypes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/:parent/acceleratorTypes")
require "http/client"
url = "{{baseUrl}}/v2/:parent/acceleratorTypes"
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}}/v2/:parent/acceleratorTypes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:parent/acceleratorTypes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:parent/acceleratorTypes"
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/v2/:parent/acceleratorTypes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/:parent/acceleratorTypes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:parent/acceleratorTypes"))
.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}}/v2/:parent/acceleratorTypes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/:parent/acceleratorTypes")
.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}}/v2/:parent/acceleratorTypes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/:parent/acceleratorTypes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:parent/acceleratorTypes';
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}}/v2/:parent/acceleratorTypes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:parent/acceleratorTypes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:parent/acceleratorTypes',
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}}/v2/:parent/acceleratorTypes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/:parent/acceleratorTypes');
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}}/v2/:parent/acceleratorTypes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:parent/acceleratorTypes';
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}}/v2/:parent/acceleratorTypes"]
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}}/v2/:parent/acceleratorTypes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:parent/acceleratorTypes",
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}}/v2/:parent/acceleratorTypes');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:parent/acceleratorTypes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:parent/acceleratorTypes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:parent/acceleratorTypes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:parent/acceleratorTypes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/:parent/acceleratorTypes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:parent/acceleratorTypes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:parent/acceleratorTypes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:parent/acceleratorTypes")
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/v2/:parent/acceleratorTypes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:parent/acceleratorTypes";
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}}/v2/:parent/acceleratorTypes
http GET {{baseUrl}}/v2/:parent/acceleratorTypes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/:parent/acceleratorTypes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:parent/acceleratorTypes")! 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
tpu.projects.locations.generateServiceIdentity
{{baseUrl}}/v2/:parent:generateServiceIdentity
QUERY PARAMS
parent
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:parent:generateServiceIdentity");
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, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/:parent:generateServiceIdentity" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v2/:parent:generateServiceIdentity"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
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}}/v2/:parent:generateServiceIdentity"),
Content = new StringContent("{}")
{
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}}/v2/:parent:generateServiceIdentity");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:parent:generateServiceIdentity"
payload := strings.NewReader("{}")
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/v2/:parent:generateServiceIdentity HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/:parent:generateServiceIdentity")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:parent:generateServiceIdentity"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.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, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/:parent:generateServiceIdentity")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/:parent:generateServiceIdentity")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/:parent:generateServiceIdentity');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:parent:generateServiceIdentity',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:parent:generateServiceIdentity';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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}}/v2/:parent:generateServiceIdentity',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/:parent:generateServiceIdentity")
.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/v2/:parent:generateServiceIdentity',
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({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:parent:generateServiceIdentity',
headers: {'content-type': 'application/json'},
body: {},
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}}/v2/:parent:generateServiceIdentity');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
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}}/v2/:parent:generateServiceIdentity',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:parent:generateServiceIdentity';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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 = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/:parent:generateServiceIdentity"]
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}}/v2/:parent:generateServiceIdentity" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:parent:generateServiceIdentity",
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([
]),
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}}/v2/:parent:generateServiceIdentity', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:parent:generateServiceIdentity');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/v2/:parent:generateServiceIdentity');
$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}}/v2/:parent:generateServiceIdentity' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:parent:generateServiceIdentity' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/:parent:generateServiceIdentity", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:parent:generateServiceIdentity"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:parent:generateServiceIdentity"
payload <- "{}"
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}}/v2/:parent:generateServiceIdentity")
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 = "{}"
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/v2/:parent:generateServiceIdentity') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:parent:generateServiceIdentity";
let payload = json!({});
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}}/v2/:parent:generateServiceIdentity \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/v2/:parent:generateServiceIdentity \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/v2/:parent:generateServiceIdentity
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:parent:generateServiceIdentity")! 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
tpu.projects.locations.list
{{baseUrl}}/v2/:name/locations
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name/locations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/:name/locations")
require "http/client"
url = "{{baseUrl}}/v2/:name/locations"
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}}/v2/:name/locations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:name/locations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name/locations"
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/v2/:name/locations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/:name/locations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name/locations"))
.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}}/v2/:name/locations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/:name/locations")
.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}}/v2/:name/locations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/:name/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name/locations';
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}}/v2/:name/locations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name/locations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:name/locations',
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}}/v2/:name/locations'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/:name/locations');
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}}/v2/:name/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name/locations';
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}}/v2/:name/locations"]
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}}/v2/:name/locations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name/locations",
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}}/v2/:name/locations');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name/locations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:name/locations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:name/locations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name/locations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/:name/locations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name/locations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name/locations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:name/locations")
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/v2/:name/locations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name/locations";
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}}/v2/:name/locations
http GET {{baseUrl}}/v2/:name/locations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/:name/locations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name/locations")! 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
tpu.projects.locations.nodes.create
{{baseUrl}}/v2/:parent/nodes
QUERY PARAMS
parent
BODY json
{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:parent/nodes");
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 \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/:parent/nodes" {:content-type :json
:form-params {:acceleratorConfig {:topology ""
:type ""}
:acceleratorType ""
:apiVersion ""
:cidrBlock ""
:createTime ""
:dataDisks [{:mode ""
:sourceDisk ""}]
:description ""
:health ""
:healthDescription ""
:id ""
:labels {}
:metadata {}
:name ""
:networkConfig {:canIpForward false
:enableExternalIps false
:network ""
:subnetwork ""}
:networkEndpoints [{:accessConfig {:externalIp ""}
:ipAddress ""
:port 0}]
:runtimeVersion ""
:schedulingConfig {:preemptible false
:reserved false}
:serviceAccount {:email ""
:scope []}
:shieldedInstanceConfig {:enableSecureBoot false}
:state ""
:symptoms [{:createTime ""
:details ""
:symptomType ""
:workerId ""}]
:tags []}})
require "http/client"
url = "{{baseUrl}}/v2/:parent/nodes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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}}/v2/:parent/nodes"),
Content = new StringContent("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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}}/v2/:parent/nodes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:parent/nodes"
payload := strings.NewReader("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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/v2/:parent/nodes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 992
{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/:parent/nodes")
.setHeader("content-type", "application/json")
.setBody("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:parent/nodes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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 \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/:parent/nodes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/:parent/nodes")
.header("content-type", "application/json")
.body("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
acceleratorConfig: {
topology: '',
type: ''
},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [
{
mode: '',
sourceDisk: ''
}
],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {
canIpForward: false,
enableExternalIps: false,
network: '',
subnetwork: ''
},
networkEndpoints: [
{
accessConfig: {
externalIp: ''
},
ipAddress: '',
port: 0
}
],
runtimeVersion: '',
schedulingConfig: {
preemptible: false,
reserved: false
},
serviceAccount: {
email: '',
scope: []
},
shieldedInstanceConfig: {
enableSecureBoot: false
},
state: '',
symptoms: [
{
createTime: '',
details: '',
symptomType: '',
workerId: ''
}
],
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/:parent/nodes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:parent/nodes',
headers: {'content-type': 'application/json'},
data: {
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:parent/nodes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"acceleratorConfig":{"topology":"","type":""},"acceleratorType":"","apiVersion":"","cidrBlock":"","createTime":"","dataDisks":[{"mode":"","sourceDisk":""}],"description":"","health":"","healthDescription":"","id":"","labels":{},"metadata":{},"name":"","networkConfig":{"canIpForward":false,"enableExternalIps":false,"network":"","subnetwork":""},"networkEndpoints":[{"accessConfig":{"externalIp":""},"ipAddress":"","port":0}],"runtimeVersion":"","schedulingConfig":{"preemptible":false,"reserved":false},"serviceAccount":{"email":"","scope":[]},"shieldedInstanceConfig":{"enableSecureBoot":false},"state":"","symptoms":[{"createTime":"","details":"","symptomType":"","workerId":""}],"tags":[]}'
};
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}}/v2/:parent/nodes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "acceleratorConfig": {\n "topology": "",\n "type": ""\n },\n "acceleratorType": "",\n "apiVersion": "",\n "cidrBlock": "",\n "createTime": "",\n "dataDisks": [\n {\n "mode": "",\n "sourceDisk": ""\n }\n ],\n "description": "",\n "health": "",\n "healthDescription": "",\n "id": "",\n "labels": {},\n "metadata": {},\n "name": "",\n "networkConfig": {\n "canIpForward": false,\n "enableExternalIps": false,\n "network": "",\n "subnetwork": ""\n },\n "networkEndpoints": [\n {\n "accessConfig": {\n "externalIp": ""\n },\n "ipAddress": "",\n "port": 0\n }\n ],\n "runtimeVersion": "",\n "schedulingConfig": {\n "preemptible": false,\n "reserved": false\n },\n "serviceAccount": {\n "email": "",\n "scope": []\n },\n "shieldedInstanceConfig": {\n "enableSecureBoot": false\n },\n "state": "",\n "symptoms": [\n {\n "createTime": "",\n "details": "",\n "symptomType": "",\n "workerId": ""\n }\n ],\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/:parent/nodes")
.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/v2/:parent/nodes',
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({
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:parent/nodes',
headers: {'content-type': 'application/json'},
body: {
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
},
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}}/v2/:parent/nodes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
acceleratorConfig: {
topology: '',
type: ''
},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [
{
mode: '',
sourceDisk: ''
}
],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {
canIpForward: false,
enableExternalIps: false,
network: '',
subnetwork: ''
},
networkEndpoints: [
{
accessConfig: {
externalIp: ''
},
ipAddress: '',
port: 0
}
],
runtimeVersion: '',
schedulingConfig: {
preemptible: false,
reserved: false
},
serviceAccount: {
email: '',
scope: []
},
shieldedInstanceConfig: {
enableSecureBoot: false
},
state: '',
symptoms: [
{
createTime: '',
details: '',
symptomType: '',
workerId: ''
}
],
tags: []
});
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}}/v2/:parent/nodes',
headers: {'content-type': 'application/json'},
data: {
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:parent/nodes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"acceleratorConfig":{"topology":"","type":""},"acceleratorType":"","apiVersion":"","cidrBlock":"","createTime":"","dataDisks":[{"mode":"","sourceDisk":""}],"description":"","health":"","healthDescription":"","id":"","labels":{},"metadata":{},"name":"","networkConfig":{"canIpForward":false,"enableExternalIps":false,"network":"","subnetwork":""},"networkEndpoints":[{"accessConfig":{"externalIp":""},"ipAddress":"","port":0}],"runtimeVersion":"","schedulingConfig":{"preemptible":false,"reserved":false},"serviceAccount":{"email":"","scope":[]},"shieldedInstanceConfig":{"enableSecureBoot":false},"state":"","symptoms":[{"createTime":"","details":"","symptomType":"","workerId":""}],"tags":[]}'
};
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 = @{ @"acceleratorConfig": @{ @"topology": @"", @"type": @"" },
@"acceleratorType": @"",
@"apiVersion": @"",
@"cidrBlock": @"",
@"createTime": @"",
@"dataDisks": @[ @{ @"mode": @"", @"sourceDisk": @"" } ],
@"description": @"",
@"health": @"",
@"healthDescription": @"",
@"id": @"",
@"labels": @{ },
@"metadata": @{ },
@"name": @"",
@"networkConfig": @{ @"canIpForward": @NO, @"enableExternalIps": @NO, @"network": @"", @"subnetwork": @"" },
@"networkEndpoints": @[ @{ @"accessConfig": @{ @"externalIp": @"" }, @"ipAddress": @"", @"port": @0 } ],
@"runtimeVersion": @"",
@"schedulingConfig": @{ @"preemptible": @NO, @"reserved": @NO },
@"serviceAccount": @{ @"email": @"", @"scope": @[ ] },
@"shieldedInstanceConfig": @{ @"enableSecureBoot": @NO },
@"state": @"",
@"symptoms": @[ @{ @"createTime": @"", @"details": @"", @"symptomType": @"", @"workerId": @"" } ],
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/:parent/nodes"]
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}}/v2/:parent/nodes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:parent/nodes",
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([
'acceleratorConfig' => [
'topology' => '',
'type' => ''
],
'acceleratorType' => '',
'apiVersion' => '',
'cidrBlock' => '',
'createTime' => '',
'dataDisks' => [
[
'mode' => '',
'sourceDisk' => ''
]
],
'description' => '',
'health' => '',
'healthDescription' => '',
'id' => '',
'labels' => [
],
'metadata' => [
],
'name' => '',
'networkConfig' => [
'canIpForward' => null,
'enableExternalIps' => null,
'network' => '',
'subnetwork' => ''
],
'networkEndpoints' => [
[
'accessConfig' => [
'externalIp' => ''
],
'ipAddress' => '',
'port' => 0
]
],
'runtimeVersion' => '',
'schedulingConfig' => [
'preemptible' => null,
'reserved' => null
],
'serviceAccount' => [
'email' => '',
'scope' => [
]
],
'shieldedInstanceConfig' => [
'enableSecureBoot' => null
],
'state' => '',
'symptoms' => [
[
'createTime' => '',
'details' => '',
'symptomType' => '',
'workerId' => ''
]
],
'tags' => [
]
]),
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}}/v2/:parent/nodes', [
'body' => '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:parent/nodes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'acceleratorConfig' => [
'topology' => '',
'type' => ''
],
'acceleratorType' => '',
'apiVersion' => '',
'cidrBlock' => '',
'createTime' => '',
'dataDisks' => [
[
'mode' => '',
'sourceDisk' => ''
]
],
'description' => '',
'health' => '',
'healthDescription' => '',
'id' => '',
'labels' => [
],
'metadata' => [
],
'name' => '',
'networkConfig' => [
'canIpForward' => null,
'enableExternalIps' => null,
'network' => '',
'subnetwork' => ''
],
'networkEndpoints' => [
[
'accessConfig' => [
'externalIp' => ''
],
'ipAddress' => '',
'port' => 0
]
],
'runtimeVersion' => '',
'schedulingConfig' => [
'preemptible' => null,
'reserved' => null
],
'serviceAccount' => [
'email' => '',
'scope' => [
]
],
'shieldedInstanceConfig' => [
'enableSecureBoot' => null
],
'state' => '',
'symptoms' => [
[
'createTime' => '',
'details' => '',
'symptomType' => '',
'workerId' => ''
]
],
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'acceleratorConfig' => [
'topology' => '',
'type' => ''
],
'acceleratorType' => '',
'apiVersion' => '',
'cidrBlock' => '',
'createTime' => '',
'dataDisks' => [
[
'mode' => '',
'sourceDisk' => ''
]
],
'description' => '',
'health' => '',
'healthDescription' => '',
'id' => '',
'labels' => [
],
'metadata' => [
],
'name' => '',
'networkConfig' => [
'canIpForward' => null,
'enableExternalIps' => null,
'network' => '',
'subnetwork' => ''
],
'networkEndpoints' => [
[
'accessConfig' => [
'externalIp' => ''
],
'ipAddress' => '',
'port' => 0
]
],
'runtimeVersion' => '',
'schedulingConfig' => [
'preemptible' => null,
'reserved' => null
],
'serviceAccount' => [
'email' => '',
'scope' => [
]
],
'shieldedInstanceConfig' => [
'enableSecureBoot' => null
],
'state' => '',
'symptoms' => [
[
'createTime' => '',
'details' => '',
'symptomType' => '',
'workerId' => ''
]
],
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/:parent/nodes');
$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}}/v2/:parent/nodes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:parent/nodes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/:parent/nodes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:parent/nodes"
payload = {
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": False,
"enableExternalIps": False,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": { "externalIp": "" },
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": False,
"reserved": False
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": { "enableSecureBoot": False },
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:parent/nodes"
payload <- "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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}}/v2/:parent/nodes")
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 \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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/v2/:parent/nodes') do |req|
req.body = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:parent/nodes";
let payload = json!({
"acceleratorConfig": json!({
"topology": "",
"type": ""
}),
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": (
json!({
"mode": "",
"sourceDisk": ""
})
),
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": json!({}),
"metadata": json!({}),
"name": "",
"networkConfig": json!({
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
}),
"networkEndpoints": (
json!({
"accessConfig": json!({"externalIp": ""}),
"ipAddress": "",
"port": 0
})
),
"runtimeVersion": "",
"schedulingConfig": json!({
"preemptible": false,
"reserved": false
}),
"serviceAccount": json!({
"email": "",
"scope": ()
}),
"shieldedInstanceConfig": json!({"enableSecureBoot": false}),
"state": "",
"symptoms": (
json!({
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
})
),
"tags": ()
});
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}}/v2/:parent/nodes \
--header 'content-type: application/json' \
--data '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}'
echo '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}' | \
http POST {{baseUrl}}/v2/:parent/nodes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "acceleratorConfig": {\n "topology": "",\n "type": ""\n },\n "acceleratorType": "",\n "apiVersion": "",\n "cidrBlock": "",\n "createTime": "",\n "dataDisks": [\n {\n "mode": "",\n "sourceDisk": ""\n }\n ],\n "description": "",\n "health": "",\n "healthDescription": "",\n "id": "",\n "labels": {},\n "metadata": {},\n "name": "",\n "networkConfig": {\n "canIpForward": false,\n "enableExternalIps": false,\n "network": "",\n "subnetwork": ""\n },\n "networkEndpoints": [\n {\n "accessConfig": {\n "externalIp": ""\n },\n "ipAddress": "",\n "port": 0\n }\n ],\n "runtimeVersion": "",\n "schedulingConfig": {\n "preemptible": false,\n "reserved": false\n },\n "serviceAccount": {\n "email": "",\n "scope": []\n },\n "shieldedInstanceConfig": {\n "enableSecureBoot": false\n },\n "state": "",\n "symptoms": [\n {\n "createTime": "",\n "details": "",\n "symptomType": "",\n "workerId": ""\n }\n ],\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/v2/:parent/nodes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"acceleratorConfig": [
"topology": "",
"type": ""
],
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
[
"mode": "",
"sourceDisk": ""
]
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": [],
"metadata": [],
"name": "",
"networkConfig": [
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
],
"networkEndpoints": [
[
"accessConfig": ["externalIp": ""],
"ipAddress": "",
"port": 0
]
],
"runtimeVersion": "",
"schedulingConfig": [
"preemptible": false,
"reserved": false
],
"serviceAccount": [
"email": "",
"scope": []
],
"shieldedInstanceConfig": ["enableSecureBoot": false],
"state": "",
"symptoms": [
[
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
]
],
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:parent/nodes")! 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
tpu.projects.locations.nodes.getGuestAttributes
{{baseUrl}}/v2/:name:getGuestAttributes
QUERY PARAMS
name
BODY json
{
"queryPath": "",
"workerIds": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name:getGuestAttributes");
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 \"queryPath\": \"\",\n \"workerIds\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/:name:getGuestAttributes" {:content-type :json
:form-params {:queryPath ""
:workerIds []}})
require "http/client"
url = "{{baseUrl}}/v2/:name:getGuestAttributes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"queryPath\": \"\",\n \"workerIds\": []\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}}/v2/:name:getGuestAttributes"),
Content = new StringContent("{\n \"queryPath\": \"\",\n \"workerIds\": []\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}}/v2/:name:getGuestAttributes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"queryPath\": \"\",\n \"workerIds\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name:getGuestAttributes"
payload := strings.NewReader("{\n \"queryPath\": \"\",\n \"workerIds\": []\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/v2/:name:getGuestAttributes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 40
{
"queryPath": "",
"workerIds": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/:name:getGuestAttributes")
.setHeader("content-type", "application/json")
.setBody("{\n \"queryPath\": \"\",\n \"workerIds\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name:getGuestAttributes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"queryPath\": \"\",\n \"workerIds\": []\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 \"queryPath\": \"\",\n \"workerIds\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/:name:getGuestAttributes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/:name:getGuestAttributes")
.header("content-type", "application/json")
.body("{\n \"queryPath\": \"\",\n \"workerIds\": []\n}")
.asString();
const data = JSON.stringify({
queryPath: '',
workerIds: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/:name:getGuestAttributes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:name:getGuestAttributes',
headers: {'content-type': 'application/json'},
data: {queryPath: '', workerIds: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name:getGuestAttributes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"queryPath":"","workerIds":[]}'
};
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}}/v2/:name:getGuestAttributes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "queryPath": "",\n "workerIds": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"queryPath\": \"\",\n \"workerIds\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name:getGuestAttributes")
.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/v2/:name:getGuestAttributes',
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({queryPath: '', workerIds: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:name:getGuestAttributes',
headers: {'content-type': 'application/json'},
body: {queryPath: '', workerIds: []},
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}}/v2/:name:getGuestAttributes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
queryPath: '',
workerIds: []
});
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}}/v2/:name:getGuestAttributes',
headers: {'content-type': 'application/json'},
data: {queryPath: '', workerIds: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name:getGuestAttributes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"queryPath":"","workerIds":[]}'
};
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 = @{ @"queryPath": @"",
@"workerIds": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/:name:getGuestAttributes"]
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}}/v2/:name:getGuestAttributes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"queryPath\": \"\",\n \"workerIds\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name:getGuestAttributes",
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([
'queryPath' => '',
'workerIds' => [
]
]),
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}}/v2/:name:getGuestAttributes', [
'body' => '{
"queryPath": "",
"workerIds": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name:getGuestAttributes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'queryPath' => '',
'workerIds' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'queryPath' => '',
'workerIds' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/:name:getGuestAttributes');
$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}}/v2/:name:getGuestAttributes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"queryPath": "",
"workerIds": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name:getGuestAttributes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"queryPath": "",
"workerIds": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"queryPath\": \"\",\n \"workerIds\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/:name:getGuestAttributes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name:getGuestAttributes"
payload = {
"queryPath": "",
"workerIds": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name:getGuestAttributes"
payload <- "{\n \"queryPath\": \"\",\n \"workerIds\": []\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}}/v2/:name:getGuestAttributes")
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 \"queryPath\": \"\",\n \"workerIds\": []\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/v2/:name:getGuestAttributes') do |req|
req.body = "{\n \"queryPath\": \"\",\n \"workerIds\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name:getGuestAttributes";
let payload = json!({
"queryPath": "",
"workerIds": ()
});
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}}/v2/:name:getGuestAttributes \
--header 'content-type: application/json' \
--data '{
"queryPath": "",
"workerIds": []
}'
echo '{
"queryPath": "",
"workerIds": []
}' | \
http POST {{baseUrl}}/v2/:name:getGuestAttributes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "queryPath": "",\n "workerIds": []\n}' \
--output-document \
- {{baseUrl}}/v2/:name:getGuestAttributes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"queryPath": "",
"workerIds": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name:getGuestAttributes")! 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
tpu.projects.locations.nodes.list
{{baseUrl}}/v2/:parent/nodes
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:parent/nodes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/:parent/nodes")
require "http/client"
url = "{{baseUrl}}/v2/:parent/nodes"
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}}/v2/:parent/nodes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:parent/nodes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:parent/nodes"
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/v2/:parent/nodes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/:parent/nodes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:parent/nodes"))
.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}}/v2/:parent/nodes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/:parent/nodes")
.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}}/v2/:parent/nodes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/:parent/nodes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:parent/nodes';
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}}/v2/:parent/nodes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:parent/nodes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:parent/nodes',
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}}/v2/:parent/nodes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/:parent/nodes');
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}}/v2/:parent/nodes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:parent/nodes';
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}}/v2/:parent/nodes"]
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}}/v2/:parent/nodes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:parent/nodes",
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}}/v2/:parent/nodes');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:parent/nodes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:parent/nodes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:parent/nodes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:parent/nodes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/:parent/nodes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:parent/nodes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:parent/nodes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:parent/nodes")
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/v2/:parent/nodes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:parent/nodes";
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}}/v2/:parent/nodes
http GET {{baseUrl}}/v2/:parent/nodes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/:parent/nodes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:parent/nodes")! 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()
PATCH
tpu.projects.locations.nodes.patch
{{baseUrl}}/v2/:name
QUERY PARAMS
name
BODY json
{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name");
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 \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/v2/:name" {:content-type :json
:form-params {:acceleratorConfig {:topology ""
:type ""}
:acceleratorType ""
:apiVersion ""
:cidrBlock ""
:createTime ""
:dataDisks [{:mode ""
:sourceDisk ""}]
:description ""
:health ""
:healthDescription ""
:id ""
:labels {}
:metadata {}
:name ""
:networkConfig {:canIpForward false
:enableExternalIps false
:network ""
:subnetwork ""}
:networkEndpoints [{:accessConfig {:externalIp ""}
:ipAddress ""
:port 0}]
:runtimeVersion ""
:schedulingConfig {:preemptible false
:reserved false}
:serviceAccount {:email ""
:scope []}
:shieldedInstanceConfig {:enableSecureBoot false}
:state ""
:symptoms [{:createTime ""
:details ""
:symptomType ""
:workerId ""}]
:tags []}})
require "http/client"
url = "{{baseUrl}}/v2/:name"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/v2/:name"),
Content = new StringContent("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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}}/v2/:name");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name"
payload := strings.NewReader("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
req, _ := http.NewRequest("PATCH", 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))
}
PATCH /baseUrl/v2/:name HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 992
{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/v2/:name")
.setHeader("content-type", "application/json")
.setBody("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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 \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/:name")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/v2/:name")
.header("content-type", "application/json")
.body("{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
.asString();
const data = JSON.stringify({
acceleratorConfig: {
topology: '',
type: ''
},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [
{
mode: '',
sourceDisk: ''
}
],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {
canIpForward: false,
enableExternalIps: false,
network: '',
subnetwork: ''
},
networkEndpoints: [
{
accessConfig: {
externalIp: ''
},
ipAddress: '',
port: 0
}
],
runtimeVersion: '',
schedulingConfig: {
preemptible: false,
reserved: false
},
serviceAccount: {
email: '',
scope: []
},
shieldedInstanceConfig: {
enableSecureBoot: false
},
state: '',
symptoms: [
{
createTime: '',
details: '',
symptomType: '',
workerId: ''
}
],
tags: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/v2/:name');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v2/:name',
headers: {'content-type': 'application/json'},
data: {
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"acceleratorConfig":{"topology":"","type":""},"acceleratorType":"","apiVersion":"","cidrBlock":"","createTime":"","dataDisks":[{"mode":"","sourceDisk":""}],"description":"","health":"","healthDescription":"","id":"","labels":{},"metadata":{},"name":"","networkConfig":{"canIpForward":false,"enableExternalIps":false,"network":"","subnetwork":""},"networkEndpoints":[{"accessConfig":{"externalIp":""},"ipAddress":"","port":0}],"runtimeVersion":"","schedulingConfig":{"preemptible":false,"reserved":false},"serviceAccount":{"email":"","scope":[]},"shieldedInstanceConfig":{"enableSecureBoot":false},"state":"","symptoms":[{"createTime":"","details":"","symptomType":"","workerId":""}],"tags":[]}'
};
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}}/v2/:name',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "acceleratorConfig": {\n "topology": "",\n "type": ""\n },\n "acceleratorType": "",\n "apiVersion": "",\n "cidrBlock": "",\n "createTime": "",\n "dataDisks": [\n {\n "mode": "",\n "sourceDisk": ""\n }\n ],\n "description": "",\n "health": "",\n "healthDescription": "",\n "id": "",\n "labels": {},\n "metadata": {},\n "name": "",\n "networkConfig": {\n "canIpForward": false,\n "enableExternalIps": false,\n "network": "",\n "subnetwork": ""\n },\n "networkEndpoints": [\n {\n "accessConfig": {\n "externalIp": ""\n },\n "ipAddress": "",\n "port": 0\n }\n ],\n "runtimeVersion": "",\n "schedulingConfig": {\n "preemptible": false,\n "reserved": false\n },\n "serviceAccount": {\n "email": "",\n "scope": []\n },\n "shieldedInstanceConfig": {\n "enableSecureBoot": false\n },\n "state": "",\n "symptoms": [\n {\n "createTime": "",\n "details": "",\n "symptomType": "",\n "workerId": ""\n }\n ],\n "tags": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:name',
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({
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v2/:name',
headers: {'content-type': 'application/json'},
body: {
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/v2/:name');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
acceleratorConfig: {
topology: '',
type: ''
},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [
{
mode: '',
sourceDisk: ''
}
],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {
canIpForward: false,
enableExternalIps: false,
network: '',
subnetwork: ''
},
networkEndpoints: [
{
accessConfig: {
externalIp: ''
},
ipAddress: '',
port: 0
}
],
runtimeVersion: '',
schedulingConfig: {
preemptible: false,
reserved: false
},
serviceAccount: {
email: '',
scope: []
},
shieldedInstanceConfig: {
enableSecureBoot: false
},
state: '',
symptoms: [
{
createTime: '',
details: '',
symptomType: '',
workerId: ''
}
],
tags: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/v2/:name',
headers: {'content-type': 'application/json'},
data: {
acceleratorConfig: {topology: '', type: ''},
acceleratorType: '',
apiVersion: '',
cidrBlock: '',
createTime: '',
dataDisks: [{mode: '', sourceDisk: ''}],
description: '',
health: '',
healthDescription: '',
id: '',
labels: {},
metadata: {},
name: '',
networkConfig: {canIpForward: false, enableExternalIps: false, network: '', subnetwork: ''},
networkEndpoints: [{accessConfig: {externalIp: ''}, ipAddress: '', port: 0}],
runtimeVersion: '',
schedulingConfig: {preemptible: false, reserved: false},
serviceAccount: {email: '', scope: []},
shieldedInstanceConfig: {enableSecureBoot: false},
state: '',
symptoms: [{createTime: '', details: '', symptomType: '', workerId: ''}],
tags: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"acceleratorConfig":{"topology":"","type":""},"acceleratorType":"","apiVersion":"","cidrBlock":"","createTime":"","dataDisks":[{"mode":"","sourceDisk":""}],"description":"","health":"","healthDescription":"","id":"","labels":{},"metadata":{},"name":"","networkConfig":{"canIpForward":false,"enableExternalIps":false,"network":"","subnetwork":""},"networkEndpoints":[{"accessConfig":{"externalIp":""},"ipAddress":"","port":0}],"runtimeVersion":"","schedulingConfig":{"preemptible":false,"reserved":false},"serviceAccount":{"email":"","scope":[]},"shieldedInstanceConfig":{"enableSecureBoot":false},"state":"","symptoms":[{"createTime":"","details":"","symptomType":"","workerId":""}],"tags":[]}'
};
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 = @{ @"acceleratorConfig": @{ @"topology": @"", @"type": @"" },
@"acceleratorType": @"",
@"apiVersion": @"",
@"cidrBlock": @"",
@"createTime": @"",
@"dataDisks": @[ @{ @"mode": @"", @"sourceDisk": @"" } ],
@"description": @"",
@"health": @"",
@"healthDescription": @"",
@"id": @"",
@"labels": @{ },
@"metadata": @{ },
@"name": @"",
@"networkConfig": @{ @"canIpForward": @NO, @"enableExternalIps": @NO, @"network": @"", @"subnetwork": @"" },
@"networkEndpoints": @[ @{ @"accessConfig": @{ @"externalIp": @"" }, @"ipAddress": @"", @"port": @0 } ],
@"runtimeVersion": @"",
@"schedulingConfig": @{ @"preemptible": @NO, @"reserved": @NO },
@"serviceAccount": @{ @"email": @"", @"scope": @[ ] },
@"shieldedInstanceConfig": @{ @"enableSecureBoot": @NO },
@"state": @"",
@"symptoms": @[ @{ @"createTime": @"", @"details": @"", @"symptomType": @"", @"workerId": @"" } ],
@"tags": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/:name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[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}}/v2/:name" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'acceleratorConfig' => [
'topology' => '',
'type' => ''
],
'acceleratorType' => '',
'apiVersion' => '',
'cidrBlock' => '',
'createTime' => '',
'dataDisks' => [
[
'mode' => '',
'sourceDisk' => ''
]
],
'description' => '',
'health' => '',
'healthDescription' => '',
'id' => '',
'labels' => [
],
'metadata' => [
],
'name' => '',
'networkConfig' => [
'canIpForward' => null,
'enableExternalIps' => null,
'network' => '',
'subnetwork' => ''
],
'networkEndpoints' => [
[
'accessConfig' => [
'externalIp' => ''
],
'ipAddress' => '',
'port' => 0
]
],
'runtimeVersion' => '',
'schedulingConfig' => [
'preemptible' => null,
'reserved' => null
],
'serviceAccount' => [
'email' => '',
'scope' => [
]
],
'shieldedInstanceConfig' => [
'enableSecureBoot' => null
],
'state' => '',
'symptoms' => [
[
'createTime' => '',
'details' => '',
'symptomType' => '',
'workerId' => ''
]
],
'tags' => [
]
]),
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('PATCH', '{{baseUrl}}/v2/:name', [
'body' => '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'acceleratorConfig' => [
'topology' => '',
'type' => ''
],
'acceleratorType' => '',
'apiVersion' => '',
'cidrBlock' => '',
'createTime' => '',
'dataDisks' => [
[
'mode' => '',
'sourceDisk' => ''
]
],
'description' => '',
'health' => '',
'healthDescription' => '',
'id' => '',
'labels' => [
],
'metadata' => [
],
'name' => '',
'networkConfig' => [
'canIpForward' => null,
'enableExternalIps' => null,
'network' => '',
'subnetwork' => ''
],
'networkEndpoints' => [
[
'accessConfig' => [
'externalIp' => ''
],
'ipAddress' => '',
'port' => 0
]
],
'runtimeVersion' => '',
'schedulingConfig' => [
'preemptible' => null,
'reserved' => null
],
'serviceAccount' => [
'email' => '',
'scope' => [
]
],
'shieldedInstanceConfig' => [
'enableSecureBoot' => null
],
'state' => '',
'symptoms' => [
[
'createTime' => '',
'details' => '',
'symptomType' => '',
'workerId' => ''
]
],
'tags' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'acceleratorConfig' => [
'topology' => '',
'type' => ''
],
'acceleratorType' => '',
'apiVersion' => '',
'cidrBlock' => '',
'createTime' => '',
'dataDisks' => [
[
'mode' => '',
'sourceDisk' => ''
]
],
'description' => '',
'health' => '',
'healthDescription' => '',
'id' => '',
'labels' => [
],
'metadata' => [
],
'name' => '',
'networkConfig' => [
'canIpForward' => null,
'enableExternalIps' => null,
'network' => '',
'subnetwork' => ''
],
'networkEndpoints' => [
[
'accessConfig' => [
'externalIp' => ''
],
'ipAddress' => '',
'port' => 0
]
],
'runtimeVersion' => '',
'schedulingConfig' => [
'preemptible' => null,
'reserved' => null
],
'serviceAccount' => [
'email' => '',
'scope' => [
]
],
'shieldedInstanceConfig' => [
'enableSecureBoot' => null
],
'state' => '',
'symptoms' => [
[
'createTime' => '',
'details' => '',
'symptomType' => '',
'workerId' => ''
]
],
'tags' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v2/:name');
$request->setRequestMethod('PATCH');
$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}}/v2/:name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/v2/:name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name"
payload = {
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": False,
"enableExternalIps": False,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": { "externalIp": "" },
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": False,
"reserved": False
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": { "enableSecureBoot": False },
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name"
payload <- "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\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.patch('/baseUrl/v2/:name') do |req|
req.body = "{\n \"acceleratorConfig\": {\n \"topology\": \"\",\n \"type\": \"\"\n },\n \"acceleratorType\": \"\",\n \"apiVersion\": \"\",\n \"cidrBlock\": \"\",\n \"createTime\": \"\",\n \"dataDisks\": [\n {\n \"mode\": \"\",\n \"sourceDisk\": \"\"\n }\n ],\n \"description\": \"\",\n \"health\": \"\",\n \"healthDescription\": \"\",\n \"id\": \"\",\n \"labels\": {},\n \"metadata\": {},\n \"name\": \"\",\n \"networkConfig\": {\n \"canIpForward\": false,\n \"enableExternalIps\": false,\n \"network\": \"\",\n \"subnetwork\": \"\"\n },\n \"networkEndpoints\": [\n {\n \"accessConfig\": {\n \"externalIp\": \"\"\n },\n \"ipAddress\": \"\",\n \"port\": 0\n }\n ],\n \"runtimeVersion\": \"\",\n \"schedulingConfig\": {\n \"preemptible\": false,\n \"reserved\": false\n },\n \"serviceAccount\": {\n \"email\": \"\",\n \"scope\": []\n },\n \"shieldedInstanceConfig\": {\n \"enableSecureBoot\": false\n },\n \"state\": \"\",\n \"symptoms\": [\n {\n \"createTime\": \"\",\n \"details\": \"\",\n \"symptomType\": \"\",\n \"workerId\": \"\"\n }\n ],\n \"tags\": []\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name";
let payload = json!({
"acceleratorConfig": json!({
"topology": "",
"type": ""
}),
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": (
json!({
"mode": "",
"sourceDisk": ""
})
),
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": json!({}),
"metadata": json!({}),
"name": "",
"networkConfig": json!({
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
}),
"networkEndpoints": (
json!({
"accessConfig": json!({"externalIp": ""}),
"ipAddress": "",
"port": 0
})
),
"runtimeVersion": "",
"schedulingConfig": json!({
"preemptible": false,
"reserved": false
}),
"serviceAccount": json!({
"email": "",
"scope": ()
}),
"shieldedInstanceConfig": json!({"enableSecureBoot": false}),
"state": "",
"symptoms": (
json!({
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
})
),
"tags": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/v2/:name \
--header 'content-type: application/json' \
--data '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}'
echo '{
"acceleratorConfig": {
"topology": "",
"type": ""
},
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
{
"mode": "",
"sourceDisk": ""
}
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": {},
"metadata": {},
"name": "",
"networkConfig": {
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
},
"networkEndpoints": [
{
"accessConfig": {
"externalIp": ""
},
"ipAddress": "",
"port": 0
}
],
"runtimeVersion": "",
"schedulingConfig": {
"preemptible": false,
"reserved": false
},
"serviceAccount": {
"email": "",
"scope": []
},
"shieldedInstanceConfig": {
"enableSecureBoot": false
},
"state": "",
"symptoms": [
{
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
}
],
"tags": []
}' | \
http PATCH {{baseUrl}}/v2/:name \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "acceleratorConfig": {\n "topology": "",\n "type": ""\n },\n "acceleratorType": "",\n "apiVersion": "",\n "cidrBlock": "",\n "createTime": "",\n "dataDisks": [\n {\n "mode": "",\n "sourceDisk": ""\n }\n ],\n "description": "",\n "health": "",\n "healthDescription": "",\n "id": "",\n "labels": {},\n "metadata": {},\n "name": "",\n "networkConfig": {\n "canIpForward": false,\n "enableExternalIps": false,\n "network": "",\n "subnetwork": ""\n },\n "networkEndpoints": [\n {\n "accessConfig": {\n "externalIp": ""\n },\n "ipAddress": "",\n "port": 0\n }\n ],\n "runtimeVersion": "",\n "schedulingConfig": {\n "preemptible": false,\n "reserved": false\n },\n "serviceAccount": {\n "email": "",\n "scope": []\n },\n "shieldedInstanceConfig": {\n "enableSecureBoot": false\n },\n "state": "",\n "symptoms": [\n {\n "createTime": "",\n "details": "",\n "symptomType": "",\n "workerId": ""\n }\n ],\n "tags": []\n}' \
--output-document \
- {{baseUrl}}/v2/:name
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"acceleratorConfig": [
"topology": "",
"type": ""
],
"acceleratorType": "",
"apiVersion": "",
"cidrBlock": "",
"createTime": "",
"dataDisks": [
[
"mode": "",
"sourceDisk": ""
]
],
"description": "",
"health": "",
"healthDescription": "",
"id": "",
"labels": [],
"metadata": [],
"name": "",
"networkConfig": [
"canIpForward": false,
"enableExternalIps": false,
"network": "",
"subnetwork": ""
],
"networkEndpoints": [
[
"accessConfig": ["externalIp": ""],
"ipAddress": "",
"port": 0
]
],
"runtimeVersion": "",
"schedulingConfig": [
"preemptible": false,
"reserved": false
],
"serviceAccount": [
"email": "",
"scope": []
],
"shieldedInstanceConfig": ["enableSecureBoot": false],
"state": "",
"symptoms": [
[
"createTime": "",
"details": "",
"symptomType": "",
"workerId": ""
]
],
"tags": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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
tpu.projects.locations.nodes.start
{{baseUrl}}/v2/:name:start
QUERY PARAMS
name
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name:start");
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, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/:name:start" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v2/:name:start"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
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}}/v2/:name:start"),
Content = new StringContent("{}")
{
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}}/v2/:name:start");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name:start"
payload := strings.NewReader("{}")
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/v2/:name:start HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/:name:start")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name:start"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.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, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/:name:start")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/:name:start")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/:name:start');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:name:start',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name:start';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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}}/v2/:name:start',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name:start")
.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/v2/:name:start',
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({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:name:start',
headers: {'content-type': 'application/json'},
body: {},
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}}/v2/:name:start');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
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}}/v2/:name:start',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name:start';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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 = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/:name:start"]
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}}/v2/:name:start" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name:start",
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([
]),
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}}/v2/:name:start', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name:start');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/v2/:name:start');
$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}}/v2/:name:start' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name:start' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/:name:start", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name:start"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name:start"
payload <- "{}"
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}}/v2/:name:start")
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 = "{}"
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/v2/:name:start') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name:start";
let payload = json!({});
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}}/v2/:name:start \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/v2/:name:start \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/v2/:name:start
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name:start")! 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
tpu.projects.locations.nodes.stop
{{baseUrl}}/v2/:name:stop
QUERY PARAMS
name
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name:stop");
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, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/:name:stop" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v2/:name:stop"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
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}}/v2/:name:stop"),
Content = new StringContent("{}")
{
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}}/v2/:name:stop");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name:stop"
payload := strings.NewReader("{}")
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/v2/:name:stop HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/:name:stop")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name:stop"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.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, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v2/:name:stop")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/:name:stop")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v2/:name:stop');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:name:stop',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name:stop';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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}}/v2/:name:stop',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name:stop")
.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/v2/:name:stop',
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({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v2/:name:stop',
headers: {'content-type': 'application/json'},
body: {},
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}}/v2/:name:stop');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
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}}/v2/:name:stop',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name:stop';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
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 = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v2/:name:stop"]
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}}/v2/:name:stop" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name:stop",
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([
]),
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}}/v2/:name:stop', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name:stop');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/v2/:name:stop');
$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}}/v2/:name:stop' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name:stop' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v2/:name:stop", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name:stop"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name:stop"
payload <- "{}"
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}}/v2/:name:stop")
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 = "{}"
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/v2/:name:stop') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name:stop";
let payload = json!({});
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}}/v2/:name:stop \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/v2/:name:stop \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/v2/:name:stop
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name:stop")! 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
tpu.projects.locations.operations.cancel
{{baseUrl}}/v2/:name:cancel
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name:cancel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v2/:name:cancel")
require "http/client"
url = "{{baseUrl}}/v2/:name:cancel"
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}}/v2/:name:cancel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:name:cancel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name:cancel"
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/v2/:name:cancel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v2/:name:cancel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name:cancel"))
.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}}/v2/:name:cancel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v2/:name:cancel")
.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}}/v2/:name:cancel');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/v2/:name:cancel'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name:cancel';
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}}/v2/:name:cancel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name:cancel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:name:cancel',
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}}/v2/:name:cancel'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v2/:name:cancel');
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}}/v2/:name:cancel'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name:cancel';
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}}/v2/:name:cancel"]
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}}/v2/:name:cancel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name:cancel",
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}}/v2/:name:cancel');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name:cancel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:name:cancel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:name:cancel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name:cancel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/v2/:name:cancel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name:cancel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name:cancel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:name:cancel")
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/v2/:name:cancel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name:cancel";
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}}/v2/:name:cancel
http POST {{baseUrl}}/v2/:name:cancel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/v2/:name:cancel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name:cancel")! 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()
DELETE
tpu.projects.locations.operations.delete
{{baseUrl}}/v2/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v2/:name")
require "http/client"
url = "{{baseUrl}}/v2/:name"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v2/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v2/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v2/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name"))
.method("DELETE", 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}}/v2/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v2/:name")
.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('DELETE', '{{baseUrl}}/v2/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name';
const options = {method: 'DELETE'};
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}}/v2/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:name',
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: 'DELETE', url: '{{baseUrl}}/v2/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v2/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v2/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name';
const options = {method: 'DELETE'};
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}}/v2/:name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
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}}/v2/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v2/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v2/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v2/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v2/:name
http DELETE {{baseUrl}}/v2/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v2/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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
tpu.projects.locations.operations.list
{{baseUrl}}/v2/:name/operations
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name/operations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/:name/operations")
require "http/client"
url = "{{baseUrl}}/v2/:name/operations"
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}}/v2/:name/operations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:name/operations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name/operations"
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/v2/:name/operations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/:name/operations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name/operations"))
.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}}/v2/:name/operations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/:name/operations")
.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}}/v2/:name/operations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/:name/operations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name/operations';
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}}/v2/:name/operations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name/operations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:name/operations',
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}}/v2/:name/operations'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/:name/operations');
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}}/v2/:name/operations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name/operations';
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}}/v2/:name/operations"]
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}}/v2/:name/operations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name/operations",
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}}/v2/:name/operations');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name/operations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:name/operations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:name/operations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name/operations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/:name/operations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name/operations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name/operations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:name/operations")
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/v2/:name/operations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name/operations";
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}}/v2/:name/operations
http GET {{baseUrl}}/v2/:name/operations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/:name/operations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name/operations")! 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
tpu.projects.locations.runtimeVersions.get
{{baseUrl}}/v2/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/:name")
require "http/client"
url = "{{baseUrl}}/v2/:name"
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}}/v2/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:name"
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/v2/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:name"))
.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}}/v2/:name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/:name")
.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}}/v2/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:name';
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}}/v2/:name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:name',
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}}/v2/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/:name');
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}}/v2/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:name';
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}}/v2/:name"]
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}}/v2/:name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:name",
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}}/v2/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:name")
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/v2/:name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:name";
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}}/v2/:name
http GET {{baseUrl}}/v2/:name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:name")! 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
tpu.projects.locations.runtimeVersions.list
{{baseUrl}}/v2/:parent/runtimeVersions
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v2/:parent/runtimeVersions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v2/:parent/runtimeVersions")
require "http/client"
url = "{{baseUrl}}/v2/:parent/runtimeVersions"
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}}/v2/:parent/runtimeVersions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v2/:parent/runtimeVersions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v2/:parent/runtimeVersions"
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/v2/:parent/runtimeVersions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v2/:parent/runtimeVersions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v2/:parent/runtimeVersions"))
.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}}/v2/:parent/runtimeVersions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v2/:parent/runtimeVersions")
.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}}/v2/:parent/runtimeVersions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v2/:parent/runtimeVersions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v2/:parent/runtimeVersions';
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}}/v2/:parent/runtimeVersions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v2/:parent/runtimeVersions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v2/:parent/runtimeVersions',
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}}/v2/:parent/runtimeVersions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v2/:parent/runtimeVersions');
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}}/v2/:parent/runtimeVersions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v2/:parent/runtimeVersions';
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}}/v2/:parent/runtimeVersions"]
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}}/v2/:parent/runtimeVersions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v2/:parent/runtimeVersions",
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}}/v2/:parent/runtimeVersions');
echo $response->getBody();
setUrl('{{baseUrl}}/v2/:parent/runtimeVersions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v2/:parent/runtimeVersions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v2/:parent/runtimeVersions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v2/:parent/runtimeVersions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v2/:parent/runtimeVersions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v2/:parent/runtimeVersions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v2/:parent/runtimeVersions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v2/:parent/runtimeVersions")
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/v2/:parent/runtimeVersions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v2/:parent/runtimeVersions";
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}}/v2/:parent/runtimeVersions
http GET {{baseUrl}}/v2/:parent/runtimeVersions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v2/:parent/runtimeVersions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v2/:parent/runtimeVersions")! 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()