Crea o actualiza PrivateEndpointConnections del espacio de nombres de servicio.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/privateEndpointConnections/{privateEndpointConnectionName}?api-version=2024-01-01
Parámetros de identificador URI
Nombre
En
Requerido
Tipo
Description
namespaceName
path
True
string
El nombre del espacio de nombres
Patrón de Regex: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$
privateEndpointConnectionName
path
True
string
Nombre de PrivateEndpointConnection
resourceGroupName
path
True
string
Nombre del grupo de recursos dentro de la suscripción de Azure.
subscriptionId
path
True
string
Credenciales de suscripción que identifican de forma única una suscripción de Microsoft Azure. El identificador de suscripción forma parte del URI para cada llamada al servicio.
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventhub import EventHubManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventhub
# USAGE
python private_end_point_connection_create.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventHubManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subID",
)
response = client.private_endpoint_connections.create_or_update(
resource_group_name="ArunMonocle",
namespace_name="sdk-Namespace-2924",
private_endpoint_connection_name="privateEndpointConnectionName",
parameters={
"properties": {
"privateEndpoint": {
"id": "/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-8396/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-2847"
},
"privateLinkServiceConnectionState": {"description": "testing", "status": "Rejected"},
"provisioningState": "Succeeded",
}
},
)
print(response)
# x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/PrivateEndPointConnectionCreate.json
if __name__ == "__main__":
main()
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.EventHubs.Models;
using Azure.ResourceManager.EventHubs;
// Generated from example definition: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2024-01-01/examples/NameSpaces/PrivateEndPointConnectionCreate.json
// this example is just showing the usage of "PrivateEndpointConnections_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this EventHubsPrivateEndpointConnectionResource created on azure
// for more information of creating EventHubsPrivateEndpointConnectionResource, please refer to the document of EventHubsPrivateEndpointConnectionResource
string subscriptionId = "subID";
string resourceGroupName = "ArunMonocle";
string namespaceName = "sdk-Namespace-2924";
string privateEndpointConnectionName = "privateEndpointConnectionName";
ResourceIdentifier eventHubsPrivateEndpointConnectionResourceId = EventHubsPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, namespaceName, privateEndpointConnectionName);
EventHubsPrivateEndpointConnectionResource eventHubsPrivateEndpointConnection = client.GetEventHubsPrivateEndpointConnectionResource(eventHubsPrivateEndpointConnectionResourceId);
// invoke the operation
EventHubsPrivateEndpointConnectionData data = new EventHubsPrivateEndpointConnectionData()
{
PrivateEndpointId = new ResourceIdentifier("/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-8396/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-2847"),
ConnectionState = new EventHubsPrivateLinkServiceConnectionState()
{
Status = EventHubsPrivateLinkConnectionStatus.Rejected,
Description = "testing",
},
ProvisioningState = EventHubsPrivateEndpointConnectionProvisioningState.Succeeded,
};
ArmOperation<EventHubsPrivateEndpointConnectionResource> lro = await eventHubsPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data);
EventHubsPrivateEndpointConnectionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
EventHubsPrivateEndpointConnectionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
Identificador de ARM para punto de conexión privado.
PrivateEndpointConnection
Propiedades de PrivateEndpointConnection.
Nombre
Tipo
Description
id
string
Identificador de recurso completo del recurso. Por ejemplo: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}