public static void StartRoles(this IServiceManagement proxy,
                               string subscriptionId,
                               string serviceName,
                               string deploymentName,
                               StartRolesOperation startRolesOperation)
 {
     proxy.EndExecuteRoleSetOperation(proxy.BeginExecuteRoleSetOperation(
                                          subscriptionId,
                                          serviceName,
                                          deploymentName,
                                          startRolesOperation,
                                          null,
                                          null));
 }
Ejemplo n.º 2
0
        internal override void ExecuteCommand()
        {
            base.ExecuteCommand();

            if (CurrentDeployment == null)
            {
                return;
            }

            string roleName = (this.ParameterSetName == "ByName") ? this.Name : this.VM.RoleName;

            // Generate a list of role names matching wildcard patterns or
            // the exact name specified in the -Name parameter.
            var roleNames = PersistentVMHelper.GetRoleNames(CurrentDeployment.RoleInstanceList, roleName);

            // Insure at least one of the role name instances can be found.
            if ((roleNames == null) || (!roleNames.Any()))
            {
                throw new ArgumentOutOfRangeException(String.Format(Resources.RoleInstanceCanNotBeFoundWithName, Name));
            }

            if (roleNames.Count == 1)
            {
                ExecuteClientActionInOCS(
                    null,
                    CommandRuntime.ToString(),
                    s => this.Channel.StartRole(s, this.ServiceName, CurrentDeployment.Name, roleNames[0]));
            }
            else
            {
                var startRolesOperation = new StartRolesOperation()
                {
                    Roles = roleNames
                };
                ExecuteClientActionInOCS(
                    null,
                    CommandRuntime.ToString(),
                    s => this.Channel.StartRoles(s, this.ServiceName, CurrentDeployment.Name, startRolesOperation));
            }
        }
Ejemplo n.º 3
0
        internal override void ExecuteCommand()
        {
            base.ExecuteCommand();

            if (CurrentDeployment == null)
            {
                return;
            }

            string roleName = (this.ParameterSetName == "ByName") ? this.Name : this.VM.RoleName;

            // Generate a list of role names matching wildcard patterns or
            // the exact name specified in the -Name parameter.
            var roleNames = PersistentVMHelper.GetRoleNames(CurrentDeployment.RoleInstanceList, roleName);

            // Insure at least one of the role name instances can be found.
            if ((roleNames == null) || (!roleNames.Any()))
                throw new ArgumentOutOfRangeException(String.Format(Resources.RoleInstanceCanNotBeFoundWithName, Name));

            if (roleNames.Count == 1)
            {
                ExecuteClientActionInOCS(
                    null,
                    CommandRuntime.ToString(),
                    s => this.Channel.StartRole(s, this.ServiceName, CurrentDeployment.Name, roleNames[0]));
            }
            else
            {
                var startRolesOperation = new StartRolesOperation() { Roles = roleNames };
                ExecuteClientActionInOCS(
                    null,
                    CommandRuntime.ToString(),
                    s => this.Channel.StartRoles(s, this.ServiceName, CurrentDeployment.Name, startRolesOperation));
            }
        }
 public static void StartRoles(this IServiceManagement proxy,
     string subscriptionId,
     string serviceName,
     string deploymentName,
     StartRolesOperation startRolesOperation)
 {
     proxy.EndExecuteRoleSetOperation(proxy.BeginExecuteRoleSetOperation(
         subscriptionId,
         serviceName,
         deploymentName,
         startRolesOperation,
         null,
         null));
 }