コード例 #1
0
        /**
         * Creates an Application and waits for it to become available to use.
         *
         * @param fnManagementClient the service client to use to create the application.
         * @param compartmentId the OCID of the compartment which owns the Application.
         * @param displayName the display name of the created Application.
         * @param subnetIds a List of subnets (in different ADs) that will expose the function.
         * @return the created application.
         */
        private static async Task <Application> CreateApplication(FunctionsManagementClient fnManagementClient,
                                                                  string compartmentId, List <string> subnetIds)
        {
            logger.Info("Creating application");
            // Create a new Application
            var createApplicationDetails = new CreateApplicationDetails
            {
                CompartmentId = compartmentId,
                DisplayName   = AppName,
                SubnetIds     = subnetIds
            };
            var createApplicationRequest = new CreateApplicationRequest
            {
                CreateApplicationDetails = createApplicationDetails
            };
            var createApplicationResponse = await fnManagementClient.CreateApplication(createApplicationRequest);

            logger.Info("Waiting for application to become Active");
            var getApplicationRequest = new GetApplicationRequest
            {
                ApplicationId = createApplicationResponse.Application.Id
            };
            var getApplicationResponse = fnManagementClient.Waiters.ForApplication(getApplicationRequest, Application.LifecycleStateEnum.Active).Execute();

            logger.Info($"Application: {getApplicationResponse.Application.DisplayName} is Active");

            return(getApplicationResponse.Application);
        }
コード例 #2
0
 public async Task <Guid> CreateApplication(CreateApplicationRequest createApplicationRequest)
 {
     using (var request = new HttpRequestMessage(HttpMethod.Post, $"api/v1/applications/createApplication"))
     {
         return(await PostPutRequestWithResponse <CreateApplicationRequest, Guid>(request, createApplicationRequest));
     }
 }
