// This method will be called for each input received from the pipeline to this cmdlet; if no input is received, this method is not called
        protected override void ProcessRecord()
        {
            MsSwitchPorts port = new MsSwitchPorts();

            port.name                = name;
            port.tags                = tags;
            port.enabled             = enabled;
            port.type                = type;
            port.vlan                = vlan;
            port.voiceVlan           = voiceVlan;
            port.isolationEnabled    = isolationEnabled;
            port.rstpEnabled         = rstpEnabled;
            port.stpGuard            = stpGuard;
            port.accessPolicyNumber  = accessPolicyNumber;
            port.linkNegotiation     = linkNegotiation;
            port.portScheduleId      = portScheduleId;
            port.stormControlEnabled = stormControlEnabled;
            port.udld                = udld;

            WriteVerbose("Entering Get Orgs call");
            var list = ProcessRecordAsync(Token, serial, portNumber, port);

            MsSwitchPorts result = JsonSerializer.Deserialize <MsSwitchPorts>(list);

            WriteObject(result, true);

            WriteVerbose("Exiting foreach");
        }
        private static string ProcessRecordAsync(string Token, string serial, string number, MsSwitchPorts port)
        {
            var task = SetMsSwitchPort(Token, serial, number, port);

            task.Wait();
            var result = task.Result;

            return(result);
        }
        private static async Task <string> SetMsSwitchPort(string Token, string serial, string number, MsSwitchPorts port)
        {
            using (HttpClient client = new HttpClient())
            {
                string jsonString;
                string uri;
                uri        = $"https://dashboard.meraki.com/api/v0/devices/{serial}/switchPorts/{number}";
                jsonString = JsonSerializer.Serialize <MsSwitchPorts>(port);

                var content = new StringContent(jsonString);
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json; charset=utf-8");
                client.DefaultRequestHeaders.Add("X-Cisco-Meraki-API-Key", Token);

                var response = await client.PutAsync(uri, content);

                var contents = await response.Content.ReadAsStringAsync();

                return(contents);
            }
        }