Create a DataflowResource
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName}?api-version=2024-11-01
URI Parameters
Name |
In |
Required |
Type |
Description |
dataflowName
|
path |
True
|
string
|
Name of Instance dataflowProfile dataflow resource
Regex pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$
|
dataflowProfileName
|
path |
True
|
string
|
Name of Instance dataflowProfile resource
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]$
|
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
Name |
Required |
Type |
Description |
extendedLocation
|
True
|
ExtendedLocation
|
Edge location of the resource.
|
properties
|
|
DataflowProperties
|
The resource-specific properties for this resource.
|
Responses
Name |
Type |
Description |
200 OK
|
DataflowResource
|
Resource 'DataflowResource' update operation succeeded
|
201 Created
|
DataflowResource
|
Resource 'DataflowResource' 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
Dataflow_CreateOrUpdate
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123?api-version=2024-11-01
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "knnafvkwoeakm",
"sourceSettings": {
"endpointRef": "iixotodhvhkkfcfyrkoveslqig",
"assetRef": "zayyykwmckaocywdkohmu",
"serializationFormat": "Json",
"schemaRef": "pknmdzqll",
"dataSources": [
"chkkpymxhp"
]
},
"builtInTransformationSettings": {
"serializationFormat": "Delta",
"schemaRef": "mcdc",
"datasets": [
{
"key": "qsfqcgxaxnhfumrsdsokwyv",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"schemaRef": "n",
"inputs": [
"mosffpsslifkq"
],
"expression": "aatbwomvflemsxialv"
}
],
"filter": [
{
"type": "Filter",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"inputs": [
"sxmjkbntgb"
],
"expression": "n"
}
],
"map": [
{
"type": "NewProperties",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"inputs": [
"xsbxuk"
],
"expression": "txoiltogsarwkzalsphvlmt",
"output": "nvgtmkfl"
}
]
},
"destinationSettings": {
"endpointRef": "kybkchnzimerguekuvqlqiqdvvrt",
"dataDestination": "cbrh"
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationDataset;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationFilter;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationMap;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowDestinationOperationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowMappingType;
import com.azure.resourcemanager.iotoperations.models.DataflowOperation;
import com.azure.resourcemanager.iotoperations.models.DataflowProperties;
import com.azure.resourcemanager.iotoperations.models.DataflowSourceOperationSettings;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.FilterType;
import com.azure.resourcemanager.iotoperations.models.OperationType;
import com.azure.resourcemanager.iotoperations.models.OperationalMode;
import com.azure.resourcemanager.iotoperations.models.SourceSerializationFormat;
import com.azure.resourcemanager.iotoperations.models.TransformationSerializationFormat;
import java.util.Arrays;
/**
* Samples for Dataflow CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_MaximumSet_Gen.json
*/
/**
* Sample code: Dataflow_CreateOrUpdate.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void dataflowCreateOrUpdate(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.dataflows().define("resource-name123")
.withExistingDataflowProfile("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(
new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv").withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(new DataflowProperties().withMode(OperationalMode.ENABLED).withOperations(
Arrays.asList(new DataflowOperation().withOperationType(OperationType.SOURCE).withName("knnafvkwoeakm")
.withSourceSettings(new DataflowSourceOperationSettings()
.withEndpointRef("iixotodhvhkkfcfyrkoveslqig").withAssetRef("zayyykwmckaocywdkohmu")
.withSerializationFormat(SourceSerializationFormat.JSON).withSchemaRef("pknmdzqll")
.withDataSources(Arrays.asList("chkkpymxhp")))
.withBuiltInTransformationSettings(new DataflowBuiltInTransformationSettings()
.withSerializationFormat(TransformationSerializationFormat.DELTA).withSchemaRef("mcdc")
.withDatasets(Arrays.asList(new DataflowBuiltInTransformationDataset()
.withKey("fakeTokenPlaceholder")
.withDescription("Lorem ipsum odor amet, consectetuer adipiscing elit.").withSchemaRef("n")
.withInputs(Arrays.asList("mosffpsslifkq")).withExpression("aatbwomvflemsxialv")))
.withFilter(Arrays.asList(new DataflowBuiltInTransformationFilter().withType(FilterType.FILTER)
.withDescription("Lorem ipsum odor amet, consectetuer adipiscing elit.")
.withInputs(Arrays.asList("sxmjkbntgb")).withExpression("n")))
.withMap(Arrays
.asList(new DataflowBuiltInTransformationMap().withType(DataflowMappingType.NEW_PROPERTIES)
.withDescription("Lorem ipsum odor amet, consectetuer adipiscing elit.")
.withInputs(Arrays.asList("xsbxuk")).withExpression("txoiltogsarwkzalsphvlmt")
.withOutput("nvgtmkfl"))))
.withDestinationSettings(new DataflowDestinationOperationSettings()
.withEndpointRef("kybkchnzimerguekuvqlqiqdvvrt").withDataDestination("cbrh")))))
.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 dataflow_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.dataflow.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
dataflow_profile_name="resource-name123",
dataflow_name="resource-name123",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"mode": "Enabled",
"operations": [
{
"builtInTransformationSettings": {
"datasets": [
{
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"expression": "aatbwomvflemsxialv",
"inputs": ["mosffpsslifkq"],
"key": "qsfqcgxaxnhfumrsdsokwyv",
"schemaRef": "n",
}
],
"filter": [
{
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"expression": "n",
"inputs": ["sxmjkbntgb"],
"type": "Filter",
}
],
"map": [
{
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"expression": "txoiltogsarwkzalsphvlmt",
"inputs": ["xsbxuk"],
"output": "nvgtmkfl",
"type": "NewProperties",
}
],
"schemaRef": "mcdc",
"serializationFormat": "Delta",
},
"destinationSettings": {
"dataDestination": "cbrh",
"endpointRef": "kybkchnzimerguekuvqlqiqdvvrt",
},
"name": "knnafvkwoeakm",
"operationType": "Source",
"sourceSettings": {
"assetRef": "zayyykwmckaocywdkohmu",
"dataSources": ["chkkpymxhp"],
"endpointRef": "iixotodhvhkkfcfyrkoveslqig",
"schemaRef": "pknmdzqll",
"serializationFormat": "Json",
},
}
],
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/Dataflow_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/Dataflow_CreateOrUpdate_MaximumSet_Gen.json
func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdate() {
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.NewDataflowClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "resource-name123", armiotoperations.DataflowResource{
Properties: &armiotoperations.DataflowProperties{
Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
Operations: []*armiotoperations.DataflowOperation{
{
OperationType: to.Ptr(armiotoperations.OperationTypeSource),
Name: to.Ptr("knnafvkwoeakm"),
SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
EndpointRef: to.Ptr("iixotodhvhkkfcfyrkoveslqig"),
AssetRef: to.Ptr("zayyykwmckaocywdkohmu"),
SerializationFormat: to.Ptr(armiotoperations.SourceSerializationFormatJSON),
SchemaRef: to.Ptr("pknmdzqll"),
DataSources: []*string{
to.Ptr("chkkpymxhp"),
},
},
BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
SerializationFormat: to.Ptr(armiotoperations.TransformationSerializationFormatDelta),
SchemaRef: to.Ptr("mcdc"),
Datasets: []*armiotoperations.DataflowBuiltInTransformationDataset{
{
Key: to.Ptr("qsfqcgxaxnhfumrsdsokwyv"),
Description: to.Ptr("Lorem ipsum odor amet, consectetuer adipiscing elit."),
SchemaRef: to.Ptr("n"),
Inputs: []*string{
to.Ptr("mosffpsslifkq"),
},
Expression: to.Ptr("aatbwomvflemsxialv"),
},
},
Filter: []*armiotoperations.DataflowBuiltInTransformationFilter{
{
Type: to.Ptr(armiotoperations.FilterTypeFilter),
Description: to.Ptr("Lorem ipsum odor amet, consectetuer adipiscing elit."),
Inputs: []*string{
to.Ptr("sxmjkbntgb"),
},
Expression: to.Ptr("n"),
},
},
Map: []*armiotoperations.DataflowBuiltInTransformationMap{
{
Type: to.Ptr(armiotoperations.DataflowMappingTypeNewProperties),
Description: to.Ptr("Lorem ipsum odor amet, consectetuer adipiscing elit."),
Inputs: []*string{
to.Ptr("xsbxuk"),
},
Expression: to.Ptr("txoiltogsarwkzalsphvlmt"),
Output: to.Ptr("nvgtmkfl"),
},
},
},
DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
EndpointRef: to.Ptr("kybkchnzimerguekuvqlqiqdvvrt"),
DataDestination: to.Ptr("cbrh"),
},
},
},
},
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.DataflowClientCreateOrUpdateResponse{
// DataflowResource: &armiotoperations.DataflowResource{
// Properties: &armiotoperations.DataflowProperties{
// Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
// Operations: []*armiotoperations.DataflowOperation{
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeSource),
// Name: to.Ptr("knnafvkwoeakm"),
// SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
// EndpointRef: to.Ptr("iixotodhvhkkfcfyrkoveslqig"),
// AssetRef: to.Ptr("zayyykwmckaocywdkohmu"),
// SerializationFormat: to.Ptr(armiotoperations.SourceSerializationFormatJSON),
// SchemaRef: to.Ptr("pknmdzqll"),
// DataSources: []*string{
// to.Ptr("chkkpymxhp"),
// },
// },
// BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
// SerializationFormat: to.Ptr(armiotoperations.TransformationSerializationFormatDelta),
// SchemaRef: to.Ptr("mcdc"),
// Datasets: []*armiotoperations.DataflowBuiltInTransformationDataset{
// {
// Key: to.Ptr("qsfqcgxaxnhfumrsdsokwyv"),
// Description: to.Ptr("Lorem ipsum odor amet, consectetuer adipiscing elit."),
// SchemaRef: to.Ptr("n"),
// Inputs: []*string{
// to.Ptr("mosffpsslifkq"),
// },
// Expression: to.Ptr("aatbwomvflemsxialv"),
// },
// },
// Filter: []*armiotoperations.DataflowBuiltInTransformationFilter{
// {
// Type: to.Ptr(armiotoperations.FilterTypeFilter),
// Description: to.Ptr("Lorem ipsum odor amet, consectetuer adipiscing elit."),
// Inputs: []*string{
// to.Ptr("sxmjkbntgb"),
// },
// Expression: to.Ptr("n"),
// },
// },
// Map: []*armiotoperations.DataflowBuiltInTransformationMap{
// {
// Type: to.Ptr(armiotoperations.DataflowMappingTypeNewProperties),
// Description: to.Ptr("Lorem ipsum odor amet, consectetuer adipiscing elit."),
// Inputs: []*string{
// to.Ptr("xsbxuk"),
// },
// Expression: to.Ptr("txoiltogsarwkzalsphvlmt"),
// Output: to.Ptr("nvgtmkfl"),
// },
// },
// },
// DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
// EndpointRef: to.Ptr("kybkchnzimerguekuvqlqiqdvvrt"),
// DataDestination: to.Ptr("cbrh"),
// },
// },
// },
// 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/dataflowProfiles/resource-name123/dataflows/resource-name123"),
// Name: to.Ptr("jxhcpwgfkxqasbexkookvxk"),
// Type: to.Ptr("zkuozvgjseokfchkscoswthzjdry"),
// 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
Sample response
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "knnafvkwoeakm",
"sourceSettings": {
"endpointRef": "iixotodhvhkkfcfyrkoveslqig",
"assetRef": "zayyykwmckaocywdkohmu",
"serializationFormat": "Json",
"schemaRef": "pknmdzqll",
"dataSources": [
"chkkpymxhp"
]
},
"builtInTransformationSettings": {
"serializationFormat": "Delta",
"schemaRef": "mcdc",
"datasets": [
{
"key": "qsfqcgxaxnhfumrsdsokwyv",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"schemaRef": "n",
"inputs": [
"mosffpsslifkq"
],
"expression": "aatbwomvflemsxialv"
}
],
"filter": [
{
"type": "Filter",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"inputs": [
"sxmjkbntgb"
],
"expression": "n"
}
],
"map": [
{
"type": "NewProperties",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"inputs": [
"xsbxuk"
],
"expression": "txoiltogsarwkzalsphvlmt",
"output": "nvgtmkfl"
}
]
},
"destinationSettings": {
"endpointRef": "kybkchnzimerguekuvqlqiqdvvrt",
"dataDestination": "cbrh"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"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": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "knnafvkwoeakm",
"sourceSettings": {
"endpointRef": "iixotodhvhkkfcfyrkoveslqig",
"assetRef": "zayyykwmckaocywdkohmu",
"serializationFormat": "Json",
"schemaRef": "pknmdzqll",
"dataSources": [
"chkkpymxhp"
]
},
"builtInTransformationSettings": {
"serializationFormat": "Delta",
"schemaRef": "mcdc",
"datasets": [
{
"key": "qsfqcgxaxnhfumrsdsokwyv",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"schemaRef": "n",
"inputs": [
"mosffpsslifkq"
],
"expression": "aatbwomvflemsxialv"
}
],
"filter": [
{
"type": "Filter",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"inputs": [
"sxmjkbntgb"
],
"expression": "n"
}
],
"map": [
{
"type": "NewProperties",
"description": "Lorem ipsum odor amet, consectetuer adipiscing elit.",
"inputs": [
"xsbxuk"
],
"expression": "txoiltogsarwkzalsphvlmt",
"output": "nvgtmkfl"
}
]
},
"destinationSettings": {
"endpointRef": "kybkchnzimerguekuvqlqiqdvvrt",
"dataDestination": "cbrh"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Dataflow_CreateOrUpdate_ComplexContextualization
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/aio-to-adx-contexualized?api-version=2024-11-01
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"map": [
{
"inputs": [
"*"
],
"output": "*"
},
{
"inputs": [
"$context(quality).*"
],
"output": "enriched.*"
}
],
"datasets": [
{
"key": "quality",
"inputs": [
"$source.country",
"$context.country"
],
"expression": "$1 == $2"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "adx-endpoint",
"dataDestination": "mytable"
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationDataset;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationMap;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowDestinationOperationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowOperation;
import com.azure.resourcemanager.iotoperations.models.DataflowProperties;
import com.azure.resourcemanager.iotoperations.models.DataflowSourceOperationSettings;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.OperationType;
import com.azure.resourcemanager.iotoperations.models.OperationalMode;
import java.util.Arrays;
/**
* Samples for Dataflow CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_ComplexContextualization.json
*/
/**
* Sample code: Dataflow_CreateOrUpdate_ComplexContextualization.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void dataflowCreateOrUpdateComplexContextualization(
com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.dataflows().define("aio-to-adx-contexualized")
.withExistingDataflowProfile("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv")
.withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(
new DataflowProperties().withMode(OperationalMode.ENABLED)
.withOperations(
Arrays.asList(
new DataflowOperation().withOperationType(OperationType.SOURCE).withName("source1")
.withSourceSettings(new DataflowSourceOperationSettings()
.withEndpointRef("aio-builtin-broker-endpoint").withDataSources(
Arrays.asList("azure-iot-operations/data/thermostat"))),
new DataflowOperation().withOperationType(OperationType.BUILT_IN_TRANSFORMATION)
.withName("transformation1")
.withBuiltInTransformationSettings(new DataflowBuiltInTransformationSettings()
.withDatasets(Arrays.asList(new DataflowBuiltInTransformationDataset()
.withKey("fakeTokenPlaceholder")
.withInputs(Arrays.asList("$source.country", "$context.country"))
.withExpression("$1 == $2")))
.withMap(Arrays.asList(
new DataflowBuiltInTransformationMap().withInputs(Arrays.asList("*"))
.withOutput("*"),
new DataflowBuiltInTransformationMap()
.withInputs(Arrays.asList("$context(quality).*"))
.withOutput("enriched.*")))),
new DataflowOperation().withOperationType(OperationType.DESTINATION)
.withName("destination1")
.withDestinationSettings(new DataflowDestinationOperationSettings()
.withEndpointRef("adx-endpoint").withDataDestination("mytable")))))
.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 dataflow_create_or_update_complex_contextualization.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.dataflow.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
dataflow_profile_name="resource-name123",
dataflow_name="aio-to-adx-contexualized",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"mode": "Enabled",
"operations": [
{
"name": "source1",
"operationType": "Source",
"sourceSettings": {
"dataSources": ["azure-iot-operations/data/thermostat"],
"endpointRef": "aio-builtin-broker-endpoint",
},
},
{
"builtInTransformationSettings": {
"datasets": [
{
"expression": "$1 == $2",
"inputs": ["$source.country", "$context.country"],
"key": "quality",
}
],
"map": [
{"inputs": ["*"], "output": "*"},
{"inputs": ["$context(quality).*"], "output": "enriched.*"},
],
},
"name": "transformation1",
"operationType": "BuiltInTransformation",
},
{
"destinationSettings": {"dataDestination": "mytable", "endpointRef": "adx-endpoint"},
"name": "destination1",
"operationType": "Destination",
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_ComplexContextualization.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/Dataflow_CreateOrUpdate_ComplexContextualization.json
func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateComplexContextualization() {
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.NewDataflowClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "aio-to-adx-contexualized", armiotoperations.DataflowResource{
Properties: &armiotoperations.DataflowProperties{
Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
Operations: []*armiotoperations.DataflowOperation{
{
OperationType: to.Ptr(armiotoperations.OperationTypeSource),
Name: to.Ptr("source1"),
SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
DataSources: []*string{
to.Ptr("azure-iot-operations/data/thermostat"),
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
Name: to.Ptr("transformation1"),
BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
Map: []*armiotoperations.DataflowBuiltInTransformationMap{
{
Inputs: []*string{
to.Ptr("*"),
},
Output: to.Ptr("*"),
},
{
Inputs: []*string{
to.Ptr("$context(quality).*"),
},
Output: to.Ptr("enriched.*"),
},
},
Datasets: []*armiotoperations.DataflowBuiltInTransformationDataset{
{
Key: to.Ptr("quality"),
Inputs: []*string{
to.Ptr("$source.country"),
to.Ptr("$context.country"),
},
Expression: to.Ptr("$1 == $2"),
},
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
Name: to.Ptr("destination1"),
DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
EndpointRef: to.Ptr("adx-endpoint"),
DataDestination: to.Ptr("mytable"),
},
},
},
},
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.DataflowClientCreateOrUpdateResponse{
// DataflowResource: &armiotoperations.DataflowResource{
// Properties: &armiotoperations.DataflowProperties{
// Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
// Operations: []*armiotoperations.DataflowOperation{
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeSource),
// Name: to.Ptr("source1"),
// SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
// EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
// DataSources: []*string{
// to.Ptr("azure-iot-operations/data/thermostat"),
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
// Name: to.Ptr("transformation1"),
// BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
// Map: []*armiotoperations.DataflowBuiltInTransformationMap{
// {
// Inputs: []*string{
// to.Ptr("*"),
// },
// Output: to.Ptr("*"),
// },
// {
// Inputs: []*string{
// to.Ptr("$context(quality).*"),
// },
// Output: to.Ptr("enriched.*"),
// },
// },
// Datasets: []*armiotoperations.DataflowBuiltInTransformationDataset{
// {
// Key: to.Ptr("quality"),
// Inputs: []*string{
// to.Ptr("$source.country"),
// to.Ptr("$context.country"),
// },
// Expression: to.Ptr("$1 == $2"),
// },
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
// Name: to.Ptr("destination1"),
// DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
// EndpointRef: to.Ptr("adx-endpoint"),
// DataDestination: to.Ptr("mytable"),
// },
// },
// },
// 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/dataflowProfiles/resource-name123/dataflows/resource-name123"),
// Name: to.Ptr("jxhcpwgfkxqasbexkookvxk"),
// Type: to.Ptr("zkuozvgjseokfchkscoswthzjdry"),
// 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
Sample response
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"map": [
{
"inputs": [
"*"
],
"output": "*"
},
{
"inputs": [
"$context(quality).*"
],
"output": "enriched.*"
}
],
"datasets": [
{
"key": "quality",
"inputs": [
"$source.country",
"$context.country"
],
"expression": "$1 == $2"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "adx-endpoint",
"dataDestination": "mytable"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"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": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"map": [
{
"inputs": [
"*"
],
"output": "*"
},
{
"inputs": [
"$context(quality).*"
],
"output": "enriched.*"
}
],
"datasets": [
{
"key": "quality",
"inputs": [
"$source.country",
"$context.country"
],
"expression": "$1 == $2"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "adx-endpoint",
"dataDestination": "mytable"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Dataflow_CreateOrUpdate_ComplexEventHub
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/aio-to-event-hub-transformed?api-version=2024-11-01
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"builtInTransformationSettings": {
"filter": [
{
"inputs": [
"temperature.Value",
"\"Tag 10\".Value"
],
"expression": "$1 > 9000 && $2 >= 8000"
}
],
"map": [
{
"inputs": [
"*"
],
"output": "*"
},
{
"inputs": [
"temperature.Value",
"\"Tag 10\".Value"
],
"expression": "($1+$2)/2",
"output": "AvgTemp.Value"
},
{
"inputs": [],
"expression": "true",
"output": "dataflow-processed"
},
{
"inputs": [
"temperature.SourceTimestamp"
],
"expression": "",
"output": ""
},
{
"inputs": [
"\"Tag 10\""
],
"expression": "",
"output": "pressure"
},
{
"inputs": [
"temperature.Value"
],
"expression": "cToF($1)",
"output": "temperatureF.Value"
},
{
"inputs": [
"\"Tag 10\".Value"
],
"expression": "scale ($1,0,10,0,100)",
"output": "\"Scale Tag 10\".Value"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "event-hub-endpoint",
"dataDestination": "myuniqueeventhub"
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationFilter;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationMap;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowDestinationOperationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowOperation;
import com.azure.resourcemanager.iotoperations.models.DataflowProperties;
import com.azure.resourcemanager.iotoperations.models.DataflowSourceOperationSettings;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.OperationType;
import com.azure.resourcemanager.iotoperations.models.OperationalMode;
import java.util.Arrays;
/**
* Samples for Dataflow CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_ComplexEventHub.json
*/
/**
* Sample code: Dataflow_CreateOrUpdate_ComplexEventHub.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
dataflowCreateOrUpdateComplexEventHub(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.dataflows().define("aio-to-event-hub-transformed")
.withExistingDataflowProfile("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv")
.withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(
new DataflowProperties().withMode(OperationalMode.ENABLED)
.withOperations(
Arrays
.asList(
new DataflowOperation().withOperationType(OperationType.SOURCE).withName("source1")
.withSourceSettings(new DataflowSourceOperationSettings()
.withEndpointRef("aio-builtin-broker-endpoint").withDataSources(Arrays
.asList("azure-iot-operations/data/thermostat"))),
new DataflowOperation().withOperationType(OperationType.BUILT_IN_TRANSFORMATION)
.withBuiltInTransformationSettings(new DataflowBuiltInTransformationSettings()
.withFilter(Arrays.asList(new DataflowBuiltInTransformationFilter()
.withInputs(Arrays.asList("temperature.Value", "\"Tag 10\".Value"))
.withExpression("$1 > 9000 && $2 >= 8000")))
.withMap(Arrays.asList(
new DataflowBuiltInTransformationMap().withInputs(Arrays.asList("*"))
.withOutput("*"),
new DataflowBuiltInTransformationMap()
.withInputs(Arrays.asList("temperature.Value", "\"Tag 10\".Value"))
.withExpression("($1+$2)/2").withOutput("AvgTemp.Value"),
new DataflowBuiltInTransformationMap().withInputs(Arrays.asList())
.withExpression("true").withOutput("dataflow-processed"),
new DataflowBuiltInTransformationMap()
.withInputs(Arrays.asList("temperature.SourceTimestamp"))
.withExpression("").withOutput(""),
new DataflowBuiltInTransformationMap()
.withInputs(Arrays.asList("\"Tag 10\"")).withExpression("")
.withOutput("pressure"),
new DataflowBuiltInTransformationMap()
.withInputs(Arrays.asList("temperature.Value"))
.withExpression("cToF($1)").withOutput("temperatureF.Value"),
new DataflowBuiltInTransformationMap()
.withInputs(Arrays.asList("\"Tag 10\".Value"))
.withExpression("scale ($1,0,10,0,100)")
.withOutput("\"Scale Tag 10\".Value")))),
new DataflowOperation().withOperationType(OperationType.DESTINATION)
.withName("destination1").withDestinationSettings(
new DataflowDestinationOperationSettings().withEndpointRef("event-hub-endpoint")
.withDataDestination("myuniqueeventhub")))))
.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 dataflow_create_or_update_complex_event_hub.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.dataflow.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
dataflow_profile_name="resource-name123",
dataflow_name="aio-to-event-hub-transformed",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"mode": "Enabled",
"operations": [
{
"name": "source1",
"operationType": "Source",
"sourceSettings": {
"dataSources": ["azure-iot-operations/data/thermostat"],
"endpointRef": "aio-builtin-broker-endpoint",
},
},
{
"builtInTransformationSettings": {
"filter": [
{
"expression": "$1 > 9000 && $2 >= 8000",
"inputs": ["temperature.Value", '"Tag 10".Value'],
}
],
"map": [
{"inputs": ["*"], "output": "*"},
{
"expression": "($1+$2)/2",
"inputs": ["temperature.Value", '"Tag 10".Value'],
"output": "AvgTemp.Value",
},
{"expression": "true", "inputs": [], "output": "dataflow-processed"},
{"expression": "", "inputs": ["temperature.SourceTimestamp"], "output": ""},
{"expression": "", "inputs": ['"Tag 10"'], "output": "pressure"},
{
"expression": "cToF($1)",
"inputs": ["temperature.Value"],
"output": "temperatureF.Value",
},
{
"expression": "scale ($1,0,10,0,100)",
"inputs": ['"Tag 10".Value'],
"output": '"Scale Tag 10".Value',
},
],
},
"operationType": "BuiltInTransformation",
},
{
"destinationSettings": {
"dataDestination": "myuniqueeventhub",
"endpointRef": "event-hub-endpoint",
},
"name": "destination1",
"operationType": "Destination",
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_ComplexEventHub.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/Dataflow_CreateOrUpdate_ComplexEventHub.json
func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateComplexEventHub() {
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.NewDataflowClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "aio-to-event-hub-transformed", armiotoperations.DataflowResource{
Properties: &armiotoperations.DataflowProperties{
Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
Operations: []*armiotoperations.DataflowOperation{
{
OperationType: to.Ptr(armiotoperations.OperationTypeSource),
Name: to.Ptr("source1"),
SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
DataSources: []*string{
to.Ptr("azure-iot-operations/data/thermostat"),
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
Filter: []*armiotoperations.DataflowBuiltInTransformationFilter{
{
Inputs: []*string{
to.Ptr("temperature.Value"),
to.Ptr("\"Tag 10\".Value"),
},
Expression: to.Ptr("$1 > 9000 && $2 >= 8000"),
},
},
Map: []*armiotoperations.DataflowBuiltInTransformationMap{
{
Inputs: []*string{
to.Ptr("*"),
},
Output: to.Ptr("*"),
},
{
Inputs: []*string{
to.Ptr("temperature.Value"),
to.Ptr("\"Tag 10\".Value"),
},
Expression: to.Ptr("($1+$2)/2"),
Output: to.Ptr("AvgTemp.Value"),
},
{
Inputs: []*string{},
Expression: to.Ptr("true"),
Output: to.Ptr("dataflow-processed"),
},
{
Inputs: []*string{
to.Ptr("temperature.SourceTimestamp"),
},
Expression: to.Ptr(""),
Output: to.Ptr(""),
},
{
Inputs: []*string{
to.Ptr("\"Tag 10\""),
},
Expression: to.Ptr(""),
Output: to.Ptr("pressure"),
},
{
Inputs: []*string{
to.Ptr("temperature.Value"),
},
Expression: to.Ptr("cToF($1)"),
Output: to.Ptr("temperatureF.Value"),
},
{
Inputs: []*string{
to.Ptr("\"Tag 10\".Value"),
},
Expression: to.Ptr("scale ($1,0,10,0,100)"),
Output: to.Ptr("\"Scale Tag 10\".Value"),
},
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
Name: to.Ptr("destination1"),
DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
EndpointRef: to.Ptr("event-hub-endpoint"),
DataDestination: to.Ptr("myuniqueeventhub"),
},
},
},
},
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.DataflowClientCreateOrUpdateResponse{
// DataflowResource: &armiotoperations.DataflowResource{
// Properties: &armiotoperations.DataflowProperties{
// Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
// Operations: []*armiotoperations.DataflowOperation{
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeSource),
// Name: to.Ptr("source1"),
// SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
// EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
// DataSources: []*string{
// to.Ptr("azure-iot-operations/data/thermostat"),
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
// Name: to.Ptr("transformation1"),
// BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
// Map: []*armiotoperations.DataflowBuiltInTransformationMap{
// {
// Inputs: []*string{
// to.Ptr("*"),
// },
// Output: to.Ptr("*"),
// },
// {
// Inputs: []*string{
// to.Ptr("$context(quality).*"),
// },
// Output: to.Ptr("enriched.*"),
// },
// },
// Datasets: []*armiotoperations.DataflowBuiltInTransformationDataset{
// {
// Key: to.Ptr("quality"),
// Inputs: []*string{
// to.Ptr("$source.country"),
// to.Ptr("$context.country"),
// },
// Expression: to.Ptr("$1 == $2"),
// },
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
// Name: to.Ptr("destination1"),
// DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
// EndpointRef: to.Ptr("adx-endpoint"),
// DataDestination: to.Ptr("mytable"),
// },
// },
// },
// 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/dataflowProfiles/resource-name123/dataflows/resource-name123"),
// Name: to.Ptr("jxhcpwgfkxqasbexkookvxk"),
// Type: to.Ptr("zkuozvgjseokfchkscoswthzjdry"),
// 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
Sample response
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"map": [
{
"inputs": [
"*"
],
"output": "*"
},
{
"inputs": [
"$context(quality).*"
],
"output": "enriched.*"
}
],
"datasets": [
{
"key": "quality",
"inputs": [
"$source.country",
"$context.country"
],
"expression": "$1 == $2"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "adx-endpoint",
"dataDestination": "mytable"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"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": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"map": [
{
"inputs": [
"*"
],
"output": "*"
},
{
"inputs": [
"$context(quality).*"
],
"output": "enriched.*"
}
],
"datasets": [
{
"key": "quality",
"inputs": [
"$source.country",
"$context.country"
],
"expression": "$1 == $2"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "adx-endpoint",
"dataDestination": "mytable"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Dataflow_CreateOrUpdate_FilterToTopic
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/mqtt-filter-to-topic?api-version=2024-11-01
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"filter": [
{
"type": "Filter",
"description": "filter-datapoint",
"inputs": [
"temperature.Value",
"\"Tag 10\".Value"
],
"expression": "$1 > 9000 && $2 >= 8000"
}
],
"map": [
{
"type": "PassThrough",
"inputs": [
"*"
],
"output": "*"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataDestination": "data/filtered/thermostat"
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationFilter;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationMap;
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowDestinationOperationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowMappingType;
import com.azure.resourcemanager.iotoperations.models.DataflowOperation;
import com.azure.resourcemanager.iotoperations.models.DataflowProperties;
import com.azure.resourcemanager.iotoperations.models.DataflowSourceOperationSettings;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.FilterType;
import com.azure.resourcemanager.iotoperations.models.OperationType;
import com.azure.resourcemanager.iotoperations.models.OperationalMode;
import java.util.Arrays;
/**
* Samples for Dataflow CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_FilterToTopic.json
*/
/**
* Sample code: Dataflow_CreateOrUpdate_FilterToTopic.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
dataflowCreateOrUpdateFilterToTopic(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.dataflows().define("mqtt-filter-to-topic")
.withExistingDataflowProfile("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv")
.withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(
new DataflowProperties().withMode(OperationalMode.ENABLED)
.withOperations(
Arrays.asList(
new DataflowOperation().withOperationType(OperationType.SOURCE).withName("source1")
.withSourceSettings(new DataflowSourceOperationSettings()
.withEndpointRef("aio-builtin-broker-endpoint").withDataSources(
Arrays.asList("azure-iot-operations/data/thermostat"))),
new DataflowOperation().withOperationType(OperationType.BUILT_IN_TRANSFORMATION)
.withName("transformation1")
.withBuiltInTransformationSettings(new DataflowBuiltInTransformationSettings()
.withFilter(Arrays.asList(new DataflowBuiltInTransformationFilter()
.withType(FilterType.FILTER).withDescription("filter-datapoint")
.withInputs(Arrays.asList("temperature.Value", "\"Tag 10\".Value"))
.withExpression("$1 > 9000 && $2 >= 8000")))
.withMap(Arrays.asList(new DataflowBuiltInTransformationMap()
.withType(DataflowMappingType.PASS_THROUGH).withInputs(Arrays.asList("*"))
.withOutput("*")))),
new DataflowOperation().withOperationType(OperationType.DESTINATION)
.withName("destination1")
.withDestinationSettings(new DataflowDestinationOperationSettings()
.withEndpointRef("aio-builtin-broker-endpoint")
.withDataDestination("data/filtered/thermostat")))))
.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 dataflow_create_or_update_filter_to_topic.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.dataflow.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
dataflow_profile_name="resource-name123",
dataflow_name="mqtt-filter-to-topic",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"mode": "Enabled",
"operations": [
{
"name": "source1",
"operationType": "Source",
"sourceSettings": {
"dataSources": ["azure-iot-operations/data/thermostat"],
"endpointRef": "aio-builtin-broker-endpoint",
},
},
{
"builtInTransformationSettings": {
"filter": [
{
"description": "filter-datapoint",
"expression": "$1 > 9000 && $2 >= 8000",
"inputs": ["temperature.Value", '"Tag 10".Value'],
"type": "Filter",
}
],
"map": [{"inputs": ["*"], "output": "*", "type": "PassThrough"}],
},
"name": "transformation1",
"operationType": "BuiltInTransformation",
},
{
"destinationSettings": {
"dataDestination": "data/filtered/thermostat",
"endpointRef": "aio-builtin-broker-endpoint",
},
"name": "destination1",
"operationType": "Destination",
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_FilterToTopic.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/Dataflow_CreateOrUpdate_FilterToTopic.json
func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateFilterToTopic() {
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.NewDataflowClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "mqtt-filter-to-topic", armiotoperations.DataflowResource{
Properties: &armiotoperations.DataflowProperties{
Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
Operations: []*armiotoperations.DataflowOperation{
{
OperationType: to.Ptr(armiotoperations.OperationTypeSource),
Name: to.Ptr("source1"),
SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
DataSources: []*string{
to.Ptr("azure-iot-operations/data/thermostat"),
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
Name: to.Ptr("transformation1"),
BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
Filter: []*armiotoperations.DataflowBuiltInTransformationFilter{
{
Type: to.Ptr(armiotoperations.FilterTypeFilter),
Description: to.Ptr("filter-datapoint"),
Inputs: []*string{
to.Ptr("temperature.Value"),
to.Ptr("\"Tag 10\".Value"),
},
Expression: to.Ptr("$1 > 9000 && $2 >= 8000"),
},
},
Map: []*armiotoperations.DataflowBuiltInTransformationMap{
{
Type: to.Ptr(armiotoperations.DataflowMappingTypePassThrough),
Inputs: []*string{
to.Ptr("*"),
},
Output: to.Ptr("*"),
},
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
Name: to.Ptr("destination1"),
DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
DataDestination: to.Ptr("data/filtered/thermostat"),
},
},
},
},
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.DataflowClientCreateOrUpdateResponse{
// DataflowResource: &armiotoperations.DataflowResource{
// Properties: &armiotoperations.DataflowProperties{
// Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
// Operations: []*armiotoperations.DataflowOperation{
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeSource),
// Name: to.Ptr("source1"),
// SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
// EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
// DataSources: []*string{
// to.Ptr("azure-iot-operations/data/thermostat"),
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
// Name: to.Ptr("transformation1"),
// BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
// Filter: []*armiotoperations.DataflowBuiltInTransformationFilter{
// {
// Type: to.Ptr(armiotoperations.FilterTypeFilter),
// Description: to.Ptr("filter-datapoint"),
// Inputs: []*string{
// to.Ptr("temperature.Value"),
// to.Ptr("\"Tag 10\".Value"),
// },
// Expression: to.Ptr("$1 > 9000 && $2 >= 8000"),
// },
// },
// Map: []*armiotoperations.DataflowBuiltInTransformationMap{
// {
// Type: to.Ptr(armiotoperations.DataflowMappingTypePassThrough),
// Inputs: []*string{
// to.Ptr("*"),
// },
// Output: to.Ptr("*"),
// },
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
// Name: to.Ptr("destination1"),
// DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
// EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
// DataDestination: to.Ptr("data/filtered/thermostat"),
// },
// },
// },
// 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/dataflowProfiles/resource-name123/dataflows/resource-name123"),
// Name: to.Ptr("jxhcpwgfkxqasbexkookvxk"),
// Type: to.Ptr("zkuozvgjseokfchkscoswthzjdry"),
// 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
Sample response
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"filter": [
{
"type": "Filter",
"description": "filter-datapoint",
"inputs": [
"temperature.Value",
"\"Tag 10\".Value"
],
"expression": "$1 > 9000 && $2 >= 8000"
}
],
"map": [
{
"type": "PassThrough",
"inputs": [
"*"
],
"output": "*"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataDestination": "data/filtered/thermostat"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"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": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"name": "transformation1",
"builtInTransformationSettings": {
"filter": [
{
"type": "Filter",
"description": "filter-datapoint",
"inputs": [
"temperature.Value",
"\"Tag 10\".Value"
],
"expression": "$1 > 9000 && $2 >= 8000"
}
],
"map": [
{
"type": "PassThrough",
"inputs": [
"*"
],
"output": "*"
}
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataDestination": "data/filtered/thermostat"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Dataflow_CreateOrUpdate_SimpleEventGrid
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/aio-to-event-grid?api-version=2024-11-01
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"thermostats/+/telemetry/temperature/#"
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "event-grid-endpoint",
"dataDestination": "factory/telemetry"
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.DataflowDestinationOperationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowOperation;
import com.azure.resourcemanager.iotoperations.models.DataflowProperties;
import com.azure.resourcemanager.iotoperations.models.DataflowSourceOperationSettings;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.OperationType;
import com.azure.resourcemanager.iotoperations.models.OperationalMode;
import java.util.Arrays;
/**
* Samples for Dataflow CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_SimpleEventGrid.json
*/
/**
* Sample code: Dataflow_CreateOrUpdate_SimpleEventGrid.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
dataflowCreateOrUpdateSimpleEventGrid(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.dataflows().define("aio-to-event-grid")
.withExistingDataflowProfile("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv")
.withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(
new DataflowProperties().withMode(OperationalMode.ENABLED)
.withOperations(
Arrays
.asList(
new DataflowOperation().withOperationType(OperationType.SOURCE).withName("source1")
.withSourceSettings(new DataflowSourceOperationSettings()
.withEndpointRef("aio-builtin-broker-endpoint")
.withDataSources(Arrays.asList("thermostats/+/telemetry/temperature/#"))),
new DataflowOperation().withOperationType(OperationType.DESTINATION)
.withName("destination1")
.withDestinationSettings(new DataflowDestinationOperationSettings()
.withEndpointRef("event-grid-endpoint")
.withDataDestination("factory/telemetry")))))
.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 dataflow_create_or_update_simple_event_grid.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.dataflow.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
dataflow_profile_name="resource-name123",
dataflow_name="aio-to-event-grid",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"mode": "Enabled",
"operations": [
{
"name": "source1",
"operationType": "Source",
"sourceSettings": {
"dataSources": ["thermostats/+/telemetry/temperature/#"],
"endpointRef": "aio-builtin-broker-endpoint",
},
},
{
"destinationSettings": {
"dataDestination": "factory/telemetry",
"endpointRef": "event-grid-endpoint",
},
"name": "destination1",
"operationType": "Destination",
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_SimpleEventGrid.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/Dataflow_CreateOrUpdate_SimpleEventGrid.json
func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateSimpleEventGrid() {
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.NewDataflowClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "aio-to-event-grid", armiotoperations.DataflowResource{
Properties: &armiotoperations.DataflowProperties{
Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
Operations: []*armiotoperations.DataflowOperation{
{
OperationType: to.Ptr(armiotoperations.OperationTypeSource),
Name: to.Ptr("source1"),
SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
DataSources: []*string{
to.Ptr("thermostats/+/telemetry/temperature/#"),
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
Name: to.Ptr("destination1"),
DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
EndpointRef: to.Ptr("event-grid-endpoint"),
DataDestination: to.Ptr("factory/telemetry"),
},
},
},
},
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.DataflowClientCreateOrUpdateResponse{
// DataflowResource: &armiotoperations.DataflowResource{
// Properties: &armiotoperations.DataflowProperties{
// Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
// Operations: []*armiotoperations.DataflowOperation{
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeSource),
// Name: to.Ptr("source1"),
// SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
// EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
// DataSources: []*string{
// to.Ptr("thermostats/+/telemetry/temperature/#"),
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
// Name: to.Ptr("destination1"),
// DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
// EndpointRef: to.Ptr("event-grid-endpoint"),
// DataDestination: to.Ptr("factory/telemetry"),
// },
// },
// },
// 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/dataflowProfiles/resource-name123/dataflows/resource-name123"),
// Name: to.Ptr("jxhcpwgfkxqasbexkookvxk"),
// Type: to.Ptr("zkuozvgjseokfchkscoswthzjdry"),
// 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
Sample response
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"thermostats/+/telemetry/temperature/#"
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "event-grid-endpoint",
"dataDestination": "factory/telemetry"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"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": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"thermostats/+/telemetry/temperature/#"
]
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "event-grid-endpoint",
"dataDestination": "factory/telemetry"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Dataflow_CreateOrUpdate_SimpleFabric
Sample request
PUT https://management.azure.com/subscriptions/F8C729F9-DF9C-4743-848F-96EE433D8E53/resourceGroups/rgiotoperations/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/aio-to-fabric?api-version=2024-11-01
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"builtInTransformationSettings": {
"serializationFormat": "Parquet",
"schemaRef": "aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0"
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "fabric-endpoint",
"dataDestination": "telemetryTable"
}
}
]
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
}
}
import com.azure.resourcemanager.iotoperations.models.DataflowBuiltInTransformationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowDestinationOperationSettings;
import com.azure.resourcemanager.iotoperations.models.DataflowOperation;
import com.azure.resourcemanager.iotoperations.models.DataflowProperties;
import com.azure.resourcemanager.iotoperations.models.DataflowSourceOperationSettings;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocation;
import com.azure.resourcemanager.iotoperations.models.ExtendedLocationType;
import com.azure.resourcemanager.iotoperations.models.OperationType;
import com.azure.resourcemanager.iotoperations.models.OperationalMode;
import com.azure.resourcemanager.iotoperations.models.TransformationSerializationFormat;
import java.util.Arrays;
/**
* Samples for Dataflow CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_SimpleFabric.json
*/
/**
* Sample code: Dataflow_CreateOrUpdate_SimpleFabric.
*
* @param manager Entry point to IoTOperationsManager.
*/
public static void
dataflowCreateOrUpdateSimpleFabric(com.azure.resourcemanager.iotoperations.IoTOperationsManager manager) {
manager.dataflows().define("aio-to-fabric")
.withExistingDataflowProfile("rgiotoperations", "resource-name123", "resource-name123")
.withExtendedLocation(
new ExtendedLocation().withName("qmbrfwcpwwhggszhrdjv").withType(ExtendedLocationType.CUSTOM_LOCATION))
.withProperties(
new DataflowProperties()
.withMode(OperationalMode.ENABLED).withOperations(Arrays.asList(
new DataflowOperation().withOperationType(OperationType.SOURCE).withName("source1")
.withSourceSettings(new DataflowSourceOperationSettings()
.withEndpointRef("aio-builtin-broker-endpoint")
.withDataSources(Arrays.asList("azure-iot-operations/data/thermostat"))),
new DataflowOperation().withOperationType(OperationType.BUILT_IN_TRANSFORMATION)
.withBuiltInTransformationSettings(new DataflowBuiltInTransformationSettings()
.withSerializationFormat(TransformationSerializationFormat.PARQUET)
.withSchemaRef("aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0")),
new DataflowOperation().withOperationType(OperationType.DESTINATION).withName("destination1")
.withDestinationSettings(new DataflowDestinationOperationSettings()
.withEndpointRef("fabric-endpoint").withDataDestination("telemetryTable")))))
.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 dataflow_create_or_update_simple_fabric.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.dataflow.begin_create_or_update(
resource_group_name="rgiotoperations",
instance_name="resource-name123",
dataflow_profile_name="resource-name123",
dataflow_name="aio-to-fabric",
resource={
"extendedLocation": {"name": "qmbrfwcpwwhggszhrdjv", "type": "CustomLocation"},
"properties": {
"mode": "Enabled",
"operations": [
{
"name": "source1",
"operationType": "Source",
"sourceSettings": {
"dataSources": ["azure-iot-operations/data/thermostat"],
"endpointRef": "aio-builtin-broker-endpoint",
},
},
{
"builtInTransformationSettings": {
"schemaRef": "aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0",
"serializationFormat": "Parquet",
},
"operationType": "BuiltInTransformation",
},
{
"destinationSettings": {"dataDestination": "telemetryTable", "endpointRef": "fabric-endpoint"},
"name": "destination1",
"operationType": "Destination",
},
],
},
},
).result()
print(response)
# x-ms-original-file: 2024-11-01/Dataflow_CreateOrUpdate_SimpleFabric.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/Dataflow_CreateOrUpdate_SimpleFabric.json
func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateSimpleFabric() {
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.NewDataflowClient().BeginCreateOrUpdate(ctx, "rgiotoperations", "resource-name123", "resource-name123", "aio-to-fabric", armiotoperations.DataflowResource{
Properties: &armiotoperations.DataflowProperties{
Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
Operations: []*armiotoperations.DataflowOperation{
{
OperationType: to.Ptr(armiotoperations.OperationTypeSource),
Name: to.Ptr("source1"),
SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
DataSources: []*string{
to.Ptr("azure-iot-operations/data/thermostat"),
},
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
SerializationFormat: to.Ptr(armiotoperations.TransformationSerializationFormatParquet),
SchemaRef: to.Ptr("aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0"),
},
},
{
OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
Name: to.Ptr("destination1"),
DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
EndpointRef: to.Ptr("fabric-endpoint"),
DataDestination: to.Ptr("telemetryTable"),
},
},
},
},
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.DataflowClientCreateOrUpdateResponse{
// DataflowResource: &armiotoperations.DataflowResource{
// Properties: &armiotoperations.DataflowProperties{
// Mode: to.Ptr(armiotoperations.OperationalModeEnabled),
// Operations: []*armiotoperations.DataflowOperation{
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeSource),
// Name: to.Ptr("source1"),
// SourceSettings: &armiotoperations.DataflowSourceOperationSettings{
// EndpointRef: to.Ptr("aio-builtin-broker-endpoint"),
// DataSources: []*string{
// to.Ptr("azure-iot-operations/data/thermostat"),
// },
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeBuiltInTransformation),
// BuiltInTransformationSettings: &armiotoperations.DataflowBuiltInTransformationSettings{
// SerializationFormat: to.Ptr(armiotoperations.TransformationSerializationFormatParquet),
// SchemaRef: to.Ptr("aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0"),
// },
// },
// {
// OperationType: to.Ptr(armiotoperations.OperationTypeDestination),
// Name: to.Ptr("destination1"),
// DestinationSettings: &armiotoperations.DataflowDestinationOperationSettings{
// EndpointRef: to.Ptr("fabric-endpoint"),
// DataDestination: to.Ptr("telemetryTable"),
// },
// },
// },
// 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/dataflowProfiles/resource-name123/dataflows/resource-name123"),
// Name: to.Ptr("jxhcpwgfkxqasbexkookvxk"),
// Type: to.Ptr("zkuozvgjseokfchkscoswthzjdry"),
// 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
Sample response
{
"properties": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"builtInTransformationSettings": {
"serializationFormat": "Parquet",
"schemaRef": "aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0"
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "fabric-endpoint",
"dataDestination": "telemetryTable"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"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": {
"mode": "Enabled",
"operations": [
{
"operationType": "Source",
"name": "source1",
"sourceSettings": {
"endpointRef": "aio-builtin-broker-endpoint",
"dataSources": [
"azure-iot-operations/data/thermostat"
]
}
},
{
"operationType": "BuiltInTransformation",
"builtInTransformationSettings": {
"serializationFormat": "Parquet",
"schemaRef": "aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0"
}
},
{
"operationType": "Destination",
"name": "destination1",
"destinationSettings": {
"endpointRef": "fabric-endpoint",
"dataDestination": "telemetryTable"
}
}
],
"provisioningState": "Succeeded"
},
"extendedLocation": {
"name": "qmbrfwcpwwhggszhrdjv",
"type": "CustomLocation"
},
"id": "/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.IoTOperations/instances/resource-name123/dataflowProfiles/resource-name123/dataflows/resource-name123",
"name": "jxhcpwgfkxqasbexkookvxk",
"type": "zkuozvgjseokfchkscoswthzjdry",
"systemData": {
"createdBy": "ssvaslsmudloholronopqyxjcu",
"createdByType": "User",
"createdAt": "2024-08-09T18:13:29.389Z",
"lastModifiedBy": "gnicpuszwd",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-09T18:13:29.389Z"
}
}
Definitions
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
Dataflow BuiltIn Transformation dataset properties
Name |
Type |
Description |
description
|
string
|
A user provided optional description of the dataset.
|
expression
|
string
|
Condition to enrich data from Broker State Store. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided)
|
inputs
|
string[]
|
List of fields for enriching from the Broker State Store.
|
key
|
string
|
The key of the dataset.
|
schemaRef
|
string
|
The reference to the schema that describes the dataset. Allowed: JSON Schema/draft-7.
|
Dataflow BuiltIn Transformation filter properties
Name |
Type |
Default value |
Description |
description
|
string
|
|
A user provided optional description of the filter.
|
expression
|
string
|
|
Condition to filter data. Can reference input fields with {n} where n is the index of the input field starting from 1. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided)
|
inputs
|
string[]
|
|
List of fields for filtering in JSON path expression.
|
type
|
FilterType
|
Filter
|
The type of dataflow operation.
|
Dataflow BuiltIn Transformation map properties
Name |
Type |
Description |
description
|
string
|
A user provided optional description of the mapping function.
|
expression
|
string
|
Modify the inputs field(s) to the final output field. Example: $1 * 2.2 (Assuming inputs section $1 is provided)
|
inputs
|
string[]
|
List of fields for mapping in JSON path expression.
|
output
|
string
|
Where and how the input fields to be organized in the output record.
|
type
|
DataflowMappingType
|
Type of transformation.
|
Dataflow BuiltIn Transformation properties
DataflowDestinationOperationSettings
Dataflow Destination Operation properties
Name |
Type |
Description |
dataDestination
|
string
|
Destination location, can be a topic or table name. Supports dynamic values with $topic, $systemProperties, $userProperties, $payload, $context, and $subscription.
|
endpointRef
|
string
|
Reference to the Endpoint CR. Can be of Broker, Kafka, Fabric, ADLS, ADX type.
|
DataflowMappingType
Dataflow type mapping properties
Name |
Type |
Description |
BuiltInFunction
|
string
|
Built in function type
|
Compute
|
string
|
Compute type
|
NewProperties
|
string
|
New Properties type
|
PassThrough
|
string
|
Pass-through type
|
Rename
|
string
|
Rename type
|
DataflowOperation
Dataflow Operation properties. NOTE - One only method is allowed to be used for one entry.
DataflowProperties
Dataflow Resource properties
Name |
Type |
Default value |
Description |
mode
|
OperationalMode
|
Enabled
|
Mode for Dataflow. Optional; defaults to Enabled.
|
operations
|
DataflowOperation[]
|
|
List of operations including source and destination references as well as transformation.
|
provisioningState
|
ProvisioningState
|
|
The status of the last operation.
|
DataflowResource
Instance dataflowProfile dataflow 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
|
DataflowProperties
|
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"
|
DataflowSourceOperationSettings
Dataflow Source Operation properties
Name |
Type |
Default value |
Description |
assetRef
|
string
|
|
Reference to the resource in Azure Device Registry where the data in the endpoint originates from.
|
dataSources
|
string[]
|
|
List of source locations. Can be Broker or Kafka topics. Supports wildcards # and +.
|
endpointRef
|
string
|
|
Reference to the Dataflow Endpoint resource. Can only be of Broker and Kafka type.
|
schemaRef
|
string
|
|
Schema CR reference. Data will be deserialized according to the schema, and dropped if it doesn't match.
|
serializationFormat
|
SourceSerializationFormat
|
Json
|
Content is a JSON Schema. Allowed: JSON Schema/draft-7.
|
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
|
FilterType
Filter Type properties
Name |
Type |
Description |
Filter
|
string
|
Filter type
|
OperationalMode
Mode properties
Name |
Type |
Description |
Disabled
|
string
|
Disabled is equivalent to False.
|
Enabled
|
string
|
Enabled is equivalent to True
|
OperationType
Dataflow Operation Type properties
Name |
Type |
Description |
BuiltInTransformation
|
string
|
Dataflow BuiltIn Transformation Operation
|
Destination
|
string
|
Dataflow Destination Operation
|
Source
|
string
|
Dataflow Source Operation
|
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.
|
Serialization Format properties
Name |
Type |
Description |
Json
|
string
|
JSON Format
|
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.
|
Transformation Format properties
Name |
Type |
Description |
Delta
|
string
|
Delta Format
|
Json
|
string
|
JSON Format
|
Parquet
|
string
|
Parquet Format
|