예제 #1
0
        public override void ExecuteCmdlet()
        {
            SharedAccessAuthorizationRuleAttributes sasRule = new SharedAccessAuthorizationRuleAttributes();

            if (AuthRuleObj != null)
            {
                sasRule = AuthRuleObj;
            }
            else
            {
                NamespaceAttributes getNameSpace = Client.GetNamespace(ResourceGroupName, NamespaceName);

                IList <Management.EventHub.Models.AccessRights?> newListAry = new List <Management.EventHub.Models.AccessRights?>();

                foreach (string test in Rights)
                {
                    newListAry.Add(ParseAccessRights(test));
                }

                sasRule.Name     = AuthorizationRuleName;
                sasRule.Rights   = newListAry;
                sasRule.Location = getNameSpace.Location;
            }

            // Update a eventHub authorizationRule

            if (ShouldProcess(target: AuthorizationRuleName, action: string.Format("Update AuthoriationRule:{0} of NameSpace:{1}", AuthorizationRuleName, NamespaceName)))
            {
                WriteObject(Client.CreateOrUpdateNamespaceAuthorizationRules(ResourceGroupName, NamespaceName, sasRule.Name, sasRule));
            }
        }
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        /// <summary>
        /// Default Constructor
        /// </summary>
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        public Rss20()
        {
            // initialize the static namespaces
            if (!RSS.NamespacesInitialized)
            {
                RSS.InitializeStaticNamespaces();
            }


            // define the default namespace attributes.  We put these in a collection so that the prefixes can be modified
            // just in case there is a conflict, etc.
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.MEDIA_NAMESPACE_PREFIX, RSS.MEDIA_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.DUBLIN_CORE_NAMESPACE_PREFIX, RSS.DUBLIN_CORE_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.DUBLIN_CORE_TERMS_NAMESPACE_PREFIX, RSS.DUBLIN_CORE_TERMS_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.GEORSS_NAMESPACE_PREFIX, RSS.GEORSS_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.OPEN_GIS_GML_NAMESPACE_PREFIX, RSS.OPEN_GIS_GML_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.CONTENT_NAMESPACE_PREFIX, RSS.CONTENT_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.ATOM_NAMESPACE_PREFIX, RSS.ATOM_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.SLASH_NAMESPACE_PREFIX, RSS.SLASH_NAMESPACE_URL));
            NamespaceAttributes.Add(new RssNamespaceAttribute(RSS.CREATIVE_COMMONS_NAMESPACE_PREFIX, RSS.CREATIVE_COMMONS_NAMESPACE_URL));


            // create a new channel
            channel = new RssChannel();
        }
        public override void ExecuteCmdlet()
        {
            SharedAccessAuthorizationRuleAttributes sasRule = new SharedAccessAuthorizationRuleAttributes();

            if (InputObj != null)
            {
                sasRule = InputObj;
            }
            else
            {
                NamespaceAttributes getNameSpace = Client.GetNamespace(ResourceGroup, Namespace);

                IList <Management.ServiceBus.Models.AccessRights?> newListAry = new List <Management.ServiceBus.Models.AccessRights?>();

                foreach (string accRights in Rights)
                {
                    newListAry.Add(ParseAccessRights(accRights));
                }

                sasRule.Name     = Name;
                sasRule.Rights   = newListAry;
                sasRule.Location = getNameSpace.Location;
            }

            // Update a Servicebus Topic authorizationRule

            if (ShouldProcess(target: Name, action: string.Format("Update AuthorizationRule:{0} of Topic:{1} of NameSpace:{2}", Name, Topic, Namespace)))
            {
                WriteObject(Client.CreateOrUpdateServiceBusTopicAuthorizationRules(ResourceGroup, Namespace, Topic, sasRule.Name, sasRule));
            }
        }
