/// <summary>
        /// Allows replacing an SPU
        ///
        /// <para>
        /// The replace services processing unit (SPU) operation is used to
        /// transition the configuration of an old, likely failed, SPU to a new
        /// replacement unit and allows modifying the configuration during the
        /// process.
        /// </para>
        /// </summary>
        /// <param name="nPodGuid">
        /// The unique identifier of the nPod of the old SPU that is being
        /// replaced
        /// </param>
        /// <param name="previousSpuSerial">
        /// The serial number of the old SPU that is being replaced
        /// </param>
        /// <param name="newSpuInfo">
        /// Configuration information for the new SPU
        /// </param>
        /// <param name="sSetGuid">
        /// The storage set information for the existing SPU. This information
        /// can be obtained from the active replacement alert and only used to
        /// verify that the correct SPU is selected.
        /// </param>
        /// <returns></returns>
        public bool ReplaceSpu(
            Guid nPodGuid,
            string previousSpuSerial,
            NPodSpuInput newSpuInfo,
            Guid sSetGuid)
        {
            ReplaceSpuInput input = new ReplaceSpuInput();

            input.NewSpuInfo        = newSpuInfo;
            input.NPodGuid          = nPodGuid;
            input.PreviousSpuSerial = previousSpuSerial;
            input.SsetGuid          = sSetGuid;

            // prepare parameters
            GraphQLParameters parameters = new GraphQLParameters();

            parameters.Add("input", input, false);

            TokenResponse tokenResponse = RunMutation <TokenResponse>(
                @"replaceSPU",
                parameters
                );

            return(DeliverToken(tokenResponse));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs execution of the command
        /// </summary>
        protected override void ProcessRecord()
        {
            NPodSpuInput input = new NPodSpuInput();

            if (ParameterPresent("Name"))
            {
                input.Name = Name;
            }

            if (ParameterPresent("Serial"))
            {
                input.Serial = Serial;
            }

            if (ParameterPresent("IPInfoConfigInput"))
            {
                input.DataIps = IPInfoConfigInput;
            }

            // make sure that all optional parameters are adjusted
            if (string.IsNullOrEmpty(input.Name))
            {
                input.Name = input.Serial;
            }

            WriteObject(input);
        }