Exemple #1
0
        public override void ExecuteCmdlet()
        {
            CreatePSResourceGroupDeploymentParameters parameters = new CreatePSResourceGroupDeploymentParameters()
            {
                ResourceGroupName       = ResourceGroupName,
                DeploymentName          = Name,
                DeploymentMode          = Mode,
                TemplateFile            = TemplateUri ?? this.TryResolvePath(TemplateFile),
                TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject),
                ParameterUri            = TemplateParameterUri,
                DeploymentDebugLogLevel = GetDeploymentDebugLogLevel(DeploymentDebugLogLevel)
            };

            if (this.Mode == DeploymentMode.Complete)
            {
                this.ConfirmAction(
                    this.Force,
                    "Are you sure you want to use the complete deployment mode? Resources in the resource group '" + ResourceGroupName + "' which are not included in the template will be deleted.",
                    "Creating a deployment with Complete mode",
                    ResourceGroupName,
                    () =>
                {
                    WriteObject(ResourcesClient.ExecuteDeployment(parameters));
                });
            }
            else
            {
                WriteObject(ResourcesClient.ExecuteDeployment(parameters));
            }
        }
        public override void ExecuteCmdlet()
        {
            BasePSResourceParameters parameters = new BasePSResourceParameters()
            {
                Name = Name,
                ResourceGroupName = ResourceGroupName,
                ResourceType      = ResourceType,
                ParentResource    = ParentResource,
                ApiVersion        = ApiVersion
            };

            List <PSResource> resourceList = ResourcesClient.FilterPSResources(parameters);

            if (resourceList != null)
            {
                if (resourceList.Count == 1 && Name != null)
                {
                    WriteObject(resourceList[0]);
                }
                else
                {
                    List <PSObject> output = new List <PSObject>();
                    resourceList.ForEach(r => output.Add(base.ConstructPSObject(
                                                             null,
                                                             "Name", r.Name,
                                                             "ResourceGroupName", r.ResourceGroupName,
                                                             "ResourceType", r.ResourceType,
                                                             "Location", r.Location,
                                                             "ParentResource", r.ParentResource)));

                    WriteObject(output, true);
                }
            }
        }
        public override void ExecuteCmdlet()
        {
            Name = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName;

            this.WriteObject(
                ResourcesClient.FilterResourceGroups(name: this.Name, tag: null, detailed: false, location: this.Location),
                true);
        }
        protected override void ProcessRecord()
        {
            Name = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName;

            this.WriteObject(
                ResourcesClient.FilterResourceGroups(name: this.Name, tag: null, detailed: false, location: this.Location),
                true);
        }
 public override void ExecuteCmdlet()
 {
     UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
     {
         ResourceGroupName = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName,
         Tag = Tag,
     };
     WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
 }
Exemple #6
0
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release.");
            Name = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName;

            this.WriteObject(
                ResourcesClient.FilterResourceGroups(name: this.Name, tag: null, detailed: false, location: this.Location),
                true);
        }
Exemple #7
0
        public override void ExecuteCmdlet()
        {
            UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Tag = Tag
            };

            WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
        }
        protected override void ProcessRecord()
        {
            UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
            {
                ResourceGroupName = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName,
                Tag = Tag,
            };

            WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
        }
        public override void ExecuteCmdlet()
        {
            FilterResourceGroupDeploymentOptions options = new FilterResourceGroupDeploymentOptions()
            {
                ResourceGroupName = ResourceGroupName ?? ResourceIdUtility.GetResourceGroupName(Id),
                DeploymentName    = Name ?? (string.IsNullOrEmpty(Id) ? null : ResourceIdUtility.GetResourceName(Id))
            };

            WriteObject(ResourcesClient.FilterResourceGroupDeployments(options), true);
        }
