/// <summary>
        /// Create a new nPod template
        /// </summary>
        /// <param name="input">
        /// An input object that describes the new nPod template
        /// </param>
        /// <returns>The created nPod template</returns>
        public NPodTemplate CreateNPodTemplate(CreateNPodTemplateInput input)
        {
            // setup parameters
            GraphQLParameters parameters = new GraphQLParameters();

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

            return(RunMutation <NPodTemplate>(@"createNPodTemplate", parameters));
        }
Exemplo n.º 2
0
            /// <summary>
            /// Performs execution of the command
            /// </summary>
            protected override void ProcessRecord()
            {
                try
                {
                    CreateNPodTemplateInput input = new CreateNPodTemplateInput();
                    if (ParameterPresent("Name"))
                    {
                        input.Name = Name;
                    }
                    if (ParameterPresent("SavingFactor"))
                    {
                        input.SavingFactor = SavingFactor;
                    }
                    if (ParameterPresent("MirroredVolume"))
                    {
                        input.MirroredVolume = MirroredVolume;
                    }
                    if (ParameterPresent("BootVolume"))
                    {
                        input.BootVolume = BootVolume;
                    }
                    if (ParameterPresent("OperatingSystem"))
                    {
                        input.OperatingSystem = OperatingSystem;
                    }
                    if (ParameterPresent("VolumeSizeBytes"))
                    {
                        input.VolumeSizeBytes = VolumeSizeBytes;
                    }
                    if (ParameterPresent("SharedLun"))
                    {
                        input.SharedLun = SharedLun;
                    }
                    if (ParameterPresent("BootVolumeSizeBytes"))
                    {
                        input.BootVolumeSizeBytes = BootVolumeSizeBytes;
                    }
                    if (ParameterPresent("BootImageURL"))
                    {
                        input.BootImageURL = BootImageURL;
                    }
                    if (ParameterPresent("Application"))
                    {
                        input.Application = Application;
                    }
                    if (ParameterPresent("Note"))
                    {
                        input.Note = Note;
                    }
                    if (ParameterPresent("SnapshotScheduleTemplateGuids"))
                    {
                        input.SnapshotScheduleTemplateGuids = SnapshotScheduleTemplateGuids;
                    }
                    if (ParameterPresent("VolumeCount"))
                    {
                        input.VolumeCount = VolumeCount;
                    }

                    NPodTemplate template = Connection.CreateNPodTemplate(input);
                    WriteObject(template);
                }
                catch (AggregateException exceptions)
                {
                    foreach (Exception ex in exceptions.InnerExceptions)
                    {
                        WriteError(ex);
                    }
                }
                catch (Exception ex)
                {
                    WriteError(ex);
                }
            }