예제 #4
0
        public override void ExecuteCmdlet()
        {
            SubscriptionAttributes subAttributes = new SubscriptionAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroup, NamespaceName);

            subAttributes.Location = getNamespaceLoc.Location;

            subAttributes.Name = SubscriptionName;

            if (AutoDeleteOnIdle != null)
            {
                subAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DeadLetteringOnFilterEvaluationExceptions != null)
            {
                subAttributes.DeadLetteringOnFilterEvaluationExceptions = DeadLetteringOnFilterEvaluationExceptions;
            }

            if (DeadLetteringOnMessageExpiration != null)
            {
                subAttributes.DeadLetteringOnMessageExpiration = DeadLetteringOnMessageExpiration;
            }

            if (EnableBatchedOperations != null)
            {
                subAttributes.EnableBatchedOperations = EnableBatchedOperations;
            }

            if (DeadLetteringOnMessageExpiration != null)
            {
                subAttributes.DeadLetteringOnMessageExpiration = DeadLetteringOnMessageExpiration;
            }

            if (IsReadOnly != null)
            {
                subAttributes.IsReadOnly = IsReadOnly;
            }

            if (LockDuration != null)
            {
                subAttributes.LockDuration = LockDuration;
            }

            if (MaxDeliveryCount != null)
            {
                subAttributes.MaxDeliveryCount = MaxDeliveryCount;
            }

            if (RequiresSession != null)
            {
                subAttributes.RequiresSession = RequiresSession;
            }

            if (ShouldProcess(target: SubscriptionName, action: string.Format("Create a new Subscription:{0} for Topic:{1} of Namsespae:{2}", SubscriptionName, TopicName, NamespaceName)))
            {
                WriteObject(Client.CreateUpdateSubscription(ResourceGroup, NamespaceName, TopicName, subAttributes.Name, subAttributes));
            }
        }
예제 #5
0
        public override void ExecuteCmdlet()
        {
            SubscriptionAttributes subAttributes = new SubscriptionAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace);

            subAttributes.Name = Name;

            if (AutoDeleteOnIdle != null)
            {
                subAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DefaultMessageTimeToLive != null)
            {
                subAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive;
            }

            if (LockDuration != null)
            {
                subAttributes.LockDuration = LockDuration;
            }

            if (DeadLetteringOnMessageExpiration != null)
            {
                subAttributes.DeadLetteringOnMessageExpiration = DeadLetteringOnMessageExpiration;
            }

            if (EnableBatchedOperations != null)
            {
                subAttributes.EnableBatchedOperations = EnableBatchedOperations;
            }

            if (DeadLetteringOnMessageExpiration != null)
            {
                subAttributes.DeadLetteringOnMessageExpiration = DeadLetteringOnMessageExpiration;
            }

            if (MaxDeliveryCount != null)
            {
                subAttributes.MaxDeliveryCount = MaxDeliveryCount;
            }

            if (RequiresSession != null)
            {
                subAttributes.RequiresSession = RequiresSession;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.CreateSubscription, Name, Topic, Namespace)))
            {
                WriteObject(Client.CreateUpdateSubscription(ResourceGroupName, Namespace, Topic, Name, subAttributes));
            }
        }
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        /// <summary>
        /// Modifies and existing namespace prefix.  Must be done before generating feed
        /// </summary>
        /// <param name="url"></param>
        /// <param name="new_prefix"></param>
        /// <returns>bool</returns>
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        public bool ModifyNamespacePrefix(string url, string new_prefix)
        {
            bool rt  = false;
            int  ndx = NamespaceAttributes.FindIndex(x => x.Url == url);

            if (ndx >= 0)
            {
                NamespaceAttributes[ndx].Prefix = new_prefix;
                rt = true;
            }
            return(rt);
        }
예제 #7
0
        public override void ExecuteCmdlet()
        {
            QueueAttributes queueAttributes = new QueueAttributes();

            if (InputObject != null)
            {
                NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace);
                queueAttributes = InputObject;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.UpdateQueue, Name, Namespace)))
            {
                WriteObject(Client.CreateUpdateQueue(ResourceGroupName, Namespace, queueAttributes.Name, queueAttributes));
            }
        }
        public override void ExecuteCmdlet()
        {
            QueueAttributes queueAttributes = new QueueAttributes();

            if (QueueObj != null)
            {
                NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroup, NamespaceName);
                QueueObj.Location = getNamespaceLoc.Location;
                queueAttributes   = QueueObj;
            }

            if (ShouldProcess(target: QueueName, action: string.Format("Updating Queue:{0} of the NameSpace:{1}", QueueName, NamespaceName)))
            {
                WriteObject(Client.CreateUpdateQueue(ResourceGroup, NamespaceName, queueAttributes.Name, queueAttributes));
            }
        }
