Пример #1
0
 public VmTicketHistoryRepository(
     IRepository <VmTicketHistory> repository,
     AppVersionContext context,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository = repository;
     _context    = context;
 }
Пример #2
0
 public UserClaimRepository(
     IRepository <UserClaim> repository,
     UserContext context,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository = repository;
     _context    = context;
 }
Пример #3
0
 public UserRoleRepository(
     IRepository <UserRole> repository,
     UserContext context,
     IUserClaimRepository userClaimRepository,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository = repository;
     //_context = context;
     _userClaimRepository = userClaimRepository;
 }
Пример #4
0
 public ServiceSlaRepository(
     IRepository <ServiceSla> repository,
     ReportContext context,
     ICacheProvider cacheProvider,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository    = repository;
     _context       = context;
     _cacheProvider = cacheProvider;
 }
Пример #5
0
        public void VisitApiIdentity(IApiIdentity apiIdentity, int depth)
        {
            Contract.Requires(apiIdentity != null);

            this.AddIndentToString(depth);

            var description = apiIdentity.ToString();

            this.AddDescriptionToString(description);
        }
Пример #6
0
 public CustomerRepository
 (
     CustomersDbContext context,
     ICacheProvider cacheProvider,
     IApiIdentity apiIdentity
 )
 {
     Context             = context;
     this._cacheProvider = cacheProvider;
     _apiIdentity        = apiIdentity;
 }
Пример #7
0
 public DbUserService(
     UserContext context,
     IApiIdentity apiIdentity,
     ICacheProvider cacheProvider,
     IUserRoleRepository userRoleRepository
     )
 {
     _context            = context ?? throw new ArgumentNullException(nameof(context));
     _apiIdentity        = apiIdentity;
     _cacheProvider      = cacheProvider;
     _userRoleRepository = userRoleRepository;
 }
Пример #8
0
 public RestUserService(
     IHttpClientFactory httpClientFactory,
     IApiIdentity apiIdentity,
     ITokenAcquisition tokenAcquisition,
     IMapper mapper,
     IConfiguration configuration)
     : base(httpClientFactory, tokenAcquisition, apiIdentity, mapper, configuration)
 {
     ApiPart    = "api/userclaim/";
     Scope      = Configuration.GetValue <string>(Core.ConstatCsro.Scopes.Scope_Auth_Api);
     ClientName = Core.ConstatCsro.EndPoints.ApiEndpointAuth;
     base.Init();
 }
Пример #9
0
 public ServiceOutageSummaryRepository(
     IRepository <ServiceOutageSummary> repository,
     IServiceSlaService serviceSlaService,
     IRefundSupportTicketRepository refundSupportTicketRepository,
     ReportContext context,
     ILogger <ServiceOutageSummaryRepository> logger,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository                    = repository;
     _serviceSlaService             = serviceSlaService;
     _refundSupportTicketRepository = refundSupportTicketRepository;
     _context = context;
     _logger  = logger;
 }
Пример #10
0
        public SubcriptionService(
            IHttpClientFactory httpClientFactory,
            //IAuthCsroService authCsroService,
            ITokenAcquisition tokenAcquisition,
            IMapper mapper,
            IApiIdentity apiIdentity,
            IConfiguration configuration)
            : base(httpClientFactory, tokenAcquisition, apiIdentity, mapper, configuration)
        {
            ApiPart    = "--";
            Scope      = Core.ConstatCsro.Scopes.MANAGEMENT_AZURE_SCOPE;
            ClientName = Core.ConstatCsro.ClientNames.MANAGEMENT_AZURE_EndPoint;

            base.Init();
        }
Пример #11
0
 public ApproveRejectAdoProjectAccessIdsCommandHandler
 (
     IProjectAdoServices projectAdoServices,
     IAdoProjectAccessRepository adoProjectAccessRepository,
     IMapper mapper,
     IApiIdentity apiIdentity,
     ILogger <ApproveRejectAdoProjectAccessIdsCommandHandler> logger
 )
 {
     _projectAdoServices         = projectAdoServices;
     _adoProjectAccessRepository = adoProjectAccessRepository;
     _mapper = mapper;
     _userId = apiIdentity.GetUserName();
     _logger = logger;
     //com 5 06
 }
