public PSNamespaceAttributes(EHNamespace evResource)
        {
            if (evResource != null)
            {
                Sku = new Sku
                {
                    Capacity = evResource.Sku.Capacity,
                    Name     = evResource.Sku.Name,
                    Tier     = evResource.Sku.Tier
                };
                if (evResource.ProvisioningState != null)
                {
                    ProvisioningState = evResource.ProvisioningState;
                }

                if (evResource.CreatedAt.HasValue)
                {
                    CreatedAt = evResource.CreatedAt;
                }

                if (evResource.UpdatedAt.HasValue)
                {
                    UpdatedAt = evResource.UpdatedAt;
                }

                if (evResource.ServiceBusEndpoint != null)
                {
                    ServiceBusEndpoint = evResource.ServiceBusEndpoint;
                }
                if (evResource.Location != null)
                {
                    Location = evResource.Location;
                }

                if (evResource.Id != null)
                {
                    Id = evResource.Id;
                }

                if (evResource.Name != null)
                {
                    Name = evResource.Name;
                }

                if (evResource.IsAutoInflateEnabled.HasValue)
                {
                    IsAutoInflateEnabled = evResource.IsAutoInflateEnabled;
                }

                if (evResource.MaximumThroughputUnits.HasValue)
                {
                    MaximumThroughputUnits = evResource.MaximumThroughputUnits;
                }

                if (evResource.KafkaEnabled.HasValue)
                {
                    KafkaEnabled = evResource.KafkaEnabled;
                }

                if (evResource.Tags.Count > 0)
                {
                    Tags = new Dictionary <string, string>(evResource.Tags);
                }

                if (evResource.Identity != null)
                {
                    Identity = new PSIdentityAttributes(evResource.Identity);

                    IdentityType = evResource.Identity.Type.ToString();

                    if (evResource.Identity.UserAssignedIdentities != null)
                    {
                        IdentityId = evResource.Identity.UserAssignedIdentities.Keys.ToArray();
                    }
                }


                if (evResource.Encryption != null)
                {
                    if (evResource.Encryption.KeyVaultProperties != null)
                    {
                        EncryptionConfig = evResource.Encryption.KeyVaultProperties.Where(x => x != null).Select(x => {
                            PSEncryptionConfigAttributes kvproperty = new PSEncryptionConfigAttributes(x);

                            return(kvproperty);
                        }).ToArray();
                    }
                }

                ResourceGroup     = Regex.Split(evResource.Id, @"/")[4];
                ResourceGroupName = Regex.Split(evResource.Id, @"/")[4];
                ZoneRedundant     = evResource.ZoneRedundant;
                DisableLocalAuth  = evResource.DisableLocalAuth;
                ClusterArmId      = evResource.ClusterArmId;
                Encryption        = new PSEncryptionAttributes(evResource.Encryption);
            }
        }
Ejemplo n.º 2
0
        public PSNamespaceAttributes(EHNamespace evResource)
        {
            if (evResource != null)
            {
                Sku = new Sku
                {
                    Capacity = evResource.Sku.Capacity,
                    Name     = evResource.Sku.Name,
                    Tier     = evResource.Sku.Tier
                };
                if (evResource.ProvisioningState != null)
                {
                    ProvisioningState = evResource.ProvisioningState;
                }

                if (evResource.CreatedAt.HasValue)
                {
                    CreatedAt = evResource.CreatedAt;
                }

                if (evResource.UpdatedAt.HasValue)
                {
                    UpdatedAt = evResource.UpdatedAt;
                }

                if (evResource.ServiceBusEndpoint != null)
                {
                    ServiceBusEndpoint = evResource.ServiceBusEndpoint;
                }
                if (evResource.Location != null)
                {
                    Location = evResource.Location;
                }

                if (evResource.Id != null)
                {
                    Id = evResource.Id;
                }

                if (evResource.Name != null)
                {
                    Name = evResource.Name;
                }

                if (evResource.IsAutoInflateEnabled.HasValue)
                {
                    IsAutoInflateEnabled = evResource.IsAutoInflateEnabled;
                }

                if (evResource.MaximumThroughputUnits.HasValue)
                {
                    MaximumThroughputUnits = evResource.MaximumThroughputUnits;
                }

                if (evResource.KafkaEnabled.HasValue)
                {
                    KafkaEnabled = evResource.KafkaEnabled;
                }

                if (evResource.Tags.Count > 0)
                {
                    Tags = new Dictionary <string, string>(evResource.Tags);
                }

                ResourceGroup     = Regex.Split(evResource.Id, @"/")[4];
                ResourceGroupName = Regex.Split(evResource.Id, @"/")[4];
                Identity          = new PSIdentityAttributes(evResource.Identity);
                ZoneRedundant     = evResource.ZoneRedundant;
                ClusterArmId      = evResource.ClusterArmId;
                Encryption        = new PSEncryptionAttributes(evResource.Encryption);
            }
        }