コード例 #3
0
        public void CreateApplicationRequestObject()
        {
            moq::Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new moq::Mock <ApplicationService.ApplicationServiceClient>(moq::MockBehavior.Strict);
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
                Application         = new Application(),
            };
            Application expectedResponse = new Application
            {
                ApplicationName      = ApplicationName.FromProjectTenantProfileApplication("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]"),
                Profile              = "profile1b48977d",
                JobAsJobName         = JobName.FromProjectTenantJob("[PROJECT]", "[TENANT]", "[JOB]"),
                CompanyAsCompanyName = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"),
                ApplicationDate      = new gt::Date(),
                Stage           = Application.Types.ApplicationStage.OfferAccepted,
                State           = Application.Types.ApplicationState.Unspecified,
                Interviews      = { new Interview(), },
                Referral        = false,
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                OutcomeNotes    = "outcome_notes38ed921d",
                Outcome         = Outcome.Neutral,
                IsMatch         = false,
                JobTitleSnippet = "job_title_snippet4f14afe7",
                ExternalId      = "external_id9442680e",
            };

            mockGrpcClient.Setup(x => x.CreateApplication(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ApplicationServiceClient client = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application response            = client.CreateApplication(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public async Task CreateAndRemoveApplication_Success()
        {
            //Arrange
            var integrationTestApplicationName = "integration.test.application";

            var createApplicationRequest = new CreateApplicationRequest
            {
                Name        = integrationTestApplicationName,
                Description = "integration.test.application description",
                Permissions = new List <PermissionApplication>
                {
                    new PermissionApplication
                    {
                        Name        = "integration.test.permission.one",
                        Description = "integration.test.permission.one description",
                    }
                }
            };

            var removeApplicationRequest = new RemoveApplicationRequest()
            {
                Name = integrationTestApplicationName,
            };

            //Act
            await _sut.Registry(createApplicationRequest).ConfigureAwait(false);

            await _sut.RemoveApplication(removeApplicationRequest).ConfigureAwait(false);
        }
コード例 #5
0
        private int SendRequest(Guid candidateId, CreateApplicationRequest request)
        {
            CreateApplicationResponse response = null;

            _service.Use("SecureService", client => response = client.CreateApplication(request));

            if (response == null || (response.ValidationErrors != null && response.ValidationErrors.Any()))
            {
                string message;
                string errorCode;

                if (response == null)
                {
                    message   = "No response";
                    errorCode = ApplicationErrorCodes.ApplicationCreationFailed;
                }
                else if (IsDuplicateError(response))
                {
                    message   = "Duplicate application";
                    errorCode = ApplicationErrorCodes.ApplicationDuplicatedError;
                }
                else
                {
                    ParseValidationError(response, out message, out errorCode);
                }

                throw new DomainException(errorCode, new { message, candidateId, vacancyId = request.Application.VacancyId });
            }

            return(response.ApplicationId);
        }
コード例 #6
0
        protected override async Task <int> ExecuteAsync(CommandContext context, CancellationToken cancellationToken)
        {
            //Get all of the device types
            DeviceType[] deviceTypes = await context.Client.DeviceTypes.GetDeviceTypesAsync(cancellationToken);

            //Find the device type
            DeviceType deviceType = deviceTypes.FindEntity(DeviceType);

            if (deviceType == null)
            {
                Console.WriteLine($"Unable to find device type '{DeviceType}'.");
                return(1);
            }

            //Create the request
            var request = new CreateApplicationRequest
            {
                DeviceTypeId = deviceType.Id,
                Name         = Name
            };

            //Create the application.
            var application = await context.Client.Applications.CreateApplicationAsync(request, cancellationToken);

            Console.WriteLine($"Application {application.Id} created.");

            return(0);
        }
コード例 #7
0
        /// <summary>Snippet for CreateApplication</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void CreateApplicationRequestObject()
        {
            // Create client
            ApplicationsClient applicationsClient = ApplicationsClient.Create();
            // Initialize request argument(s)
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                Application = new Application(),
            };
            // Make the request
            Operation <Application, OperationMetadataV1> response = applicationsClient.CreateApplication(request);

            // Poll until the returned long-running operation is complete
            Operation <Application, OperationMetadataV1> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Application result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Application, OperationMetadataV1> retrievedResponse = applicationsClient.PollOnceCreateApplication(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Application retrievedResult = retrievedResponse.Result;
            }
        }
コード例 #8
0
        public async Task GivenEmployerHasSelectedTheApprenticeshipsForTheApplication()
        {
            _apprenticeshipResponses = new ApprenticeshipResponse[2];

            _apprenticeshipResponses[0] = _fixture.Build <ApprenticeshipResponse>().With(x => x.Id, _apprenticeshipIds[0])
                                          .With(x => x.EmployerAccountId, _accountId).With(x => x.AccountLegalEntityId, _accountLegalEntityId)
                                          .With(x => x.ApprenticeshipEmployerTypeOnApproval, ApprenticeshipEmployerType.Levy)
                                          .Create();
            _apprenticeshipResponses[1] = _fixture.Build <ApprenticeshipResponse>().With(x => x.Id, _apprenticeshipIds[1])
                                          .With(x => x.EmployerAccountId, _accountId).With(x => x.AccountLegalEntityId, _accountLegalEntityId)
                                          .With(x => x.ApprenticeshipEmployerTypeOnApproval, ApprenticeshipEmployerType.Levy)
                                          .Create();

            SetResponseFromCommitmentsForApprenticeshipId(_apprenticeshipIds[0], _apprenticeshipResponses[0]);
            SetResponseFromCommitmentsForApprenticeshipId(_apprenticeshipIds[1], _apprenticeshipResponses[1]);

            SetupExpectedCreateAndUpdateIncentiveApplication();

            var request = new CreateApplicationRequest
            {
                ApplicationId        = _applicationId,
                AccountId            = _accountId,
                AccountLegalEntityId = _accountLegalEntityId,
                ApprenticeshipIds    = _apprenticeshipIds
            };

            _response = await _context.OuterApiClient.PostAsync($"accounts/{_accountId}/applications", new StringContent(JsonSerializer.Serialize(request), Encoding.UTF8, "application/json"));

            _response.EnsureSuccessStatusCode();
        }
コード例 #9
0
        /// <summary>
        /// Creates an application.
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        public async Task <CreateApplicationResponse> CreateApplication(CreateApplicationRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called createApplication");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/applications".Trim('/')));
            HttpMethod         method         = new HttpMethod("Post");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage);
                }

                return(Converter.FromHttpResponseMessage <CreateApplicationResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"CreateApplication failed with error: {e.Message}");
                throw;
            }
        }
