コード例 #1
0
 /// <summary>
 /// Update a connection.  (see
 /// http://aka.ms/azureautomationsdk/connectionoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Automation.IConnectionOperations.
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters supplied to the update a connection
 /// operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> UpdateAsync(this IConnectionOperations operations, string automationAccount, ConnectionUpdateParameters parameters)
 {
     return operations.UpdateAsync(automationAccount, parameters, CancellationToken.None);
 }
コード例 #2
0
        public Connection UpdateConnectionFieldValue(string automationAccountName, string name, string connectionFieldName, object value)
        {
            var connectionModel = this.TryGetConnectionModel(automationAccountName, name);
            if (connectionModel == null)
            {
                throw new ResourceCommonException(typeof(Connection),
                    string.Format(CultureInfo.CurrentCulture, Resources.ConnectionNotFound, name));
            }

            if (connectionModel.Properties.FieldDefinitionValues.ContainsKey(connectionFieldName))
            {
                connectionModel.Properties.FieldDefinitionValues[connectionFieldName] =
                    PowerShellJsonConverter.Serialize(value);
            }
            else
            {
                throw new ResourceCommonException(typeof(Connection),
                   string.Format(CultureInfo.CurrentCulture, Resources.ConnectionFieldNameNotFound, name));
            }

            var cuparam = new ConnectionUpdateParameters()
            {
                Name = name,
                Properties = new ConnectionUpdateProperties()
                {
                    Description = connectionModel.Properties.Description,
                    FieldDefinitionValues = connectionModel.Properties.FieldDefinitionValues
                }
            };

            this.automationManagementClient.Connections.Update(automationAccountName, cuparam);

            return new Connection(automationAccountName, this.automationManagementClient.Connections.Get(automationAccountName, name).Connection);
        }
コード例 #3
0
 /// <summary>
 /// Update a connection.  (see
 /// http://aka.ms/azureautomationsdk/connectionoperations for more
 /// information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.Automation.IConnectionOperations.
 /// </param>
 /// <param name='automationAccount'>
 /// Required. The automation account name.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters supplied to the update a connection
 /// operation.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse Update(this IConnectionOperations operations, string automationAccount, ConnectionUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IConnectionOperations)s).UpdateAsync(automationAccount, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }