public void IdentifierIsConstructedWithoutParent() { ResourceIdentifier id = new ResourceIdentifier(); id.Subscription = "abc123"; id.ResourceGroupName = "group1"; id.ResourceType = "Microsoft.Test/db"; id.ResourceName = "r45678db"; Assert.Equal("/subscriptions/abc123/resourceGroups/group1/providers/Microsoft.Test/db/r45678db", id.ToString()); }
public void IdentifierIsConstructedFromProvidedValues() { ResourceIdentifier id = new ResourceIdentifier(); id.Subscription = "abc123"; id.ResourceGroupName = "group1"; id.ResourceType = "Microsoft.Test/servers/db"; id.ParentResource = "servers/r12345sql"; id.ResourceName = "r45678db"; Assert.Equal("/subscriptions/abc123/resourceGroups/group1/providers/Microsoft.Test/servers/r12345sql/db/r45678db", id.ToString()); }
public static PSResource ToPSResource(this GenericResourceExtended resource, ResourcesClient client, bool minimal) { ResourceIdentifier identifier = new ResourceIdentifier(resource.Id); return new PSResource { Name = identifier.ResourceName, Location = resource.Location, ResourceType = identifier.ResourceType, ResourceGroupName = identifier.ResourceGroupName, ParentResource = identifier.ParentResource, Properties = JsonUtilities.DeserializeJson(resource.Properties), PropertiesText = resource.Properties, Tags = TagsConversionHelper.CreateTagHashtable(resource.Tags), Permissions = minimal ? null : client.GetResourcePermissions(identifier), ResourceId = identifier.ToString() }; }
public static PSResource ToPSResource(this GenericResource resource, ResourcesClient client, bool minimal) { var identifier = new ResourceIdentifier(resource.Id); return(new PSResource { Name = identifier.ResourceName, Location = resource.Location, ResourceType = identifier.ResourceType, ResourceGroupName = identifier.ResourceGroupName, ParentResource = identifier.ParentResource, Properties = JsonUtilities.DeserializeJson(resource.Properties?.ToString()), PropertiesText = resource.Properties?.ToString(), Tags = TagsConversionHelper.CreateTagHashtable(resource.Tags), Permissions = minimal ? null : client.GetResourcePermissions(identifier), ResourceId = identifier.ToString() }); }
public void IdentifierIsConstructedWithMissingParameters() { ResourceIdentifier id = new ResourceIdentifier(); Assert.True(string.IsNullOrEmpty(id.ToString())); }
public void IdentifierIsConstructedWithMissingParameters() { ResourceIdentifier id = new ResourceIdentifier(); Assert.Equal("/subscriptions//resourceGroups//providers///", id.ToString()); }