/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.ChimeSDKMeetings;
using Amazon.ChimeSDKMeetings.Model;
namespace Amazon.PowerShell.Cmdlets.CHMTG
{
///
/// The capabilities that you want to update.
///
///
/// You use the capabilities with a set of values that control what the capabilities can
/// do, such as SendReceive
data. For more information about those values,
/// see .
///
/// When using capabilities, be aware of these corner cases:
/// -
/// You can't set
content
capabilities to SendReceive
or Receive
/// unless you also set video
capabilities to SendReceive
or
/// Receive
. If you don't set the video
capability to receive,
/// the response will contain an HTTP 400 Bad Request status code. However, you can set
/// your video
capability to receive and you set your content
/// capability to not receive.
/// -
/// When you change an
audio
capability from None
or Receive
/// to Send
or SendReceive
, and if the attendee left their
/// microphone unmuted, audio will flow from the attendee to the other meeting participants.
/// -
/// When you change a
video
or content
capability from None
/// or Receive
to Send
or SendReceive
, and if
/// the attendee turned on their video or content streams, remote attendees can receive
/// those streams, but only after media renegotiation between the client and the Amazon
/// Chime back-end server.
///
///
[Cmdlet("Update", "CHMTGAttendeeCapability", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("Amazon.ChimeSDKMeetings.Model.Attendee")]
[AWSCmdlet("Calls the Amazon Chime SDK Meetings UpdateAttendeeCapabilities API operation.", Operation = new[] {"UpdateAttendeeCapabilities"}, SelectReturnType = typeof(Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesResponse))]
[AWSCmdletOutput("Amazon.ChimeSDKMeetings.Model.Attendee or Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesResponse",
"This cmdlet returns an Amazon.ChimeSDKMeetings.Model.Attendee object.",
"The service call response (type Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class UpdateCHMTGAttendeeCapabilityCmdlet : AmazonChimeSDKMeetingsClientCmdlet, IExecutor
{
protected override bool IsSensitiveResponse { get; set; } = true;
#region Parameter AttendeeId
///
///
/// The ID of the attendee associated with the update request.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String AttendeeId { get; set; }
#endregion
#region Parameter Capabilities_Audio
///
///
/// The audio capability assigned to an attendee.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
[AWSConstantClassSource("Amazon.ChimeSDKMeetings.MediaCapabilities")]
public Amazon.ChimeSDKMeetings.MediaCapabilities Capabilities_Audio { get; set; }
#endregion
#region Parameter Capabilities_Content
///
///
/// The content capability assigned to an attendee.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
[AWSConstantClassSource("Amazon.ChimeSDKMeetings.MediaCapabilities")]
public Amazon.ChimeSDKMeetings.MediaCapabilities Capabilities_Content { get; set; }
#endregion
#region Parameter MeetingId
///
///
/// The ID of the meeting associated with the update request.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)]
#else
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String MeetingId { get; set; }
#endregion
#region Parameter Capabilities_Video
///
///
/// The video capability assigned to an attendee.
///
///
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
[AWSConstantClassSource("Amazon.ChimeSDKMeetings.MediaCapabilities")]
public Amazon.ChimeSDKMeetings.MediaCapabilities Capabilities_Video { get; set; }
#endregion
#region Parameter Select
///
/// Use the -Select parameter to control the cmdlet output. The default value is 'Attendee'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesResponse).
/// Specifying the name of a property of type Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesResponse will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "Attendee";
#endregion
#region Parameter PassThru
///
/// Changes the cmdlet behavior to return the value passed to the MeetingId parameter.
/// The -PassThru parameter is deprecated, use -Select '^MeetingId' instead. This parameter will be removed in a future version.
///
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^MeetingId' instead. This parameter will be removed in a future version.")]
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter PassThru { get; set; }
#endregion
#region Parameter Force
///
/// This parameter overrides confirmation prompts to force
/// the cmdlet to continue its operation. This parameter should always
/// be used with caution.
///
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter Force { get; set; }
#endregion
protected override void ProcessRecord()
{
this._AWSSignerType = "v4";
base.ProcessRecord();
var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.MeetingId), MyInvocation.BoundParameters);
if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-CHMTGAttendeeCapability (UpdateAttendeeCapabilities)"))
{
return;
}
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
if (this.PassThru.IsPresent)
{
throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select));
}
}
else if (this.PassThru.IsPresent)
{
context.Select = (response, cmdlet) => this.MeetingId;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.AttendeeId = this.AttendeeId;
#if MODULAR
if (this.AttendeeId == null && ParameterWasBound(nameof(this.AttendeeId)))
{
WriteWarning("You are passing $null as a value for parameter AttendeeId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.Capabilities_Audio = this.Capabilities_Audio;
#if MODULAR
if (this.Capabilities_Audio == null && ParameterWasBound(nameof(this.Capabilities_Audio)))
{
WriteWarning("You are passing $null as a value for parameter Capabilities_Audio which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.Capabilities_Content = this.Capabilities_Content;
#if MODULAR
if (this.Capabilities_Content == null && ParameterWasBound(nameof(this.Capabilities_Content)))
{
WriteWarning("You are passing $null as a value for parameter Capabilities_Content which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.Capabilities_Video = this.Capabilities_Video;
#if MODULAR
if (this.Capabilities_Video == null && ParameterWasBound(nameof(this.Capabilities_Video)))
{
WriteWarning("You are passing $null as a value for parameter Capabilities_Video which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.MeetingId = this.MeetingId;
#if MODULAR
if (this.MeetingId == null && ParameterWasBound(nameof(this.MeetingId)))
{
WriteWarning("You are passing $null as a value for parameter MeetingId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
// create request
var request = new Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesRequest();
if (cmdletContext.AttendeeId != null)
{
request.AttendeeId = cmdletContext.AttendeeId;
}
// populate Capabilities
var requestCapabilitiesIsNull = true;
request.Capabilities = new Amazon.ChimeSDKMeetings.Model.AttendeeCapabilities();
Amazon.ChimeSDKMeetings.MediaCapabilities requestCapabilities_capabilities_Audio = null;
if (cmdletContext.Capabilities_Audio != null)
{
requestCapabilities_capabilities_Audio = cmdletContext.Capabilities_Audio;
}
if (requestCapabilities_capabilities_Audio != null)
{
request.Capabilities.Audio = requestCapabilities_capabilities_Audio;
requestCapabilitiesIsNull = false;
}
Amazon.ChimeSDKMeetings.MediaCapabilities requestCapabilities_capabilities_Content = null;
if (cmdletContext.Capabilities_Content != null)
{
requestCapabilities_capabilities_Content = cmdletContext.Capabilities_Content;
}
if (requestCapabilities_capabilities_Content != null)
{
request.Capabilities.Content = requestCapabilities_capabilities_Content;
requestCapabilitiesIsNull = false;
}
Amazon.ChimeSDKMeetings.MediaCapabilities requestCapabilities_capabilities_Video = null;
if (cmdletContext.Capabilities_Video != null)
{
requestCapabilities_capabilities_Video = cmdletContext.Capabilities_Video;
}
if (requestCapabilities_capabilities_Video != null)
{
request.Capabilities.Video = requestCapabilities_capabilities_Video;
requestCapabilitiesIsNull = false;
}
// determine if request.Capabilities should be set to null
if (requestCapabilitiesIsNull)
{
request.Capabilities = null;
}
if (cmdletContext.MeetingId != null)
{
request.MeetingId = cmdletContext.MeetingId;
}
CmdletOutput output;
// issue call
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
pipelineOutput = cmdletContext.Select(response, this);
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
return output;
}
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesResponse CallAWSServiceOperation(IAmazonChimeSDKMeetings client, Amazon.ChimeSDKMeetings.Model.UpdateAttendeeCapabilitiesRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Chime SDK Meetings", "UpdateAttendeeCapabilities");
try
{
#if DESKTOP
return client.UpdateAttendeeCapabilities(request);
#elif CORECLR
return client.UpdateAttendeeCapabilitiesAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public System.String AttendeeId { get; set; }
public Amazon.ChimeSDKMeetings.MediaCapabilities Capabilities_Audio { get; set; }
public Amazon.ChimeSDKMeetings.MediaCapabilities Capabilities_Content { get; set; }
public Amazon.ChimeSDKMeetings.MediaCapabilities Capabilities_Video { get; set; }
public System.String MeetingId { get; set; }
public System.Func Select { get; set; } =
(response, cmdlet) => response.Attendee;
}
}
}