Example #1
0
        public override void ExecuteCmdlet()
        {
            PSStorageInsightParameters parameters = new PSStorageInsightParameters()
            {
                Name = Name,
                StorageAccountResourceId = StorageAccountResourceId,
                StorageAccountKey        = StorageAccountKey,
                Tables     = Tables?.ToList(),
                Containers = Containers?.ToList(),
                Etag       = ETag,
                Tags       = Tag
            };

            if (ParameterSetName == ByWorkspaceObject)
            {
                parameters.ResourceGroupName = Workspace.ResourceGroupName;
                parameters.WorkspaceName     = Workspace.Name;
            }
            else
            {
                parameters.ResourceGroupName = ResourceGroupName;
                parameters.WorkspaceName     = WorkspaceName;
            }
            if (ShouldProcess(Name, $"Create StorageInsight: {Name}, in workspace: {WorkspaceName}, resource group: {ResourceGroupName}"))
            {
                WriteObject(OperationalInsightsClient.CreatePSStorageInsight(parameters, ConfirmAction, Force.IsPresent));
            }
        }
        public override void ExecuteCmdlet()
        {
            PSStorageInsightParameters parameters = null;

            if (ParameterSetName == ByWorkspaceObject)
            {
                ResourceGroupName = Workspace.ResourceGroupName;
                WorkspaceName     = Workspace.Name;
            }

            parameters = new PSStorageInsightParameters
            {
                ResourceGroupName = ResourceGroupName,
                WorkspaceName     = WorkspaceName,
                Name = Name,
                StorageAccountKey        = StorageAccountKey,
                StorageAccountResourceId = StorageAccountResourceId,
                Containers = Containers?.ToList(),
                Tables     = Tables?.ToList(),
                Etag       = ETag,
                Tags       = Tag
            };

            if (ShouldProcess(Name, $"Update StorageInsight: {Name}, in workspace: {WorkspaceName}, resource group: {ResourceGroupName}"))
            {
                WriteObject(OperationalInsightsClient.UpdatePSStorageInsight(parameters));
            }
        }