public PSStorageAccount(StorageModels.StorageAccount storageAccount) { this.ResourceGroupName = new ResourceIdentifier(storageAccount.Id).ResourceGroupName; this.StorageAccountName = storageAccount.Name; this.Id = storageAccount.Id; this.Location = storageAccount.Location; this.Sku = storageAccount.Sku; this.Encryption = storageAccount.Encryption; this.Kind = storageAccount.Kind; this.AccessTier = storageAccount.AccessTier; this.CreationTime = storageAccount.CreationTime; this.CustomDomain = storageAccount.CustomDomain is null ? null : new PSCustomDomain(storageAccount.CustomDomain); this.Identity = storageAccount.Identity; this.LastGeoFailoverTime = storageAccount.LastGeoFailoverTime; this.PrimaryEndpoints = storageAccount.PrimaryEndpoints; this.PrimaryLocation = storageAccount.PrimaryLocation; this.ProvisioningState = storageAccount.ProvisioningState; this.SecondaryEndpoints = storageAccount.SecondaryEndpoints; this.SecondaryLocation = storageAccount.SecondaryLocation; this.StatusOfPrimary = storageAccount.StatusOfPrimary; this.StatusOfSecondary = storageAccount.StatusOfSecondary; this.Tags = storageAccount.Tags; this.EnableHttpsTrafficOnly = storageAccount.EnableHttpsTrafficOnly; this.NetworkRuleSet = PSNetworkRuleSet.ParsePSNetworkRule(storageAccount.NetworkRuleSet); this.EnableHierarchicalNamespace = storageAccount.IsHnsEnabled; this.AzureFilesIdentityBasedAuth = storageAccount.AzureFilesIdentityBasedAuthentication is null ? null : new PSAzureFilesIdentityBasedAuthentication(storageAccount.AzureFilesIdentityBasedAuthentication); }
public PSStorageAccount(StorageModels.StorageAccount storageAccount) { this.ResourceGroupName = new ResourceIdentifier(storageAccount.Id).ResourceGroupName; this.StorageAccountName = storageAccount.Name; this.Id = storageAccount.Id; this.Location = storageAccount.Location; this.Sku = new PSSku(storageAccount.Sku); this.Encryption = storageAccount.Encryption; this.Kind = storageAccount.Kind; this.AccessTier = storageAccount.AccessTier; this.CreationTime = storageAccount.CreationTime; this.CustomDomain = storageAccount.CustomDomain is null ? null : new PSCustomDomain(storageAccount.CustomDomain); this.Identity = storageAccount.Identity; this.LastGeoFailoverTime = storageAccount.LastGeoFailoverTime; this.PrimaryEndpoints = storageAccount.PrimaryEndpoints; this.PrimaryLocation = storageAccount.PrimaryLocation; this.ProvisioningState = storageAccount.ProvisioningState; this.SecondaryEndpoints = storageAccount.SecondaryEndpoints; this.SecondaryLocation = storageAccount.SecondaryLocation; this.StatusOfPrimary = storageAccount.StatusOfPrimary; this.StatusOfSecondary = storageAccount.StatusOfSecondary; this.Tags = storageAccount.Tags; this.EnableHttpsTrafficOnly = storageAccount.EnableHttpsTrafficOnly; this.NetworkRuleSet = PSNetworkRuleSet.ParsePSNetworkRule(storageAccount.NetworkRuleSet); this.EnableHierarchicalNamespace = storageAccount.IsHnsEnabled; this.FailoverInProgress = storageAccount.FailoverInProgress; this.LargeFileSharesState = storageAccount.LargeFileSharesState; this.AzureFilesIdentityBasedAuth = storageAccount.AzureFilesIdentityBasedAuthentication is null ? null : new PSAzureFilesIdentityBasedAuthentication(storageAccount.AzureFilesIdentityBasedAuthentication); this.GeoReplicationStats = PSGeoReplicationStats.ParsePSGeoReplicationStats(storageAccount.GeoReplicationStats); this.AllowBlobPublicAccess = storageAccount.AllowBlobPublicAccess; this.MinimumTlsVersion = storageAccount.MinimumTlsVersion; this.BlobRestoreStatus = storageAccount.BlobRestoreStatus is null ? null : new PSBlobRestoreStatus(storageAccount.BlobRestoreStatus); }
//Parse wrapped PSNetworkRuleSet to storage NetworkRule object in SDK public static NetworkRuleSet ParseStorageNetworkRule(PSNetworkRuleSet rules) { if (rules == null) { return(null); } NetworkRuleSet returnRules = new NetworkRuleSet(); returnRules.Bypass = ParseStorageNetworkRuleBypass(rules.Bypass); returnRules.DefaultAction = ParseStorageNetworkRuleDefaultAction(rules.DefaultAction); List <IPRule> ipRuleList = new List <IPRule>(); if (rules.IpRules != null) { foreach (var ipRule in rules.IpRules) { ipRuleList.Add(ParseStorageNetworkRuleIPRule(ipRule)); } returnRules.IpRules = ipRuleList.ToArray(); } List <VirtualNetworkRule> virtualNetworkList = new List <VirtualNetworkRule>(); if (rules.VirtualNetworkRules != null) { foreach (var virtualNetworkRule in rules.VirtualNetworkRules) { virtualNetworkList.Add(ParseStorageNetworkRuleVirtualNetworkRule(virtualNetworkRule)); } returnRules.VirtualNetworkRules = virtualNetworkList.ToArray(); } return(returnRules); }
public PSStorageAccount(StorageModels.StorageAccount storageAccount) { this.ResourceGroupName = ParseResourceGroupFromId(storageAccount.Id); this.StorageAccountName = storageAccount.Name; this.Id = storageAccount.Id; this.Location = storageAccount.Location; this.Sku = storageAccount.Sku; this.Encryption = storageAccount.Encryption; this.Kind = storageAccount.Kind; this.AccessTier = storageAccount.AccessTier; this.CreationTime = storageAccount.CreationTime; this.CustomDomain = storageAccount.CustomDomain; this.Identity = storageAccount.Identity; this.LastGeoFailoverTime = storageAccount.LastGeoFailoverTime; this.PrimaryEndpoints = storageAccount.PrimaryEndpoints; this.PrimaryLocation = storageAccount.PrimaryLocation; this.ProvisioningState = storageAccount.ProvisioningState; this.SecondaryEndpoints = storageAccount.SecondaryEndpoints; this.SecondaryLocation = storageAccount.SecondaryLocation; this.StatusOfPrimary = storageAccount.StatusOfPrimary; this.StatusOfSecondary = storageAccount.StatusOfSecondary; this.Tags = storageAccount.Tags; this.EnableHttpsTrafficOnly = storageAccount.EnableHttpsTrafficOnly; this.NetworkRuleSet = PSNetworkRuleSet.ParsePSNetworkRule(storageAccount.NetworkAcls); }
//Parse Storage NetworkRule object in SDK to wrapped PSNetworkRuleSet public static PSNetworkRuleSet ParsePSNetworkRule(NetworkRuleSet rules) { if (rules == null) { return(null); } PSNetworkRuleSet returnRules = new PSNetworkRuleSet(); returnRules.Bypass = ParsePSNetworkRuleBypass(rules.Bypass); returnRules.DefaultAction = ParsePSNetworkRuleDefaultAction(rules.DefaultAction); List <PSIpRule> ipRuleList = new List <PSIpRule>(); if (rules.IpRules != null) { foreach (var ipRule in rules.IpRules) { ipRuleList.Add(ParsePSNetworkRuleIPRule(ipRule)); } returnRules.IpRules = ipRuleList.ToArray(); } List <PSVirtualNetworkRule> virtualNetworkList = new List <PSVirtualNetworkRule>(); if (rules.VirtualNetworkRules != null) { foreach (var virtualNetworkRule in rules.VirtualNetworkRules) { virtualNetworkList.Add(ParsePSNetworkRuleVirtualNetworkRule(virtualNetworkRule)); } returnRules.VirtualNetworkRules = virtualNetworkList.ToArray(); } List <PSResourceAccessRule> resourceAccessRuleList = new List <PSResourceAccessRule>(); if (rules.ResourceAccessRules != null) { foreach (var rule in rules.ResourceAccessRules) { resourceAccessRuleList.Add(ParsePSResourceAccessRule(rule)); } returnRules.ResourceAccessRules = resourceAccessRuleList.ToArray(); } return(returnRules); }