Пример #12
0
        public BaseDataService(
            IHttpClientFactory httpClientFactory,
            ITokenAcquisition tokenAcquisition,
            IApiIdentity apiIdentity,
            IMapper mapper,
            IConfiguration configuration,
            bool useSpn = false)
        {
            HttpClientFactory = httpClientFactory;
            _tokenAcquisition = tokenAcquisition;
            ApiIdentity       = apiIdentity;

            Mapper        = mapper;
            Configuration = configuration;
            UseSpn        = useSpn;
        }
Пример #13
0
        public SupportAzureService(
            ILogger <SupportAzureService> logger,
            IHttpClientFactory httpClientFactory,
            ITokenAcquisition tokenAcquisition,
            IMapper mapper,
            IApiIdentity apiIdentity,
            IConfiguration configuration)
            : base(httpClientFactory, tokenAcquisition, apiIdentity, mapper, configuration)
        {
            _logger = logger;

            UseUrlNotApiPart = true;
            Scope            = Core.ConstatCsro.Scopes.MANAGEMENT_AZURE_SCOPE;
            ClientName       = Core.ConstatCsro.ClientNames.MANAGEMENT_AZURE_EndPoint;

            base.Init();
        }
Пример #14
0
 public ServiceIssueRepository(
     IRepository <ServiceIssue> repository,
     ReportContext context,
     IMapper mapper,
     ISubscriptionRepository subscriptionRepository,
     IAzureHealthService azureHealthService,
     ICacheProvider cacheProvider,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository             = repository;
     _context                = context;
     _mapper                 = mapper;
     _subscriptionRepository = subscriptionRepository;
     _azureHealthService     = azureHealthService;
     _cacheProvider          = cacheProvider;
     //_userId = ApiIdentity.GetUserName();
 }
Пример #15
0
 public VmOperationExecuteCommandHandler(
     IConfiguration configuration,
     IApiIdentity apiIdentity,
     IVmSdkService vmSdkService,
     IMessageBus messageBus,
     IVmTicketRepository repository,
     IVmTicketHistoryRepository vmTicketHistoryRepository,
     ILogger <VmOperationExecuteCommandHandler> logger)
 {
     _userId       = apiIdentity.GetUserName();
     _vmSdkService = vmSdkService;
     _messageBus   = messageBus;
     _repository   = repository;
     _vmTicketHistoryRepository = vmTicketHistoryRepository;
     _logger           = logger;
     _serviceBusConfig = configuration.GetSection(nameof(ServiceBusConfig)).Get <ServiceBusConfig>();
 }
Пример #16
0
        public VmTicketRepository(
            IAzureVmManagementService azureVmManagementService,
            IRepository <VmTicket> repository,
            AppVersionContext context,
            IVmSdkService vmSdkService,
            IConfiguration configuration,
            IApiIdentity apiIdentity) : base(context, apiIdentity)
        {
            _azureVmManagementService = azureVmManagementService;
            _repository    = repository;
            _context       = context;
            _vmSdkService  = vmSdkService;
            _configuration = configuration;
            _userId        = ApiIdentity.GetUserName();

            VmRebootDelay = configuration.GetValue <int>("VmRebootDelay");
        }
Пример #17
0
 public RefundSupportTicketRepository(
     IRepository <RefundSupportTicket> repository,
     ReportContext context,
     IMapper mapper,
     ISupportAzureService supportAzureService,
     ISubscriptionRepository subscriptionRepository,
     ICacheProvider cacheProvider,
     ILogger <RefundSupportTicketRepository> logger,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository             = repository;
     _context                = context;
     _mapper                 = mapper;
     _supportAzureService    = supportAzureService;
     _subscriptionRepository = subscriptionRepository;
     _cacheProvider          = cacheProvider;
     _logger                 = logger;
 }
Пример #18
0
 public ServiceOutageSummaryService(
     IServiceSlaService serviceSlaService,
     IServiceOutageRepository serviceOutageRepository,
     IRefundSupportTicketRepository refundSupportTicketRepository,
     ISupportedRegionsService supportedRegionsService,
     IServiceOutageSummaryRepository serviceOutageSummaryRepository,
     IAzureHealthService azureHealthService,
     IAzureHealthSPNService azureHealthSPNService,
     IApiIdentity apiIdentity
     )
 {
     _serviceSlaService              = serviceSlaService;
     _serviceOutageRepository        = serviceOutageRepository;
     _refundSupportTicketRepository  = refundSupportTicketRepository;
     _supportedRegionsService        = supportedRegionsService;
     _serviceOutageSummaryRepository = serviceOutageSummaryRepository;
     _azureHealthService             = azureHealthService;
     _azureHealthSPNService          = azureHealthSPNService;
 }
