/// <summary>
        /// <para>Creates a new case in the AWS Support Center. This operation is modeled on the behavior of the AWS Support Center <a href="https://aws.amazon.com/support/createCase">Open a new case</a> page. Its parameters require you to specify the following information:
        /// </para> <ol> <li> <b>ServiceCode.</b> The code for an AWS service. You obtain the <c>ServiceCode</c> by calling DescribeServices. </li>
        /// <li> <b>CategoryCode.</b> The category for the service defined for the <c>ServiceCode</c> value. You also obtain the category code for a
        /// service by calling DescribeServices. Each AWS service defines its own set of category codes. </li>
        /// <li> <b>SeverityCode.</b> A value that indicates the urgency of the case, which in turn determines the response time according to your
        /// service level agreement with AWS Support. You obtain the SeverityCode by calling DescribeSeverityLevels.</li>
        /// <li> <b>Subject.</b> The <b>Subject</b> field on the AWS Support Center <a href="https://aws.amazon.com/support/createCase">Open a new
        /// case</a> page.</li>
        /// <li> <b>CommunicationBody.</b> The <b>Description</b> field on the AWS Support Center <a href="https://aws.amazon.com/support/createCase">Open a new case</a> page.</li>
        /// <li> <b>Language.</b> The human language in which AWS Support handles the case. English and Japanese are currently supported.</li>
        /// <li> <b>CcEmailAddresses.</b> The AWS Support Center <b>CC</b> field on the <a href="https://aws.amazon.com/support/createCase">Open a
        /// new case</a> page. You can list email addresses to be copied on any correspondence about the case. The account that opens the case is
        /// already identified by passing the AWS Credentials in the HTTP POST method or in a method or function call from one of the programming
        /// languages supported by an <a href="http://aws.amazon.com/tools/">AWS SDK</a> . </li>
        /// <li> <b>IssueType.</b> The type of issue for the case. You can specify either "customer-service" or "technical." If you do not indicate a
        /// value, the default is "technical." </li>
        /// </ol> <para><b>NOTE:</b> The AWS Support API does not currently support the ability to add attachments to cases. You can, however, call
        /// AddCommunicationToCase to add information to an open case. </para> <para>A successful CreateCase request returns an AWS Support case number.
        /// Case numbers are used by the DescribeCases action to retrieve existing AWS Support cases. </para>
        /// </summary>
        ///
        /// <param name="createCaseRequest">Container for the necessary parameters to execute the CreateCase service method on AmazonAWSSupport.</param>
        ///
        /// <returns>The response from the CreateCase service method, as returned by AmazonAWSSupport.</returns>
        ///
        /// <exception cref="T:Amazon.AWSSupport.Model.InternalServerErrorException" />
        /// <exception cref="T:Amazon.AWSSupport.Model.CaseCreationLimitExceededException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public Task <CreateCaseResponse> CreateCaseAsync(CreateCaseRequest createCaseRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new CreateCaseRequestMarshaller();
            var unmarshaller = CreateCaseResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, CreateCaseRequest, CreateCaseResponse>(createCaseRequest, marshaller, unmarshaller, signer, cancellationToken));
        }
Beispiel #2
0
        internal CreateCaseResponse CreateCase(CreateCaseRequest request)
        {
            var marshaller   = new CreateCaseRequestMarshaller();
            var unmarshaller = CreateCaseResponseUnmarshaller.Instance;

            return(Invoke <CreateCaseRequest, CreateCaseResponse>(request, marshaller, unmarshaller));
        }
Beispiel #3
0
 public CreateCaseModel Execute(CreateCaseRequest request)
 {
     return(new CreateCaseModel
     {
         UserIsAuthenticated = _currentSdkUser.IsAuthenticated
     });
 }
Beispiel #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateCase operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateCase 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/support-2013-04-15/CreateCase">REST API Reference for CreateCase Operation</seealso>
        public Task <CreateCaseResponse> CreateCaseAsync(CreateCaseRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new CreateCaseRequestMarshaller();
            var unmarshaller = CreateCaseResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateCaseRequest, CreateCaseResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
Beispiel #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateCase operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the CreateCase 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/support-2013-04-15/CreateCase">REST API Reference for CreateCase Operation</seealso>
        public virtual Task <CreateCaseResponse> CreateCaseAsync(CreateCaseRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateCaseRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateCaseResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateCaseResponse>(request, options, cancellationToken));
        }
Beispiel #6
0
        internal virtual CreateCaseResponse CreateCase(CreateCaseRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateCaseRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateCaseResponseUnmarshaller.Instance;

            return(Invoke <CreateCaseResponse>(request, options));
        }
