1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from azure.identity import DefaultAzureCredential
from azure.mgmt.logic import LogicManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-logic
# USAGE
python create_or_update_schema.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 = LogicManagementClient(
credential=DefaultAzureCredential(),
subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
)
response = client.integration_account_schemas.create_or_update(
resource_group_name="testResourceGroup",
integration_account_name="testIntegrationAccount",
schema_name="testSchema",
schema={
"location": "westus",
"properties": {
"content": '<?xml version="1.0" encoding="utf-16"?>\r\n<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://Inbound_EDI.OrderFile" targetNamespace="http://Inbound_EDI.OrderFile" xmlns:xs="http://www.w3.org/2001/XMLSchema">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:schemaInfo default_pad_char=" " count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" standard="Flat File" root_reference="OrderFile" />\r\n <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:element name="OrderFile">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:complexType>\r\n <xs:sequence>\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:groupInfo sequence_number="0" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:element name="Order">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="infix" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:complexType>\r\n <xs:sequence>\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:groupInfo sequence_number="0" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:element name="Header">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="char" child_delimiter="|" child_order="infix" tag_name="HDR|" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:complexType>\r\n <xs:sequence>\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:groupInfo sequence_number="0" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:element name="PODate" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="1" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="PONumber" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo justification="left" sequence_number="2" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="CustomerID" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="3" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="CustomerContactName" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="4" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="CustomerContactPhone" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="5" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n </xs:sequence>\r\n </xs:complexType>\r\n </xs:element>\r\n <xs:element minOccurs="1" maxOccurs="unbounded" name="LineItems">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="char" child_delimiter="|" child_order="infix" tag_name="DTL|" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:complexType>\r\n <xs:sequence>\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:groupInfo sequence_number="0" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n <xs:element name="PONumber" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="1" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="ItemOrdered" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="2" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="Quantity" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="3" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="UOM" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="4" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="Price" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="5" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="ExtendedPrice" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="6" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n <xs:element name="Description" type="xs:string">\r\n <xs:annotation>\r\n <xs:appinfo>\r\n <b:fieldInfo sequence_number="7" justification="left" />\r\n </xs:appinfo>\r\n </xs:annotation>\r\n </xs:element>\r\n </xs:sequence>\r\n </xs:complexType>\r\n </xs:element>\r\n </xs:sequence>\r\n </xs:complexType>\r\n </xs:element>\r\n </xs:sequence>\r\n </xs:complexType>\r\n </xs:element>\r\n</xs:schema>',
"contentType": "application/xml",
"metadata": {},
"schemaType": "Xml",
},
"tags": {"integrationAccountSchemaName": "IntegrationAccountSchema8120"},
},
)
print(response)
# x-ms-original-file: specification/logic/resource-manager/Microsoft.Logic/stable/2019-05-01/examples/IntegrationAccountSchemas_CreateOrUpdate.json
if __name__ == "__main__":
main()
|