Beispiel #1
0
        private async Task <Issue> CreateDeprecationNoticeAsync(NewAzureDeprecationV1Message newNoticeV1MessageQueueMessage)
        {
            // Determine deprecation year
            var deprecationYear = newNoticeV1MessageQueueMessage.GetDueDate().Year;

            // Get matching milestone
            var milestoneDueDate = DateTimeOffset.Parse($"12/31/{deprecationYear}").AddDays(1);
            var milestone        = await _gitHubRepository.GetOrCreateMilestoneAsync(deprecationYear.ToString(),
                                                                                     $"All Azure deprecation notices which are closing in {deprecationYear}", milestoneDueDate);

            // Get matching project
            var project = await _gitHubRepository.GetOrCreateProjectAsync("Deprecation Notice Timeline");

            // Generate issue content
            var issueContent = IssueFactory.GenerateNewDeprecationNotice(newNoticeV1MessageQueueMessage);

            // Determine all required labels
            var labels = DetermineRequiredLabels(newNoticeV1MessageQueueMessage);

            // Create GitHub issue
            var createdIssue = await _gitHubRepository.CreateIssueAsync(newNoticeV1MessageQueueMessage.Title, issueContent, milestone, labels);

            // Add GitHub issue to deprecation notice project
            await _gitHubRepository.AddIssueToProjectAsync(project.Id, deprecationYear.ToString(), createdIssue.Id);

            return(createdIssue);
        }
        public void GenerateNewDeprecationNotice_ValidMessageWithAdvancedTimeline_GeneratesExpectedIssue()
        {
            // Arrange
            const string ExpectedIssueContent = @"Azure Cognitive Services Translator v2 is deprecated by 24 May 2021.

**Deadline:** May 24, 2021
**Impacted Services:**
- Azure Cognitive Services

**More information:**
- https://azure.microsoft.com/en-gb/updates/version-2-of-translator-is-retiring-on-24-may-2021/
- https://docs.microsoft.com/en-us/azure/cognitive-services/translator/migrate-to-v3

### Notice

Here's the official report from Microsoft:

> In May 2018, we announced the general availability of version 3 of Translator and will retire version 2 of Translator on 24 May 2021.
> 
> Key benefits of version 3 of Translator include: 
> - More functionalities including bilingual dictionary, transliterate and translate to multiple target languages in a single request.
> - Provides a  [layered security model](https://docs.microsoft.com/en-us/azure/cognitive-services/Welcome#securing-resources) as part of Azure Cognitive Services.
> - Customized translations through [Custom Translator](https://portal.customtranslator.azure.ai/).

### Timeline

| Phase | Date | Description |
|:------|------|-------------|
|Creation Disabled|Jan 01, 2021|No longer able to create new resources with type V1|
|Deprecation|May 24, 2021|Feature will no longer work|

### Impact

Service will no longer be available.

### Required Action

Here's the official report from Microsoft:

> - If you are using version 2 of Translator, please [migrate your applications to version 3](https://docs.microsoft.com/en-us/azure/cognitive-services/translator/migrate-to-v3) before 24 May 2021 to avoid service disruption.
> - Your current Translator subscription and key will work with version 3, there is no need to create a new Translator subscription in the Azure portal.

### Contact

Contact the product group through email ([email](mailto:[email protected])).

### More information

https://docs.microsoft.com/en-us/azure/cognitive-services/translator/migrate-to-v3";

            var newAzureDeprecationV1Message = NewAzureDeprecationGenerator.GenerateSample(useAdvancedTimeline: true);

            // Act
            var issueContent = IssueFactory.GenerateNewDeprecationNotice(newAzureDeprecationV1Message);

            // Assert
            Assert.Equal(ExpectedIssueContent, issueContent);
        }
Beispiel #3
0
        /// <summary>
        /// Retrieves single issue by id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <Result <IssueDto> > GetIssueAsync(int id)
        {
            try
            {
                var issue = await this.Db.Issues
                            .Include(x => x.Location)
                            .Include(x => x.Citizen)
                            .SingleOrDefaultAsync(x => x.Id == id);

                if (issue == null)
                {
                    return(Result <IssueDto> .Failure("Issue not found."));
                }

                return(Result <IssueDto> .Success(IssueFactory.Create(issue)));
            }
            catch (Exception exception)
            {
                Log.Logger.Error(exception, "Error in Get Issue method.");
                return(Result <IssueDto> .Failure("Error in Get Issue method."));
            }
        }
Beispiel #4
0
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue.
//		public static async Task ProcessQueueMessage([TimerTrigger("0 */10 * * * *")]TimerInfo timer)
        public static async void ProcessQueueMessage([TimerTrigger("0 0 12 1/3 * *")] TimerInfo timer)
        {
            var issueCommandRepository = new IssueCommandRepository();
            var issueQueryRepository   = new IssueQueryRepository();
            var issueContext           = new IssueContext(issueQueryRepository, issueCommandRepository);
            var issueFactory           = new IssueFactory(issueContext);

            var titleCommandRepository = new TitleCommandRepository();
            var titleQueryRepository   = new TitleQueryRepository();
            var titleContext           = new TitleContext(titleQueryRepository, titleCommandRepository);
            var titleFactory           = new TitleFactory(titleContext);

            var publisherQueryRepository = new PublisherQueryRepository();
            var publisherContext         = new PublisherContext(publisherQueryRepository);
            var publisherFactory         = new PublisherFactory(publisherContext);

            var catalogContext = new CatalogContext(publisherFactory, titleFactory, issueFactory);

            var Catalog = new CatalogObject(catalogContext);

            await Catalog.Commands.NewReleases(0);

            var end = string.Empty;
        }