Пример #19
0
 public AdoProjectAccessRepository(
     IConfiguration configuration,
     IRepository <AdoProjectAccess> repository,
     AdoContext context,
     //IAdoProjectHistoryRepository adoProjectHistoryRepository,
     IMapper mapper,
     ILogger <AdoProjectAccessRepository> logger,
     IMessageBus messageBus,
     IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository = repository;
     _context    = context;
     //_adoProjectHistoryRepository = adoProjectHistoryRepository;
     _mapper           = mapper;
     _logger           = logger;
     _messageBus       = messageBus;
     _userId           = ApiIdentity.GetUserName();
     _serviceBusConfig = configuration.GetSection(nameof(ServiceBusConfig)).Get <ServiceBusConfig>();
 }
Пример #20
0
        public AzureHealthSPNService(
            IServiceProvider serviceProvider,
            IHttpClientFactory httpClientFactory,
            ISubscriptionRepository subscriptionRepository,
            ILogger <AzureHealthSPNService> logger,
            ITokenAcquisition tokenAcquisition,
            ISupportedRegionsService supportedRegionsService,
            IMapper mapper,
            IApiIdentity apiIdentity,
            IConfiguration configuration)
            : base(serviceProvider, httpClientFactory, subscriptionRepository, logger, tokenAcquisition, supportedRegionsService, mapper, apiIdentity, configuration)
        {
            UseSpn = true;

            UseUrlNotApiPart = true;
            Scope            = Core.ConstatCsro.Scopes.MANAGEMENT_AZURE_SCOPE;
            ClientName       = Core.ConstatCsro.ClientNames.MANAGEMENT_AZURE_EndPoint;

            base.Init();
        }
Пример #21
0
        public static ApiObjectType CreateApiObjectType(string apiName,
                                                        string apiDescription,
                                                        IEnumerable <IApiProperty> apiProperties,
                                                        IApiIdentity apiIdentity,
                                                        IEnumerable <IApiRelationship> apiRelationships,
                                                        Type clrType)
        {
            Contract.Requires(apiName.SafeHasContent());
            Contract.Requires(clrType != null);

            var apiPropertiesCollection    = apiProperties.SafeToReadOnlyCollection();
            var apiRelationshipsCollection = apiRelationships.SafeToReadOnlyCollection();
            var apiObjectType = new ApiObjectType(apiName,
                                                  apiDescription,
                                                  apiPropertiesCollection,
                                                  apiIdentity,
                                                  apiRelationshipsCollection,
                                                  clrType);

            return(apiObjectType);
        }
Пример #22
0
        // PUBLIC CONSTRUCTORS //////////////////////////////////////////////
        #region Constructors
        public ApiObjectType(string apiName,
                             string apiDescription,
                             IEnumerable <IApiProperty> apiProperties,
                             IApiIdentity apiIdentity,
                             IEnumerable <IApiRelationship> apiRelationships,
                             Type clrObjectType)
            : base(apiName, apiDescription, clrObjectType)
        {
            Contract.Requires(apiName.SafeHasContent());
            Contract.Requires(clrObjectType != null);

            this.ApiProperties    = apiProperties.SafeToReadOnlyCollection();
            this.ApiIdentity      = apiIdentity;
            this.ApiRelationships = apiRelationships.SafeToReadOnlyCollection();

            this.ApiPropertyByApiNameDictionary = this.ApiProperties.ToDictionary(x => x.ApiName);
            this.ApiPropertyByClrNameDictionary = this.ApiProperties.ToDictionary(x => x.ClrName);

            this.ApiRelationshipByApiNameDictionary = this.ApiRelationships.ToDictionary(x => x.ApiProperty.ApiName);
            this.ApiRelationshipByClrNameDictionary = this.ApiRelationships.ToDictionary(x => x.ApiProperty.ClrName);
        }
Пример #23
0
 public ReportRepository(ReportContext context, IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
 }
Пример #24
0
 public Repository(DbContext context, IApiIdentity apiIdentity)
 {
     DatabaseContext = context;
     ApiIdentity     = apiIdentity;
 }
Пример #25
0
 public TicketRepository(IRepository <Ticket> repository, AppVersionContext context, IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
     _repository = repository;
     _context    = context;
 }
Пример #26
0
 public UserRepository(UserContext context, IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
 }