Exemple #10
0
        protected override void ProcessRecord()
        {
            FilterResourceGroupDeploymentOptions options = new FilterResourceGroupDeploymentOptions()
            {
                ResourceGroupName = ResourceGroupName ?? ResourceIdUtility.GetResourceGroupName(Id),
                DeploymentName    = Name ?? (string.IsNullOrEmpty(Id) ? null : ResourceIdUtility.GetResourceName(Id))
            };

            WriteObject(ResourcesClient.FilterResourceGroupDeployments(options), true);
        }
        protected override void ProcessRecord()
        {
            UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
            {
                ResourceGroupName = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName,
                Tag = Tag,
            };

            WriteWarning("The output object of this cmdlet will be modified in a future release.");
            WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
        }
Exemple #12
0
        public override void ExecuteCmdlet()
        {
            UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Tag = Tag
            };

            WriteWarning("The output object of this cmdlet will be modified in a future release.");
            WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
        }
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release.");
            UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
            {
                ResourceGroupName = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName,
                Tag = Tag,
            };

            WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
        }
Exemple #14
0
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release.");
            FilterResourceGroupDeploymentOptions options = new FilterResourceGroupDeploymentOptions()
            {
                ResourceGroupName = ResourceGroupName ?? ResourceIdUtility.GetResourceGroupName(Id),
                DeploymentName    = Name ?? (string.IsNullOrEmpty(Id) ? null : ResourceIdUtility.GetResourceName(Id))
            };

            WriteObject(ResourcesClient.FilterResourceGroupDeployments(options), true);
        }
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release. Also, the usability of Tag parameter in this cmdlet will be modified in a future release. This will impact creating, updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494");
            UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters
            {
                ResourceGroupName = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName,
                Tag = Tag,
            };

            WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
        }
Exemple #16
0
        public override void ExecuteCmdlet()
        {
            GetPSResourceGroupLogParameters parameters = new GetPSResourceGroupLogParameters
            {
                Name           = Name,
                DeploymentName = DeploymentName,
                All            = All.IsPresent
            };

            WriteObject(ResourcesClient.GetResourceGroupLogs(parameters), true);
        }
Exemple #17
0
        public override void ExecuteCmdlet()
        {
            Name = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName;

            ConfirmAction(
                Force.IsPresent,
                string.Format(ProjectResources.RemovingResourceGroup, Name),
                ProjectResources.RemoveResourceGroupMessage,
                Name,
                () => ResourcesClient.DeleteResourceGroup(Name));
        }
        public override void ExecuteCmdlet()
        {
            ValidatePSResourceGroupDeploymentParameters parameters = new ValidatePSResourceGroupDeploymentParameters()
            {
                ResourceGroupName       = ResourceGroupName,
                TemplateFile            = TemplateUri ?? this.TryResolvePath(TemplateFile),
                TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject),
                ParameterUri            = TemplateParameterUri
            };

            WriteObject(ResourcesClient.ValidatePSResourceGroupDeployment(parameters, Mode));
        }
Exemple #19
0
        protected override void ProcessRecord()
        {
            ValidatePSResourceGroupDeploymentParameters parameters = new ValidatePSResourceGroupDeploymentParameters()
            {
                ResourceGroupName       = ResourceGroupName,
                TemplateFile            = TemplateUri ?? this.TryResolvePath(TemplateFile),
                TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject),
                ParameterUri            = TemplateParameterUri
            };

            WriteObject(ResourcesClient.ValidatePSResourceGroupDeployment(parameters, Mode));
        }
        public override void ExecuteCmdlet()
        {
            CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Location          = Location,
                Force             = Force.IsPresent,
                Tag           = Tag,
                ConfirmAction = ConfirmAction
            };

            WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
        }
        protected override void ProcessRecord()
        {
            CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Location          = Location,
                Force             = Force.IsPresent,
                Tag           = Tag,
                ConfirmAction = ConfirmAction
            };

            WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
        }
