예제 #1
0
        public PSApiKey(ApplicationInsightsComponentApiKey key)
        {
            this.ApiKey      = key.ApiKey;
            this.CreatedDate = key.CreatedDate;
            this.Id          = key.Id.Split('/')[10];
            this.Description = key.Name;

            List <string> accessPermission = new List <string>();

            ApiKeyRole[] roles = new ApiKeyRole[] {
                ReadTelemetry,
                WriteAnnotations,
                ReadAgentConfiguration
            };

            if (key.LinkedReadProperty != null)
            {
                foreach (var readaccess in key.LinkedReadProperty)
                {
                    var role = ExtraRole(roles, readaccess);
                    if (role != null)
                    {
                        accessPermission.Add(role.roleName);
                    }
                }
            }

            if (key.LinkedWriteProperty != null)
            {
                foreach (var writeAccess in key.LinkedWriteProperty)
                {
                    var role = ExtraRole(roles, writeAccess);
                    if (role != null)
                    {
                        accessPermission.Add(role.roleName);
                    }
                }
            }

            this.Permissions = accessPermission.ToArray();
        }
예제 #2
0
 public PSApiKeyTableView(ApplicationInsightsComponentApiKey key)
     : base(key)
 {
 }