Пример #27
0
 public AppRepository(AppVersionContext context, IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
 }
        // ReSharper disable once ReturnTypeCanBeEnumerable.Local
        private static IReadOnlyCollection <IApiRelationship> CreateApiRelationships(ApiMutableObjectType apiMutableObjectType,
                                                                                     ApiSchemaProxy apiSchemaProxy,
                                                                                     IEnumerable <IApiProperty> apiProperties,
                                                                                     IApiIdentity apiIdentity)
        {
            Contract.Requires(apiMutableObjectType != null);
            Contract.Requires(apiSchemaProxy != null);
            Contract.Requires(apiProperties != null);

            // If this API object type has no identity, it may not contain any relationships.
            if (apiIdentity == null)
            {
                return(null);
            }

            var apiMutableSchema = apiMutableObjectType.ApiMutableSchema;
            var clrRelationshipPropertyCollection = apiMutableObjectType.ClrRelationshipPropertyCollection;
            var apiRelationships = clrRelationshipPropertyCollection
                                   .Where(x =>
            {
                // Can not create an API relationship if the related API object type does not have identity (must be an API resource type).
                var clrPropertyType     = x.ClrPropertyType;
                var apiPropertyTypeKind = clrPropertyType.GetApiTypeKind(out var clrPropertyItemType);
                switch (apiPropertyTypeKind)
                {
                case ApiTypeKind.Object:
                    {
                        var isApiResourceType = apiMutableSchema.ClrResourceTypes.Contains(clrPropertyType);
                        if (!isApiResourceType)
                        {
                            return(false);
                        }

                        break;
                    }

                case ApiTypeKind.Collection:
                    {
                        var apiItemTypeKind = clrPropertyItemType.GetApiTypeKind();
                        switch (apiItemTypeKind)
                        {
                        case ApiTypeKind.Collection:
                            {
                                // Unable to handle collections within collections.
                                var message = $"Unable to create API relationship for an API property [{nameof(x.ClrPropertyName)}={x.ClrPropertyName}] that contains collections within collections";
                                throw new ApiSchemaException(message);
                            }
                        }

                        var isApiResourceType = apiMutableSchema.ClrResourceTypes.Contains(clrPropertyItemType);
                        if (!isApiResourceType)
                        {
                            return(false);
                        }

                        break;
                    }

                default:
                    {
                        return(false);
                    }
                }

                return(true);
            })
                                   .Select(x =>
            {
                var clrPropertyName     = x.ClrPropertyName;
                var clrPropertyType     = x.ClrPropertyType;
                var apiProperty         = apiProperties.Single(y => y.ClrName == clrPropertyName);
                var apiPropertyTypeKind = clrPropertyType.GetApiTypeKind(out var clrPropertyItemType);

                ApiRelationshipCardinality apiCardinality;
                Type clrType;
                switch (apiPropertyTypeKind)
                {
                case ApiTypeKind.Object:
                    {
                        apiCardinality = ApiRelationshipCardinality.ToOne;
                        clrType        = clrPropertyType;
                        break;
                    }

                case ApiTypeKind.Collection:
                    {
                        apiCardinality = ApiRelationshipCardinality.ToMany;
                        clrType        = clrPropertyItemType;
                        break;
                    }

                default:
                    {
                        throw new ArgumentOutOfRangeException();
                    }
                }

                var apiRelatedTypeResolver = new ApiSchemaProxyTypeResolver(apiSchemaProxy, ApiTypeKind.Object, clrType);
                var apiRelationship        = ApiTypeFactory.CreateApiRelationship(apiProperty, apiCardinality, apiRelatedTypeResolver);

                return(apiRelationship);
            })
                                   .ToList();

            foreach (var apiRelationship in apiRelationships)
            {
                ApiFrameworkLog.Debug($"Created {apiRelationship}".Indent(IndentConstants.ApiMutableObjectTypeRelationship));
            }

            return(apiRelationships);
        }
Пример #29
0
 public GenericDataService(IHttpClientFactory httpClientFactory, ITokenAcquisition tokenAcquisition, IApiIdentity apiIdentity, IMapper mapper, IConfiguration configuration, bool useSpn = false)
     : base(httpClientFactory, tokenAcquisition, apiIdentity, mapper, configuration, useSpn)
 {
 }
Пример #30
0
 public AdoRepository(AdoContext context, IApiIdentity apiIdentity) : base(context, apiIdentity)
 {
 }