Skip to content
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

Make the Parent of ResourceContainerBase to be the OperationsBase type #22589

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public ArmClient(
ClientOptions = options?.Clone() ?? new ArmClientOptions();
Pipeline = ManagementPipelineBuilder.Build(Credential, BaseUri, options ?? ClientOptions);

_tenant = new TenantOperations(ClientOptions, Credential, BaseUri, Pipeline);
DefaultSubscription = string.IsNullOrWhiteSpace(defaultSubscriptionId)
? GetDefaultSubscription()
: GetSubscriptions().TryGet(defaultSubscriptionId);
Comment on lines +95 to 98
Copy link
Member Author

@fengzhou-msft fengzhou-msft Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_tenant is now used when creating SusbcriptionContainer, so move the initialization upward.

_tenant = new TenantOperations(ClientOptions, Credential, BaseUri, Pipeline);
ClientOptions.ApiVersions.SetProviderClient(this);
}

Expand Down Expand Up @@ -128,10 +128,7 @@ public ArmClient(
/// Gets the Azure subscriptions.
/// </summary>
/// <returns> Subscription container. </returns>
public virtual SubscriptionContainer GetSubscriptions()
{
return new SubscriptionContainer(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline));
}
public virtual SubscriptionContainer GetSubscriptions() => _tenant.GetSubscriptions();

/// <summary>
/// Gets the tenants.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ protected ResourceContainerBase(OperationsBase parent)
{
}

/// <summary>
/// Gets the parent resource of this resource.
/// </summary>
protected new ResourceOperationsBase Parent { get {return base.Parent as ResourceOperationsBase;} }

/// <summary>
/// Verify that the input resource Id is a valid container for this type.
/// </summary>
Expand Down