예제 #1
0
        protected override void Execute()
        {
            object resultObject;

            if (string.IsNullOrEmpty(InstanceId))
            {
                switch (RoleType)
                {
                case RoleType.AccountContainerserver:
                    resultObject = Client.AccountContainerServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new AccountContainerRoleInstanceResponse(_));
                    break;

                case RoleType.BlobFrontend:
                    resultObject = Client.BlobFrontendInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new BlobFrontEndRoleInstanceResponse(_));
                    break;

                case RoleType.TableFrontend:
                    resultObject = Client.TableFrontendInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableFrontEndRoleInstanceResponse(_));
                    break;

                case RoleType.BlobServer:
                    resultObject = Client.BlobServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new BlobServerRoleInstanceResponse(_));
                    break;

                case RoleType.TableServer:
                    resultObject = Client.TableServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableServerRoleInstanceResponse(_));
                    break;

                case RoleType.HealthMonitoringserver:
                    resultObject = Client.HealthMonitoringServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new MonitoringServerRoleInstanceResponse(_));
                    break;

                case RoleType.MetricsServer:
                    resultObject = Client.MetricsServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new MetricsServerRoleInstanceResponse(_));
                    break;

                case RoleType.TableMaster:
                    resultObject = Client.TableMasterInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableMasterRoleInstanceResponse(_));
                    break;

                default:
                    throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType));
                }
            }
            else
            {
                switch (RoleType)
                {
                case RoleType.AccountContainerserver:
                    resultObject = new AccountContainerRoleInstanceResponse(Client.AccountContainerServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.BlobFrontend:
                    resultObject = new BlobFrontEndRoleInstanceResponse(Client.BlobFrontendInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.TableFrontend:
                    resultObject = new TableFrontEndRoleInstanceResponse(Client.TableFrontendInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.BlobServer:
                    resultObject = new BlobServerRoleInstanceResponse(Client.BlobServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.TableServer:
                    resultObject = new TableServerRoleInstanceResponse(Client.TableServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.HealthMonitoringserver:
                    resultObject = new MonitoringServerRoleInstanceResponse(Client.HealthMonitoringServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.MetricsServer:
                    resultObject = new MetricsServerRoleInstanceResponse(Client.MetricsServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                case RoleType.TableMaster:
                    resultObject = new TableMasterRoleInstanceResponse(Client.TableMasterInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                    break;

                default:
                    throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType));
                }
            }
            WriteObject(resultObject, true);
        }
예제 #2
0
 protected override void Execute()
 {
     object resultObject;
     if (string.IsNullOrEmpty(InstanceId))
     {
         switch (RoleType)
         {
             case RoleType.AccountContainerserver:
                 resultObject = Client.AccountContainerServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new AccountContainerRoleInstanceResponse(_));
                 break;
             case RoleType.BlobFrontend:
                 resultObject = Client.BlobFrontendInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new BlobFrontEndRoleInstanceResponse(_));
                 break;
             case RoleType.TableFrontend:
                 resultObject = Client.TableFrontendInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableFrontEndRoleInstanceResponse(_));
                 break;
             case RoleType.BlobServer:
                 resultObject = Client.BlobServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new BlobServerRoleInstanceResponse(_));
                 break;
             case RoleType.TableServer:
                 resultObject = Client.TableServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableServerRoleInstanceResponse(_));
                 break;
             case RoleType.HealthMonitoringserver:
                 resultObject = Client.HealthMonitoringServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new MonitoringServerRoleInstanceResponse(_));
                 break;
             case RoleType.MetricsServer:
                 resultObject = Client.MetricsServerInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new MetricsServerRoleInstanceResponse(_));
                 break;
             case RoleType.TableMaster:
                 resultObject = Client.TableMasterInstances.List(ResourceGroupName, FarmName).RoleInstances.Select(_ => new TableMasterRoleInstanceResponse(_));
                 break;
             default:
                 throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType));
         }
     }
     else
     {
         switch (RoleType)
         {
             case RoleType.AccountContainerserver:
                 resultObject = new AccountContainerRoleInstanceResponse(Client.AccountContainerServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.BlobFrontend:
                 resultObject = new BlobFrontEndRoleInstanceResponse(Client.BlobFrontendInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.TableFrontend:
                 resultObject = new TableFrontEndRoleInstanceResponse(Client.TableFrontendInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.BlobServer:
                 resultObject = new BlobServerRoleInstanceResponse(Client.BlobServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.TableServer:
                 resultObject = new TableServerRoleInstanceResponse(Client.TableServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.HealthMonitoringserver:
                 resultObject = new MonitoringServerRoleInstanceResponse(Client.HealthMonitoringServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.MetricsServer:
                 resultObject = new MetricsServerRoleInstanceResponse(Client.MetricsServerInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             case RoleType.TableMaster:
                 resultObject = new TableMasterRoleInstanceResponse(Client.TableMasterInstances.Get(ResourceGroupName, FarmName, InstanceId).RoleInstance);
                 break;
             default:
                 throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.InvalidRoleTypeErrorMessageFormat, RoleType));
         }
     }
     WriteObject(resultObject, true);
 }