コード例 #10
0
        public async Task CreateApplicationAsync(string applicationName, string server, string host, string storageDirectory)
        {
            var request = new CreateApplicationRequest
            {
                AppType = "Live",
                Name    = applicationName,
                ClientStreamReadAccess  = "*",
                ClientStreamWriteAccess = "*",
                Description             = "Video Hearings Application for Audio Recordings",
                StreamConfig            = new StreamConfigurationConfig
                {
                    CreateStorageDir = true,
                    StreamType       = "live-record",
                    StorageDir       = $"{storageDirectory}{applicationName}",
                    StorageDirExists = false
                },
                SecurityConfig = new SecurityConfigRequest
                {
                    PublishBlockDuplicateStreamNames = true,
                    PublishIPWhiteList = "*",
                }
            };

            var response = await _httpClient.PostAsync
                           (
                $"v2/servers/{server}/vhosts/{host}/applications",
                new StringContent(ApiRequestHelper.SerialiseRequestToCamelCaseJson(request), Encoding.UTF8, "application/json")
                           );

            await HandleUnsuccessfulResponse(response);
        }
コード例 #11
0
        /// <summary>
        /// <para> Creates an application that has one configuration template named <c>default</c> and no application versions. </para>
        /// <para><b>NOTE:</b> The default configuration template is for a 32-bit version of the Amazon Linux operating system running the Tomcat 6
        /// application container. </para>
        /// </summary>
        ///
        /// <param name="createApplicationRequest">Container for the necessary parameters to execute the CreateApplication service method on
        ///           AmazonElasticBeanstalk.</param>
        ///
        /// <returns>The response from the CreateApplication service method, as returned by AmazonElasticBeanstalk.</returns>
        ///
        /// <exception cref="TooManyApplicationsException"/>
        public CreateApplicationResponse CreateApplication(CreateApplicationRequest createApplicationRequest)
        {
            IRequest <CreateApplicationRequest> request  = new CreateApplicationRequestMarshaller().Marshall(createApplicationRequest);
            CreateApplicationResponse           response = Invoke <CreateApplicationRequest, CreateApplicationResponse> (request, this.signer, CreateApplicationResponseUnmarshaller.GetInstance());

            return(response);
        }
コード例 #12
0
        /// <summary>Snippet for CreateApplicationAsync</summary>
        public async Task CreateApplicationRequestObjectAsync()
        {
            // Snippet: CreateApplicationAsync(CreateApplicationRequest, CallSettings)
            // Additional: CreateApplicationAsync(CreateApplicationRequest, CancellationToken)
            // Create client
            ApplicationsClient applicationsClient = await ApplicationsClient.CreateAsync();

            // Initialize request argument(s)
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                Application = new Application(),
            };
            // Make the request
            Operation <Application, OperationMetadataV1> response = await applicationsClient.CreateApplicationAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <Application, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Application result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Application, OperationMetadataV1> retrievedResponse = await applicationsClient.PollOnceCreateApplicationAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Application retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
コード例 #13
0
        internal virtual CreateApplicationResponse CreateApplication(CreateApplicationRequest request)
        {
            var marshaller   = CreateApplicationRequestMarshaller.Instance;
            var unmarshaller = CreateApplicationResponseUnmarshaller.Instance;

            return(Invoke <CreateApplicationRequest, CreateApplicationResponse>(request, marshaller, unmarshaller));
        }
