SetServiceHook() публичный Метод

Sets the service hook to allow the azure remote repo to connect and deploy
public SetServiceHook ( string publishingUsername, string publishingPassword, string azureRepoName, string accountName, string repoName ) : string
publishingUsername string
publishingPassword string
azureRepoName string
accountName string
repoName string
Результат string
Пример #1
0
        /// <summary>
        /// Creates a website given github credentials
        /// </summary>
        /// <param name="website"></param>
        /// <param name="gitDetails">the details of the github repo</param>
        public void CreateFromGithub(Website website, GitDetails gitDetails)
        {
            // create the new website
            Create(website);

            // we have the new website properties
            var githubClient = new GithubClient(new WebsiteRequestHelper())
            {
                Username = gitDetails.Username,
                Password = gitDetails.Password,
            };
            var repoList = githubClient.GetRepositories();

            if (!repoList.ContainsKey(gitDetails.RepositoryName))
            {
                throw new FluentManagementException("git repository not found", "WebsiteClient");
            }
            // add the service hook in place
            string setServiceHook = githubClient.SetServiceHook(WebsiteProperties.Config.PublishingUsername,
                                                                WebsiteProperties.Config.PublishingPassword, website.Name + ".scm.azurewebsites.net",
                                                                repoList[gitDetails.RepositoryName], gitDetails.RepositoryName);

            // get all of the auth token values
            githubClient.GetOAuthToken(repoList[gitDetails.RepositoryName], gitDetails.RepositoryName);
            // add the metadata from the service hook
            WebsiteProperties.Config.Metadata.Add("ScmUri", githubClient.ScmUri);
            WebsiteProperties.Config.Metadata.Add("CloneUri", githubClient.CloneUri);
            WebsiteProperties.Config.Metadata.Add("RepoApiUri", githubClient.RepoApiUri);
            WebsiteProperties.Config.Metadata.Add("OAuthToken", githubClient.OAuthToken);
            WebsiteProperties.Config.ScmType = ScmType.GitHub;
            // update windows azure
            Update();
            // call the service hook
            //githubClient.TestServiceHook(setServiceHook);
            if (!String.IsNullOrEmpty(setServiceHook))
            {
                return;
            }
            Delete();
            throw new FluentManagementException(
                      "website created but unable to set service hook in github rolled back deployment", "WebsiteClient");
        }
Пример #2
0
        /// <summary>
        /// Creates a website given github credentials
        /// </summary>
        /// <param name="website"></param>
        /// <param name="gitDetails">the details of the github repo</param>
        public void CreateFromGithub(Website website, GitDetails gitDetails)
        {
            // create the new website
            Create(website);

            // we have the new website properties
            var githubClient = new GithubClient(new WebsiteRequestHelper())
                                   {
                                       Username = gitDetails.Username,
                                       Password = gitDetails.Password,
                                   };
            var repoList = githubClient.GetRepositories();
            if(!repoList.ContainsKey(gitDetails.RepositoryName))
                throw new FluentManagementException("git repository not found", "WebsiteClient");
            // add the service hook in place
            string setServiceHook = githubClient.SetServiceHook(WebsiteProperties.Config.PublishingUsername,
                                        WebsiteProperties.Config.PublishingPassword, website.Name + ".scm.azurewebsites.net",
                                        repoList[gitDetails.RepositoryName], gitDetails.RepositoryName);

            // get all of the auth token values
            githubClient.GetOAuthToken(repoList[gitDetails.RepositoryName], gitDetails.RepositoryName);
            // add the metadata from the service hook
            WebsiteProperties.Config.Metadata.Add("ScmUri", githubClient.ScmUri);
            WebsiteProperties.Config.Metadata.Add("CloneUri", githubClient.CloneUri);
            WebsiteProperties.Config.Metadata.Add("RepoApiUri", githubClient.RepoApiUri);
            WebsiteProperties.Config.Metadata.Add("OAuthToken", githubClient.OAuthToken);
            WebsiteProperties.Config.ScmType = ScmType.GitHub;
            // update windows azure
            Update();
            // call the service hook
            //githubClient.TestServiceHook(setServiceHook);
            if (!String.IsNullOrEmpty(setServiceHook)) return;
            Delete();
            throw new FluentManagementException(
                "website created but unable to set service hook in github rolled back deployment", "WebsiteClient");
        }