This class holds the credentials used to perform GCloud operations.
        public override async void Publish()
        {
            var context = new Context
            {
                CredentialsPath = CredentialsStore.Default.CurrentAccountPath,
                ProjectId = CredentialsStore.Default.CurrentProjectId,
                AppName = GoogleCloudExtensionPackage.ApplicationName,
                AppVersion = GoogleCloudExtensionPackage.ApplicationVersion,
            };
            var options = new NetCoreDeployment.DeploymentOptions
            {
                Version = Version,
                Promote = Promote,
                Context = context
            };
            var project = _publishDialog.Project;

            GcpOutputWindow.Activate();
            GcpOutputWindow.Clear();
            GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishStepStartMessage, project.Name));

            _publishDialog.FinishFlow();

            NetCorePublishResult result;
            using (var frozen = StatusbarHelper.Freeze())
            using (var animationShown = StatusbarHelper.ShowDeployAnimation())
            using (var progress = StatusbarHelper.ShowProgressBar(Resources.FlexPublishProgressMessage))
            using (var deployingOperation = ShellUtils.SetShellUIBusy())
            {
                result = await NetCoreDeployment.PublishProjectAsync(
                    project.FullPath,
                    options,
                    progress,
                    GcpOutputWindow.OutputLine);
            }

            if (result != null)
            {
                GcpOutputWindow.OutputLine(String.Format(Resources.FlexPublishSuccessMessage, project.Name));
                StatusbarHelper.SetText(Resources.PublishSuccessStatusMessage);

                var url = result.GetDeploymentUrl();
                GcpOutputWindow.OutputLine(String.Format(Resources.PublishUrlMessage, url));
                if (OpenWebsite)
                {
                    Process.Start(url);
                }
            }
            else
            {
                GcpOutputWindow.OutputLine(String.Format(Resources.FlexPublishFailedMessage, project.Name));
                StatusbarHelper.SetText(Resources.PublishFailureStatusMessage);
            }
        }
 private static Task<bool> DeployAppBundleAsync(
     string stageDirectory,
     string version,
     bool promote,
     Context context,
     Action<string> outputAction)
 {
     var appYamlPath = Path.Combine(stageDirectory, AppYamlName);
     return GCloudWrapper.DeployAppAsync(
         appYaml: appYamlPath,
         version: version,
         promote: promote,
         outputAction: outputAction,
         context: context);
 }
        private async Task<WindowsInstanceCredentials> CreateOrResetCredentials(string user)
        {
            try
            {
                Debug.WriteLine("The user requested the password to be generated.");
                if (!UserPromptUtils.ActionPrompt(
                        prompt: String.Format(Resources.ResetPasswordConfirmationPromptMessage, user, _instance.Name),
                        title: Resources.ResetPasswordConfirmationPromptTitle,
                        message: Resources.UiOperationCannotBeUndone,
                        actionCaption: Resources.UiResetButtonCaption,
                        isWarning: true))
                {
                    Debug.WriteLine("The user cancelled resetting the password.");
                    return null;
                }

                Debug.WriteLine($"Resetting the password for the user {user}");

                // Check that gcloud is in the right state to invoke the reset credentials method.
                if (!await VerifyGCloudDependencies())
                {
                    Debug.WriteLine("Missing gcloud dependencies for resetting password.");
                    return null;
                }

                var context = new Context
                {
                    CredentialsPath = CredentialsStore.Default.CurrentAccountPath,
                    ProjectId = CredentialsStore.Default.CurrentProjectId,
                    AppName = GoogleCloudExtensionPackage.ApplicationName,
                    AppVersion = GoogleCloudExtensionPackage.ApplicationVersion,
                };
                return await GCloudWrapper.ResetWindowsCredentialsAsync(
                    instanceName: _instance.Name,
                    zoneName: _instance.GetZoneName(),
                    userName: user,
                    context: context);
            }
            catch (GCloudException ex)
            {
                UserPromptUtils.ErrorPrompt(
                    String.Format(Resources.ResetPasswordFailedPromptMessage, _instance.Name, ex.Message),
                    Resources.ResetPasswordConfirmationPromptTitle);
                return null;
            }
        }