Atualizações um novo recurso de chave pública SSH.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}?api-version=2024-03-01
Parâmetros de URI
Nome |
Em |
Obrigatório |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos.
|
sshPublicKeyName
|
path |
True
|
string
|
O nome da chave pública SSH.
|
subscriptionId
|
path |
True
|
string
|
Credenciais de assinatura que identificam exclusivamente a assinatura do Microsoft Azure. A ID da assinatura faz parte do URI para cada chamada de serviço.
|
api-version
|
query |
True
|
string
|
Versão da API do cliente.
|
Corpo da solicitação
Nome |
Tipo |
Description |
properties.publicKey
|
string
|
Chave pública SSH usada para autenticar em uma máquina virtual por meio de ssh. Se essa propriedade não for fornecida inicialmente quando o recurso for criado, a propriedade publicKey será preenchida quando generateKeyPair for chamado. Se a chave pública for fornecida após a criação do recurso, a chave pública fornecida precisará ter pelo menos 2048 bits e no formato ssh-rsa.
|
tags
|
object
|
Marcações de recursos
|
Respostas
Segurança
azure_auth
Fluxo do OAuth2 do Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nome |
Description |
user_impersonation
|
representar sua conta de usuário
|
Exemplos
SshPublicKey_Update_MaximumSet_Gen
Sample Request
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/aaaaaaaaaaaa?api-version=2024-03-01
{
"properties": {
"publicKey": "{ssh-rsa public key}"
},
"tags": {
"key2854": "a"
}
}
import com.azure.resourcemanager.compute.models.SshPublicKeyUpdateResource;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SshPublicKeys Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/
* sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json
*/
/**
* Sample code: SshPublicKey_Update_MaximumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void sshPublicKeyUpdateMaximumSetGen(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSshPublicKeys().updateWithResponse(
"rgcompute", "aaaaaaaaaaaa", new SshPublicKeyUpdateResource()
.withTags(mapOf("key2854", "fakeTokenPlaceholder")).withPublicKey("fakeTokenPlaceholder"),
com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json
func ExampleSSHPublicKeysClient_Update_sshPublicKeyUpdateMaximumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewSSHPublicKeysClient().Update(ctx, "rgcompute", "aaaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{
Tags: map[string]*string{
"key2854": to.Ptr("a"),
},
Properties: &armcompute.SSHPublicKeyResourceProperties{
PublicKey: to.Ptr("{ssh-rsa public key}"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{
// Name: to.Ptr("mySshPublicKeyName"),
// Type: to.Ptr("aaaa"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "key6396": to.Ptr("aaaaaaaaaaaaa"),
// "key8839": to.Ptr("aaa"),
// },
// Properties: &armcompute.SSHPublicKeyResourceProperties{
// PublicKey: to.Ptr("{ssh-rsa public key}"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"location": "westus",
"properties": {
"publicKey": "{ssh-rsa public key}"
},
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName",
"name": "mySshPublicKeyName",
"type": "aaaa",
"tags": {
"key6396": "aaaaaaaaaaaaa",
"key8839": "aaa"
}
}
SshPublicKey_Update_MinimumSet_Gen
Sample Request
PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/aaaaaaaaaaa?api-version=2024-03-01
{}
import com.azure.resourcemanager.compute.models.SshPublicKeyUpdateResource;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SshPublicKeys Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/
* sshPublicKeyExamples/SshPublicKey_Update_MinimumSet_Gen.json
*/
/**
* Sample code: SshPublicKey_Update_MinimumSet_Gen.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void sshPublicKeyUpdateMinimumSetGen(com.azure.resourcemanager.AzureResourceManager azure) {
azure.virtualMachines().manager().serviceClient().getSshPublicKeys().updateWithResponse("rgcompute",
"aaaaaaaaaaa", new SshPublicKeyUpdateResource(), com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MinimumSet_Gen.json
func ExampleSSHPublicKeysClient_Update_sshPublicKeyUpdateMinimumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewSSHPublicKeysClient().Update(ctx, "rgcompute", "aaaaaaaaaaa", armcompute.SSHPublicKeyUpdateResource{}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SSHPublicKeyResource = armcompute.SSHPublicKeyResource{
// Location: to.Ptr("westus"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"location": "westus"
}
Definições
ApiError
Erro de API.
Nome |
Tipo |
Description |
code
|
string
|
O código de erro.
|
details
|
ApiErrorBase[]
|
Os detalhes do erro da API
|
innererror
|
InnerError
|
O erro interno da API
|
message
|
string
|
A mensagem de erro.
|
target
|
string
|
O destino do erro específico.
|
ApiErrorBase
Base de erros de API.
Nome |
Tipo |
Description |
code
|
string
|
O código de erro.
|
message
|
string
|
A mensagem de erro.
|
target
|
string
|
O destino do erro específico.
|
CloudError
Uma resposta de erro do serviço de computação.
Nome |
Tipo |
Description |
error
|
ApiError
|
Erro de API.
|
InnerError
Detalhes do erro interno.
Nome |
Tipo |
Description |
errordetail
|
string
|
A mensagem de erro interna ou despejo de exceção.
|
exceptiontype
|
string
|
O tipo de exceção.
|
SshPublicKeyResource
Especifica informações sobre a chave pública SSH.
Nome |
Tipo |
Description |
id
|
string
|
ID do recurso
|
location
|
string
|
Localização do recurso
|
name
|
string
|
Nome do recurso
|
properties.publicKey
|
string
|
Chave pública SSH usada para autenticar em uma máquina virtual por meio de ssh. Se essa propriedade não for fornecida inicialmente quando o recurso for criado, a propriedade publicKey será preenchida quando generateKeyPair for chamado. Se a chave pública for fornecida após a criação do recurso, a chave pública fornecida precisará ter pelo menos 2048 bits e no formato ssh-rsa.
|
tags
|
object
|
Marcações de recursos
|
type
|
string
|
Tipo de recurso
|
SshPublicKeyUpdateResource
Especifica informações sobre a chave pública SSH.
Nome |
Tipo |
Description |
properties.publicKey
|
string
|
Chave pública SSH usada para autenticar em uma máquina virtual por meio de ssh. Se essa propriedade não for fornecida inicialmente quando o recurso for criado, a propriedade publicKey será preenchida quando generateKeyPair for chamado. Se a chave pública for fornecida após a criação do recurso, a chave pública fornecida precisará ter pelo menos 2048 bits e no formato ssh-rsa.
|
tags
|
object
|
Marcações de recursos
|