Skip to content

Rename Profile to DefaultProfile #881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static AzureRMCmdlet()
/// <summary>
/// Gets or sets the global profile for ARM cmdlets.
/// </summary>
public static AzureRMProfile Profile { get; set; }
public static AzureRMProfile DefaultProfile { get; set; }

/// <summary>
/// Gets the current default context.
Expand All @@ -44,12 +44,12 @@ protected override AzureContext DefaultContext
{
get
{
if (Profile == null || Profile.DefaultContext == null)
if (DefaultProfile == null || DefaultProfile.DefaultContext == null)
{
throw new PSInvalidOperationException("Run Login-AzureRMAccount to logic with profile.");
}

return Profile.DefaultContext;
return DefaultProfile.DefaultContext;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.ScenarioTests.Common/RMTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void BaseSetup()
AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud],
new AzureTenant { Id = Guid.NewGuid(), Domain = "testdomain.onmicrosoft.com" });

AzureRMCmdlet.Profile = currentProfile;
AzureRMCmdlet.DefaultProfile = currentProfile;

// Now override AzureSession.DataStore to use the MemoryDataStore
if (AzureSession.DataStore != null && !(AzureSession.DataStore is MemoryDataStore))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public IAutomationClient AutomationClient
{
get
{
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
}

set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public IAutomationClient AutomationClient
{
get
{
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
}

set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IAutomationClient AutomationClient
{
get
{
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
}

set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public IAutomationClient AutomationClient
{
get
{
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
}

set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public IAutomationClient AutomationClient
{
get
{
return this.automationClient = this.automationClient ?? new AutomationClient(Profile.DefaultContext);
return this.automationClient = this.automationClient ?? new AutomationClient(DefaultProfile.DefaultContext);
}

set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ComputeClient ComputeClient
{
if (computeClient == null)
{
computeClient = new ComputeClient(Profile.DefaultContext)
computeClient = new ComputeClient(DefaultProfile.DefaultContext)
{
VerboseLogger = WriteVerboseWithTimestamp,
ErrorLogger = WriteErrorWithTimestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected override void ProcessRecord()
if (string.Equals(this.ParameterSetName, SetCustomScriptExtensionByContainerBlobsParamSetName))
{
this.StorageEndpointSuffix = string.IsNullOrEmpty(this.StorageEndpointSuffix) ?
Profile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix) : this.StorageEndpointSuffix;
DefaultProfile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix) : this.StorageEndpointSuffix;
var sName = string.IsNullOrEmpty(this.StorageAccountName) ? GetStorageName() : this.StorageAccountName;
var sKey = string.IsNullOrEmpty(this.StorageAccountKey) ? GetStorageKey(sName) : this.StorageAccountKey;

Expand Down Expand Up @@ -234,7 +234,7 @@ protected override void ProcessRecord()

protected string GetStorageName()
{
return Profile.DefaultContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount);
return DefaultProfile.DefaultContext.Subscription.GetProperty(AzureSubscription.Property.StorageAccount);
}

protected string GetStorageKey(string storageName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private static IStorageManagementClient GetStorageClient(this Microsoft.Azure.Co
{
if (_storageClientWrapper == null)
{
_storageClientWrapper = new StorageManagementClientWrapper(AzureRMCmdlet.Profile.DefaultContext);
_storageClientWrapper = new StorageManagementClientWrapper(AzureRMCmdlet.DefaultProfile.DefaultContext);
}

return _storageClientWrapper.StorageManagementClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ protected override void ProcessRecord()
if (StorageEndpointSuffix == null)
{
StorageEndpointSuffix =
Profile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
DefaultProfile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private void ValidateParameters()
if (ArchiveStorageEndpointSuffix == null)
{
ArchiveStorageEndpointSuffix =
Profile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
DefaultProfile.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
}

if (!(Regex.Match(Version, VersionRegexExpr).Success))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public StorageManagementClient StorageClient
if (this.storageClient == null)
{
this.storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>(
Profile.DefaultContext, AzureEnvironment.Endpoint.ServiceManagement);
DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ServiceManagement);
}

return this.storageClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public NetworkClient NetworkClient
{
if (networkClient == null)
{
networkClient = new NetworkClient(Profile.DefaultContext)
networkClient = new NetworkClient(DefaultProfile.DefaultContext)
{
VerboseLogger = WriteVerboseWithTimestamp,
ErrorLogger = WriteErrorWithTimestamp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ private StorageCredentialsFactory CreateStorageCredentialsFactory(BlobUri destin
StorageCredentialsFactory storageCredentialsFactory;

var storageClient = AzureSession.ClientFactory.CreateClient<StorageManagementClient>(
Profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);

if (StorageCredentialsFactory.IsChannelRequired(Destination))
{
storageCredentialsFactory = new StorageCredentialsFactory(this.ResourceGroupName, storageClient, AzureRMCmdlet.Profile.DefaultContext.Subscription);
storageCredentialsFactory = new StorageCredentialsFactory(this.ResourceGroupName, storageClient, AzureRMCmdlet.DefaultProfile.DefaultContext.Subscription);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public IInsightsClient InsightsClient
if (this.insightsClient == null)
{
// The premise is that a command to establish a context (like Add-AzureAccount) has been called before this command in order to have a correct CurrentContext
this.insightsClient = AzureSession.ClientFactory.CreateClient<InsightsClient>(Profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
this.insightsClient = AzureSession.ClientFactory.CreateClient<InsightsClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
}

return this.insightsClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public IInsightsManagementClient InsightsManagementClient
if (this.insightsManagementClient == null)
{
// The premise is that a command to establish a context (like Add-AzureAccount) has been called before this command in order to have a correct CurrentContext
this.insightsManagementClient = AzureSession.ClientFactory.CreateClient<InsightsManagementClient>(Profile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
this.insightsManagementClient = AzureSession.ClientFactory.CreateClient<InsightsManagementClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager);
}

return this.insightsManagementClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public void SetupEnvironment()
var testSubscription = new AzureSubscription()
{
Id = new Guid(csmEnvironment.SubscriptionId),
Name = AzureRMCmdlet.Profile.DefaultContext.Subscription.Name,
Environment = AzureRMCmdlet.Profile.DefaultContext.Environment.Name,
Name = AzureRMCmdlet.DefaultProfile.DefaultContext.Subscription.Name,
Environment = AzureRMCmdlet.DefaultProfile.DefaultContext.Environment.Name,
Account = user,
Properties = new Dictionary<AzureSubscription.Property, string>
{
Expand All @@ -73,7 +73,7 @@ public void SetupEnvironment()
}
};

AzureRMCmdlet.Profile.DefaultContext = new AzureContext(testSubscription, testAccount, AzureRMCmdlet.Profile.DefaultContext.Environment, new AzureTenant { Id = new Guid(tenantId) });
AzureRMCmdlet.DefaultProfile.DefaultContext = new AzureContext(testSubscription, testAccount, AzureRMCmdlet.DefaultProfile.DefaultContext.Environment, new AzureTenant { Id = new Guid(tenantId) });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ private GraphRbacManagementClient GetGraphClient()
if (HttpMockServer.Variables.ContainsKey(TenantIdKey))
{
tenantId = HttpMockServer.Variables[TenantIdKey];
AzureRMCmdlet.Profile.DefaultContext.Tenant.Id = new Guid(tenantId);
AzureRMCmdlet.DefaultProfile.DefaultContext.Tenant.Id = new Guid(tenantId);
}
if (HttpMockServer.Variables.ContainsKey(DomainKey))
{
UserDomain = HttpMockServer.Variables[DomainKey];
AzureRMCmdlet.Profile.DefaultContext.Tenant.Domain = UserDomain;
AzureRMCmdlet.DefaultProfile.DefaultContext.Tenant.Domain = UserDomain;
}

}
Expand Down
Loading