예제 #9
0
 /// <summary>
 /// Gets a Namespace from the service.
 /// </summary>
 /// <returns>A single Namespace</returns>
 public override void ExecuteCmdlet()
 {
     if (!string.IsNullOrEmpty(ResourceGroupName) && !string.IsNullOrEmpty(Name))
     {
         // Get a namespace
         NamespaceAttributes attributes = Client.GetNamespace(ResourceGroupName, Name);
         WriteObject(attributes);
     }
     else if (!string.IsNullOrEmpty(ResourceGroupName) && string.IsNullOrEmpty(Name))
     {
         // List all namespaces in given resource group
         IEnumerable <NamespaceAttributes> namespaceList = Client.ListNamespaces(ResourceGroupName);
         WriteObject(namespaceList.ToList(), true);
     }
     else
     {
         // List all namespaces in the given subscription
         IEnumerable <NamespaceAttributes> namespaceList = Client.ListAllNamespaces();
         WriteObject(namespaceList.ToList(), true);
     }
 }
예제 #10
0
        public override void ExecuteCmdlet()
        {
            SharedAccessAuthorizationRuleAttributes sasRule = new SharedAccessAuthorizationRuleAttributes();

            NamespaceAttributes getNameSpace = Client.GetNamespace(ResourceGroup, NamespaceName);

            IList <Management.ServiceBus.Models.AccessRights?> newListAry = new List <Management.ServiceBus.Models.AccessRights?>();

            foreach (string rights in Rights)
            {
                newListAry.Add(ParseAccessRights(rights));
            }

            sasRule.Name     = AuthorizationRuleName;
            sasRule.Rights   = newListAry;
            sasRule.Location = getNameSpace.Location;

            // Create a new ServiceBus namespace authorizationRule
            if (ShouldProcess(target: AuthorizationRuleName, action: string.Format("Create new AuthorizationRule:{0} for Queue:{1} of NameSpace:{2}", AuthorizationRuleName, QueueName, NamespaceName)))
            {
                WriteObject(Client.CreateOrUpdateServiceBusQueueAuthorizationRules(ResourceGroup, NamespaceName, QueueName, sasRule.Name, sasRule));
            }
        }
예제 #11
0
        public override void ExecuteCmdlet()
        {
            SharedAccessAuthorizationRuleAttributes sasRule = new SharedAccessAuthorizationRuleAttributes();
            NamespaceAttributes getNamespace = Client.GetNamespace(ResourceGroupName, NamespaceName);

            sasRule.Rights = new List <string>();

            if (Rights != null && Rights.Length > 0)
            {
                foreach (string test in Rights)
                {
                    sasRule.Rights.Add(test);
                }
            }

            sasRule.Name     = AuthorizationRuleName;
            sasRule.Location = getNamespace.Location;

            // Create a new eventHub authorizationRule
            if (ShouldProcess(target: AuthorizationRuleName, action: string.Format("Create new AuthorizationRule: {0} for NameSpace:{1}", AuthorizationRuleName, NamespaceName)))
            {
                WriteObject(Client.CreateOrUpdateNamespaceAuthorizationRules(ResourceGroupName, NamespaceName, sasRule.Name, sasRule));
            }
        }
        public override void ExecuteCmdlet()
        {
            TopicAttributes topicAttributes = new TopicAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace);

            topicAttributes.Name = Name;

            if (EnablePartitioning != null)
            {
                topicAttributes.EnablePartitioning = EnablePartitioning;
            }


            if (AutoDeleteOnIdle != null)
            {
                topicAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DefaultMessageTimeToLive != null)
            {
                topicAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive;
            }

            if (DuplicateDetectionHistoryTimeWindow != null)
            {
                topicAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow;
            }


            if (EnableBatchedOperations != null)
            {
                topicAttributes.EnableBatchedOperations = EnableBatchedOperations;
            }



            if (EnableExpress != null)
            {
                topicAttributes.EnableExpress = EnableExpress;
            }


            if (MaxSizeInMegabytes != null)
            {
                topicAttributes.MaxSizeInMegabytes = (int?)MaxSizeInMegabytes;
            }

            if (RequiresDuplicateDetection != null)
            {
                topicAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection;
            }

            if (SupportOrdering != null)
            {
                topicAttributes.SupportOrdering = SupportOrdering;
            }

            if (SizeInBytes != null)
            {
                topicAttributes.SizeInBytes = SizeInBytes;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.CreateTopic, Name, Namespace)))
            {
                WriteObject(Client.CreateUpdateTopic(ResourceGroupName, Namespace, Name, topicAttributes));
            }
        }
