Esse conteúdo foi útil?
Como poderíamos tornar este artigo mais útil?
You can enable a specific service account and use the secret credentials associated with the account.
The PUT operation enables the existing service account.
PUT /service-accounts/{serviceAccountId}/enabled
Name |
In |
Type |
Required |
Description |
---|---|---|---|---|
serviceAccountId |
path |
string |
true |
Numeric ID of the service account. |
package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{ "text/plain", }, "Authorization": []string{ "Bearer {access-token}", }, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("PUT", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... }
import java.net.HttpURLConnection; import java.net.URL; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("PUT"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } }
const headers = { 'Accept': 'text/plain', 'Authorization': 'Bearer {access-token}' }; fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled', { method: 'PUT', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); });
import requests headers = { 'Accept': 'text/plain', 'Authorization': 'Bearer {access-token}' } r = requests.put('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled', headers=headers) print(r.text)
require 'rest-client' require 'json' headers = { 'Accept' => 'text/plain', 'Authorization' => 'Bearer {access-token}' } result = RestClient.put 'https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled', params: {}, headers: headers puts result
Status Code | Description | Return JSON Payload | ||||||
---|---|---|---|---|---|---|---|---|
200 | Service Account enabled successfully. | - | ||||||
400 | It is an invalid request or invalid service account information. | { "code": "string", "message": "string" }
|
||||||
403 | Forbidden The account has no services enabled. |
{ "code": "string", "message": "string" }
|
||||||
404 | The service account to enable was not found or expired. | { "code": "string", "message": "string" }
|
||||||
409 | The service account is not ready to be enabled and is still being processed by some regions. | { "code": "string", "message": "string" }
|
||||||
500 | The server encountered an internal error. | { "code": "string", "message": "string" }
|
||||||
503 | Service Unavailable | { "code": "string", "message": "string" }
|