Esempio n. 1
0
        /// <summary>
        /// Populates Service bus message object with valid values.
        /// </summary>
        /// <param name="serviceBusQueueActionParams">Service bus properties specified via PowerShell.</param>
        /// <param name="serviceBusMessage">Servce message object to be populated.</param>
        private void PopulateServiceBusMessage(PSServiceBusParams serviceBusQueueActionParams, ServiceBusMessage serviceBusMessage)
        {
            if (string.IsNullOrWhiteSpace(serviceBusQueueActionParams.NamespaceProperty) ||
                string.IsNullOrWhiteSpace(serviceBusQueueActionParams.Message) ||
                string.IsNullOrWhiteSpace(serviceBusQueueActionParams.TransportType))
            {
                throw new PSManagement.PSArgumentException(Resources.SchedulerInvalidServiceBus);
            }

            if (serviceBusMessage == null)
            {
                throw new ArgumentException("serviceBusMessage: Object must be initialized");
            }

            ServiceBusAuthentication authentication = this.GetServiceBusAuthentication(serviceBusQueueActionParams.Authentication);

            serviceBusMessage.Authentication    = this.GetServiceBusAuthentication(serviceBusQueueActionParams.Authentication);
            serviceBusMessage.Message           = serviceBusQueueActionParams.Message;
            serviceBusMessage.NamespaceProperty = serviceBusQueueActionParams.NamespaceProperty;
            serviceBusMessage.TransportType     = serviceBusQueueActionParams.TransportType.GetValueOrDefaultEnum <ServiceBusTransportType>(defaultValue: ServiceBusTransportType.NetMessaging);
        }
Esempio n. 2
0
        /// <summary>
        /// Get service bus authentication details.
        /// </summary>
        /// <param name="authentication">Service bus authentication.</param>
        /// <returns>PSServiceBusJobActionAuthenticationDetails</returns>
        internal static PSServiceBusJobActionAuthenticationDetails GetServiceBusActionAuthenticationDetails(ServiceBusAuthentication authentication)
        {
            if (authentication == null)
            {
                throw new ArgumentNullException(paramName: "authentication");
            }

            var psServiceBusAuthentication = new PSServiceBusJobActionAuthenticationDetails()
            {
                ServiceBusSasKey = authentication.SasKey,
                ServiceBusSasKeyName = authentication.SasKeyName,
                ServiceBusType = authentication.Type.ToString(),
            };

            return psServiceBusAuthentication;
        }
Esempio n. 3
0
 /// <summary>
 /// Populates service bus authentication properties.
 /// </summary>
 /// <param name="serviceBusAuthentication">Service bus authentication properties specified via PowerShell.</param>
 /// <param name="existingServiceBusAuthentication">Existing job's service bus authentication properties.</param>
 private void PopulateServiceBusAuthentication(PSServiceBusAuthenticationParams serviceBusAuthentication, ServiceBusAuthentication existingServiceBusAuthentication)
 {
     if (serviceBusAuthentication != null)
     {
         existingServiceBusAuthentication.SasKey     = serviceBusAuthentication.SasKey.GetValueOrDefault(defaultValue: existingServiceBusAuthentication.SasKey);
         existingServiceBusAuthentication.SasKeyName = serviceBusAuthentication.SasKeyName.GetValueOrDefault(defaultValue: existingServiceBusAuthentication.SasKeyName);
         existingServiceBusAuthentication.Type       = serviceBusAuthentication.Type.GetValueOrDefaultEnum <ServiceBusAuthenticationType?>(defaultValue: existingServiceBusAuthentication.Type);
     }
 }
 /// <summary>
 /// Populates service bus authentication properties.
 /// </summary>
 /// <param name="serviceBusAuthentication">Service bus authentication properties specified via PowerShell.</param>
 /// <param name="existingServiceBusAuthentication">Existing job's service bus authentication properties.</param>
 private void PopulateServiceBusAuthentication(PSServiceBusAuthenticationParams serviceBusAuthentication, ServiceBusAuthentication existingServiceBusAuthentication)
 {
     if (serviceBusAuthentication != null)
     {
         existingServiceBusAuthentication.SasKey = serviceBusAuthentication.SasKey.GetValueOrDefault(defaultValue: existingServiceBusAuthentication.SasKey);
         existingServiceBusAuthentication.SasKeyName = serviceBusAuthentication.SasKeyName.GetValueOrDefault(defaultValue: existingServiceBusAuthentication.SasKeyName);
         existingServiceBusAuthentication.Type = serviceBusAuthentication.Type.GetValueOrDefaultEnum<ServiceBusAuthenticationType?>(defaultValue: existingServiceBusAuthentication.Type);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Get service bus authentication details.
        /// </summary>
        /// <param name="authentication">Service bus authentication.</param>
        /// <returns>PSServiceBusJobActionAuthenticationDetails</returns>
        internal static PSServiceBusJobActionAuthenticationDetails GetServiceBusActionAuthenticationDetails(ServiceBusAuthentication authentication)
        {
            if (authentication == null)
            {
                throw new ArgumentNullException(paramName: "authentication");
            }

            var psServiceBusAuthentication = new PSServiceBusJobActionAuthenticationDetails()
            {
                ServiceBusSasKey     = authentication.SasKey,
                ServiceBusSasKeyName = authentication.SasKeyName,
                ServiceBusType       = authentication.Type.ToString(),
            };

            return(psServiceBusAuthentication);
        }