예제 #13
0
        public override void ExecuteCmdlet()
        {
            QueueAttributes queueAttributes = new QueueAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroupName, Namespace);

            queueAttributes.Name = Name;
            queueAttributes.EnablePartitioning = EnablePartitioning;

            if (LockDuration != null)
            {
                queueAttributes.LockDuration = LockDuration;
            }

            if (AutoDeleteOnIdle != null)
            {
                queueAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DefaultMessageTimeToLive != null)
            {
                queueAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive;
            }

            if (DuplicateDetectionHistoryTimeWindow != null)
            {
                queueAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow;
            }

            if (DeadLetteringOnMessageExpiration != null)
            {
                queueAttributes.DeadLetteringOnMessageExpiration = DeadLetteringOnMessageExpiration;
            }

            if (MaxSizeInMegabytes != null)
            {
                queueAttributes.MaxSizeInMegabytes = (int?)MaxSizeInMegabytes;
            }

            if (MaxDeliveryCount != null)
            {
                queueAttributes.MaxDeliveryCount = MaxDeliveryCount;
            }

            if (MessageCount != null)
            {
                queueAttributes.MessageCount = MessageCount;
            }

            if (RequiresDuplicateDetection != null)
            {
                queueAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection;
            }

            if (RequiresSession != null)
            {
                queueAttributes.RequiresSession = RequiresSession;
            }

            if (SizeInBytes != null)
            {
                queueAttributes.SizeInBytes = SizeInBytes;
            }

            if (ShouldProcess(target: Name, action: string.Format(Resources.CreateQueue, Name, Namespace)))
            {
                WriteObject(Client.CreateUpdateQueue(ResourceGroupName, Namespace, Name, queueAttributes));
            }
        }
예제 #14
0
        public override void ExecuteCmdlet()
        {
            TopicAttributes topicAttributes = new TopicAttributes();

            NamespaceAttributes getNamespaceLoc = Client.GetNamespace(ResourceGroup, NamespaceName);

            topicAttributes.Location = getNamespaceLoc.Location;

            topicAttributes.Name = TopicName;

            if (EnablePartitioning != null)
            {
                topicAttributes.EnablePartitioning = EnablePartitioning;
            }


            if (AutoDeleteOnIdle != null)
            {
                topicAttributes.AutoDeleteOnIdle = AutoDeleteOnIdle;
            }

            if (DefaultMessageTimeToLive != null)
            {
                topicAttributes.DefaultMessageTimeToLive = DefaultMessageTimeToLive;
            }

            if (DuplicateDetectionHistoryTimeWindow != null)
            {
                topicAttributes.DuplicateDetectionHistoryTimeWindow = DuplicateDetectionHistoryTimeWindow;
            }


            if (EnableBatchedOperations != null)
            {
                topicAttributes.EnableBatchedOperations = EnableBatchedOperations;
            }

            if (EnableSubscriptionPartitioning != null)
            {
                topicAttributes.EnableSubscriptionPartitioning = EnableSubscriptionPartitioning;
            }

            if (EnableExpress != null)
            {
                topicAttributes.EnableExpress = EnableExpress;
            }

            if (FilteringMessagesBeforePublishing != null)
            {
                topicAttributes.FilteringMessagesBeforePublishing = FilteringMessagesBeforePublishing;
            }

            if (IsAnonymousAccessible != null)
            {
                topicAttributes.IsAnonymousAccessible = IsAnonymousAccessible;
            }

            if (IsExpress != null)
            {
                topicAttributes.IsExpress = IsExpress;
            }

            if (MaxSizeInMegabytes != null)
            {
                topicAttributes.MaxSizeInMegabytes = MaxSizeInMegabytes;
            }

            if (RequiresDuplicateDetection != null)
            {
                topicAttributes.RequiresDuplicateDetection = RequiresDuplicateDetection;
            }

            if (SupportOrdering != null)
            {
                topicAttributes.SupportOrdering = SupportOrdering;
            }

            if (SizeInBytes != null)
            {
                topicAttributes.SizeInBytes = SizeInBytes;
            }


            if (ShouldProcess(target: TopicName, action: string.Format("Create a new Topic:{0} for Namespace:{1}", TopicName, NamespaceName)))
            {
                WriteObject(Client.CreateUpdateTopic(ResourceGroup, NamespaceName, topicAttributes.Name, topicAttributes));
            }
        }