コード例 #14
0
        public void SetUp()
        {
            _getAccountResponse  = _fixture.Create <GetAccountResponse>();
            _command             = _fixture.Create <CreateApplicationCommand>();
            _response            = _fixture.Create <CreateApplicationResponse>();
            _getStandardResponse = _fixture.Create <GetStandardsListItem>();

            _account         = _fixture.Create <Account>();
            _accountsService = new Mock <IAccountsService>();
            _accountsService.Setup(x => x.GetAccount(_command.EncodedAccountId)).ReturnsAsync(_account);

            _coursesApiClient = new Mock <ICoursesApiClient <CoursesApiConfiguration> >();
            _coursesApiClient.Setup(x => x.Get <GetStandardsListItem>(It.Is <GetStandardDetailsByIdRequest>(r => r.Id == _command.StandardId)))
            .ReturnsAsync(_getStandardResponse);

            _levyTransferMatchingService = new Mock <ILevyTransferMatchingService>();

            _levyTransferMatchingService.Setup(x => x.GetAccount(It.Is <GetAccountRequest>(r => r.AccountId == _command.EmployerAccountId)))
            .ReturnsAsync(_getAccountResponse);

            _levyTransferMatchingService.Setup(x => x.CreateApplication(It.IsAny <CreateApplicationRequest>()))
            .Callback <CreateApplicationRequest>(r => _createApplicationRequest = r)
            .ReturnsAsync(_response);

            _handler = new CreateApplicationCommandHandler(_levyTransferMatchingService.Object, _accountsService.Object, Mock.Of <ILogger <CreateApplicationCommandHandler> >(), _coursesApiClient.Object);
        }
コード例 #15
0
        public void Execute()
        {
            var APPLICATION_NAME  = Environment.GetEnvironmentVariable("APPLICATION_NAME") ?? "APPLICATION_NAME";
            var VONAGE_API_KEY    = Environment.GetEnvironmentVariable("VONAGE_API_KEY") ?? "VONAGE_API_KEY";
            var VONAGE_API_SECRET = Environment.GetEnvironmentVariable("VONAGE_API_SECRET") ?? "VONAGE_API_SECRET";

            var credentials = Credentials.FromApiKeyAndSecret(VONAGE_API_KEY, VONAGE_API_SECRET);
            var client      = new VonageClient(credentials);

            var messagesWebhooks = new Dictionary <Webhook.Type, Webhook>();

            messagesWebhooks.Add(
                Webhook.Type.inbound_url,
                new Webhook {
                Address = "https://example.com/webhooks/inbound",
                Method  = "POST"
            });
            messagesWebhooks.Add(
                Webhook.Type.status_url,
                new Webhook {
                Address = "https://example.com/webhooks/status",
                Method  = "POST"
            });
            var messagesCapability = new Messages(messagesWebhooks);
            var request            = new CreateApplicationRequest {
                Name         = APPLICATION_NAME,
                Capabilities = new ApplicationCapabilities {
                    Messages = messagesCapability
                }
            };
            var response = client.ApplicationClient.CreateApplicaiton(request);

            Console.WriteLine(JsonConvert.SerializeObject(response));
        }
