예제 #1
0
 /// <summary>
 /// Initializes a new instance of the ConnectionCreateParameters class
 /// with required arguments.
 /// </summary>
 public ConnectionCreateParameters(string name, ConnectionCreateProperties properties)
     : this()
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (properties == null)
     {
         throw new ArgumentNullException("properties");
     }
     this.Name       = name;
     this.Properties = properties;
 }
 /// <summary>
 /// Initializes a new instance of the ConnectionCreateParameters class
 /// with required arguments.
 /// </summary>
 public ConnectionCreateParameters(string name, ConnectionCreateProperties properties)
     : this()
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (properties == null)
     {
         throw new ArgumentNullException("properties");
     }
     this.Name = name;
     this.Properties = properties;
 }
예제 #3
0
        public Connection CreateConnection(string automationAccountName, string name, string connectionTypeName, IDictionary connectionFieldValues,
            string description)
        {
            var connectionModel = this.TryGetConnectionModel(automationAccountName, name);
            if (connectionModel != null)
            {
                throw new ResourceCommonException(typeof(Connection),
                    string.Format(CultureInfo.CurrentCulture, Resources.ConnectionAlreadyExists, name));
            }

            var ccprop = new ConnectionCreateProperties()
            {
                Description = description,
                ConnectionType = new ConnectionTypeAssociationProperty() { Name = connectionTypeName },
                FieldDefinitionValues = connectionFieldValues.Cast<DictionaryEntry>().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString())
            };

            var ccparam = new ConnectionCreateParameters() { Name = name, Properties = ccprop };

            var connection = this.automationManagementClient.Connections.Create(automationAccountName, ccparam).Connection;

            return new Connection(automationAccountName, connection);
        }