diff --git a/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj b/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj index d2f98ae45e7a..f2de630f5262 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj +++ b/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj @@ -132,6 +132,8 @@ + + diff --git a/src/ResourceManager/Profile/Commands.Profile/DataCollection/DisableAzureDataCollection.cs b/src/ResourceManager/Profile/Commands.Profile/DataCollection/DisableAzureDataCollection.cs new file mode 100644 index 000000000000..54f9712a98db --- /dev/null +++ b/src/ResourceManager/Profile/Commands.Profile/DataCollection/DisableAzureDataCollection.cs @@ -0,0 +1,30 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.Azure.Commands.Profile.Models; +using Microsoft.Azure.Commands.ResourceManager.Common; +using System.Security.Permissions; + +namespace Microsoft.Azure.Commands.Profile +{ + [Cmdlet(VerbsLifecycle.Disable, "AzureDataCollection")] + public class DisableAzureDataCollectionCommand : EnableAzureDataCollectionCommand + { + protected override void ProcessRecord() + { + SetDataCollectionProfile(false); + } + } +} diff --git a/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs b/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs new file mode 100644 index 000000000000..b79b70cad717 --- /dev/null +++ b/src/ResourceManager/Profile/Commands.Profile/DataCollection/EnableAzureDataCollection.cs @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Management.Automation; +using Microsoft.Azure.Commands.Profile.Models; +using Microsoft.Azure.Commands.ResourceManager.Common; +using System.Security.Permissions; + +namespace Microsoft.Azure.Commands.Profile +{ + [Cmdlet(VerbsLifecycle.Enable, "AzureDataCollection")] + public class EnableAzureDataCollectionCommand : AzureRMCmdlet + { + protected override void ProcessRecord() + { + SetDataCollectionProfile(true); + } + + protected void SetDataCollectionProfile(bool enable) + { + var profile = GetDataCollectionProfile(); + profile.EnableAzureDataCollection = enable; + SaveDataCollectionProfile(); + } + } +}