/// <summary>
        /// Creates and returns <see cref="AutoBackupSettings"/> object.
        /// </summary>
        protected override void ProcessRecord()
        {
            AutoBackupSettings autoBackupSettings = new AutoBackupSettings();

            autoBackupSettings.Enable           = (Enable.IsPresent) ? Enable.ToBool() : false;
            autoBackupSettings.EnableEncryption = (EnableEncryption.IsPresent) ? EnableEncryption.ToBool() : false;
            autoBackupSettings.RetentionPeriod  = RetentionPeriodInDays;

            switch (ParameterSetName)
            {
            case StorageContextParamSetName:
                autoBackupSettings.StorageUrl       = StorageContext.BlobEndPoint;
                autoBackupSettings.StorageAccessKey = this.GetStorageKey();
                break;

            case StorageUriParamSetName:
                autoBackupSettings.StorageUrl       = (StorageUri == null)? null: StorageUri.ToString();
                autoBackupSettings.StorageAccessKey = (StorageKey == null)? null: SecureStringHelper.ConvertToUnsecureString(StorageKey);
                break;
            }

            // Check if certificate password was set
            autoBackupSettings.Password = (CertificatePassword == null) ? null : SecureStringHelper.ConvertToUnsecureString(CertificatePassword);

            WriteObject(autoBackupSettings);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates and returns <see cref="AutoBackupSettings"/> object.
        /// </summary>
        protected override void ProcessRecord()
        {
            AutoBackupSettings autoBackupSettings = new AutoBackupSettings();

            autoBackupSettings.Enable           = (Enable.IsPresent) ? Enable.ToBool() : false;
            autoBackupSettings.EnableEncryption = (EnableEncryption.IsPresent) ? EnableEncryption.ToBool() : false;
            autoBackupSettings.RetentionPeriod  = RetentionPeriodInDays;

            switch (ParameterSetName)
            {
            case StorageContextParamSetName:
                autoBackupSettings.StorageUrl       = StorageContext.BlobEndPoint;
                autoBackupSettings.StorageAccessKey = this.GetStorageKey();
                break;

            case StorageUriParamSetName:
                autoBackupSettings.StorageUrl       = (StorageUri == null)? null: StorageUri.ToString();
                autoBackupSettings.StorageAccessKey = (StorageKey == null)? null: SecureStringHelper.ConvertToUnsecureString(StorageKey);
                break;
            }

            // Check if certificate password was set
            autoBackupSettings.Password = (CertificatePassword == null) ? null : SecureStringHelper.ConvertToUnsecureString(CertificatePassword);

            autoBackupSettings.BackupSystemDbs    = BackupSystemDbs.IsPresent ? BackupSystemDbs.ToBool() : false;
            autoBackupSettings.BackupScheduleType = BackupScheduleType;

            // Set other Backup schedule settings only if BackUpSchedule type is Manual.
            if (!string.IsNullOrEmpty(BackupScheduleType) && string.Equals(BackupScheduleType, BackupScheduleManualType, StringComparison.InvariantCultureIgnoreCase))
            {
                ValidateBackupScheduleSettings();

                autoBackupSettings.FullBackupFrequency   = FullBackupFrequency;
                autoBackupSettings.FullBackupStartTime   = FullBackupStartHour;
                autoBackupSettings.FullBackupWindowHours = FullBackupWindowInHours;
                autoBackupSettings.LogBackupFrequency    = LogBackupFrequencyInMinutes;
            }

            WriteObject(autoBackupSettings);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ConnectorPingTimeout != null)
         {
             hashCode = hashCode * 59 + ConnectorPingTimeout.GetHashCode();
         }
         if (ConnectorPingInterval != null)
         {
             hashCode = hashCode * 59 + ConnectorPingInterval.GetHashCode();
         }
         if (DiscoveryLiteCheckInterval != null)
         {
             hashCode = hashCode * 59 + DiscoveryLiteCheckInterval.GetHashCode();
         }
         if (ClusterSyncServiceTimeout != null)
         {
             hashCode = hashCode * 59 + ClusterSyncServiceTimeout.GetHashCode();
         }
         if (ClusterSyncServiceInterval != null)
         {
             hashCode = hashCode * 59 + ClusterSyncServiceInterval.GetHashCode();
         }
         if (EnableSyncToken != null)
         {
             hashCode = hashCode * 59 + EnableSyncToken.GetHashCode();
         }
         if (MinEventDelay != null)
         {
             hashCode = hashCode * 59 + MinEventDelay.GetHashCode();
         }
         if (SocketConnectTimeout != null)
         {
             hashCode = hashCode * 59 + SocketConnectTimeout.GetHashCode();
         }
         if (SoTimeout != null)
         {
             hashCode = hashCode * 59 + SoTimeout.GetHashCode();
         }
         if (TopologyConnectorUrls != null)
         {
             hashCode = hashCode * 59 + TopologyConnectorUrls.GetHashCode();
         }
         if (TopologyConnectorWhitelist != null)
         {
             hashCode = hashCode * 59 + TopologyConnectorWhitelist.GetHashCode();
         }
         if (AutoStopLocalLoopEnabled != null)
         {
             hashCode = hashCode * 59 + AutoStopLocalLoopEnabled.GetHashCode();
         }
         if (GzipConnectorRequestsEnabled != null)
         {
             hashCode = hashCode * 59 + GzipConnectorRequestsEnabled.GetHashCode();
         }
         if (HmacEnabled != null)
         {
             hashCode = hashCode * 59 + HmacEnabled.GetHashCode();
         }
         if (EnableEncryption != null)
         {
             hashCode = hashCode * 59 + EnableEncryption.GetHashCode();
         }
         if (SharedKey != null)
         {
             hashCode = hashCode * 59 + SharedKey.GetHashCode();
         }
         if (HmacSharedKeyTTL != null)
         {
             hashCode = hashCode * 59 + HmacSharedKeyTTL.GetHashCode();
         }
         if (BackoffStandbyFactor != null)
         {
             hashCode = hashCode * 59 + BackoffStandbyFactor.GetHashCode();
         }
         if (BackoffStableFactor != null)
         {
             hashCode = hashCode * 59 + BackoffStableFactor.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns true if OrgApacheSlingDiscoveryOakConfigProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingDiscoveryOakConfigProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingDiscoveryOakConfigProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ConnectorPingTimeout == other.ConnectorPingTimeout ||
                     ConnectorPingTimeout != null &&
                     ConnectorPingTimeout.Equals(other.ConnectorPingTimeout)
                     ) &&
                 (
                     ConnectorPingInterval == other.ConnectorPingInterval ||
                     ConnectorPingInterval != null &&
                     ConnectorPingInterval.Equals(other.ConnectorPingInterval)
                 ) &&
                 (
                     DiscoveryLiteCheckInterval == other.DiscoveryLiteCheckInterval ||
                     DiscoveryLiteCheckInterval != null &&
                     DiscoveryLiteCheckInterval.Equals(other.DiscoveryLiteCheckInterval)
                 ) &&
                 (
                     ClusterSyncServiceTimeout == other.ClusterSyncServiceTimeout ||
                     ClusterSyncServiceTimeout != null &&
                     ClusterSyncServiceTimeout.Equals(other.ClusterSyncServiceTimeout)
                 ) &&
                 (
                     ClusterSyncServiceInterval == other.ClusterSyncServiceInterval ||
                     ClusterSyncServiceInterval != null &&
                     ClusterSyncServiceInterval.Equals(other.ClusterSyncServiceInterval)
                 ) &&
                 (
                     EnableSyncToken == other.EnableSyncToken ||
                     EnableSyncToken != null &&
                     EnableSyncToken.Equals(other.EnableSyncToken)
                 ) &&
                 (
                     MinEventDelay == other.MinEventDelay ||
                     MinEventDelay != null &&
                     MinEventDelay.Equals(other.MinEventDelay)
                 ) &&
                 (
                     SocketConnectTimeout == other.SocketConnectTimeout ||
                     SocketConnectTimeout != null &&
                     SocketConnectTimeout.Equals(other.SocketConnectTimeout)
                 ) &&
                 (
                     SoTimeout == other.SoTimeout ||
                     SoTimeout != null &&
                     SoTimeout.Equals(other.SoTimeout)
                 ) &&
                 (
                     TopologyConnectorUrls == other.TopologyConnectorUrls ||
                     TopologyConnectorUrls != null &&
                     TopologyConnectorUrls.Equals(other.TopologyConnectorUrls)
                 ) &&
                 (
                     TopologyConnectorWhitelist == other.TopologyConnectorWhitelist ||
                     TopologyConnectorWhitelist != null &&
                     TopologyConnectorWhitelist.Equals(other.TopologyConnectorWhitelist)
                 ) &&
                 (
                     AutoStopLocalLoopEnabled == other.AutoStopLocalLoopEnabled ||
                     AutoStopLocalLoopEnabled != null &&
                     AutoStopLocalLoopEnabled.Equals(other.AutoStopLocalLoopEnabled)
                 ) &&
                 (
                     GzipConnectorRequestsEnabled == other.GzipConnectorRequestsEnabled ||
                     GzipConnectorRequestsEnabled != null &&
                     GzipConnectorRequestsEnabled.Equals(other.GzipConnectorRequestsEnabled)
                 ) &&
                 (
                     HmacEnabled == other.HmacEnabled ||
                     HmacEnabled != null &&
                     HmacEnabled.Equals(other.HmacEnabled)
                 ) &&
                 (
                     EnableEncryption == other.EnableEncryption ||
                     EnableEncryption != null &&
                     EnableEncryption.Equals(other.EnableEncryption)
                 ) &&
                 (
                     SharedKey == other.SharedKey ||
                     SharedKey != null &&
                     SharedKey.Equals(other.SharedKey)
                 ) &&
                 (
                     HmacSharedKeyTTL == other.HmacSharedKeyTTL ||
                     HmacSharedKeyTTL != null &&
                     HmacSharedKeyTTL.Equals(other.HmacSharedKeyTTL)
                 ) &&
                 (
                     BackoffStandbyFactor == other.BackoffStandbyFactor ||
                     BackoffStandbyFactor != null &&
                     BackoffStandbyFactor.Equals(other.BackoffStandbyFactor)
                 ) &&
                 (
                     BackoffStableFactor == other.BackoffStableFactor ||
                     BackoffStableFactor != null &&
                     BackoffStableFactor.Equals(other.BackoffStableFactor)
                 ));
        }