Beispiel #7
0
        public async Task <CreateCaseResponse> CreateCaseAsync(CreateCaseRequest createCaseRequest)
        {
            using var httpClient = new HttpClient { BaseAddress = _settings.BaseAddress };
            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", $"Basic {_settings.Key}");

            using var content  = new StringContent(JsonConvert.SerializeObject(createCaseRequest), Encoding.Default, "application/json");
            using var response = await httpClient.PostAsync("cases", content);

            var responseData = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <CreateCaseResponse>(responseData));
        }
        internal CreateCaseResponse CreateCase(CreateCaseRequest request)
        {
            var task = CreateCaseAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Beispiel #9
0
        public static async Task Run([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)
        {
            _globalLogger = log;

            //Input from VTFK
            var docToP360Request = context.GetInput <(DocToP360Request DocToP360Request, string archeoTransGuid)>();

            PrivatePersonLookupRequest privatePersonLookupRequest = (PrivatePersonLookupRequest)docToP360Request.DocToP360Request;

            //Check if the personalIdNumber exsits in P360
            if (!await context.CallActivityAsync <bool>("DoesPersonExsist", (privatePersonLookupRequest, docToP360Request.archeoTransGuid)))
            {
                //if not, create a user with given input
                PrivatePersonSyncRequest privatePersonSyncRequest = (PrivatePersonSyncRequest)docToP360Request.DocToP360Request;

                await context.CallActivityAsync("CreatePrivatePerson", (privatePersonSyncRequest, docToP360Request.archeoTransGuid));
            }

            //Checks if d exists with given Initials
            EnterpriseDepartmentLookupRequest enterpriseDepartmentLookupRequest = (EnterpriseDepartmentLookupRequest)docToP360Request.DocToP360Request.parameter;

            //Gets the Recno from GetEnterprise
            var recNO = await context.CallActivityAsync <int>("GetEnterPriseRecno", (enterpriseDepartmentLookupRequest, docToP360Request.archeoTransGuid));

            //Sends GetEnterprise recno to CreateCase
            CreateCaseRequest createCaseRequest = (CreateCaseRequest)(docToP360Request.DocToP360Request, recNO);

            createCaseRequest.parameter.ResponsibleEnterpriseRecno = recNO;

            //Stores CaseNumber from CreateCase
            var caseNumber = await context.CallActivityAsync <string>("CreateCase", (createCaseRequest, docToP360Request.archeoTransGuid));

            //Creates document with given parameters, CaseNumber from CreateCase and Recno from GetEnterprise
            CreateDocumentRequest createDocumentRequest = (CreateDocumentRequest)(docToP360Request.DocToP360Request, caseNumber, recNO);

            CreateDocumentResponse createDocumentResponse = await context.CallActivityAsync <CreateDocumentResponse>("CreateDocument", (createDocumentRequest, docToP360Request.archeoTransGuid));

            //Updates the case with created CaseNumber
            UpdateCaseRequest updateCaseRequest = (UpdateCaseRequest)(docToP360Request.DocToP360Request, caseNumber);

            UpdateCaseResponse UpdateCaseResponse = await context.CallActivityAsync <UpdateCaseResponse>("UpdateCase", (updateCaseRequest, docToP360Request.archeoTransGuid));
        }
        //CreateCase - Creates a case with given input parameters
        public static async Task <CreateCaseResponse> CreateCase(CreateCaseRequest createCaseRequest, string transactionId)
        {
            ArcheoLogger ArchLogger = new ArcheoLogger(null, new ArcheoConfiguration()
            {
                ApiKey = _ArchKey
            });

            try
            {
                //Logs the request
                ArchLogger.Log(
                    Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(createCaseRequest)),
                    "Request to CreateCase",
                    "CreateCaseRequest.Json",
                    transactionId: transactionId,
                    transactionType: "DocumentToP360",
                    status: "Success",
                    processed: DateTime.UtcNow);

                //Json serializer
                var stringContent          = new StringContent(JsonConvert.SerializeObject(createCaseRequest), Encoding.UTF8, "application/json");
                HttpResponseMessage result = await newClient.PostAsync(_BaseUrl + "/CaseService/CreateCase?authKey=" + _ApiAuthKey, stringContent);

                if (result.IsSuccessStatusCode)
                {
                    //Read Server Response
                    var responseData = await result.Content.ReadAsAsync <CreateCaseResponse>();

                    //Logs the response
                    ArchLogger.Log(
                        Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(responseData)),
                        "Response from CreateCase",
                        "CreateCaseResponse.json",
                        transactionId: transactionId,
                        transactionType: "DocumentToP360",
                        status: "Success",
                        processed: DateTime.UtcNow);
                    return(responseData);
                }
                else
                {
                    //If server response isn't 200
                    ArchLogger.LogHttpFailure(
                        response: result,
                        transactionId: transactionId,
                        transactionType: "DocumentToP360",
                        status: "Error",
                        description: "Return code to https://360.vtfk.no was NOT 200",
                        processed: DateTime.UtcNow);
                    return(null);
                }
            }
            catch (Exception ex)
            {
                //logs exception
                ArchLogger.LogException(ex, "Error during CreateCase execution", transactionId: transactionId,
                                        transactionType: "DocumentToP360",
                                        status: "Error",
                                        logTimestamp: DateTime.UtcNow);
                return(null);
            }
            finally
            {
                //Sends log to Archeo
                await ArchLogger.SendLogs();
            }
        }