/// <summary>
        /// Call to start the process of upload to integration account
        /// </summary>
        /// <param name="mapsToBeUploaded"></param>
        /// <param name="mapsDetailsList"></param>
        /// <param name="outputDir"></param>
        /// <param name="overrideExistingMapsFlag"></param>
        /// <param name="aadInstance"></param>
        /// <param name="resource"></param>
        /// <param name="clientId"></param>
        /// <param name="clientSecret"></param>
        /// <param name="subscriptionId"></param>
        /// <param name="resourceGroupName"></param>
        /// <param name="iaName"></param>
        public void UploadToIntegrationAccount(List <MapDetails> mapsToBeUploaded, ref List <MapDetails> mapDetailsList, string outputDir, bool overrideExistingMapsFlag, string subscriptionId, string resourceGroupName, string iaName, AuthenticationResult authResult)
        {
            if (mapsToBeUploaded.Count > 0)
            {
                IntegrationAccountContextForMaps iacontext = new IntegrationAccountContextForMaps();
                try
                {
                    IntegrationAccountDetails iaDetails = new IntegrationAccountDetails
                    {
                        SubscriptionId         = subscriptionId,
                        ResourceGroupName      = resourceGroupName,
                        IntegrationAccountName = iaName
                    };
                    iacontext.SchemaUploadFromFolder(outputDir, mapsToBeUploaded, overrideExistingMapsFlag, iaDetails, authResult, ref mapDetailsList);
                }

                catch (Exception e)
                {
                    string message = $"ERROR! Something went wrong while doing a map upload from local folder ${outputDir}. \nErrorMessage:{e.Message}";
                    TraceProvider.WriteLine($"{message} \nStackTrace:{e.StackTrace}");

                    throw e;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Retuns true if the schema artifact already exists, false if it does not.
        /// </summary>
        /// <param name="url"></param>
        /// <param name="iaDetails"></param>
        /// <returns></returns>
        public bool CheckIfArtifactExists(string url, AuthenticationResult authResult)
        {
            IntegrationAccountContextForMaps sclient = new IntegrationAccountContextForMaps();
            HttpResponseMessage response             = new HttpResponseMessage();

            try
            {
                response = sclient.SendGetRequestToIA(url, authResult);
                if (!response.IsSuccessStatusCode)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }