public void UpdatesSetPSResourceGroupWithTag() { UpdatePSResourceGroupParameters expectedParameters = new UpdatePSResourceGroupParameters() { ResourceGroupName = resourceGroupName, Tag = tags.ToArray() }; UpdatePSResourceGroupParameters actualParameters = new UpdatePSResourceGroupParameters(); PSResourceGroup expected = new PSResourceGroup() { ResourceGroupName = expectedParameters.ResourceGroupName, Resources = new List<PSResource>() { new PSResource() { Name = "resource1" } }, Tags = expectedParameters.Tag }; resourcesClientMock.Setup(f => f.UpdatePSResourceGroup(It.IsAny<UpdatePSResourceGroupParameters>())) .Returns(expected) .Callback((UpdatePSResourceGroupParameters p) => { actualParameters = p; }); cmdlet.Name = expectedParameters.ResourceGroupName; cmdlet.Tag = expectedParameters.Tag; cmdlet.ExecuteCmdlet(); Assert.Equal(expectedParameters.ResourceGroupName, actualParameters.ResourceGroupName); Assert.Equal(expectedParameters.Tag, actualParameters.Tag); commandRuntimeMock.Verify(f => f.WriteObject(expected), Times.Once()); }
/// <summary> /// Updates a resource group. /// </summary> /// <param name="parameters">The create parameters</param> /// <returns>The created resource group</returns> public virtual PSResourceGroup UpdatePSResourceGroup(UpdatePSResourceGroupParameters parameters) { ResourceGroup resourceGroup = ResourceManagementClient.ResourceGroups.Get(parameters.ResourceGroupName).ResourceGroup; resourceGroup = CreateOrUpdateResourceGroup(parameters.ResourceGroupName, resourceGroup.Location, parameters.Tag); WriteVerbose(string.Format("Updated resource group '{0}' in location '{1}'", resourceGroup.Name, resourceGroup.Location)); return(resourceGroup.ToPSResourceGroup(this, true)); }
public override void ExecuteCmdlet() { UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters { ResourceGroupName = Name ?? ResourceIdentifier.FromResourceGroupIdentifier(this.Id).ResourceGroupName, 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() { 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)); }
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)); }
public override void ExecuteCmdlet() { UpdatePSResourceGroupParameters parameters = new UpdatePSResourceGroupParameters { ResourceGroupName = Name, Tag = Tag }; WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters)); }
/// <summary> /// Updates a resource group. /// </summary> /// <param name="parameters">The create parameters</param> /// <returns>The created resource group</returns> public virtual PSResourceGroup UpdatePSResourceGroup(UpdatePSResourceGroupParameters parameters) { ResourceGroup resourceGroup = ResourceManagementClient.ResourceGroups.Get(parameters.ResourceGroupName).ResourceGroup; resourceGroup = CreateOrUpdateResourceGroup(parameters.ResourceGroupName, resourceGroup.Location, parameters.Tag); WriteVerbose(string.Format("Updated resource group '{0}' in location '{1}'", resourceGroup.Name, resourceGroup.Location)); return resourceGroup.ToPSResourceGroup(this); }