Skip to content

Commit

Permalink
Merge pull request #6911 from v-Ajnava/preview_local
Browse files Browse the repository at this point in the history
Service Bus : fix for issues 5058 and 5055
  • Loading branch information
markcowl authored Aug 20, 2018
2 parents 90e3d38 + cf0db04 commit 5c259d3
Show file tree
Hide file tree
Showing 57 changed files with 8,307 additions and 8,029 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public void ServiceBusNameSpace_CURD_Tests()
public void ServiceBusNameSpaceAuth_CURD_Tests()
{
ServiceBusController.NewInstance.RunPsTest(_logger, "ServiceBusNameSpaceAuthTests");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# limitations under the License.
# ----------------------------------------------------------------------------------


<#
.SYNOPSIS
Tests EventHub Namespace Create List Remove operations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public void ServiceBusTopic_CURD()
public void ServiceBusTopicAuth_CURD()
{
ServiceBusController.NewInstance.RunPsTest(_logger, "ServiceBusTopicAuthTests");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,5 @@ function ServiceBusTopicAuthTests

Write-Debug " Delete resourcegroup"
Remove-AzureRmResourceGroup -Name $resourceGroupName -Force
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
-->
## Current Release
* Fixed issue with default resource groups not being set.
* Fix for issues
- https://github.com/Azure/azure-powershell/issues/5058
- https://github.com/Azure/azure-powershell/issues/5055

## Version 0.6.9
* Updated to the latest version of the Azure ClientRuntime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Commands.ServiceBus.Models;
using Microsoft.Azure.Management.ServiceBus.Models;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
Expand Down Expand Up @@ -60,67 +61,73 @@ public class GetAzureServiceBusAuthorizationRule : AzureServiceBusCmdletBase
public override void ExecuteCmdlet()
{

//Get Namespace Authorization Rule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Namespace AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetNamespaceAuthorizationRules(ResourceGroupName, Namespace, Name);
WriteObject(authRule);
}
else
{
// Get all Namespace AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListNamespaceAuthorizationRules(ResourceGroupName, Namespace);
WriteObject(authRuleList, true);
}
try
{
//Get Namespace Authorization Rule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Namespace AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetNamespaceAuthorizationRules(ResourceGroupName, Namespace, Name);
WriteObject(authRule);
}
else
{
// Get all Namespace AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListNamespaceAuthorizationRules(ResourceGroupName, Namespace);
WriteObject(authRuleList, true);
}


// Get Queue authorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
// Get Queue authorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Queue AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetServiceBusQueueAuthorizationRules(ResourceGroupName, Namespace, Queue, Name);
// Get a Queue AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetServiceBusQueueAuthorizationRules(ResourceGroupName, Namespace, Queue, Name);
WriteObject(authRule);
}
else
{
// Get all Queue AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListServiceBusQueueAuthorizationRules(ResourceGroupName, Namespace, Queue);
// Get all Queue AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListServiceBusQueueAuthorizationRules(ResourceGroupName, Namespace, Queue);
WriteObject(authRuleList, true);
}

// Get Topic authorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Topic AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetServiceBusTopicAuthorizationRules(ResourceGroupName, Namespace, Topic, Name);
WriteObject(authRule);
}
else
{
// Get all Topic AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListServiceBusTopicAuthorizationRules(ResourceGroupName, Namespace, Topic);
WriteObject(authRuleList, true);
}

// Get Alias authorizationRule
if (ParameterSetName.Equals(AliasAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Topic AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetAliasAuthorizationRules(ResourceGroupName, Namespace, AliasName, Name);
WriteObject(authRule);
}
else
{
// Get all Topic AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListAliasAuthorizationRules(ResourceGroupName, Namespace, AliasName);
WriteObject(authRuleList, true);
}
// Get Topic authorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Topic AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetServiceBusTopicAuthorizationRules(ResourceGroupName, Namespace, Topic, Name);
WriteObject(authRule);
}
else
{
// Get all Topic AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListServiceBusTopicAuthorizationRules(ResourceGroupName, Namespace, Topic);
WriteObject(authRuleList, true);
}