Exemple #22
0
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release. Also, the usability of Tag parameter in this cmdlet will be modified in a future release. This will impact creating, updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494");
            CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Location          = Location,
                Force             = Force.IsPresent,
                Tag           = Tag,
                ConfirmAction = ConfirmAction
            };

            WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
        }
        protected override void ProcessRecord()
        {
            CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Location          = Location,
                Force             = Force.IsPresent,
                Tag           = Tag,
                ConfirmAction = ConfirmAction
            };

            WriteWarning("The output object of this cmdlet will be modified in a future release.");
            WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
        }
Exemple #24
0
        public override void ExecuteCmdlet()
        {
            WriteWarning("The output object type of this cmdlet will be modified in a future release.");
            CreatePSResourceGroupParameters parameters = new CreatePSResourceGroupParameters
            {
                ResourceGroupName = Name,
                Location          = Location,
                Force             = Force.IsPresent,
                Tag           = Tag,
                ConfirmAction = ConfirmAction
            };

            WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
        }
Exemple #25
0
        public override void ExecuteCmdlet()
        {
            ConfirmAction(
                Force.IsPresent,
                string.Format(ProjectResources.RemovingResourceGroup, Name),
                ProjectResources.RemoveResourceGroupMessage,
                Name,
                () => ResourcesClient.DeleteResourceGroup(Name));

            if (PassThru)
            {
                WriteObject(true);
            }
        }
Exemple #26
0
        public override void ExecuteCmdlet()
        {
            ConfirmAction(
                Force.IsPresent,
                string.Format(ProjectResources.CancelResourceGroupDeployment, ResourceGroupName),
                ProjectResources.CancelResourceGroupDeploymentMessage,
                ResourceGroupName,
                () => ResourcesClient.CancelDeployment(ResourceGroupName, Name));

            if (PassThru)
            {
                WriteObject(true);
            }
        }
Exemple #27
0
        public override void ExecuteCmdlet()
        {
            UpdatePSResourceParameters parameters = new UpdatePSResourceParameters()
            {
                Name = Name,
                ResourceGroupName = ResourceGroupName,
                ResourceType      = ResourceType,
                ParentResource    = ParentResource,
                PropertyObject    = PropertyObject,
                ApiVersion        = ApiVersion
            };

            WriteObject(ResourcesClient.UpdatePSResource(parameters));
        }
Exemple #28
0
        public override void ExecuteCmdlet()
        {
            ValidatePSResourceGroupDeploymentParameters parameters = new ValidatePSResourceGroupDeploymentParameters()
            {
                ResourceGroupName       = ResourceGroupName,
                GalleryTemplateIdentity = GalleryTemplateIdentity,
                TemplateFile            = TemplateUri ?? this.TryResolvePath(TemplateFile),
                TemplateParameterObject = GetTemplateParameterObject(TemplateParameterObject),
                TemplateVersion         = TemplateVersion,
                StorageAccountName      = StorageAccountName
            };

            WriteObject(ResourcesClient.ValidatePSResourceGroupDeployment(parameters));
        }
        public override void ExecuteCmdlet()
        {
            ConfirmAction(
                Force.IsPresent,
                string.Format(ProjectResources.CancelResourceGroupDeployment, ResourceGroupName),
                ProjectResources.CancelResourceGroupDeploymentMessage,
                ResourceGroupName,
                () => ResourcesClient.CancelDeployment(ResourceGroupName, Name));

            if (PassThru)
            {
                WriteWarning("The output object of this cmdlet will be modified in a future release.");
                WriteObject(true);
            }
        }
Exemple #30
0
        public override void ExecuteCmdlet()
        {
            if (this.Tag != null)
            {
                WriteWarning("The Tag parameter is being deprecated and will be removed in a future release.");
            }
            if (this.Detailed.IsPresent)
            {
                WriteWarning("The Detailed switch parameter is being deprecated and will be removed in a future release.");
            }
            WriteWarning("The output object of this cmdlet will be modified in a future release.");
            var detailed = Detailed.IsPresent || !string.IsNullOrEmpty(Name);

            WriteObject(ResourcesClient.FilterResourceGroups(Name, Tag, detailed), true);
        }