コード例 #1
0
        public PSCognitiveServicesAccount(CognitiveServicesModels.CognitiveServicesAccount cognitiveServicesAccount)
        {
            this.ResourceGroupName = ParseResourceGroupFromId(cognitiveServicesAccount.Id);
            this.AccountName       = cognitiveServicesAccount.Name;
            this.Id           = cognitiveServicesAccount.Id;
            this.Location     = cognitiveServicesAccount.Location;
            this.Sku          = cognitiveServicesAccount.Sku;
            this.AccountType  = cognitiveServicesAccount.Kind;
            this.Etag         = cognitiveServicesAccount.Etag;
            this.ResourceType = cognitiveServicesAccount.Type;
            this.Tags         = cognitiveServicesAccount.Tags;

            this.Endpoint            = cognitiveServicesAccount.Properties.Endpoint;
            this.ProvisioningState   = cognitiveServicesAccount.Properties.ProvisioningState;
            this.CustomSubDomainName = cognitiveServicesAccount.Properties.CustomSubDomainName;

            this.Identity         = cognitiveServicesAccount.Identity;
            this.UserOwnedStorage = cognitiveServicesAccount.Properties.UserOwnedStorage;
            this.Encryption       = cognitiveServicesAccount.Properties.Encryption;
            this.ApiProperties    = cognitiveServicesAccount.Properties.ApiProperties;

            this.PublicNetworkAccess        = cognitiveServicesAccount.Properties.PublicNetworkAccess;
            this.PrivateEndpointConnections = cognitiveServicesAccount.Properties.PrivateEndpointConnections;

            if (cognitiveServicesAccount.Properties.NetworkAcls != null)
            {
                this.NetworkRuleSet = PSNetworkRuleSet.Create(cognitiveServicesAccount.Properties.NetworkAcls);
            }
        }
コード例 #2
0
        public PSCognitiveServicesAccount(CognitiveServicesModels.CognitiveServicesAccount cognitiveServicesAccount)
        {
            this.ResourceGroupName = ParseResourceGroupFromId(cognitiveServicesAccount.Id);
            this.AccountName       = cognitiveServicesAccount.Name;
            this.Id                  = cognitiveServicesAccount.Id;
            this.Endpoint            = cognitiveServicesAccount.Properties.Endpoint;
            this.Location            = cognitiveServicesAccount.Location;
            this.Sku                 = cognitiveServicesAccount.Sku;
            this.AccountType         = cognitiveServicesAccount.Kind;
            this.Etag                = cognitiveServicesAccount.Etag;
            this.ResourceType        = cognitiveServicesAccount.Type;
            this.ProvisioningState   = cognitiveServicesAccount.Properties.ProvisioningState;
            this.Tags                = cognitiveServicesAccount.Tags;
            this.CustomSubDomainName = cognitiveServicesAccount.Properties.CustomSubDomainName;

            if (cognitiveServicesAccount.Properties.NetworkAcls != null)
            {
                this.NetworkRuleSet = PSNetworkRuleSet.Create(cognitiveServicesAccount.Properties.NetworkAcls);
            }
        }
コード例 #3
0
        public static PSNetworkRuleSet Create(CognitiveServicesModels.NetworkRuleSet networkRuleSet)
        {
            var result = new PSNetworkRuleSet();

            if (networkRuleSet.DefaultAction != null)
            {
                result.DefaultAction = (PSNetWorkRuleDefaultActionEnum)Enum.Parse(typeof(PSNetWorkRuleDefaultActionEnum), networkRuleSet.DefaultAction);
            }
            else
            {
                result.DefaultAction = PSNetWorkRuleDefaultActionEnum.Deny;
            }


            var ipRules = new List <PSIpRule>();

            if (networkRuleSet.IpRules != null)
            {
                foreach (var ipRule in networkRuleSet.IpRules)
                {
                    ipRules.Add(PSIpRule.Create(ipRule));
                }
            }
            result.IpRules = ipRules.ToArray();

            var virtualNetworkRules = new List <PSVirtualNetworkRule>();

            if (networkRuleSet.VirtualNetworkRules != null)
            {
                foreach (var virtualNetworkRule in networkRuleSet.VirtualNetworkRules)
                {
                    virtualNetworkRules.Add(PSVirtualNetworkRule.Create(virtualNetworkRule));
                }
            }
            result.VirtualNetworkRules = virtualNetworkRules.ToArray();

            return(result);
        }
コード例 #4
0
        public PSCognitiveServicesAccount(Account cognitiveServicesAccount)
        {
            this.ResourceGroupName = ParseResourceGroupFromId(cognitiveServicesAccount.Id);
            this.AccountName       = cognitiveServicesAccount.Name;
            this.Id           = cognitiveServicesAccount.Id;
            this.Location     = cognitiveServicesAccount.Location;
            this.Sku          = cognitiveServicesAccount.Sku;
            this.AccountType  = cognitiveServicesAccount.Kind;
            this.Etag         = cognitiveServicesAccount.Etag;
            this.ResourceType = cognitiveServicesAccount.Type;
            this.Tags         = cognitiveServicesAccount.Tags;

            // Properties aliases
            this.CustomSubDomainName           = cognitiveServicesAccount.Properties.CustomSubDomainName;
            this.Identity                      = cognitiveServicesAccount.Identity;
            this.UserOwnedStorage              = cognitiveServicesAccount.Properties.UserOwnedStorage;
            this.Encryption                    = cognitiveServicesAccount.Properties.Encryption;
            this.ApiProperties                 = CognitiveServicesAccountApiProperties.Parse(cognitiveServicesAccount.Properties.ApiProperties);
            this.PublicNetworkAccess           = cognitiveServicesAccount.Properties.PublicNetworkAccess;
            this.DisableLocalAuth              = cognitiveServicesAccount.Properties.DisableLocalAuth;
            this.RestrictOutboundNetworkAccess = cognitiveServicesAccount.Properties.RestrictOutboundNetworkAccess;
            this.AllowedFqdnList               = cognitiveServicesAccount.Properties.AllowedFqdnList;

            // other properties
            this.Properties = cognitiveServicesAccount.Properties;

            // Read-only properties, should not add more as they can be retrived from properties
            this.PrivateEndpointConnections = cognitiveServicesAccount.Properties.PrivateEndpointConnections;
            this.Capabilities      = cognitiveServicesAccount.Properties.Capabilities;
            this.Endpoint          = cognitiveServicesAccount.Properties.Endpoint;
            this.ProvisioningState = cognitiveServicesAccount.Properties.ProvisioningState;

            if (cognitiveServicesAccount.Properties.NetworkAcls != null)
            {
                this.NetworkRuleSet = PSNetworkRuleSet.Create(cognitiveServicesAccount.Properties.NetworkAcls);
            }
        }