< Summary

Class:Azure.Analytics.Synapse.Artifacts.Models.AzureFunctionActivity
Assembly:Azure.Analytics.Synapse.Artifacts
File(s):C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\AzureFunctionActivity.cs
C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\AzureFunctionActivity.Serialization.cs
Covered lines:0
Uncovered lines:122
Coverable lines:122
Total lines:247
Line coverage:0% (0 of 122)
Covered branches:0
Total branches:60
Branch coverage:0% (0 of 60)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_Method()-0%100%
get_FunctionName()-0%100%
get_Headers()-0%100%
get_Body()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeAzureFunctionActivity(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\AzureFunctionActivity.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10
 11namespace Azure.Analytics.Synapse.Artifacts.Models
 12{
 13    /// <summary> Azure Function activity. </summary>
 14    public partial class AzureFunctionActivity : ExecutionActivity
 15    {
 16        /// <summary> Initializes a new instance of AzureFunctionActivity. </summary>
 17        /// <param name="name"> Activity name. </param>
 18        /// <param name="method"> Rest API method for target endpoint. </param>
 19        /// <param name="functionName"> Name of the Function that the Azure Function Activity will call. Type: string (o
 20        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="functionName"/> is null.
 021        public AzureFunctionActivity(string name, AzureFunctionActivityMethod method, object functionName) : base(name)
 22        {
 023            if (name == null)
 24            {
 025                throw new ArgumentNullException(nameof(name));
 26            }
 027            if (functionName == null)
 28            {
 029                throw new ArgumentNullException(nameof(functionName));
 30            }
 31
 032            Method = method;
 033            FunctionName = functionName;
 034            Type = "AzureFunctionActivity";
 035        }
 36
 37        /// <summary> Initializes a new instance of AzureFunctionActivity. </summary>
 38        /// <param name="name"> Activity name. </param>
 39        /// <param name="type"> Type of activity. </param>
 40        /// <param name="description"> Activity description. </param>
 41        /// <param name="dependsOn"> Activity depends on condition. </param>
 42        /// <param name="userProperties"> Activity user properties. </param>
 43        /// <param name="additionalProperties"> . </param>
 44        /// <param name="linkedServiceName"> Linked service reference. </param>
 45        /// <param name="policy"> Activity policy. </param>
 46        /// <param name="method"> Rest API method for target endpoint. </param>
 47        /// <param name="functionName"> Name of the Function that the Azure Function Activity will call. Type: string (o
 48        /// <param name="headers"> Represents the headers that will be sent to the request. For example, to set the lang
 49        /// <param name="body"> Represents the payload that will be sent to the endpoint. Required for POST/PUT method, 
 050        internal AzureFunctionActivity(string name, string type, string description, IList<ActivityDependency> dependsOn
 51        {
 052            Method = method;
 053            FunctionName = functionName;
 054            Headers = headers;
 055            Body = body;
 056            Type = type ?? "AzureFunctionActivity";
 057        }
 58
 59        /// <summary> Rest API method for target endpoint. </summary>
 060        public AzureFunctionActivityMethod Method { get; set; }
 61        /// <summary> Name of the Function that the Azure Function Activity will call. Type: string (or Expression with 
 062        public object FunctionName { get; set; }
 63        /// <summary> Represents the headers that will be sent to the request. For example, to set the language and type
 064        public object Headers { get; set; }
 65        /// <summary> Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowe
 066        public object Body { get; set; }
 67    }
 68}

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\AzureFunctionActivity.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Analytics.Synapse.Artifacts.Models
 13{
 14    public partial class AzureFunctionActivity : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Optional.IsDefined(LinkedServiceName))
 20            {
 021                writer.WritePropertyName("linkedServiceName");
 022                writer.WriteObjectValue(LinkedServiceName);
 23            }
 024            if (Optional.IsDefined(Policy))
 25            {
 026                writer.WritePropertyName("policy");
 027                writer.WriteObjectValue(Policy);
 28            }
 029            writer.WritePropertyName("name");
 030            writer.WriteStringValue(Name);
 031            writer.WritePropertyName("type");
 032            writer.WriteStringValue(Type);
 033            if (Optional.IsDefined(Description))
 34            {
 035                writer.WritePropertyName("description");
 036                writer.WriteStringValue(Description);
 37            }
 038            if (Optional.IsCollectionDefined(DependsOn))
 39            {
 040                writer.WritePropertyName("dependsOn");
 041                writer.WriteStartArray();
 042                foreach (var item in DependsOn)
 43                {
 044                    writer.WriteObjectValue(item);
 45                }
 046                writer.WriteEndArray();
 47            }
 048            if (Optional.IsCollectionDefined(UserProperties))
 49            {
 050                writer.WritePropertyName("userProperties");
 051                writer.WriteStartArray();
 052                foreach (var item in UserProperties)
 53                {
 054                    writer.WriteObjectValue(item);
 55                }
 056                writer.WriteEndArray();
 57            }
 058            writer.WritePropertyName("typeProperties");
 059            writer.WriteStartObject();
 060            writer.WritePropertyName("method");
 061            writer.WriteStringValue(Method.ToString());
 062            writer.WritePropertyName("functionName");
 063            writer.WriteObjectValue(FunctionName);
 064            if (Optional.IsDefined(Headers))
 65            {
 066                writer.WritePropertyName("headers");
 067                writer.WriteObjectValue(Headers);
 68            }
 069            if (Optional.IsDefined(Body))
 70            {
 071                writer.WritePropertyName("body");
 072                writer.WriteObjectValue(Body);
 73            }
 074            writer.WriteEndObject();
 075            foreach (var item in AdditionalProperties)
 76            {
 077                writer.WritePropertyName(item.Key);
 078                writer.WriteObjectValue(item.Value);
 79            }
 080            writer.WriteEndObject();
 081        }
 82
 83        internal static AzureFunctionActivity DeserializeAzureFunctionActivity(JsonElement element)
 84        {
 085            Optional<LinkedServiceReference> linkedServiceName = default;
 086            Optional<ActivityPolicy> policy = default;
 087            string name = default;
 088            string type = default;
 089            Optional<string> description = default;
 090            Optional<IList<ActivityDependency>> dependsOn = default;
 091            Optional<IList<UserProperty>> userProperties = default;
 092            AzureFunctionActivityMethod method = default;
 093            object functionName = default;
 094            Optional<object> headers = default;
 095            Optional<object> body = default;
 096            IDictionary<string, object> additionalProperties = default;
 097            Dictionary<string, object> additionalPropertiesDictionary = default;
 098            foreach (var property in element.EnumerateObject())
 99            {
 0100                if (property.NameEquals("linkedServiceName"))
 101                {
 0102                    linkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value);
 0103                    continue;
 104                }
 0105                if (property.NameEquals("policy"))
 106                {
 0107                    policy = ActivityPolicy.DeserializeActivityPolicy(property.Value);
 0108                    continue;
 109                }
 0110                if (property.NameEquals("name"))
 111                {
 0112                    name = property.Value.GetString();
 0113                    continue;
 114                }
 0115                if (property.NameEquals("type"))
 116                {
 0117                    type = property.Value.GetString();
 0118                    continue;
 119                }
 0120                if (property.NameEquals("description"))
 121                {
 0122                    description = property.Value.GetString();
 0123                    continue;
 124                }
 0125                if (property.NameEquals("dependsOn"))
 126                {
 0127                    List<ActivityDependency> array = new List<ActivityDependency>();
 0128                    foreach (var item in property.Value.EnumerateArray())
 129                    {
 0130                        array.Add(ActivityDependency.DeserializeActivityDependency(item));
 131                    }
 0132                    dependsOn = array;
 0133                    continue;
 134                }
 0135                if (property.NameEquals("userProperties"))
 136                {
 0137                    List<UserProperty> array = new List<UserProperty>();
 0138                    foreach (var item in property.Value.EnumerateArray())
 139                    {
 0140                        array.Add(UserProperty.DeserializeUserProperty(item));
 141                    }
 0142                    userProperties = array;
 0143                    continue;
 144                }
 0145                if (property.NameEquals("typeProperties"))
 146                {
 0147                    foreach (var property0 in property.Value.EnumerateObject())
 148                    {
 0149                        if (property0.NameEquals("method"))
 150                        {
 0151                            method = new AzureFunctionActivityMethod(property0.Value.GetString());
 0152                            continue;
 153                        }
 0154                        if (property0.NameEquals("functionName"))
 155                        {
 0156                            functionName = property0.Value.GetObject();
 0157                            continue;
 158                        }
 0159                        if (property0.NameEquals("headers"))
 160                        {
 0161                            headers = property0.Value.GetObject();
 0162                            continue;
 163                        }
 0164                        if (property0.NameEquals("body"))
 165                        {
 0166                            body = property0.Value.GetObject();
 167                            continue;
 168                        }
 169                    }
 170                    continue;
 171                }
 0172                additionalPropertiesDictionary ??= new Dictionary<string, object>();
 0173                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
 174            }
 0175            additionalProperties = additionalPropertiesDictionary;
 0176            return new AzureFunctionActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(
 177        }
 178    }
 179}