Skip to content

Commit 98c119a

Browse files
author
Hovsep
committed
Merge pull request Azure#1032 from hovsepm/movemove
[#104636870] Added EnableAzureDataCollection and DisableAzureDataCollection cmdlets.
2 parents 885844e + 4b69f5b commit 98c119a

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
<Reference Include="System.Xml.Linq" />
133133
</ItemGroup>
134134
<ItemGroup>
135+
<Compile Include="DataCollection\DisableAzureDataCollection.cs" />
136+
<Compile Include="DataCollection\EnableAzureDataCollection.cs" />
135137
<Compile Include="Environment\RemoveAzureRMEnvironment.cs" />
136138
<Compile Include="Environment\GetAzureRMEnvironment.cs" />
137139
<Compile Include="Environment\SetAzureRMEnvironment.cs" />
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Management.Automation;
16+
using Microsoft.Azure.Commands.Profile.Models;
17+
using Microsoft.Azure.Commands.ResourceManager.Common;
18+
using System.Security.Permissions;
19+
20+
namespace Microsoft.Azure.Commands.Profile
21+
{
22+
[Cmdlet(VerbsLifecycle.Disable, "AzureDataCollection")]
23+
public class DisableAzureDataCollectionCommand : EnableAzureDataCollectionCommand
24+
{
25+
protected override void ProcessRecord()
26+
{
27+
SetDataCollectionProfile(false);
28+
}
29+
}
30+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Management.Automation;
16+
using Microsoft.Azure.Commands.Profile.Models;
17+
using Microsoft.Azure.Commands.ResourceManager.Common;
18+
using System.Security.Permissions;
19+
20+
namespace Microsoft.Azure.Commands.Profile
21+
{
22+
[Cmdlet(VerbsLifecycle.Enable, "AzureDataCollection")]
23+
public class EnableAzureDataCollectionCommand : AzureRMCmdlet
24+
{
25+
protected override void ProcessRecord()
26+
{
27+
SetDataCollectionProfile(true);
28+
}
29+
30+
protected void SetDataCollectionProfile(bool enable)
31+
{
32+
var profile = GetDataCollectionProfile();
33+
profile.EnableAzureDataCollection = enable;
34+
SaveDataCollectionProfile();
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)