Create a BrokerListenerResource
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName}?api-version=2024-11-01
URI Parameters
Name |
In |
Required |
Type |
Description |
brokerName
|
path |
True
|
string
|
Name of broker.
Regex pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$
|
instanceName
|
path |
True
|
string
|
Name of instance.
Regex pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$
|
listenerName
|
path |
True
|
string
|
Name of Instance broker listener resource
Regex pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
uuid
|
The ID of the target subscription. The value must be an UUID.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Request Body
Responses
Name |
Type |
Description |
200 OK
|
BrokerListenerResource
|
Resource 'BrokerListenerResource' update operation succeeded
|
201 Created
|
BrokerListenerResource
|
Resource 'BrokerListenerResource' create operation succeeded
Headers
- Azure-AsyncOperation: string
- Retry-After: integer
|
Other Status Codes
|
ErrorResponse
|
An unexpected error response.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
BrokerListener_CreateOrUpdate
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123?api-version=2024-11-01
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"ports": [
{
"authenticationRef": "tjvdroaqqy",
"authorizationRef": "inxhvxnwswyrvt",
"nodePort": 7281,
"port": 1268,
"protocol": "Mqtt",
"tls": {
"mode": "Automatic",
"certManagerCertificateSpec": {
"duration": "qmpeffoksron",
"secretName": "oagi",
"renewBefore": "hutno",
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"kind": "Issuer",
"name": "ocwoqpgucvjrsuudtjhb"
},
"privateKey": {
"algorithm": "Ec256",
"rotationPolicy": "Always"
},
"san": {
"dns": [
"xhvmhrrhgfsapocjeebqtnzarlj"
],
"ip": [
"zbgugfzcgsmegevzktsnibyuyp"
]
}
},
"manual": {
"secretRef": "secret-name"
}
}
}
],
"serviceType": "ClusterIp"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.BrokerListenerProperties;
import com.azure.resourcemanager.iotoperations.models.BrokerProtocolType;
import com.azure.resourcemanager.iotoperations.models.CertManagerCertificateSpec;
import com.azure.resourcemanager.iotoperations.models.CertManagerIssuerKind;
import com.azure.resourcemanager.iotoperations.models.CertManagerIssuerRef;
import com.azure.resourcemanager.iotoperations.models.CertManagerPrivateKey;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.ListenerPort;
import com.azure.resourcemanager.iotoperations.models.PrivateKeyAlgorithm;
import com.azure.resourcemanager.iotoperations.models.PrivateKeyRotationPolicy;
import com.azure.resourcemanager.iotoperations.models.SanForCert;
import com.azure.resourcemanager.iotoperations.models.ServiceType;
import com.azure.resourcemanager.iotoperations.models.TlsCertMethod;
import com.azure.resourcemanager.iotoperations.models.TlsCertMethodMode;
import com.azure.resourcemanager.iotoperations.models.X509ManualCertificate;
import java.util.Arrays;
/**
* Samples for BrokerListener CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json
*/
/**
* Sample code: BrokerListener_CreateOrUpdate.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
brokerListenerCreateOrUpdate(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.brokerListeners().define("resource-name123")
.withExistingBroker("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(
new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv").withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(new BrokerListenerProperties().withServiceName("tpfiszlapdpxktx")
.withPorts(Arrays.asList(new ListenerPort().withAuthenticationRef("tjvdroaqqy")
.withAuthorizationRef("fakeTokenPlaceholder").withNodePort(7281).withPort(1268)
.withProtocol(BrokerProtocolType.MQTT)
.withTls(new TlsCertMethod().withMode(TlsCertMethodMode.AUTOMATIC)
.withCertManagerCertificateSpec(new CertManagerCertificateSpec().withDuration("qmpeffoksron")
.withSecretName("fakeTokenPlaceholder").withRenewBefore("hutno")
.withIssuerRef(new CertManagerIssuerRef().withGroup("jtmuladdkpasfpoyvewekmiy")
.withKind(CertManagerIssuerKind.ISSUER).withName("ocwoqpgucvjrsuudtjhb"))
.withPrivateKey(new CertManagerPrivateKey().withAlgorithm(PrivateKeyAlgorithm.EC256)
.withRotationPolicy(PrivateKeyRotationPolicy.ALWAYS))
.withSan(new SanForCert().withDns(Arrays.asList("xhvmhrrhgfsapocjeebqtnzarlj"))
.withIp(Arrays.asList("zbgugfzcgsmegevzktsnibyuyp"))))
.withManual(new X509ManualCertificate().withSecretRef("fakeTokenPlaceholder")))))
.withServiceType(ServiceType.CLUSTER_IP))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.iotoperations import IoTOperationsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-iotoperations
# USAGE
python broker_listener_create_or_update_maximum_set_gen.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 = IoTOperationsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.broker_listener.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
broker_name="resource-name123",
listener_name="resource-name123",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"ports": [
{
"authenticationRef": "tjvdroaqqy",
"authorizationRef": "inxhvxnwswyrvt",
"nodePort": 7281,
"port": 1268,
"protocol": "Mqtt",
"tls": {
"certManagerCertificateSpec": {
"duration": "qmpeffoksron",
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"kind": "Issuer",
"name": "ocwoqpgucvjrsuudtjhb",
},
"privateKey": {"algorithm": "Ec256", "rotationPolicy": "Always"},
"renewBefore": "hutno",
"san": {"dns": ["xhvmhrrhgfsapocjeebqtnzarlj"], "ip": ["zbgugfzcgsmegevzktsnibyuyp"]},
"secretName": "oagi",
},
"manual": {"secretRef": "secret-name"},
"mode": "Automatic",
},
}
],
"serviceName": "tpfiszlapdpxktx",
"serviceType": "ClusterIp",
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armiotoperations_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/iotoperations/armiotoperations"
)
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json
func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewBrokerListenerClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerListenerResource{
Properties: &armiotoperations.BrokerListenerProperties{
ServiceName: to.Ptr("tpfiszlapdpxktx"),
Ports: []*armiotoperations.ListenerPort{
{
AuthenticationRef: to.Ptr("tjvdroaqqy"),
AuthorizationRef: to.Ptr("inxhvxnwswyrvt"),
NodePort: to.Ptr[int32](7281),
Port: to.Ptr[int32](1268),
Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeMqtt),
TLS: &armiotoperations.TLSCertMethod{
Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
Duration: to.Ptr("qmpeffoksron"),
SecretName: to.Ptr("oagi"),
RenewBefore: to.Ptr("hutno"),
IssuerRef: &armiotoperations.CertManagerIssuerRef{
Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
Name: to.Ptr("ocwoqpgucvjrsuudtjhb"),
},
PrivateKey: &armiotoperations.CertManagerPrivateKey{
Algorithm: to.Ptr(armiotoperations.PrivateKeyAlgorithmEc256),
RotationPolicy: to.Ptr(armiotoperations.PrivateKeyRotationPolicyAlways),
},
San: &armiotoperations.SanForCert{
DNS: []*string{
to.Ptr("xhvmhrrhgfsapocjeebqtnzarlj"),
},
IP: []*string{
to.Ptr("zbgugfzcgsmegevzktsnibyuyp"),
},
},
},
Manual: &armiotoperations.X509ManualCertificate{
SecretRef: to.Ptr("secret-name"),
},
},
},
},
ServiceType: to.Ptr(armiotoperations.ServiceTypeClusterIP),
},
ExtendedLocation: &armiotoperations.ExtendedLocation{
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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 = armiotoperations.BrokerListenerClientCreateOrUpdateResponse{
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
// Properties: &armiotoperations.BrokerListenerProperties{
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
// Ports: []*armiotoperations.ListenerPort{
// {
// AuthenticationRef: to.Ptr("tjvdroaqqy"),
// AuthorizationRef: to.Ptr("inxhvxnwswyrvt"),
// NodePort: to.Ptr[int32](7281),
// Port: to.Ptr[int32](1268),
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeMqtt),
// TLS: &armiotoperations.TLSCertMethod{
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
// CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
// Duration: to.Ptr("qmpeffoksron"),
// SecretName: to.Ptr("oagi"),
// RenewBefore: to.Ptr("hutno"),
// IssuerRef: &armiotoperations.CertManagerIssuerRef{
// Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
// Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
// Name: to.Ptr("ocwoqpgucvjrsuudtjhb"),
// },
// PrivateKey: &armiotoperations.CertManagerPrivateKey{
// Algorithm: to.Ptr(armiotoperations.PrivateKeyAlgorithmEc256),
// RotationPolicy: to.Ptr(armiotoperations.PrivateKeyRotationPolicyAlways),
// },
// San: &armiotoperations.SanForCert{
// DNS: []*string{
// to.Ptr("xhvmhrrhgfsapocjeebqtnzarlj"),
// },
// IP: []*string{
// to.Ptr("zbgugfzcgsmegevzktsnibyuyp"),
// },
// },
// },
// Manual: &armiotoperations.X509ManualCertificate{
// SecretRef: to.Ptr("secret-name"),
// },
// },
// },
// },
// ServiceType: to.Ptr(armiotoperations.ServiceTypeClusterIP),
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
// },
// ExtendedLocation: &armiotoperations.ExtendedLocation{
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
// },
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
// Name: to.Ptr("hoqjaachratt"),
// Type: to.Ptr("hizbknwegcdaeh"),
// SystemData: &armiotoperations.SystemData{
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
// LastModifiedBy: to.Ptr("gnicpuszwd"),
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.IotOperations.Models;
using Azure.ResourceManager.IotOperations;
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json
// this example is just showing the usage of "BrokerListenerResource_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 IotOperationsBrokerListenerResource created on azure
// for more information of creating IotOperationsBrokerListenerResource, please refer to the document of IotOperationsBrokerListenerResource
string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53";
string resourceGroupName = "rgiotoperations";
string instanceName = "resource-name123";
string brokerName = "resource-name123";
string listenerName = "resource-name123";
ResourceIdentifier iotOperationsBrokerListenerResourceId = IotOperationsBrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName);
IotOperationsBrokerListenerResource iotOperationsBrokerListener = client.GetIotOperationsBrokerListenerResource(iotOperationsBrokerListenerResourceId);
// invoke the operation
IotOperationsBrokerListenerData data = new IotOperationsBrokerListenerData(new IotOperationsExtendedLocation("qmbrfwcpwwhggszhrdjv", IotOperationsExtendedLocationType.CustomLocation))
{
Properties = new IotOperationsBrokerListenerProperties(new BrokerListenerPort[]
{
new BrokerListenerPort(1268)
{
AuthenticationRef = "tjvdroaqqy",
AuthorizationRef = "inxhvxnwswyrvt",
NodePort = 7281,
Protocol = BrokerProtocolType.Mqtt,
Tls = new ListenerPortTlsCertMethod(TlsCertMethodMode.Automatic)
{
CertManagerCertificateSpec = new CertManagerCertificateSpec(new CertManagerIssuerRef("jtmuladdkpasfpoyvewekmiy", CertManagerIssuerKind.Issuer, "ocwoqpgucvjrsuudtjhb"))
{
Duration = "qmpeffoksron",
SecretName = "oagi",
RenewBefore = "hutno",
PrivateKey = new CertManagerPrivateKey(PrivateKeyAlgorithm.Ec256, PrivateKeyRotationPolicy.Always),
San = new SanForCert(new string[]{"xhvmhrrhgfsapocjeebqtnzarlj"}, new string[]{"zbgugfzcgsmegevzktsnibyuyp"}),
},
ManualSecretRef = "secret-name",
},
}
})
{
ServiceName = "tpfiszlapdpxktx",
ServiceType = BlockerListenerServiceType.ClusterIP,
},
};
ArmOperation<IotOperationsBrokerListenerResource> lro = await iotOperationsBrokerListener.UpdateAsync(WaitUntil.Completed, data);
IotOperationsBrokerListenerResource 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
IotOperationsBrokerListenerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"ports": [
{
"authenticationRef": "tjvdroaqqy",
"authorizationRef": "inxhvxnwswyrvt",
"nodePort": 7281,
"port": 1268,
"protocol": "Mqtt",
"tls": {
"mode": "Automatic",
"certManagerCertificateSpec": {
"duration": "qmpeffoksron",
"secretName": "oagi",
"renewBefore": "hutno",
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"kind": "Issuer",
"name": "ocwoqpgucvjrsuudtjhb"
},
"privateKey": {
"algorithm": "Ec256",
"rotationPolicy": "Always"
},
"san": {
"dns": [
"xhvmhrrhgfsapocjeebqtnzarlj"
],
"ip": [
"zbgugfzcgsmegevzktsnibyuyp"
]
}
},
"manual": {
"secretRef": "secret-name"
}
}
}
],
"serviceType": "ClusterIp",
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123",
"name": "hoqjaachratt",
"type": "hizbknwegcdaeh",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Azure-AsyncOperation: https://contoso.com/operationstatus
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"ports": [
{
"authenticationRef": "tjvdroaqqy",
"authorizationRef": "inxhvxnwswyrvt",
"nodePort": 7281,
"port": 1268,
"protocol": "Mqtt",
"tls": {
"mode": "Automatic",
"certManagerCertificateSpec": {
"duration": "qmpeffoksron",
"secretName": "oagi",
"renewBefore": "hutno",
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"kind": "Issuer",
"name": "ocwoqpgucvjrsuudtjhb"
},
"privateKey": {
"algorithm": "Ec256",
"rotationPolicy": "Always"
},
"san": {
"dns": [
"xhvmhrrhgfsapocjeebqtnzarlj"
],
"ip": [
"zbgugfzcgsmegevzktsnibyuyp"
]
}
},
"manual": {
"secretRef": "secret-name"
}
}
}
],
"serviceType": "ClusterIp",
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123",
"name": "hoqjaachratt",
"type": "hizbknwegcdaeh",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
BrokerListener_CreateOrUpdate_Complex
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123?api-version=2024-11-01
{
"properties": {
"serviceType": "LoadBalancer",
"ports": [
{
"port": 8080,
"authenticationRef": "example-authentication",
"protocol": "WebSockets"
},
{
"port": 8443,
"authenticationRef": "example-authentication",
"protocol": "WebSockets",
"tls": {
"mode": "Automatic",
"certManagerCertificateSpec": {
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"name": "example-issuer",
"kind": "Issuer"
}
}
}
},
{
"port": 1883,
"authenticationRef": "example-authentication"
},
{
"port": 8883,
"authenticationRef": "example-authentication",
"tls": {
"mode": "Manual",
"manual": {
"secretRef": "example-secret"
}
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.BrokerListenerProperties;
import com.azure.resourcemanager.iotoperations.models.BrokerProtocolType;
import com.azure.resourcemanager.iotoperations.models.CertManagerCertificateSpec;
import com.azure.resourcemanager.iotoperations.models.CertManagerIssuerKind;
import com.azure.resourcemanager.iotoperations.models.CertManagerIssuerRef;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.ListenerPort;
import com.azure.resourcemanager.iotoperations.models.ServiceType;
import com.azure.resourcemanager.iotoperations.models.TlsCertMethod;
import com.azure.resourcemanager.iotoperations.models.TlsCertMethodMode;
import com.azure.resourcemanager.iotoperations.models.X509ManualCertificate;
import java.util.Arrays;
/**
* Samples for BrokerListener CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json
*/
/**
* Sample code: BrokerListener_CreateOrUpdate_Complex.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
brokerListenerCreateOrUpdateComplex(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.brokerListeners().define("resource-name123")
.withExistingBroker("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(
new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv").withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(new BrokerListenerProperties()
.withPorts(Arrays.asList(
new ListenerPort().withAuthenticationRef("example-authentication").withPort(8080)
.withProtocol(BrokerProtocolType.WEB_SOCKETS),
new ListenerPort().withAuthenticationRef("example-authentication").withPort(8443)
.withProtocol(BrokerProtocolType.WEB_SOCKETS)
.withTls(new TlsCertMethod().withMode(TlsCertMethodMode.AUTOMATIC)
.withCertManagerCertificateSpec(new CertManagerCertificateSpec()
.withIssuerRef(new CertManagerIssuerRef().withGroup("jtmuladdkpasfpoyvewekmiy")
.withKind(CertManagerIssuerKind.ISSUER).withName("example-issuer")))),
new ListenerPort().withAuthenticationRef("example-authentication").withPort(1883),
new ListenerPort().withAuthenticationRef("example-authentication").withPort(8883)
.withTls(new TlsCertMethod().withMode(TlsCertMethodMode.MANUAL)
.withManual(new X509ManualCertificate().withSecretRef("fakeTokenPlaceholder")))))
.withServiceType(ServiceType.LOAD_BALANCER))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.iotoperations import IoTOperationsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-iotoperations
# USAGE
python broker_listener_create_or_update_complex.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 = IoTOperationsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.broker_listener.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
broker_name="resource-name123",
listener_name="resource-name123",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"ports": [
{"authenticationRef": "example-authentication", "port": 8080, "protocol": "WebSockets"},
{
"authenticationRef": "example-authentication",
"port": 8443,
"protocol": "WebSockets",
"tls": {
"certManagerCertificateSpec": {
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"kind": "Issuer",
"name": "example-issuer",
}
},
"mode": "Automatic",
},
},
{"authenticationRef": "example-authentication", "port": 1883},
{
"authenticationRef": "example-authentication",
"port": 8883,
"tls": {"manual": {"secretRef": "example-secret"}, "mode": "Manual"},
},
],
"serviceType": "LoadBalancer",
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armiotoperations_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/iotoperations/armiotoperations"
)
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json
func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdateComplex() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewBrokerListenerClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerListenerResource{
Properties: &armiotoperations.BrokerListenerProperties{
ServiceType: to.Ptr(armiotoperations.ServiceTypeLoadBalancer),
Ports: []*armiotoperations.ListenerPort{
{
Port: to.Ptr[int32](8080),
AuthenticationRef: to.Ptr("example-authentication"),
Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
},
{
Port: to.Ptr[int32](8443),
AuthenticationRef: to.Ptr("example-authentication"),
Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
TLS: &armiotoperations.TLSCertMethod{
Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
IssuerRef: &armiotoperations.CertManagerIssuerRef{
Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
Name: to.Ptr("example-issuer"),
Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
},
},
},
},
{
Port: to.Ptr[int32](1883),
AuthenticationRef: to.Ptr("example-authentication"),
},
{
Port: to.Ptr[int32](8883),
AuthenticationRef: to.Ptr("example-authentication"),
TLS: &armiotoperations.TLSCertMethod{
Mode: to.Ptr(armiotoperations.TLSCertMethodModeManual),
Manual: &armiotoperations.X509ManualCertificate{
SecretRef: to.Ptr("example-secret"),
},
},
},
},
},
ExtendedLocation: &armiotoperations.ExtendedLocation{
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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 = armiotoperations.BrokerListenerClientCreateOrUpdateResponse{
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
// Properties: &armiotoperations.BrokerListenerProperties{
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
// ServiceType: to.Ptr(armiotoperations.ServiceTypeLoadBalancer),
// Ports: []*armiotoperations.ListenerPort{
// {
// Port: to.Ptr[int32](8080),
// AuthenticationRef: to.Ptr("example-authentication"),
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
// },
// {
// Port: to.Ptr[int32](8443),
// AuthenticationRef: to.Ptr("example-authentication"),
// Protocol: to.Ptr(armiotoperations.BrokerProtocolTypeWebSockets),
// TLS: &armiotoperations.TLSCertMethod{
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeAutomatic),
// CertManagerCertificateSpec: &armiotoperations.CertManagerCertificateSpec{
// IssuerRef: &armiotoperations.CertManagerIssuerRef{
// Group: to.Ptr("jtmuladdkpasfpoyvewekmiy"),
// Name: to.Ptr("example-issuer"),
// Kind: to.Ptr(armiotoperations.CertManagerIssuerKindIssuer),
// },
// },
// },
// },
// {
// Port: to.Ptr[int32](1883),
// AuthenticationRef: to.Ptr("example-authentication"),
// },
// {
// Port: to.Ptr[int32](8883),
// AuthenticationRef: to.Ptr("example-authentication"),
// TLS: &armiotoperations.TLSCertMethod{
// Mode: to.Ptr(armiotoperations.TLSCertMethodModeManual),
// Manual: &armiotoperations.X509ManualCertificate{
// SecretRef: to.Ptr("example-secret"),
// },
// },
// },
// },
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
// },
// ExtendedLocation: &armiotoperations.ExtendedLocation{
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
// },
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
// Name: to.Ptr("hoqjaachratt"),
// Type: to.Ptr("hizbknwegcdaeh"),
// SystemData: &armiotoperations.SystemData{
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
// LastModifiedBy: to.Ptr("gnicpuszwd"),
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.IotOperations.Models;
using Azure.ResourceManager.IotOperations;
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json
// this example is just showing the usage of "BrokerListenerResource_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 IotOperationsBrokerListenerResource created on azure
// for more information of creating IotOperationsBrokerListenerResource, please refer to the document of IotOperationsBrokerListenerResource
string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53";
string resourceGroupName = "rgiotoperations";
string instanceName = "resource-name123";
string brokerName = "resource-name123";
string listenerName = "resource-name123";
ResourceIdentifier iotOperationsBrokerListenerResourceId = IotOperationsBrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName);
IotOperationsBrokerListenerResource iotOperationsBrokerListener = client.GetIotOperationsBrokerListenerResource(iotOperationsBrokerListenerResourceId);
// invoke the operation
IotOperationsBrokerListenerData data = new IotOperationsBrokerListenerData(new IotOperationsExtendedLocation("qmbrfwcpwwhggszhrdjv", IotOperationsExtendedLocationType.CustomLocation))
{
Properties = new IotOperationsBrokerListenerProperties(new BrokerListenerPort[]
{
new BrokerListenerPort(8080)
{
AuthenticationRef = "example-authentication",
Protocol = BrokerProtocolType.WebSockets,
},
new BrokerListenerPort(8443)
{
AuthenticationRef = "example-authentication",
Protocol = BrokerProtocolType.WebSockets,
Tls = new ListenerPortTlsCertMethod(TlsCertMethodMode.Automatic)
{
CertManagerCertificateSpec = new CertManagerCertificateSpec(new CertManagerIssuerRef("jtmuladdkpasfpoyvewekmiy", CertManagerIssuerKind.Issuer, "example-issuer")),
},
},
new BrokerListenerPort(1883)
{
AuthenticationRef = "example-authentication",
},
new BrokerListenerPort(8883)
{
AuthenticationRef = "example-authentication",
Tls = new ListenerPortTlsCertMethod(TlsCertMethodMode.Manual)
{
ManualSecretRef = "example-secret",
},
}
})
{
ServiceType = BlockerListenerServiceType.LoadBalancer,
},
};
ArmOperation<IotOperationsBrokerListenerResource> lro = await iotOperationsBrokerListener.UpdateAsync(WaitUntil.Completed, data);
IotOperationsBrokerListenerResource 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
IotOperationsBrokerListenerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"serviceType": "LoadBalancer",
"ports": [
{
"port": 8080,
"authenticationRef": "example-authentication",
"protocol": "WebSockets"
},
{
"port": 8443,
"authenticationRef": "example-authentication",
"protocol": "WebSockets",
"tls": {
"mode": "Automatic",
"certManagerCertificateSpec": {
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"name": "example-issuer",
"kind": "Issuer"
}
}
}
},
{
"port": 1883,
"authenticationRef": "example-authentication"
},
{
"port": 8883,
"authenticationRef": "example-authentication",
"tls": {
"mode": "Manual",
"manual": {
"secretRef": "example-secret"
}
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123",
"name": "hoqjaachratt",
"type": "hizbknwegcdaeh",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Azure-AsyncOperation: https://contoso.com/operationstatus
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"serviceType": "LoadBalancer",
"ports": [
{
"port": 8080,
"authenticationRef": "example-authentication",
"protocol": "WebSockets"
},
{
"port": 8443,
"authenticationRef": "example-authentication",
"protocol": "WebSockets",
"tls": {
"mode": "Automatic",
"certManagerCertificateSpec": {
"issuerRef": {
"group": "jtmuladdkpasfpoyvewekmiy",
"name": "example-issuer",
"kind": "Issuer"
}
}
}
},
{
"port": 1883,
"authenticationRef": "example-authentication"
},
{
"port": 8883,
"authenticationRef": "example-authentication",
"tls": {
"mode": "Manual",
"manual": {
"secretRef": "example-secret"
}
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123",
"name": "hoqjaachratt",
"type": "hizbknwegcdaeh",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
BrokerListener_CreateOrUpdate_Simple
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123?api-version=2024-11-01
{
"properties": {
"ports": [
{
"port": 1883
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.BrokerListenerProperties;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.ListenerPort;
import java.util.Arrays;
/**
* Samples for BrokerListener CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json
*/
/**
* Sample code: BrokerListener_CreateOrUpdate_Simple.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
brokerListenerCreateOrUpdateSimple(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.brokerListeners().define("resource-name123")
.withExistingBroker("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(
new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv").withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(new BrokerListenerProperties().withPorts(Arrays.asList(new ListenerPort().withPort(1883))))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.iotoperations import IoTOperationsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-iotoperations
# USAGE
python broker_listener_create_or_update_simple.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 = IoTOperationsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.broker_listener.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
broker_name="resource-name123",
listener_name="resource-name123",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {"ports": [{"port": 1883}]},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armiotoperations_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/iotoperations/armiotoperations"
)
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json
func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdateSimple() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotoperations.NewClientFactory("F8C729F9-DF9C-4743-848F-96EE433D8E53", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewBrokerListenerClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.BrokerListenerResource{
Properties: &armiotoperations.BrokerListenerProperties{
Ports: []*armiotoperations.ListenerPort{
{
Port: to.Ptr[int32](1883),
},
},
},
ExtendedLocation: &armiotoperations.ExtendedLocation{
Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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 = armiotoperations.BrokerListenerClientCreateOrUpdateResponse{
// BrokerListenerResource: &armiotoperations.BrokerListenerResource{
// Properties: &armiotoperations.BrokerListenerProperties{
// ServiceName: to.Ptr("tpfiszlapdpxktx"),
// ServiceType: to.Ptr(armiotoperations.ServiceTypeLoadBalancer),
// Ports: []*armiotoperations.ListenerPort{
// {
// Port: to.Ptr[int32](1883),
// },
// },
// ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded),
// },
// ExtendedLocation: &armiotoperations.ExtendedLocation{
// Name: to.Ptr("qmbrfwcpwwhggszhrdjv"),
// Type: to.Ptr(armiotoperations.ExtendedLocationTypeCustomLocation),
// },
// ID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123"),
// Name: to.Ptr("hoqjaachratt"),
// Type: to.Ptr("hizbknwegcdaeh"),
// SystemData: &armiotoperations.SystemData{
// CreatedBy: to.Ptr("ssvaslsmudloholronopqyxjcu"),
// CreatedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
// LastModifiedBy: to.Ptr("gnicpuszwd"),
// LastModifiedByType: to.Ptr(armiotoperations.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-08-09T18:13:29.389Z"); return t}()),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.IotOperations.Models;
using Azure.ResourceManager.IotOperations;
// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json
// this example is just showing the usage of "BrokerListenerResource_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 IotOperationsBrokerListenerResource created on azure
// for more information of creating IotOperationsBrokerListenerResource, please refer to the document of IotOperationsBrokerListenerResource
string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53";
string resourceGroupName = "rgiotoperations";
string instanceName = "resource-name123";
string brokerName = "resource-name123";
string listenerName = "resource-name123";
ResourceIdentifier iotOperationsBrokerListenerResourceId = IotOperationsBrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName);
IotOperationsBrokerListenerResource iotOperationsBrokerListener = client.GetIotOperationsBrokerListenerResource(iotOperationsBrokerListenerResourceId);
// invoke the operation
IotOperationsBrokerListenerData data = new IotOperationsBrokerListenerData(new IotOperationsExtendedLocation("qmbrfwcpwwhggszhrdjv", IotOperationsExtendedLocationType.CustomLocation))
{
Properties = new IotOperationsBrokerListenerProperties(new BrokerListenerPort[]
{
new BrokerListenerPort(1883)
}),
};
ArmOperation<IotOperationsBrokerListenerResource> lro = await iotOperationsBrokerListener.UpdateAsync(WaitUntil.Completed, data);
IotOperationsBrokerListenerResource 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
IotOperationsBrokerListenerData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"serviceType": "LoadBalancer",
"ports": [
{
"port": 1883
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123",
"name": "hoqjaachratt",
"type": "hizbknwegcdaeh",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Azure-AsyncOperation: https://contoso.com/operationstatus
{
"properties": {
"serviceName": "tpfiszlapdpxktx",
"serviceType": "LoadBalancer",
"ports": [
{
"port": 1883
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/brokers/resource-name123/listeners/resource-name123",
"name": "hoqjaachratt",
"type": "hizbknwegcdaeh",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Definitions
BrokerListenerProperties
Defines a Broker listener. A listener is a collection of ports on which the broker accepts connections from clients.
Name |
Type |
Default value |
Description |
ports
|
ListenerPort[]
|
|
Ports on which this listener accepts client connections.
|
provisioningState
|
ProvisioningState
|
|
The status of the last operation.
|
serviceName
|
string
|
|
Kubernetes Service name of this listener.
|
serviceType
|
ServiceType
|
ClusterIp
|
Kubernetes Service type of this listener.
|
BrokerListenerResource
Instance broker resource
Name |
Type |
Description |
extendedLocation
|
ExtendedLocation
|
Edge location of the resource.
|
id
|
string
|
Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
name
|
string
|
The name of the resource
|
properties
|
BrokerListenerProperties
|
The resource-specific properties for this resource.
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
BrokerProtocolType
Broker Protocol types
Name |
Type |
Description |
Mqtt
|
string
|
protocol broker
|
WebSockets
|
string
|
protocol websocket
|
CertManagerCertificateSpec
Automatic TLS server certificate management with cert-manager
Name |
Type |
Description |
duration
|
string
|
Lifetime of certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes.
|
issuerRef
|
CertManagerIssuerRef
|
cert-manager issuerRef.
|
privateKey
|
CertManagerPrivateKey
|
Type of certificate private key.
|
renewBefore
|
string
|
When to begin renewing certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes.
|
san
|
SanForCert
|
Additional Subject Alternative Names (SANs) to include in the certificate.
|
secretName
|
string
|
Secret for storing server certificate. Any existing data will be overwritten. This is a reference to the secret through an identifying name, not the secret itself.
|
CertManagerIssuerKind
CertManagerIssuerKind properties
Name |
Type |
Description |
ClusterIssuer
|
string
|
ClusterIssuer kind.
|
Issuer
|
string
|
Issuer kind.
|
CertManagerIssuerRef
Cert-Manager issuerRef properties
Name |
Type |
Default value |
Description |
group
|
string
|
cert-manager.io
|
group of issuer.
|
kind
|
CertManagerIssuerKind
|
|
kind of issuer (Issuer or ClusterIssuer).
|
name
|
string
|
|
name of issuer.
|
CertManagerPrivateKey
Cert Manager private key properties
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
ExtendedLocation
Extended location is an extension of Azure locations. They provide a way to use their Azure ARC enabled Kubernetes clusters as target locations for deploying Azure services instances.
Name |
Type |
Description |
name
|
string
|
The name of the extended location.
|
type
|
ExtendedLocationType
|
Type of ExtendedLocation.
|
ExtendedLocationType
The enum defining type of ExtendedLocation accepted.
Name |
Type |
Description |
CustomLocation
|
string
|
CustomLocation type
|
ListenerPort
Defines a TCP port on which a BrokerListener
listens.
Name |
Type |
Default value |
Description |
authenticationRef
|
string
|
|
Reference to client authentication settings. Omit to disable authentication.
|
authorizationRef
|
string
|
|
Reference to client authorization settings. Omit to disable authorization.
|
nodePort
|
integer
|
|
Kubernetes node port. Only relevant when this port is associated with a NodePort listener.
|
port
|
integer
|
|
TCP port for accepting client connections.
|
protocol
|
BrokerProtocolType
|
Mqtt
|
Protocol to use for client connections.
|
tls
|
TlsCertMethod
|
|
TLS server certificate settings for this port. Omit to disable TLS.
|
PrivateKeyAlgorithm
Private key algorithm types.
Name |
Type |
Description |
Ec256
|
string
|
Algorithm - ec256.
|
Ec384
|
string
|
Algorithm - ec384.
|
Ec521
|
string
|
Algorithm - ec521.
|
Ed25519
|
string
|
Algorithm - ed25519.
|
Rsa2048
|
string
|
Algorithm - rsa2048.
|
Rsa4096
|
string
|
Algorithm - rsa4096.
|
Rsa8192
|
string
|
Algorithm - rsa8192.
|
PrivateKeyRotationPolicy
Private key rotation policy.
Name |
Type |
Description |
Always
|
string
|
Rotation Policy - Always.
|
Never
|
string
|
Rotation Policy - Never.
|
ProvisioningState
The enum defining status of resource.
Name |
Type |
Description |
Accepted
|
string
|
Resource has been Accepted.
|
Canceled
|
string
|
Resource creation was canceled.
|
Deleting
|
string
|
Resource is Deleting.
|
Failed
|
string
|
Resource creation failed.
|
Provisioning
|
string
|
Resource is getting provisioned.
|
Succeeded
|
string
|
Resource has been created.
|
Updating
|
string
|
Resource is Updating.
|
SanForCert
Subject Alternative Names (SANs) for certificate.
Name |
Type |
Default value |
Description |
dns
|
string[]
|
[]
|
DNS SANs.
|
ip
|
string[]
|
[]
|
IP address SANs.
|
ServiceType
Kubernetes Service Types supported by Listener
Name |
Type |
Description |
ClusterIp
|
string
|
Cluster IP Service.
|
LoadBalancer
|
string
|
Load Balancer Service.
|
NodePort
|
string
|
Node Port Service.
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
TlsCertMethod
Collection of different TLS types, NOTE- Enum at a time only one of them needs to be supported
Name |
Type |
Description |
certManagerCertificateSpec
|
CertManagerCertificateSpec
|
Option 1 - Automatic TLS server certificate management with cert-manager.
|
manual
|
X509ManualCertificate
|
Option 2 - Manual TLS server certificate management through a defined secret.
|
mode
|
TlsCertMethodMode
|
Mode of TLS server certificate management.
|
TlsCertMethodMode
Broker Authentication Mode
Name |
Type |
Description |
Automatic
|
string
|
Automatic TLS server certificate configuration.
|
Manual
|
string
|
Manual TLS server certificate configuration.
|
X509ManualCertificate
X509 Certificate Authentication properties.
Name |
Type |
Description |
secretRef
|
string
|
Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself.
|