コード例 #16
0
        public void CreateApplication2()
        {
            Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new Mock <ApplicationService.ApplicationServiceClient>(MockBehavior.Strict);
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                ParentAsProfileName = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"),
                Application         = new Application(),
            };
            Application expectedResponse = new Application
            {
                ApplicationName = new ApplicationName("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]"),
                ExternalId      = "externalId-1153075697",
                Profile         = "profile-309425751",
                Job             = "job105405",
                Company         = "company950484093",
                OutcomeNotes    = "outcomeNotes-355961964",
                JobTitleSnippet = "jobTitleSnippet-1100512972",
            };

            mockGrpcClient.Setup(x => x.CreateApplication(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ApplicationServiceClient client = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application response            = client.CreateApplication(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #17
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateApplication operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateApplication operation on AmazonServerlessApplicationRepositoryClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateApplication
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/serverlessrepo-2017-09-08/CreateApplication">REST API Reference for CreateApplication Operation</seealso>
        public virtual IAsyncResult BeginCreateApplication(CreateApplicationRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new CreateApplicationRequestMarshaller();
            var unmarshaller = CreateApplicationResponseUnmarshaller.Instance;

            return(BeginInvoke <CreateApplicationRequest>(request, marshaller, unmarshaller,
                                                          callback, state));
        }
コード例 #18
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateApplication operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateApplication operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/discovery-2015-11-01/CreateApplication">REST API Reference for CreateApplication Operation</seealso>
        public virtual Task <CreateApplicationResponse> CreateApplicationAsync(CreateApplicationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = CreateApplicationRequestMarshaller.Instance;
            var unmarshaller = CreateApplicationResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateApplicationRequest, CreateApplicationResponse>(request, marshaller,
                                                                                     unmarshaller, cancellationToken));
        }
コード例 #19
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateApplication operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateApplication operation on AmazonIoTFleetHubClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateApplication
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/iotfleethub-2020-11-03/CreateApplication">REST API Reference for CreateApplication Operation</seealso>
        public virtual IAsyncResult BeginCreateApplication(CreateApplicationRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateApplicationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateApplicationResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
コード例 #20
0
        internal virtual CreateApplicationResponse CreateApplication(CreateApplicationRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateApplicationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateApplicationResponseUnmarshaller.Instance;

            return(Invoke <CreateApplicationResponse>(request, options));
        }
コード例 #21
0
        /// <summary>
        /// Creates an application, optionally including an AWS SAM file to create the first application
        /// version in the same call.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateApplication service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the CreateApplication service method, as returned by ServerlessApplicationRepository.</returns>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.BadRequestException">
        /// One of the parameters in the request is invalid.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.ConflictException">
        /// The resource already exists.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.ForbiddenException">
        /// The client is not authenticated.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.InternalServerErrorException">
        /// The AWS Serverless Application Repository service encountered an internal error.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.TooManyRequestsException">
        /// The client is sending more than the allowed number of requests per unit of time.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/serverlessrepo-2017-09-08/CreateApplication">REST API Reference for CreateApplication Operation</seealso>
        public virtual Task <CreateApplicationResponse> CreateApplicationAsync(CreateApplicationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateApplicationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateApplicationResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateApplicationResponse>(request, options, cancellationToken));
        }
コード例 #22
0
        public async Task <ActionResult <Guid> > CreateApplication(
            [FromBody] CreateApplicationRequest createApplicationRequest)
        {
            _logger.LogInformation("Received Create Application Request");

            var applicationResponse = await _mediator.Send(createApplicationRequest);

            return(CreatedAtRoute("CreateApplication",
                                  applicationResponse));
        }
コード例 #23
0
        public async Task <IActionResult> Index()
        {
            var createAppRequest = new CreateApplicationRequest
            {
                ApplicationName = DateTime.Now.ToString("MM-dd-yyyy-hh-mm-ss")
            };

            var createAppResponse = await AmazonCodeDeployClient.CreateApplicationAsync(createAppRequest);

            return(View());
        }
コード例 #24
0
        public async Task <IActionResult> Add(CreateApplicationRequest createAppRequest)
        {
            try
            {
                var createAppResponse = await AmazonCodeDeployClient.CreateApplicationAsync(createAppRequest);
            }
            catch (System.Exception)
            {
            }

            return(RedirectToAction("Index", "Project"));
        }
コード例 #25
0
        public async Task <CreateApplicationCommandResult> Handle(CreateApplicationCommand request, CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Creating Application to Pledge {request.PledgeId} for Account {request.EmployerAccountId}");

            var accountTask  = _levyTransferMatchingService.GetAccount(new GetAccountRequest(request.EmployerAccountId));
            var standardTask = _coursesApiClient.Get <GetStandardsListItem>(new GetStandardDetailsByIdRequest(request.StandardId));

            await Task.WhenAll(accountTask, standardTask);

            var account  = accountTask.Result;
            var standard = standardTask.Result;

            if (account == null)
            {
                _logger.LogInformation($"Account {request.EmployerAccountId} does not exist - creating");
                await CreateAccount(request);
            }

            var data = new CreateApplicationRequestData
            {
                EmployerAccountId   = request.EmployerAccountId,
                Details             = request.Details,
                StandardId          = request.StandardId,
                StandardTitle       = standard.Title,
                StandardLevel       = standard.Level,
                StandardDuration    = standard.TypicalDuration,
                StandardMaxFunding  = standard.MaxFundingOn(request.StartDate),
                StandardRoute       = standard.Route,
                NumberOfApprentices = request.NumberOfApprentices,
                StartDate           = request.StartDate,
                HasTrainingProvider = request.HasTrainingProvider,
                Sectors             = request.Sectors,
                Locations           = request.Locations,
                AdditionalLocation  = request.AdditionalLocation,
                SpecificLocation    = request.SpecificLocation,
                FirstName           = request.FirstName,
                LastName            = request.LastName,
                EmailAddresses      = request.EmailAddresses,
                BusinessWebsite     = request.BusinessWebsite,
                UserId          = request.UserId,
                UserDisplayName = request.UserDisplayName
            };

            var createApplicationRequest = new CreateApplicationRequest(request.PledgeId, data);

            var result = await _levyTransferMatchingService.CreateApplication(createApplicationRequest);

            return(new CreateApplicationCommandResult
            {
                ApplicationId = result.ApplicationId
            });
        }
コード例 #26
0
        /// <summary>
        /// 创建应用程序
        /// </summary>
        /// <param name="request">请求</param>
        public async Task <Guid> CreateAsync(CreateApplicationRequest request)
        {
            var entity = request.MapTo <Admin.Systems.Domain.Models.Application>();

            await ValidateCreateAsync(entity);

            entity.Init();
            await ApplicationRepository.AddAsync(entity);

            await UnitOfWork.CommitAsync();

            return(entity.Id);
        }
コード例 #27
0
        public ActionResult Create(CreateApplicationRequest request)
        {
            try
            {
                appServ.CreateApp(request).GetAwaiter().GetResult();

                return(RedirectToAction("List"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #28
0
        public Application CreateNewApplication(CreateApplicationRequest request)
        {
            var entity = new ApplicationDbEntity
            {
                Id            = Guid.NewGuid(),
                CreatedAt     = DateTime.UtcNow,
                Status        = request.Status,
                MainApplicant = request.MainApplicant,
                OtherMembers  = request.OtherMembers.ToList()
            };

            _dynamoDbContext.SaveAsync(entity).GetAwaiter().GetResult();
            return(entity.ToDomain());
        }
コード例 #29
0
        public CreateApplicationRequestResponse Post(CreateApplicationRequest request)
        {
            var agent = new UserModel();

            var createApplicationInteractor = TryResolve <CreateApplicationInteractor>();
            var createApplicationInput      = request.ConvertTo <CreateApplicationInput>();
            var createApplicationOutput     = createApplicationInteractor.Handle(agent, createApplicationInput);

            var response = new CreateApplicationRequestResponse {
                Result = createApplicationOutput.ApplicationId
            };

            return(response);
        }
コード例 #30
0
 /// <summary>Snippet for CreateApplication</summary>
 public void CreateApplicationRequestObject()
 {
     // Snippet: CreateApplication(CreateApplicationRequest, CallSettings)
     // Create client
     ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.Create();
     // Initialize request argument(s)
     CreateApplicationRequest request = new CreateApplicationRequest
     {
         ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
         Application         = new Application(),
     };
     // Make the request
     Application response = applicationServiceClient.CreateApplication(request);
     // End snippet
 }