コード例 #1
0
        protected override IAsyncResult BeginExecute(NativeActivityContext context, AsyncCallback callback, object state)
        {
            string restApiUrl = RestApiUrl.Get(context);

            if (!restApiUrl.EndsWith("/"))
            {
                restApiUrl += "/";
            }
            string client_id = ClientId.Get(context);
            string client_secret;

            if (ClientSecretSecure.Get(context) != null)
            {
                client_secret = SecureStringToString(ClientSecretSecure.Get(context));
            }
            else
            {
                client_secret = ClientSecretInsecure.Get(context);
            }

            string redirect_uri  = RedirectUrl.Get(context);
            int    serverTimeout = TimeoutMS.Get(context);


            authAgent = new AuthenticationAgent(restApiUrl, client_id, client_secret, redirect_uri, serverTimeout);

            authAgent.GetAuthUrl();

            ScheduleAuthActivities(context);

            AuthenticateAsyncDelegate = new Action(AuthenticateAsync);
            return(AuthenticateAsyncDelegate.BeginInvoke(callback, state));
        }
コード例 #2
0
 protected override void Execute(CodeActivityContext context)
 {
     try
     {
         var azureVM = new AzureVMTerminalRunner(SubscriptionId.Get(context), ClientSecret.Get(context)
                                                 , ClientId.Get(context), TenantId.Get(context));
         var resonses = azureVM.RunUnixCommand(GroupName.Get(context), VmName.Get(context), Commands.Get(context).Split(';'), VmUserName.Get(context)
                                               , VmUserPassword.Get(context));
         Response.Set(context, JsonConvert.SerializeObject(resonses));
     }
     catch (Exception e)
     {
         Error.Set(context, e.Message);
     }
 }
コード例 #3
0
 protected override void Execute(CodeActivityContext context)
 {
     try
     {
         var azureVM = new AzureVM(SubscriptionId.Get(context), ClientSecret.Get(context)
                                   , ClientId.Get(context), TenantId.Get(context));
         azureVM.CreateCentOS7VM(GroupName.Get(context), VmName.Get(context), Region.Get(context), VmUserName.Get(context)
                                 , VmUserPassword.Get(context));
         Response.Set(context, "Complete");
     }
     catch (Exception e)
     {
         Error.Set(context, e.Message);
     }
 }
コード例 #4
0
        protected override IAsyncResult BeginExecute(NativeActivityContext context, AsyncCallback callback, object state)
        {
            string restApiUrl = RestApiUrl.Get(context);

            if (!restApiUrl.EndsWith("/"))
            {
                restApiUrl += "/";
            }
            string client_id = ClientId.Get(context);
            string client_secret;

            if (ClientSecretSecure.Get(context) != null)
            {
                client_secret = SecureStringToString(ClientSecretSecure.Get(context));
            }
            else
            {
                client_secret = ClientSecretInsecure.Get(context);
            }

            string redirect_uri  = RedirectUrl.Get(context);
            int    serverTimeout = TimeoutMS.Get(context);


            authAgent = new AuthenticationAgent(restApiUrl, client_id, client_secret, redirect_uri, serverTimeout);

            if (AuthentificationTokenIn.Get(context) != null)
            {
                authAgent.authToken = JsonConvert.DeserializeObject <AuthToken>(AuthentificationTokenIn.Get(context));
                authAgent.GetAuthUrl();
                authAgent.authCode        = JsonConvert.DeserializeObject <ConcurrentDictionary <string, string> >(AuthentificationCodeIn.Get(context));
                AuthenticateAsyncDelegate = new Action(ConfigureAuthentification);
            }
            else
            {
                authAgent.GetAuthUrl();
                ScheduleAuthActivities(context);
                AuthenticateAsyncDelegate = new Action(AuthenticateAsync);
            }

            return(AuthenticateAsyncDelegate.BeginInvoke(callback, state));
        }