// Get Alias authorizationRule
if (ParameterSetName.Equals(AliasAuthoRuleParameterSet))
if (!string.IsNullOrEmpty(Name))
{
// Get a Topic AuthorizationRule
PSSharedAccessAuthorizationRuleAttributes authRule = Client.GetAliasAuthorizationRules(ResourceGroupName, Namespace, AliasName, Name);
WriteObject(authRule);
}
else
{
// Get all Topic AuthorizationRules
IEnumerable<PSSharedAccessAuthorizationRuleAttributes> authRuleList = Client.ListAliasAuthorizationRules(ResourceGroupName, Namespace, AliasName);
WriteObject(authRuleList, true);
}
}
catch (ErrorResponseException ex)
{
WriteError(ServiceBusClient.WriteErrorforBadrequest(ex));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,40 @@ public class GetAzureServiceBusKey : AzureServiceBusCmdletBase
public override void ExecuteCmdlet()
{

// Get a Namespace List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
try
{
PSListKeysAttributes keys = Client.GetNamespaceListKeys(ResourceGroupName, Namespace, Name);
WriteObject(keys,true);
}
// Get a Namespace List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
{
PSListKeysAttributes keys = Client.GetNamespaceListKeys(ResourceGroupName, Namespace, Name);
WriteObject(keys, true);
}

// Get a Queue List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
{
PSListKeysAttributes keys = Client.GetQueueKey(ResourceGroupName, Namespace, Queue, Name);
WriteObject(keys,true);
}
// Get a Queue List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
{
PSListKeysAttributes keys = Client.GetQueueKey(ResourceGroupName, Namespace, Queue, Name);
WriteObject(keys, true);
}

// Get a Topic List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
{
PSListKeysAttributes keys = Client.GetTopicKey(ResourceGroupName, Namespace, Topic, Name);
WriteObject(keys,true);
}
// Get a Topic List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
{
PSListKeysAttributes keys = Client.GetTopicKey(ResourceGroupName, Namespace, Topic, Name);
WriteObject(keys, true);
}

// Get Alias List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(AliasAuthoRuleParameterSet))
// Get Alias List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(AliasAuthoRuleParameterSet))
{
PSListKeysAttributes keys = Client.GetAliasListKeys(ResourceGroupName, Namespace, AliasName, Name);
WriteObject(keys, true);
}
}
catch (ErrorResponseException ex)
{
PSListKeysAttributes keys = Client.GetAliasListKeys(ResourceGroupName, Namespace, AliasName, Name);
WriteObject(keys, true);
WriteError(ServiceBusClient.WriteErrorforBadrequest(ex));
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,40 +59,47 @@ public class NewAzureServiceBusAuthorizationRule : AzureServiceBusCmdletBase

public override void ExecuteCmdlet()
{
PSSharedAccessAuthorizationRuleAttributes sasRule = new PSSharedAccessAuthorizationRuleAttributes();
sasRule.Rights = new List<AccessRights?>();

foreach (string test in Rights)
try
{
sasRule.Rights.Add(ParseAccessRights(test));
}
PSSharedAccessAuthorizationRuleAttributes sasRule = new PSSharedAccessAuthorizationRuleAttributes();
sasRule.Rights = new List<AccessRights?>();

//Create a new Namespace Authorization Rule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
{
if (ShouldProcess(target: sasRule.Name, action: string.Format(Resources.CreateNamespaceAuthorizationrule, Name, Namespace)))
foreach (string test in Rights)
{
WriteObject(Client.CreateOrUpdateNamespaceAuthorizationRules(ResourceGroupName, Namespace, Name, sasRule));
sasRule.Rights.Add(ParseAccessRights(test));
}
}

// Create a new Queue authorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
{
if (ShouldProcess(target: sasRule.Name, action: string.Format(Resources.CreateQueueAuthorizationrule, Name, Queue)))
//Create a new Namespace Authorization Rule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
{
WriteObject(Client.CreateOrUpdateServiceBusQueueAuthorizationRules(ResourceGroupName, Namespace, Queue, Name, sasRule));
if (ShouldProcess(target: sasRule.Name, action: string.Format(Resources.CreateNamespaceAuthorizationrule, Name, Namespace)))
{
WriteObject(Client.CreateOrUpdateNamespaceAuthorizationRules(ResourceGroupName, Namespace, Name, sasRule));
}
}
}

// Create a new Topic authorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
{
if (ShouldProcess(target: sasRule.Name, action: string.Format(Resources.CreateTopicAuthorizationrule, Name, Topic)))
// Create a new Queue authorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
{
if (ShouldProcess(target: sasRule.Name, action: string.Format(Resources.CreateQueueAuthorizationrule, Name, Queue)))
{
WriteObject(Client.CreateOrUpdateServiceBusQueueAuthorizationRules(ResourceGroupName, Namespace, Queue, Name, sasRule));
}
}

// Create a new Topic authorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
{
WriteObject(Client.CreateOrUpdateServiceBusTopicAuthorizationRules(ResourceGroupName, Namespace, Topic, Name, sasRule));
if (ShouldProcess(target: sasRule.Name, action: string.Format(Resources.CreateTopicAuthorizationrule, Name, Topic)))
{
WriteObject(Client.CreateOrUpdateServiceBusTopicAuthorizationRules(ResourceGroupName, Namespace, Topic, Name, sasRule));
}
}
}
catch (ErrorResponseException ex)
{
WriteError(ServiceBusClient.WriteErrorforBadrequest(ex));
}

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,40 @@ public class NewAzureServiceBusKey : AzureServiceBusCmdletBase
public string KeyValue { get; set; }

public override void ExecuteCmdlet()
{
// Generate new Namespace List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
{
try
{
if (ShouldProcess(target: RegenerateKey, action: string.Format(Resources.RegenerateKeyNamesapce, Name, Namespace)))
// Generate new Namespace List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(NamespaceAuthoRuleParameterSet))
{
WriteObject(Client.SetRegenerateKeys(ResourceGroupName, Namespace, Name, RegenerateKey, KeyValue));
if (ShouldProcess(target: RegenerateKey, action: string.Format(Resources.RegenerateKeyNamesapce, Name, Namespace)))
{
WriteObject(Client.SetRegenerateKeys(ResourceGroupName, Namespace, Name, RegenerateKey, KeyValue));
}
}
}

// Generate new Queue List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
{
if (ShouldProcess(target: RegenerateKey, action: string.Format(Resources.RegenerateKeyQueue, Name, Queue)))
// Generate new Queue List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(QueueAuthoRuleParameterSet))
{
WriteObject(Client.NewQueueKey(ResourceGroupName, Namespace, Queue, Name, RegenerateKey, KeyValue));
if (ShouldProcess(target: RegenerateKey, action: string.Format(Resources.RegenerateKeyQueue, Name, Queue)))
{
WriteObject(Client.NewQueueKey(ResourceGroupName, Namespace, Queue, Name, RegenerateKey, KeyValue));
}
}
}

// Generate new Topic List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
{
if (ShouldProcess(target: RegenerateKey, action: string.Format(Resources.RegenerateKeyTopic, Name, Topic)))
// Generate new Topic List Keys for the specified AuthorizationRule
if (ParameterSetName.Equals(TopicAuthoRuleParameterSet))
{
WriteObject(Client.NewTopicKey(ResourceGroupName, Namespace, Topic, Name, RegenerateKey, KeyValue));
if (ShouldProcess(target: RegenerateKey, action: string.Format(Resources.RegenerateKeyTopic, Name, Topic)))
{
WriteObject(Client.NewTopicKey(ResourceGroupName, Namespace, Topic, Name, RegenerateKey, KeyValue));
}
}
}
catch (ErrorResponseException ex)
{
WriteError(ServiceBusClient.WriteErrorforBadrequest(ex));
}
}
}
}
Loading

0 comments on commit 5c259d3

Please sign in to comment.