public void SecurityContacts_Update()
        {
            using (var context = MockContext.Start(this.GetType()))
            {
                var securityCenterClient = GetSecurityCenterClient(context);

                var contact = new SecurityContact("*****@*****.**", "", "Off", "Off");

                var securityContact = securityCenterClient.SecurityContacts.Update("default2", contact);
                ValidateSecurityContact(securityContact);
            }
        }
 public static PSSecurityContact ConvertToPSType(this SecurityContact value)
 {
     return(new PSSecurityContact()
     {
         Id = value.Id,
         Name = value.Name,
         Email = value.Email,
         Phone = value.Phone,
         AlertNotifications = value.AlertNotifications,
         AlertsToAdmins = value.AlertsToAdmins
     });
 }
        public override void ExecuteCmdlet()
        {
            var alertAdmin        = AlertAdmin.IsPresent ? "On" : "Off";
            var alertNotification = NotifyOnAlert.IsPresent ? "On" : "Off";

            if (ShouldProcess(Name, VerbsCommon.Set))
            {
                var contact = new SecurityContact(Email, Phone, alertNotification, alertAdmin);
                var sc      = SecurityCenterClient.SecurityContacts.CreateWithHttpMessagesAsync(Name, contact).GetAwaiter().GetResult().Body;

                WriteObject(sc.ConvertToPSType(), enumerateCollection: true);
            }
        }
 /// <summary>
 /// Security contact configurations for the subscription
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='securityContactName'>
 /// Name of the security contact object
 /// </param>
 /// <param name='securityContact'>
 /// Security contact object
 /// </param>
 public static SecurityContact Create(this ISecurityContactsOperations operations, string securityContactName, SecurityContact securityContact)
 {
     return operations.CreateAsync(securityContactName, securityContact).GetAwaiter().GetResult();
 }
 /// <summary>
 /// Security contact configurations for the subscription
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='securityContactName'>
 /// Name of the security contact object
 /// </param>
 /// <param name='securityContact'>
 /// Security contact object
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<SecurityContact> UpdateAsync(this ISecurityContactsOperations operations, string securityContactName, SecurityContact securityContact, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateWithHttpMessagesAsync(securityContactName, securityContact, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
 private void ValidateSecurityContact(SecurityContact securityContact)
 {
     Assert.NotNull(securityContact);
 }