public override void ExecuteCmdlet() { if (ParameterSetName.Equals(ClusterInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ResourceName; } else if (ParameterSetName.Equals(ClusterResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ResourceName; } // delete a Cluster if (ShouldProcess(target: Name, action: string.Format("Removing cluster {0} from Resourgroup - {1}", Name, ResourceGroupName))) { try { var result = Client.DeleteEventHubCluster(ResourceGroupName, Name); if (PassThru.IsPresent) { WriteObject(result); } } catch (Management.EventHub.Models.ErrorResponseException ex) { WriteError(Eventhub.EventHubsClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(ConsumergroupInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; EventHub = identifier.ParentResource1; Name = identifier.ResourceName; } else if (ParameterSetName.Equals(ConsumergroupResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; EventHub = identifier.ParentResource1; Name = identifier.ResourceName; } // delete a ConsumerGroup if (ShouldProcess(target: Name, action: string.Format(Resources.RemoveConsumerGroup, Name, EventHub))) { Client.DeletConsumerGroup(ResourceGroupName, Namespace, EventHub, Name); if (PassThru) { WriteObject(true); } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(NamespaceInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ParentResource; } else if (ParameterSetName.Equals(NetworkRuleSetResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ParentResource; } // delete a Ip Filter Rule if (ShouldProcess(target: Name, action: string.Format("Delete NetwrokruleSet for Namespace {0} of ResourceGroup {1}", Name, ResourceGroupName))) { try { var result = Client.DeleteNetworkRuleSet(ResourceGroupName, Name); if (PassThru.IsPresent) { WriteObject(result); } } catch (Management.EventHub.Models.ErrorResponseException ex) { WriteError(Eventhub.EventHubsClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName == GeoDRInputObjectParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = getParamGeoDR.ResourceGroupName; Namespace = getParamGeoDR.ParentResource; Name = getParamGeoDR.ResourceName; } if (ParameterSetName == GeoDRConfigResourceIdParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(ResourceId); ResourceGroupName = getParamGeoDR.ResourceGroupName; Namespace = getParamGeoDR.ParentResource; Name = getParamGeoDR.ResourceName; } if (ShouldProcess(target: Name, action: string.Format(Resources.DRBreakPairing, Name, Namespace))) { try { Client.SetServiceBusDRConfigurationBreakPairing(ResourceGroupName, Namespace, Name); if (PassThru) { WriteObject(true); } } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(EventhubInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Name = identifier.ResourceName; } else if (ParameterSetName.Equals(EventhubResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Name = identifier.ResourceName; } // delete a EventHub if (ShouldProcess(target: Name, action: string.Format(Resources.RemovingEventHub, Name, Namespace))) { var result = Client.DeleteEventHub(ResourceGroupName, Namespace, Name); if (PassThru.IsPresent) { WriteObject(result); } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(NamespaceInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ResourceName; } else if (ParameterSetName.Equals(NamespaceResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ResourceName; } // delete a EventHub namespace if (ShouldProcess(target: Name, action: string.Format(Resources.RemoveNamespaces, Name, ResourceGroupName))) { Client.BeginDeleteNamespace(ResourceGroupName, Name); if (PassThru) { WriteObject(true); } } }
public override void ExecuteCmdlet() { if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getParamMigrationconfig = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = getParamMigrationconfig.ResourceGroupName; Name = getParamMigrationconfig.ResourceName; } else if (ParameterSetName == ResourceIdParameterSet) { LocalResourceIdentifier getParamMigrationconfig = new LocalResourceIdentifier(ResourceId); ResourceGroupName = getParamMigrationconfig.ResourceGroupName; Name = getParamMigrationconfig.ResourceName; } try { PSServiceBusMigrationConfigurationAttributes migrationConfiguration = Client.GetServiceBusMigrationConfiguration(ResourceGroupName, Name); WriteObject(migrationConfiguration); } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(SubscriptionInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Topic = identifier.ParentResource1; Name = identifier.ResourceName; } if (ParameterSetName.Equals(SubscriptionResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Topic = identifier.ParentResource1; Name = identifier.ResourceName; } // delete a Subscription if (ShouldProcess(target: Name, action: string.Format(Resources.RemoveSubscription, Name, Topic, Namespace))) { var result = Client.DeleteSubscription(ResourceGroupName, Namespace, Topic, Name); if (PassThru.IsPresent) { WriteObject(result); } } }
public override void ExecuteCmdlet() { PSServiceBusDRConfigurationAttributes drConfiguration = new PSServiceBusDRConfigurationAttributes() { PartnerNamespace = this.PartnerNamespace }; if (!string.IsNullOrEmpty(AlternateName)) drConfiguration.AlternateName = AlternateName; if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = getParamGeoDR.ResourceGroupName; Namespace = getParamGeoDR.ResourceName; } if (ParameterSetName == NamespaceResourceIdParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(ResourceId); ResourceGroupName = getParamGeoDR.ResourceGroupName; Namespace = getParamGeoDR.ResourceName; } try { if (ShouldProcess(target: Name, action: string.Format(Resources.DRCreateAlias, Name, Namespace))) { WriteObject(Client.CreateServiceBusDRConfiguration(ResourceGroupName, Namespace, Name, drConfiguration)); } } catch (ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } }
public override void ExecuteCmdlet() { if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getMigrationConfig = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = getMigrationConfig.ResourceGroupName; Name = getMigrationConfig.ResourceName; } else if (ParameterSetName == NamespaceResourceIdParameterSet) { LocalResourceIdentifier getMigrationConfig = new LocalResourceIdentifier(ResourceId); ResourceGroupName = getMigrationConfig.ResourceGroupName; Name = getMigrationConfig.ResourceName; } if (ShouldProcess(target: Name, action: string.Format(Resources.CompleteMigrationConfiguration))) { Client.SetServiceBusCompleteMigrationConfiguration(ResourceGroupName, Name); if (PassThru) { WriteObject(true); } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(NamespaceInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ResourceName; } else if (ParameterSetName.Equals(NamespaceResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Name = identifier.ResourceName; } // delete a EventHub namespace if (ShouldProcess(target: Name, action: string.Format(Resources.RemoveNamespaces, Name, ResourceGroupName))) { try { Client.BeginDeleteNamespace(ResourceGroupName, Name); if (PassThru) { WriteObject(true); } } catch (Management.EventHub.Models.ErrorResponseException ex) { WriteError(Eventhub.EventHubsClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getMigrationConfig = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = getMigrationConfig.ResourceGroupName; Name = getMigrationConfig.ResourceName; } else if (ParameterSetName == NamespaceResourceIdParameterSet) { LocalResourceIdentifier getMigrationConfig = new LocalResourceIdentifier(ResourceId); ResourceGroupName = getMigrationConfig.ResourceGroupName; Name = getMigrationConfig.ResourceName; } if (ShouldProcess(target: Name, action: string.Format(Resources.CompleteMigrationConfiguration))) { try { Client.SetServiceBusCompleteMigrationConfiguration(ResourceGroupName, Name); if (PassThru) { WriteObject(true); } } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(QueueInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Name = identifier.ResourceName; } else if (ParameterSetName.Equals(QueueResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Name = identifier.ResourceName; } // delete a Queue if (ShouldProcess(target: Name, action: string.Format(Resources.RemoveQueue, Name, Namespace))) { try { var result = Client.DeleteQueue(ResourceGroupName, Namespace, Name); if (PassThru.IsPresent) { WriteObject(result); } } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(InputObject.Id); if (getParamGeoDR.ResourceGroupName != null && getParamGeoDR.ResourceName != null) { if (!string.IsNullOrEmpty(Name)) { PSServiceBusDRConfigurationAttributes drConfiguration = Client.GetServiceBusDRConfiguration(getParamGeoDR.ResourceGroupName, getParamGeoDR.ResourceName, Name); WriteObject(drConfiguration); } else { IEnumerable <PSServiceBusDRConfigurationAttributes> drConfigurationList = Client.ListAllServiceBusDRConfiguration(getParamGeoDR.ResourceGroupName, getParamGeoDR.ResourceName); WriteObject(drConfigurationList.ToList(), true); } } } if (ParameterSetName == ResourceIdParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(ResourceId); if (getParamGeoDR.ResourceGroupName != null && getParamGeoDR.ResourceName != null) { if (!string.IsNullOrEmpty(Name)) { PSServiceBusDRConfigurationAttributes drConfiguration = Client.GetServiceBusDRConfiguration(getParamGeoDR.ResourceGroupName, getParamGeoDR.ResourceName, Name); WriteObject(drConfiguration); } else { IEnumerable <PSServiceBusDRConfigurationAttributes> drConfigurationList = Client.ListAllServiceBusDRConfiguration(getParamGeoDR.ResourceGroupName, getParamGeoDR.ResourceName); WriteObject(drConfigurationList.ToList(), true); } } } if (ParameterSetName == GeoDRParameterSet) { if (!string.IsNullOrEmpty(Name)) { // Get a DRConfiguration PSServiceBusDRConfigurationAttributes drConfiguration = Client.GetServiceBusDRConfiguration(ResourceGroupName, Namespace, Name); WriteObject(drConfiguration); } else { // Get all DRConfigurations IEnumerable <PSServiceBusDRConfigurationAttributes> drConfigurationList = Client.ListAllServiceBusDRConfiguration(ResourceGroupName, Namespace); WriteObject(drConfigurationList.ToList(), true); } } }
public override void ExecuteCmdlet() { if (ParameterSetName == GeoDRInputObjectParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(InputObject.Id); if (getParamGeoDR.ResourceGroupName != null && getParamGeoDR.ParentResource != null && getParamGeoDR.ResourceName != null) { if (ShouldProcess(target: getParamGeoDR.ResourceName, action: string.Format(Resources.DRFailOver, getParamGeoDR.ResourceName, getParamGeoDR.ParentResource))) { Client.SetServiceBusDRConfigurationFailOver(getParamGeoDR.ResourceGroupName, getParamGeoDR.ParentResource, getParamGeoDR.ResourceName); if (PassThru) { WriteObject(true); } } } else { WriteObject(false); } } if (ParameterSetName == GeoDRConfigResourceIdParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(ResourceId); if (getParamGeoDR.ResourceGroupName != null && getParamGeoDR.ParentResource != null && getParamGeoDR.ResourceName != null) { if (ShouldProcess(target: getParamGeoDR.ResourceName, action: string.Format(Resources.DRFailOver, getParamGeoDR.ResourceName, getParamGeoDR.ParentResource))) { Client.SetServiceBusDRConfigurationFailOver(getParamGeoDR.ResourceGroupName, getParamGeoDR.ParentResource, getParamGeoDR.ResourceName); if (PassThru) { WriteObject(true); } } } else { WriteObject(false); } } if (ParameterSetName == GeoDRParameterSet) { if (ShouldProcess(target: Name, action: string.Format(Resources.DRFailOver, Name, Namespace))) { Client.SetServiceBusDRConfigurationFailOver(ResourceGroupName, Namespace, Name); if (PassThru) { WriteObject(true); } } } }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(RuleInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Topic = Namespace = identifier.ParentResource1; Subscription = Namespace = identifier.ParentResource2; Name = Namespace = identifier.ResourceName; } if (ParameterSetName.Equals(RuleResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Topic = Namespace = identifier.ParentResource1; Subscription = Namespace = identifier.ParentResource2; Name = Namespace = identifier.ResourceName; } try { // delete a Rule ConfirmAction( Force.IsPresent, string.Format(Resources.RemoveRule, Name, Subscription, Namespace), string.Format(Resources.RemoveRule, Name, Subscription, Namespace), Name, () => { var result = Client.DeleteRule(ResourceGroupName, Namespace, Topic, Subscription, Name); if (PassThru) { WriteObject(result); } }); } catch (Management.ServiceBus.Models.ErrorResponseException ex) { WriteError(ServiceBusClient.WriteErrorforBadrequest(ex)); } }
public override void ExecuteCmdlet() { PSServiceBusDRConfigurationAttributes drConfiguration = new PSServiceBusDRConfigurationAttributes() { PartnerNamespace = this.PartnerNamespace }; if (!string.IsNullOrEmpty(AlternateName)) { drConfiguration.AlternateName = AlternateName; } if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(InputObject.Id); if (getParamGeoDR.ResourceGroupName != null && getParamGeoDR.ResourceName != null) { if (ShouldProcess(target: Name, action: string.Format(Resources.DRCreateAlias, Name, getParamGeoDR.ResourceName))) { WriteObject(Client.CreateServiceBusDRConfiguration(getParamGeoDR.ResourceGroupName, getParamGeoDR.ResourceName, Name, drConfiguration)); } } } if (ParameterSetName == NamespaceResourceIdParameterSet) { LocalResourceIdentifier getParamGeoDR = new LocalResourceIdentifier(ResourceId); if (getParamGeoDR.ResourceGroupName != null && getParamGeoDR.ResourceName != null) { if (ShouldProcess(target: Name, action: string.Format(Resources.DRCreateAlias, Name, getParamGeoDR.ResourceName))) { WriteObject(Client.CreateServiceBusDRConfiguration(getParamGeoDR.ResourceGroupName, getParamGeoDR.ResourceName, Name, drConfiguration)); } } } if (ParameterSetName == GeoDRParameterSet) { if (ShouldProcess(target: Name, action: string.Format(Resources.DRCreateAlias, Name, Namespace))) { WriteObject(Client.CreateServiceBusDRConfiguration(ResourceGroupName, Namespace, Name, drConfiguration)); } } }
public override void ExecuteCmdlet() { PSEventHubClusterAttributes cluster = new PSEventHubClusterAttributes(); if (ParameterSetName.Equals(ClusterPropertiesParameterSet)) { cluster.Location = Location; if (this.IsParameterBound(c => c.Capacity)) { cluster.Sku.Capacity = Capacity; } else { cluster.Sku.Capacity = 1; } if (this.IsParameterBound(c => c.Tag)) { cluster.Tags = TagsConversionHelper.CreateTagDictionary(Tag, validate: true); } } if (ParameterSetName.Equals(ClusterResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); cluster = Client.GetEventHubCluster(identifier.ResourceGroupName, identifier.ResourceName); cluster.Name = Name; } if (ShouldProcess(target: cluster.Name, action: string.Format("Create cluster {0} in ResourveGroup - {1}", cluster.Name, ResourceGroupName))) { try { WriteObject(Client.CreateOrUpdateEventHubCluster(ResourceGroupName, Name, cluster)); } catch (Management.EventHub.Models.ErrorResponseException ex) { WriteError(Eventhub.EventHubsClient.WriteErrorforBadrequest(ex)); } } }
public override void ExecuteCmdlet() { if (ParameterSetName == NamespaceInputObjectParameterSet) { LocalResourceIdentifier getParamMigrationconfig = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = getParamMigrationconfig.ResourceGroupName; Name = getParamMigrationconfig.ResourceName; } else if (ParameterSetName == ResourceIdParameterSet) { LocalResourceIdentifier getParamMigrationconfig = new LocalResourceIdentifier(ResourceId); ResourceGroupName = getParamMigrationconfig.ResourceGroupName; Name = getParamMigrationconfig.ResourceName; } PSServiceBusMigrationConfigurationAttributes migrationConfiguration = Client.GetServiceBusMigrationConfiguration(ResourceGroupName, Name); WriteObject(migrationConfiguration); }
public override void ExecuteCmdlet() { if (ParameterSetName.Equals(RuleInputObjectParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(InputObject.Id); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Topic = Namespace = identifier.ParentResource1; Subscription = Namespace = identifier.ParentResource2; Name = Namespace = identifier.ResourceName; } if (ParameterSetName.Equals(RuleResourceIdParameterSet)) { LocalResourceIdentifier identifier = new LocalResourceIdentifier(ResourceId); ResourceGroupName = identifier.ResourceGroupName; Namespace = identifier.ParentResource; Topic = Namespace = identifier.ParentResource1; Subscription = Namespace = identifier.ParentResource2; Name = Namespace = identifier.ResourceName; } // delete a Rule ConfirmAction( Force.IsPresent, string.Format(Resources.RemoveRule, Name, Subscription, Namespace), string.Format(Resources.RemoveRule, Name, Subscription, Namespace), Name, () => { var result = Client.DeleteRule(ResourceGroupName, Namespace, Topic, Subscription, Name); if (PassThru) { WriteObject(result); } }); }