Beispiel #1
0
        public ServiceIdentity(
            string deviceId,
            string moduleId,
            string deviceScope,
            IEnumerable <string> parentScopes,
            string generationId,
            IEnumerable <string> capabilities,
            ServiceAuthentication authentication,
            ServiceIdentityStatus status)
        {
            this.DeviceId       = Preconditions.CheckNonWhiteSpace(deviceId, nameof(deviceId));
            this.ModuleId       = Option.Maybe(moduleId);
            this.DeviceScope    = Option.Maybe(deviceScope);
            this.Capabilities   = Preconditions.CheckNotNull(capabilities, nameof(capabilities));
            this.Authentication = Preconditions.CheckNotNull(authentication, nameof(authentication));
            this.Id             = this.ModuleId.Map(m => $"{deviceId}/{moduleId}").GetOrElse(deviceId);
            this.GenerationId   = Preconditions.CheckNonWhiteSpace(generationId, nameof(generationId));
            this.Status         = status;

            this.ParentScopes = parentScopes != null
                ? new List <string>(parentScopes)
                : !this.IsEdgeDevice && !string.IsNullOrWhiteSpace(deviceScope) ? new List <string> {
                deviceScope
            } : new List <string>();
        }
Beispiel #2
0
 public ServiceIdentity(
     string deviceId,
     string generationId,
     IEnumerable <string> capabilities,
     ServiceAuthentication authentication,
     ServiceIdentityStatus status)
     : this(deviceId, null, generationId, capabilities, authentication, status)
 {
 }
Beispiel #3
0
 public ServiceIdentity(
     string deviceId,
     string moduleId,
     string generationId,
     IEnumerable <string> capabilities,
     ServiceAuthentication authentication,
     ServiceIdentityStatus status)
 {
     this.DeviceId       = Preconditions.CheckNonWhiteSpace(deviceId, nameof(deviceId));
     this.ModuleId       = Option.Maybe(moduleId);
     this.Capabilities   = Preconditions.CheckNotNull(capabilities, nameof(capabilities));
     this.Authentication = Preconditions.CheckNotNull(authentication, nameof(authentication));
     this.Id             = this.ModuleId.Map(m => $"{deviceId}/{moduleId}").GetOrElse(deviceId);
     this.GenerationId   = Preconditions.CheckNonWhiteSpace(generationId, nameof(generationId));
     this.Status         = status;
 }