protected override void ProcessRecord()
 {
     base.ProcessRecord();
     
     var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.BranchName), MyInvocation.BoundParameters);
     if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-AMPBranch (CreateBranch)"))
     {
         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<Amazon.Amplify.Model.CreateBranchResponse, NewAMPBranchCmdlet>(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.BranchName;
     }
     #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
     context.AppId = this.AppId;
     #if MODULAR
     if (this.AppId == null && ParameterWasBound(nameof(this.AppId)))
     {
         WriteWarning("You are passing $null as a value for parameter AppId 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.BackendEnvironmentArn = this.BackendEnvironmentArn;
     context.BasicAuthCredential = this.BasicAuthCredential;
     context.BranchName = this.BranchName;
     #if MODULAR
     if (this.BranchName == null && ParameterWasBound(nameof(this.BranchName)))
     {
         WriteWarning("You are passing $null as a value for parameter BranchName 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.BuildSpec = this.BuildSpec;
     context.Description = this.Description;
     context.DisplayName = this.DisplayName;
     context.EnableAutoBuild = this.EnableAutoBuild;
     context.EnableBasicAuth = this.EnableBasicAuth;
     context.EnableNotification = this.EnableNotification;
     context.EnablePullRequestPreview = this.EnablePullRequestPreview;
     if (this.EnvironmentVariable != null)
     {
         context.EnvironmentVariable = new Dictionary<System.String, System.String>(StringComparer.Ordinal);
         foreach (var hashKey in this.EnvironmentVariable.Keys)
         {
             context.EnvironmentVariable.Add((String)hashKey, (String)(this.EnvironmentVariable[hashKey]));
         }
     }
     context.Framework = this.Framework;
     context.PullRequestEnvironmentName = this.PullRequestEnvironmentName;
     context.Stage = this.Stage;
     if (this.Tag != null)
     {
         context.Tag = new Dictionary<System.String, System.String>(StringComparer.Ordinal);
         foreach (var hashKey in this.Tag.Keys)
         {
             context.Tag.Add((String)hashKey, (String)(this.Tag[hashKey]));
         }
     }
     context.Ttl = this.Ttl;
     
     // allow further manipulation of loaded context prior to processing
     PostExecutionContextLoad(context);
     
     var output = Execute(context) as CmdletOutput;
     ProcessOutput(output);
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.InstanceId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Add-CONNQueueQuickConnect (AssociateQueueQuickConnects)"))
            {
                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 <Amazon.Connect.Model.AssociateQueueQuickConnectsResponse, AddCONNQueueQuickConnectCmdlet>(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.InstanceId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.InstanceId = this.InstanceId;
            #if MODULAR
            if (this.InstanceId == null && ParameterWasBound(nameof(this.InstanceId)))
            {
                WriteWarning("You are passing $null as a value for parameter InstanceId 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.QueueId = this.QueueId;
            #if MODULAR
            if (this.QueueId == null && ParameterWasBound(nameof(this.QueueId)))
            {
                WriteWarning("You are passing $null as a value for parameter QueueId 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
            if (this.QuickConnectId != null)
            {
                context.QuickConnectId = new List <System.String>(this.QuickConnectId);
            }
            #if MODULAR
            if (this.QuickConnectId == null && ParameterWasBound(nameof(this.QuickConnectId)))
            {
                WriteWarning("You are passing $null as a value for parameter QuickConnectId 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);
        }
Example #3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = string.Empty;

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Send-SMEHeartbeat (SendHeartbeat)"))
            {
                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 <Amazon.SagemakerEdgeManager.Model.SendHeartbeatResponse, SendSMEHeartbeatCmdlet>(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.DeviceName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            if (this.AgentMetric != null)
            {
                context.AgentMetric = new List <Amazon.SagemakerEdgeManager.Model.EdgeMetric>(this.AgentMetric);
            }
            context.AgentVersion = this.AgentVersion;
            #if MODULAR
            if (this.AgentVersion == null && ParameterWasBound(nameof(this.AgentVersion)))
            {
                WriteWarning("You are passing $null as a value for parameter AgentVersion 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.DeviceFleetName = this.DeviceFleetName;
            #if MODULAR
            if (this.DeviceFleetName == null && ParameterWasBound(nameof(this.DeviceFleetName)))
            {
                WriteWarning("You are passing $null as a value for parameter DeviceFleetName 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.DeviceName = this.DeviceName;
            #if MODULAR
            if (this.DeviceName == null && ParameterWasBound(nameof(this.DeviceName)))
            {
                WriteWarning("You are passing $null as a value for parameter DeviceName 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
            if (this.Model != null)
            {
                context.Model = new List <Amazon.SagemakerEdgeManager.Model.Model>(this.Model);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #4
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            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 <Amazon.Neptune.Model.DescribeEventsResponse, GetNPTEventCmdlet>(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.SourceIdentifier;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.Duration   = this.Duration;
            context.EndTimeUtc = this.EndTimeUtc;
            if (this.EventCategory != null)
            {
                context.EventCategory = new List <System.String>(this.EventCategory);
            }
            if (this.Filter != null)
            {
                context.Filter = new List <Amazon.Neptune.Model.Filter>(this.Filter);
            }
            context.Marker    = this.Marker;
            context.MaxRecord = this.MaxRecord;
            #if !MODULAR
            if (ParameterWasBound(nameof(this.MaxRecord)) && this.MaxRecord.HasValue)
            {
                WriteWarning("AWSPowerShell and AWSPowerShell.NetCore use the MaxRecord parameter to limit the total number of items returned by the cmdlet." +
                             " This behavior is obsolete and will be removed in a future version of these modules. Pipe the output of this cmdlet into Select-Object -First to terminate" +
                             " retrieving data pages early and control the number of items returned. AWS.Tools already implements the new behavior of simply passing MaxRecord" +
                             " to the service to specify how many items should be returned by each service call.");
            }
            #endif
            context.SourceIdentifier = this.SourceIdentifier;
            context.SourceType       = this.SourceType;
            context.StartTimeUtc     = this.StartTimeUtc;
            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.EndTime = this.EndTime;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.StartTime = this.StartTime;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #5
0
 internal static void LoadWeb(CmdletContext ctx, Web web, bool detail)
 {
     ctx.Load(web);
     ctx.Load(web, w => w.HasUniqueRoleAssignments,
         w => w.EnableMinimalDownload);
     if (detail)
     {
         ctx.Load(web,
             w => w.AllowDesignerForCurrentUser,
             w => w.AllowMasterPageEditingForCurrentUser,
             w => w.AllowRevertFromTemplateForCurrentUser,
             w => w.AllProperties,
             w => w.AlternateCssUrl,
             w => w.AssociatedMemberGroup,
             w => w.AssociatedOwnerGroup,
             w => w.AssociatedVisitorGroup,
             //w => w.AvailableContentTypes,
             //w => w.AvailableFields,
             //w => w.ContentTypes,
             w => w.CurrentUser,
             //w => w.EffectiveBasePermissions,
             //w => w.EventReceivers,
             //w => w.Features,
             //w => w.Fields,
             //w => w.FirstUniqueAncestorSecurableObject,
             //w => w.Folders,
             //w => w.Lists,
             //w => w.ListTemplates,
             w => w.Navigation,
             w => w.RecycleBin,
             w => w.RegionalSettings,
             w => w.RoleAssignments,
             w => w.RoleDefinitions,
             //w => w.RootFolder,
             w => w.SaveSiteAsTemplateEnabled,
             w => w.ShowUrlStructureForCurrentUser,
             //w => w.SiteGroups,
             //w => w.SiteUserInfoList,
             //w => w.SiteUsers,
             w => w.SiteLogoUrl,
             w => w.SupportedUILanguageIds,
             w => w.ThemeInfo,
             w => w.UserCustomActions,
             w => w.WorkflowAssociations,
             w => w.WorkflowTemplates);
     }
     ctx.ExecuteQuery();
 }
Example #6
0
 internal static SPOField GetField(CmdletContext ctx, FieldCollection fields, string nameOrTitle)
 {
     Field field = fields.GetByInternalNameOrTitle(nameOrTitle);
     ctx.Load(field);
     ctx.ExecuteQuery();
     if (!field.ServerObjectIsNull.Value)
     {
         return new SPOField(field);
     }
     return null;
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.KeyId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Import-KMSKeyMaterial (ImportKeyMaterial)"))
            {
                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 <Amazon.KeyManagementService.Model.ImportKeyMaterialResponse, ImportKMSKeyMaterialCmdlet>(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.KeyId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.EncryptedKeyMaterial = this.EncryptedKeyMaterial;
            #if MODULAR
            if (this.EncryptedKeyMaterial == null && ParameterWasBound(nameof(this.EncryptedKeyMaterial)))
            {
                WriteWarning("You are passing $null as a value for parameter EncryptedKeyMaterial 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.ExpirationModel = this.ExpirationModel;
            context.ImportToken     = this.ImportToken;
            #if MODULAR
            if (this.ImportToken == null && ParameterWasBound(nameof(this.ImportToken)))
            {
                WriteWarning("You are passing $null as a value for parameter ImportToken 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.KeyId = this.KeyId;
            #if MODULAR
            if (this.KeyId == null && ParameterWasBound(nameof(this.KeyId)))
            {
                WriteWarning("You are passing $null as a value for parameter KeyId 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.ValidTo = this.ValidTo;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.Attribute), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Edit-EC2FpgaImageAttribute (ModifyFpgaImageAttribute)"))
            {
                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 <Amazon.EC2.Model.ModifyFpgaImageAttributeResponse, EditEC2FpgaImageAttributeCmdlet>(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.Attribute;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.Attribute   = this.Attribute;
            context.Description = this.Description;
            context.FpgaImageId = this.FpgaImageId;
            #if MODULAR
            if (this.FpgaImageId == null && ParameterWasBound(nameof(this.FpgaImageId)))
            {
                WriteWarning("You are passing $null as a value for parameter FpgaImageId 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
            if (this.LoadPermission_Add != null)
            {
                context.LoadPermission_Add = new List <Amazon.EC2.Model.LoadPermissionRequest>(this.LoadPermission_Add);
            }
            if (this.LoadPermission_Remove != null)
            {
                context.LoadPermission_Remove = new List <Amazon.EC2.Model.LoadPermissionRequest>(this.LoadPermission_Remove);
            }
            context.Name          = this.Name;
            context.OperationType = this.OperationType;
            if (this.ProductCode != null)
            {
                context.ProductCode = new List <System.String>(this.ProductCode);
            }
            if (this.UserGroup != null)
            {
                context.UserGroup = new List <System.String>(this.UserGroup);
            }
            if (this.UserId != null)
            {
                context.UserId = new List <System.String>(this.UserId);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #9
0
 internal static void LoadList(CmdletContext ctx, List list, bool detailed)
 {
     ctx.Load(list);
     ctx.Load(list,
         l => l.RootFolder,
         l => l.DefaultViewUrl,
         l => l.HasUniqueRoleAssignments);
     if (detailed)
     {
         ctx.Load(list,
             l => l.DefaultDisplayFormUrl,
             l => l.DefaultEditFormUrl,
             l => l.DefaultNewFormUrl,
             l => l.IsSiteAssetsLibrary,
             l => l.OnQuickLaunch,
             l => l.SchemaXml,
             l => l.UserCustomActions,
             l => l.ValidationFormula,
             l => l.ValidationMessage,
             l => l.WorkflowAssociations);
         SPOFolder.LoadFolder(ctx, list.RootFolder, detailed, true);
     }
     else
         ctx.ExecuteQuery();
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.Name), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-MWAAEnvironment (CreateEnvironment)"))
            {
                return;
            }

            var context = new CmdletContext();

            // allow for manipulation of parameters prior to loading into context
            PreExecutionContextLoad(context);

            if (ParameterWasBound(nameof(this.Select)))
            {
                context.Select = CreateSelectDelegate <Amazon.MWAA.Model.CreateEnvironmentResponse, NewMWAAEnvironmentCmdlet>(Select) ??
                                 throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
            }
            if (this.AirflowConfigurationOption != null)
            {
                context.AirflowConfigurationOption = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.AirflowConfigurationOption.Keys)
                {
                    context.AirflowConfigurationOption.Add((String)hashKey, (String)(this.AirflowConfigurationOption[hashKey]));
                }
            }
            context.AirflowVersion = this.AirflowVersion;
            context.DagS3Path      = this.DagS3Path;
            #if MODULAR
            if (this.DagS3Path == null && ParameterWasBound(nameof(this.DagS3Path)))
            {
                WriteWarning("You are passing $null as a value for parameter DagS3Path 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.EnvironmentClass = this.EnvironmentClass;
            context.ExecutionRoleArn = this.ExecutionRoleArn;
            #if MODULAR
            if (this.ExecutionRoleArn == null && ParameterWasBound(nameof(this.ExecutionRoleArn)))
            {
                WriteWarning("You are passing $null as a value for parameter ExecutionRoleArn 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.KmsKey = this.KmsKey;
            context.DagProcessingLogs_Enabled  = this.DagProcessingLogs_Enabled;
            context.DagProcessingLogs_LogLevel = this.DagProcessingLogs_LogLevel;
            context.SchedulerLogs_Enabled      = this.SchedulerLogs_Enabled;
            context.SchedulerLogs_LogLevel     = this.SchedulerLogs_LogLevel;
            context.TaskLogs_Enabled           = this.TaskLogs_Enabled;
            context.TaskLogs_LogLevel          = this.TaskLogs_LogLevel;
            context.WebserverLogs_Enabled      = this.WebserverLogs_Enabled;
            context.WebserverLogs_LogLevel     = this.WebserverLogs_LogLevel;
            context.WorkerLogs_Enabled         = this.WorkerLogs_Enabled;
            context.WorkerLogs_LogLevel        = this.WorkerLogs_LogLevel;
            context.MaxWorker = this.MaxWorker;
            context.Name      = this.Name;
            #if MODULAR
            if (this.Name == null && ParameterWasBound(nameof(this.Name)))
            {
                WriteWarning("You are passing $null as a value for parameter Name 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
            if (this.NetworkConfiguration_SecurityGroupId != null)
            {
                context.NetworkConfiguration_SecurityGroupId = new List <System.String>(this.NetworkConfiguration_SecurityGroupId);
            }
            if (this.NetworkConfiguration_SubnetId != null)
            {
                context.NetworkConfiguration_SubnetId = new List <System.String>(this.NetworkConfiguration_SubnetId);
            }
            context.PluginsS3ObjectVersion      = this.PluginsS3ObjectVersion;
            context.PluginsS3Path               = this.PluginsS3Path;
            context.RequirementsS3ObjectVersion = this.RequirementsS3ObjectVersion;
            context.RequirementsS3Path          = this.RequirementsS3Path;
            context.SourceBucketArn             = this.SourceBucketArn;
            #if MODULAR
            if (this.SourceBucketArn == null && ParameterWasBound(nameof(this.SourceBucketArn)))
            {
                WriteWarning("You are passing $null as a value for parameter SourceBucketArn 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
            if (this.Tag != null)
            {
                context.Tag = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.Tag.Keys)
                {
                    context.Tag.Add((String)hashKey, (String)(this.Tag[hashKey]));
                }
            }
            context.WebserverAccessMode          = this.WebserverAccessMode;
            context.WeeklyMaintenanceWindowStart = this.WeeklyMaintenanceWindowStart;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
 internal static void LoadWebPart(CmdletContext ctx, WebPart webPart)
 {
     ctx.Load(webPart,
         wp => wp.Hidden,
         wp => wp.IsClosed,
         wp => wp.Properties,
         wp => wp.Subtitle,
         wp => wp.Title,
         wp => wp.TitleUrl,
         wp => wp.ZoneIndex);
     ctx.ExecuteQuery();
 }
Example #12
0
 internal static void LoadSite(CmdletContext ctx, Site site, bool detailed)
 {
     ctx.Load(site);
     if (detailed)
     {
         ctx.Load(site,
             s => s.CanUpgrade,
             s => s.Owner,
             s => s.RecycleBin,
             s => s.UpgradeInfo,
             s => s.Usage,
             s => s.UserCustomActions);
     }
     ctx.ExecuteQuery();
 }
Example #13
0
        internal static void LoadFile(CmdletContext ctx, File file)
        {
            ctx.Load(file);
            ctx.Load(file,
                f => f.Author,
                f => f.ModifiedBy,
                f => f.CheckedOutByUser,
                f => f.LockedByUser,
                f => f.Versions);
            ctx.ExecuteQuery();

            try
            {
                ctx.Load(file, f => f.ListItemAllFields);
                ctx.ExecuteQuery();
            }
            catch { }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ReplicationGroupId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Edit-ECReplicationGroup (ModifyReplicationGroup)"))
            {
                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 <Amazon.ElastiCache.Model.ModifyReplicationGroupResponse, EditECReplicationGroupCmdlet>(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.ReplicationGroupId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.ApplyImmediately         = this.ApplyImmediately;
            context.AuthToken                = this.AuthToken;
            context.AuthTokenUpdateStrategy  = this.AuthTokenUpdateStrategy;
            context.AutomaticFailoverEnabled = this.AutomaticFailoverEnabled;
            context.AutoMinorVersionUpgrade  = this.AutoMinorVersionUpgrade;
            context.CacheNodeType            = this.CacheNodeType;
            context.CacheParameterGroupName  = this.CacheParameterGroupName;
            if (this.CacheSecurityGroupName != null)
            {
                context.CacheSecurityGroupName = new List <System.String>(this.CacheSecurityGroupName);
            }
            context.EngineVersion = this.EngineVersion;
            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.NodeGroupId = this.NodeGroupId;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.NotificationTopicArn        = this.NotificationTopicArn;
            context.NotificationTopicStatus     = this.NotificationTopicStatus;
            context.PreferredMaintenanceWindow  = this.PreferredMaintenanceWindow;
            context.PrimaryClusterId            = this.PrimaryClusterId;
            context.ReplicationGroupDescription = this.ReplicationGroupDescription;
            context.ReplicationGroupId          = this.ReplicationGroupId;
            #if MODULAR
            if (this.ReplicationGroupId == null && ParameterWasBound(nameof(this.ReplicationGroupId)))
            {
                WriteWarning("You are passing $null as a value for parameter ReplicationGroupId 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
            if (this.SecurityGroupId != null)
            {
                context.SecurityGroupId = new List <System.String>(this.SecurityGroupId);
            }
            context.SnapshotRetentionLimit = this.SnapshotRetentionLimit;
            context.SnapshottingClusterId  = this.SnapshottingClusterId;
            context.SnapshotWindow         = this.SnapshotWindow;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #15
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.CatalogId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Grant-LKFPermission (GrantPermissions)"))
            {
                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 <Amazon.LakeFormation.Model.GrantPermissionsResponse, GrantLKFPermissionCmdlet>(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.Permission;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.CatalogId = this.CatalogId;
            if (this.Permission != null)
            {
                context.Permission = new List <System.String>(this.Permission);
            }
            #if MODULAR
            if (this.Permission == null && ParameterWasBound(nameof(this.Permission)))
            {
                WriteWarning("You are passing $null as a value for parameter Permission 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
            if (this.PermissionsWithGrantOption != null)
            {
                context.PermissionsWithGrantOption = new List <System.String>(this.PermissionsWithGrantOption);
            }
            context.Principal_DataLakePrincipalIdentifier = this.Principal_DataLakePrincipalIdentifier;
            context.Resource_Catalog         = this.Resource_Catalog;
            context.Database_Name            = this.Database_Name;
            context.DataLocation_ResourceArn = this.DataLocation_ResourceArn;
            context.Table_DatabaseName       = this.Table_DatabaseName;
            context.Table_Name = this.Table_Name;
            if (this.TableWithColumns_ColumnName != null)
            {
                context.TableWithColumns_ColumnName = new List <System.String>(this.TableWithColumns_ColumnName);
            }
            if (this.ColumnWildcard_ExcludedColumnName != null)
            {
                context.ColumnWildcard_ExcludedColumnName = new List <System.String>(this.ColumnWildcard_ExcludedColumnName);
            }
            context.TableWithColumns_DatabaseName = this.TableWithColumns_DatabaseName;
            context.TableWithColumns_Name         = this.TableWithColumns_Name;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #16
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.TargetProductName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Copy-SCProduct (CopyProduct)"))
            {
                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 <Amazon.ServiceCatalog.Model.CopyProductResponse, CopySCProductCmdlet>(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.IdempotencyToken;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AcceptLanguage = this.AcceptLanguage;
            if (this.CopyOption != null)
            {
                context.CopyOption = new List <System.String>(this.CopyOption);
            }
            context.IdempotencyToken = this.IdempotencyToken;
            context.SourceProductArn = this.SourceProductArn;
            #if MODULAR
            if (this.SourceProductArn == null && ParameterWasBound(nameof(this.SourceProductArn)))
            {
                WriteWarning("You are passing $null as a value for parameter SourceProductArn 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
            if (this.SourceProvisioningArtifactIdentifier != null)
            {
                context.SourceProvisioningArtifactIdentifier = new List <Dictionary <System.String, System.String> >();
                foreach (var hashTable in this.SourceProvisioningArtifactIdentifier)
                {
                    var d = new Dictionary <System.String, System.String>();
                    foreach (var hashKey in hashTable.Keys)
                    {
                        d.Add((String)hashKey, (String)(hashTable[hashKey]));
                    }
                    context.SourceProvisioningArtifactIdentifier.Add(d);
                }
            }
            context.TargetProductId   = this.TargetProductId;
            context.TargetProductName = this.TargetProductName;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.DestinationKeyId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Invoke-KMSReEncrypt (ReEncrypt)"))
            {
                return;
            }

            var context = new CmdletContext();

            // allow for manipulation of parameters prior to loading into context
            PreExecutionContextLoad(context);

            if (ParameterWasBound(nameof(this.Select)))
            {
                context.Select = CreateSelectDelegate <Amazon.KeyManagementService.Model.ReEncryptResponse, InvokeKMSReEncryptCmdlet>(Select) ??
                                 throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
            }
            context.CiphertextBlob = this.CiphertextBlob;
            #if MODULAR
            if (this.CiphertextBlob == null && ParameterWasBound(nameof(this.CiphertextBlob)))
            {
                WriteWarning("You are passing $null as a value for parameter CiphertextBlob 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.DestinationEncryptionAlgorithm = this.DestinationEncryptionAlgorithm;
            if (this.DestinationEncryptionContext != null)
            {
                context.DestinationEncryptionContext = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.DestinationEncryptionContext.Keys)
                {
                    context.DestinationEncryptionContext.Add((String)hashKey, (String)(this.DestinationEncryptionContext[hashKey]));
                }
            }
            context.DestinationKeyId = this.DestinationKeyId;
            #if MODULAR
            if (this.DestinationKeyId == null && ParameterWasBound(nameof(this.DestinationKeyId)))
            {
                WriteWarning("You are passing $null as a value for parameter DestinationKeyId 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
            if (this.GrantToken != null)
            {
                context.GrantToken = new List <System.String>(this.GrantToken);
            }
            context.SourceEncryptionAlgorithm = this.SourceEncryptionAlgorithm;
            if (this.SourceEncryptionContext != null)
            {
                context.SourceEncryptionContext = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.SourceEncryptionContext.Keys)
                {
                    context.SourceEncryptionContext.Add((String)hashKey, (String)(this.SourceEncryptionContext[hashKey]));
                }
            }
            context.SourceKeyId = this.SourceKeyId;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #18
0
        internal static void LoadView(CmdletContext ctx, View view)
        {
            ctx.Load(view);
            ctx.Load(view, v => v.ViewFields);

            ctx.ExecuteQuery();
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            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 <Amazon.Chime.Model.ListRoomMembershipsResponse, GetCHMRoomMembershipListCmdlet>(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.RoomId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AccountId = this.AccountId;
            #if MODULAR
            if (this.AccountId == null && ParameterWasBound(nameof(this.AccountId)))
            {
                WriteWarning("You are passing $null as a value for parameter AccountId 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
            if (ParameterWasBound(nameof(this.MaxResult)))
            {
                context.MaxResult = this.MaxResult;
            }
            #if MODULAR
            else
            {
                WriteVerbose("MaxResult parameter unset, using default value of '99'");
                context.MaxResult = 99;
            }
            #endif
            #if !MODULAR
            if (ParameterWasBound(nameof(this.MaxResult)) && this.MaxResult.HasValue)
            {
                WriteWarning("AWSPowerShell and AWSPowerShell.NetCore use the MaxResult parameter to limit the total number of items returned by the cmdlet." +
                             " This behavior is obsolete and will be removed in a future version of these modules. Pipe the output of this cmdlet into Select-Object -First to terminate" +
                             " retrieving data pages early and control the number of items returned. AWS.Tools already implements the new behavior of simply passing MaxResult" +
                             " to the service to specify how many items should be returned by each service call.");
            }
            #endif
            context.NextToken = this.NextToken;
            context.RoomId    = this.RoomId;
            #if MODULAR
            if (this.RoomId == null && ParameterWasBound(nameof(this.RoomId)))
            {
                WriteWarning("You are passing $null as a value for parameter RoomId 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);
        }
        internal static void LoadContentType(CmdletContext ctx, ContentType ct)
        {
            ctx.Load(ct);
            ctx.Load(ct,
                c => c.FieldLinks,
                c => c.Fields,
                c => c.Parent,
                c => c.SchemaXmlWithResourceTokens,
                c => c.WorkflowAssociations);

            ctx.ExecuteQuery();
        }
Example #21
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            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 <Amazon.CostExplorer.Model.GetSavingsPlansPurchaseRecommendationResponse, GetCESavingsPlansPurchaseRecommendationCmdlet>(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.PaymentOption;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AccountScope        = this.AccountScope;
            context.Filter              = this.Filter;
            context.LookbackPeriodInDay = this.LookbackPeriodInDay;
            #if MODULAR
            if (this.LookbackPeriodInDay == null && ParameterWasBound(nameof(this.LookbackPeriodInDay)))
            {
                WriteWarning("You are passing $null as a value for parameter LookbackPeriodInDay 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.NextPageToken = this.NextPageToken;
            context.PageSize      = this.PageSize;
            context.PaymentOption = this.PaymentOption;
            #if MODULAR
            if (this.PaymentOption == null && ParameterWasBound(nameof(this.PaymentOption)))
            {
                WriteWarning("You are passing $null as a value for parameter PaymentOption 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.SavingsPlansType = this.SavingsPlansType;
            #if MODULAR
            if (this.SavingsPlansType == null && ParameterWasBound(nameof(this.SavingsPlansType)))
            {
                WriteWarning("You are passing $null as a value for parameter SavingsPlansType 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.TermInYear = this.TermInYear;
            #if MODULAR
            if (this.TermInYear == null && ParameterWasBound(nameof(this.TermInYear)))
            {
                WriteWarning("You are passing $null as a value for parameter TermInYear 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);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.SyncName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-SSMResourceDataSync (CreateResourceDataSync)"))
            {
                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 <Amazon.SimpleSystemsManagement.Model.CreateResourceDataSyncResponse, NewSSMResourceDataSyncCmdlet>(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.SyncName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.S3Destination_AWSKMSKeyARN = this.S3Destination_AWSKMSKeyARN;
            context.S3Destination_BucketName   = this.S3Destination_BucketName;
            context.DestinationDataSharing_DestinationDataSharingType = this.DestinationDataSharing_DestinationDataSharingType;
            context.S3Destination_Prefix     = this.S3Destination_Prefix;
            context.S3Destination_Region     = this.S3Destination_Region;
            context.S3Destination_SyncFormat = this.S3Destination_SyncFormat;
            context.SyncName = this.SyncName;
            #if MODULAR
            if (this.SyncName == null && ParameterWasBound(nameof(this.SyncName)))
            {
                WriteWarning("You are passing $null as a value for parameter SyncName 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
            if (this.AwsOrganizationsSource_OrganizationalUnit != null)
            {
                context.AwsOrganizationsSource_OrganizationalUnit = new List <Amazon.SimpleSystemsManagement.Model.ResourceDataSyncOrganizationalUnit>(this.AwsOrganizationsSource_OrganizationalUnit);
            }
            context.AwsOrganizationsSource_OrganizationSourceType = this.AwsOrganizationsSource_OrganizationSourceType;
            context.SyncSource_IncludeFutureRegion = this.SyncSource_IncludeFutureRegion;
            if (this.SyncSource_SourceRegion != null)
            {
                context.SyncSource_SourceRegion = new List <System.String>(this.SyncSource_SourceRegion);
            }
            context.SyncSource_SourceType = this.SyncSource_SourceType;
            context.SyncType = this.SyncType;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #23
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.Family), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Register-ECSTaskDefinition (RegisterTaskDefinition)"))
            {
                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 <Amazon.ECS.Model.RegisterTaskDefinitionResponse, RegisterECSTaskDefinitionCmdlet>(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.Family;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            if (this.ContainerDefinition != null)
            {
                context.ContainerDefinition = new List <Amazon.ECS.Model.ContainerDefinition>(this.ContainerDefinition);
            }
            #if MODULAR
            if (this.ContainerDefinition == null && ParameterWasBound(nameof(this.ContainerDefinition)))
            {
                WriteWarning("You are passing $null as a value for parameter ContainerDefinition 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.Cpu = this.Cpu;
            context.ExecutionRoleArn = this.ExecutionRoleArn;
            context.Family           = this.Family;
            #if MODULAR
            if (this.Family == null && ParameterWasBound(nameof(this.Family)))
            {
                WriteWarning("You are passing $null as a value for parameter Family 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
            if (this.InferenceAccelerator != null)
            {
                context.InferenceAccelerator = new List <Amazon.ECS.Model.InferenceAccelerator>(this.InferenceAccelerator);
            }
            context.IpcMode     = this.IpcMode;
            context.Memory      = this.Memory;
            context.NetworkMode = this.NetworkMode;
            context.PidMode     = this.PidMode;
            if (this.PlacementConstraint != null)
            {
                context.PlacementConstraint = new List <Amazon.ECS.Model.TaskDefinitionPlacementConstraint>(this.PlacementConstraint);
            }
            context.ProxyConfiguration_ContainerName = this.ProxyConfiguration_ContainerName;
            if (this.ProxyConfiguration_Property != null)
            {
                context.ProxyConfiguration_Property = new List <Amazon.ECS.Model.KeyValuePair>(this.ProxyConfiguration_Property);
            }
            context.ProxyConfiguration_Type = this.ProxyConfiguration_Type;
            if (this.RequiresCompatibility != null)
            {
                context.RequiresCompatibility = new List <System.String>(this.RequiresCompatibility);
            }
            if (this.Tag != null)
            {
                context.Tag = new List <Amazon.ECS.Model.Tag>(this.Tag);
            }
            context.TaskRoleArn = this.TaskRoleArn;
            if (this.Volume != null)
            {
                context.Volume = new List <Amazon.ECS.Model.Volume>(this.Volume);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            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 <Amazon.LexModelsV2.Model.ListRecommendedIntentsResponse, GetLMBV2RecommendedIntentListCmdlet>(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.BotRecommendationId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.BotId = this.BotId;
            #if MODULAR
            if (this.BotId == null && ParameterWasBound(nameof(this.BotId)))
            {
                WriteWarning("You are passing $null as a value for parameter BotId 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.BotRecommendationId = this.BotRecommendationId;
            #if MODULAR
            if (this.BotRecommendationId == null && ParameterWasBound(nameof(this.BotRecommendationId)))
            {
                WriteWarning("You are passing $null as a value for parameter BotRecommendationId 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.BotVersion = this.BotVersion;
            #if MODULAR
            if (this.BotVersion == null && ParameterWasBound(nameof(this.BotVersion)))
            {
                WriteWarning("You are passing $null as a value for parameter BotVersion 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.LocaleId = this.LocaleId;
            #if MODULAR
            if (this.LocaleId == null && ParameterWasBound(nameof(this.LocaleId)))
            {
                WriteWarning("You are passing $null as a value for parameter LocaleId 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.MaxResult = this.MaxResult;
            context.NextToken = this.NextToken;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = string.Empty;

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-R53RFirewallRuleGroupAssociation (AssociateFirewallRuleGroup)"))
            {
                return;
            }

            var context = new CmdletContext();

            // allow for manipulation of parameters prior to loading into context
            PreExecutionContextLoad(context);

            if (ParameterWasBound(nameof(this.Select)))
            {
                context.Select = CreateSelectDelegate <Amazon.Route53Resolver.Model.AssociateFirewallRuleGroupResponse, NewR53RFirewallRuleGroupAssociationCmdlet>(Select) ??
                                 throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
            }
            context.CreatorRequestId    = this.CreatorRequestId;
            context.FirewallRuleGroupId = this.FirewallRuleGroupId;
            #if MODULAR
            if (this.FirewallRuleGroupId == null && ParameterWasBound(nameof(this.FirewallRuleGroupId)))
            {
                WriteWarning("You are passing $null as a value for parameter FirewallRuleGroupId 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.MutationProtection = this.MutationProtection;
            context.Name = this.Name;
            #if MODULAR
            if (this.Name == null && ParameterWasBound(nameof(this.Name)))
            {
                WriteWarning("You are passing $null as a value for parameter Name 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.Priority = this.Priority;
            #if MODULAR
            if (this.Priority == null && ParameterWasBound(nameof(this.Priority)))
            {
                WriteWarning("You are passing $null as a value for parameter Priority 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
            if (this.Tag != null)
            {
                context.Tag = new List <Amazon.Route53Resolver.Model.Tag>(this.Tag);
            }
            context.VpcId = this.VpcId;
            #if MODULAR
            if (this.VpcId == null && ParameterWasBound(nameof(this.VpcId)))
            {
                WriteWarning("You are passing $null as a value for parameter VpcId 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);
        }
Example #26
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.QueueName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-SQSQueue (CreateQueue)"))
            {
                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 <Amazon.SQS.Model.CreateQueueResponse, NewSQSQueueCmdlet>(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.QueueName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            if (this.Attribute != null)
            {
                context.Attribute = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.Attribute.Keys)
                {
                    context.Attribute.Add((String)hashKey, (String)(this.Attribute[hashKey]));
                }
            }
            context.QueueName = this.QueueName;
            #if MODULAR
            if (this.QueueName == null && ParameterWasBound(nameof(this.QueueName)))
            {
                WriteWarning("You are passing $null as a value for parameter QueueName 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
            if (this.Tag != null)
            {
                context.Tag = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.Tag.Keys)
                {
                    context.Tag.Add((String)hashKey, (String)(this.Tag[hashKey]));
                }
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.AutoScalingGroupName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-ASAutoScalingGroup (UpdateAutoScalingGroup)"))
            {
                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 <Amazon.AutoScaling.Model.UpdateAutoScalingGroupResponse, UpdateASAutoScalingGroupCmdlet>(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.AutoScalingGroupName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AutoScalingGroupName = this.AutoScalingGroupName;
            #if MODULAR
            if (this.AutoScalingGroupName == null && ParameterWasBound(nameof(this.AutoScalingGroupName)))
            {
                WriteWarning("You are passing $null as a value for parameter AutoScalingGroupName 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
            if (this.AvailabilityZone != null)
            {
                context.AvailabilityZone = new List <System.String>(this.AvailabilityZone);
            }
            context.DefaultCooldown                   = this.DefaultCooldown;
            context.DesiredCapacity                   = this.DesiredCapacity;
            context.HealthCheckGracePeriod            = this.HealthCheckGracePeriod;
            context.HealthCheckType                   = this.HealthCheckType;
            context.LaunchConfigurationName           = this.LaunchConfigurationName;
            context.LaunchTemplate_LaunchTemplateId   = this.LaunchTemplate_LaunchTemplateId;
            context.LaunchTemplate_LaunchTemplateName = this.LaunchTemplate_LaunchTemplateName;
            context.LaunchTemplate_Version            = this.LaunchTemplate_Version;
            context.MaxInstanceLifetime               = this.MaxInstanceLifetime;
            context.MaxSize = this.MaxSize;
            context.MinSize = this.MinSize;
            context.MixedInstancesPolicy             = this.MixedInstancesPolicy;
            context.NewInstancesProtectedFromScaleIn = this.NewInstancesProtectedFromScaleIn;
            context.PlacementGroup       = this.PlacementGroup;
            context.ServiceLinkedRoleARN = this.ServiceLinkedRoleARN;
            if (this.TerminationPolicy != null)
            {
                context.TerminationPolicy = new List <System.String>(this.TerminationPolicy);
            }
            context.VPCZoneIdentifier = this.VPCZoneIdentifier;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = string.Empty;

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Start-COMPKeyPhrasesDetectionJob (StartKeyPhrasesDetectionJob)"))
            {
                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 <Amazon.Comprehend.Model.StartKeyPhrasesDetectionJobResponse, StartCOMPKeyPhrasesDetectionJobCmdlet>(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.InputDataConfig;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.ClientRequestToken = this.ClientRequestToken;
            context.DataAccessRoleArn  = this.DataAccessRoleArn;
            #if MODULAR
            if (this.DataAccessRoleArn == null && ParameterWasBound(nameof(this.DataAccessRoleArn)))
            {
                WriteWarning("You are passing $null as a value for parameter DataAccessRoleArn 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.InputDataConfig = this.InputDataConfig;
            #if MODULAR
            if (this.InputDataConfig == null && ParameterWasBound(nameof(this.InputDataConfig)))
            {
                WriteWarning("You are passing $null as a value for parameter InputDataConfig 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.JobName      = this.JobName;
            context.LanguageCode = this.LanguageCode;
            #if MODULAR
            if (this.LanguageCode == null && ParameterWasBound(nameof(this.LanguageCode)))
            {
                WriteWarning("You are passing $null as a value for parameter LanguageCode 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.OutputDataConfig = this.OutputDataConfig;
            #if MODULAR
            if (this.OutputDataConfig == null && ParameterWasBound(nameof(this.OutputDataConfig)))
            {
                WriteWarning("You are passing $null as a value for parameter OutputDataConfig 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.VolumeKmsKeyId = this.VolumeKmsKeyId;
            if (this.VpcConfig_SecurityGroupId != null)
            {
                context.VpcConfig_SecurityGroupId = new List <System.String>(this.VpcConfig_SecurityGroupId);
            }
            if (this.VpcConfig_Subnet != null)
            {
                context.VpcConfig_Subnet = new List <System.String>(this.VpcConfig_Subnet);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #29
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.FunctionName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-LMFunctionConfiguration (UpdateFunctionConfiguration)"))
            {
                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 <Amazon.Lambda.Model.UpdateFunctionConfigurationResponse, UpdateLMFunctionConfigurationCmdlet>(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.FunctionName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.DeadLetterConfig_TargetArn = this.DeadLetterConfig_TargetArn;
            context.Description = this.Description;
            if (this.Environment_Variable != null)
            {
                context.Environment_Variable = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.Environment_Variable.Keys)
                {
                    context.Environment_Variable.Add((String)hashKey, (String)(this.Environment_Variable[hashKey]));
                }
            }
            context.Environment_IsVariablesSet = this.Environment_IsVariablesSet;
            context.FunctionName = this.FunctionName;
            #if MODULAR
            if (this.FunctionName == null && ParameterWasBound(nameof(this.FunctionName)))
            {
                WriteWarning("You are passing $null as a value for parameter FunctionName 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.Handler   = this.Handler;
            context.KMSKeyArn = this.KMSKeyArn;
            if (this.Layer != null)
            {
                context.Layer = new List <System.String>(this.Layer);
            }
            context.MemorySize         = this.MemorySize;
            context.RevisionId         = this.RevisionId;
            context.Role               = this.Role;
            context.Runtime            = this.Runtime;
            context.Timeout            = this.Timeout;
            context.TracingConfig_Mode = this.TracingConfig_Mode;
            if (this.VpcConfig_SecurityGroupId != null)
            {
                context.VpcConfig_SecurityGroupId = new List <System.String>(this.VpcConfig_SecurityGroupId);
            }
            if (this.VpcConfig_SubnetId != null)
            {
                context.VpcConfig_SubnetId = new List <System.String>(this.VpcConfig_SubnetId);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #30
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.DataAccessRoleArn), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Start-CMPMICD10CMInferenceJob (StartICD10CMInferenceJob)"))
            {
                return;
            }

            var context = new CmdletContext();

            // allow for manipulation of parameters prior to loading into context
            PreExecutionContextLoad(context);

            if (ParameterWasBound(nameof(this.Select)))
            {
                context.Select = CreateSelectDelegate <Amazon.ComprehendMedical.Model.StartICD10CMInferenceJobResponse, StartCMPMICD10CMInferenceJobCmdlet>(Select) ??
                                 throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
            }
            context.ClientRequestToken = this.ClientRequestToken;
            context.DataAccessRoleArn  = this.DataAccessRoleArn;
            #if MODULAR
            if (this.DataAccessRoleArn == null && ParameterWasBound(nameof(this.DataAccessRoleArn)))
            {
                WriteWarning("You are passing $null as a value for parameter DataAccessRoleArn 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.InputDataConfig_S3Bucket = this.InputDataConfig_S3Bucket;
            #if MODULAR
            if (this.InputDataConfig_S3Bucket == null && ParameterWasBound(nameof(this.InputDataConfig_S3Bucket)))
            {
                WriteWarning("You are passing $null as a value for parameter InputDataConfig_S3Bucket 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.InputDataConfig_S3Key = this.InputDataConfig_S3Key;
            context.JobName      = this.JobName;
            context.KMSKey       = this.KMSKey;
            context.LanguageCode = this.LanguageCode;
            #if MODULAR
            if (this.LanguageCode == null && ParameterWasBound(nameof(this.LanguageCode)))
            {
                WriteWarning("You are passing $null as a value for parameter LanguageCode 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.OutputDataConfig_S3Bucket = this.OutputDataConfig_S3Bucket;
            #if MODULAR
            if (this.OutputDataConfig_S3Bucket == null && ParameterWasBound(nameof(this.OutputDataConfig_S3Bucket)))
            {
                WriteWarning("You are passing $null as a value for parameter OutputDataConfig_S3Bucket 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.OutputDataConfig_S3Key = this.OutputDataConfig_S3Key;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #31
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.FieldName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-ASYNResolver (UpdateResolver)"))
            {
                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 <Amazon.AppSync.Model.UpdateResolverResponse, UpdateASYNResolverCmdlet>(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.FieldName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.ApiId = this.ApiId;
            #if MODULAR
            if (this.ApiId == null && ParameterWasBound(nameof(this.ApiId)))
            {
                WriteWarning("You are passing $null as a value for parameter ApiId 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.DataSourceName = this.DataSourceName;
            context.FieldName      = this.FieldName;
            #if MODULAR
            if (this.FieldName == null && ParameterWasBound(nameof(this.FieldName)))
            {
                WriteWarning("You are passing $null as a value for parameter FieldName 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.Kind = this.Kind;
            if (this.PipelineConfig_Function != null)
            {
                context.PipelineConfig_Function = new List <System.String>(this.PipelineConfig_Function);
            }
            context.RequestMappingTemplate = this.RequestMappingTemplate;
            #if MODULAR
            if (this.RequestMappingTemplate == null && ParameterWasBound(nameof(this.RequestMappingTemplate)))
            {
                WriteWarning("You are passing $null as a value for parameter RequestMappingTemplate 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.ResponseMappingTemplate = this.ResponseMappingTemplate;
            context.TypeName = this.TypeName;
            #if MODULAR
            if (this.TypeName == null && ParameterWasBound(nameof(this.TypeName)))
            {
                WriteWarning("You are passing $null as a value for parameter TypeName 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);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.Name), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-WAFRuleGroup (CreateRuleGroup)"))
            {
                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 <Amazon.WAF.Model.CreateRuleGroupResponse, NewWAFRuleGroupCmdlet>(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.Name;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.ChangeToken = this.ChangeToken;
            #if MODULAR
            if (this.ChangeToken == null && ParameterWasBound(nameof(this.ChangeToken)))
            {
                WriteWarning("You are passing $null as a value for parameter ChangeToken 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.MetricName = this.MetricName;
            #if MODULAR
            if (this.MetricName == null && ParameterWasBound(nameof(this.MetricName)))
            {
                WriteWarning("You are passing $null as a value for parameter MetricName 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.Name = this.Name;
            #if MODULAR
            if (this.Name == null && ParameterWasBound(nameof(this.Name)))
            {
                WriteWarning("You are passing $null as a value for parameter Name 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
            if (this.Tag != null)
            {
                context.Tag = new List <Amazon.WAF.Model.Tag>(this.Tag);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ClientId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Start-CGIPAuth (InitiateAuth)"))
            {
                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 <Amazon.CognitoIdentityProvider.Model.InitiateAuthResponse, StartCGIPAuthCmdlet>(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.ClientId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AnalyticsMetadata_AnalyticsEndpointId = this.AnalyticsMetadata_AnalyticsEndpointId;
            context.AuthFlow = this.AuthFlow;
            #if MODULAR
            if (this.AuthFlow == null && ParameterWasBound(nameof(this.AuthFlow)))
            {
                WriteWarning("You are passing $null as a value for parameter AuthFlow 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
            if (this.AuthParameter != null)
            {
                context.AuthParameter = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.AuthParameter.Keys)
                {
                    context.AuthParameter.Add((String)hashKey, (String)(this.AuthParameter[hashKey]));
                }
            }
            context.ClientId = this.ClientId;
            #if MODULAR
            if (this.ClientId == null && ParameterWasBound(nameof(this.ClientId)))
            {
                WriteWarning("You are passing $null as a value for parameter ClientId 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
            if (this.ClientMetadata != null)
            {
                context.ClientMetadata = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.ClientMetadata.Keys)
                {
                    context.ClientMetadata.Add((String)hashKey, (String)(this.ClientMetadata[hashKey]));
                }
            }
            context.UserContextData_EncodedData = this.UserContextData_EncodedData;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #34
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.UserPoolId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-CGIPUserPoolClient (UpdateUserPoolClient)"))
            {
                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 <Amazon.CognitoIdentityProvider.Model.UpdateUserPoolClientResponse, UpdateCGIPUserPoolClientCmdlet>(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.UserPoolId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AccessTokenValidity = this.AccessTokenValidity;
            if (this.AllowedOAuthFlow != null)
            {
                context.AllowedOAuthFlow = new List <System.String>(this.AllowedOAuthFlow);
            }
            context.AllowedOAuthFlowsUserPoolClient = this.AllowedOAuthFlowsUserPoolClient;
            if (this.AllowedOAuthScope != null)
            {
                context.AllowedOAuthScope = new List <System.String>(this.AllowedOAuthScope);
            }
            context.AnalyticsConfiguration_ApplicationArn = this.AnalyticsConfiguration_ApplicationArn;
            context.AnalyticsConfiguration_ApplicationId  = this.AnalyticsConfiguration_ApplicationId;
            context.AnalyticsConfiguration_ExternalId     = this.AnalyticsConfiguration_ExternalId;
            context.AnalyticsConfiguration_RoleArn        = this.AnalyticsConfiguration_RoleArn;
            context.AnalyticsConfiguration_UserDataShared = this.AnalyticsConfiguration_UserDataShared;
            if (this.CallbackURLs != null)
            {
                context.CallbackURLs = new List <System.String>(this.CallbackURLs);
            }
            context.ClientId = this.ClientId;
            #if MODULAR
            if (this.ClientId == null && ParameterWasBound(nameof(this.ClientId)))
            {
                WriteWarning("You are passing $null as a value for parameter ClientId 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.ClientName         = this.ClientName;
            context.DefaultRedirectURI = this.DefaultRedirectURI;
            if (this.ExplicitAuthFlow != null)
            {
                context.ExplicitAuthFlow = new List <System.String>(this.ExplicitAuthFlow);
            }
            context.IdTokenValidity = this.IdTokenValidity;
            if (this.LogoutURLs != null)
            {
                context.LogoutURLs = new List <System.String>(this.LogoutURLs);
            }
            context.PreventUserExistenceError = this.PreventUserExistenceError;
            if (this.ReadAttribute != null)
            {
                context.ReadAttribute = new List <System.String>(this.ReadAttribute);
            }
            context.RefreshTokenValidity = this.RefreshTokenValidity;
            if (this.SupportedIdentityProvider != null)
            {
                context.SupportedIdentityProvider = new List <System.String>(this.SupportedIdentityProvider);
            }
            context.TokenValidityUnits_AccessToken  = this.TokenValidityUnits_AccessToken;
            context.TokenValidityUnits_IdToken      = this.TokenValidityUnits_IdToken;
            context.TokenValidityUnits_RefreshToken = this.TokenValidityUnits_RefreshToken;
            context.UserPoolId = this.UserPoolId;
            #if MODULAR
            if (this.UserPoolId == null && ParameterWasBound(nameof(this.UserPoolId)))
            {
                WriteWarning("You are passing $null as a value for parameter UserPoolId 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
            if (this.WriteAttribute != null)
            {
                context.WriteAttribute = new List <System.String>(this.WriteAttribute);
            }

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #35
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ConnectionId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Enable-DCPublicVirtualInterface (AllocatePublicVirtualInterface)"))
            {
                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 <Amazon.DirectConnect.Model.AllocatePublicVirtualInterfaceResponse, EnableDCPublicVirtualInterfaceCmdlet>(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.ConnectionId;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.ConnectionId = this.ConnectionId;
            #if MODULAR
            if (this.ConnectionId == null && ParameterWasBound(nameof(this.ConnectionId)))
            {
                WriteWarning("You are passing $null as a value for parameter ConnectionId 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.NewPublicVirtualInterfaceAllocation_AddressFamily = this.NewPublicVirtualInterfaceAllocation_AddressFamily;
            context.NewPublicVirtualInterfaceAllocation_AmazonAddress = this.NewPublicVirtualInterfaceAllocation_AmazonAddress;
            context.NewPublicVirtualInterfaceAllocation_Asn           = this.NewPublicVirtualInterfaceAllocation_Asn;
            #if MODULAR
            if (this.NewPublicVirtualInterfaceAllocation_Asn == null && ParameterWasBound(nameof(this.NewPublicVirtualInterfaceAllocation_Asn)))
            {
                WriteWarning("You are passing $null as a value for parameter NewPublicVirtualInterfaceAllocation_Asn 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.NewPublicVirtualInterfaceAllocation_AuthKey         = this.NewPublicVirtualInterfaceAllocation_AuthKey;
            context.NewPublicVirtualInterfaceAllocation_CustomerAddress = this.NewPublicVirtualInterfaceAllocation_CustomerAddress;
            if (this.NewPublicVirtualInterfaceAllocation_RouteFilterPrefix != null)
            {
                context.NewPublicVirtualInterfaceAllocation_RouteFilterPrefix = new List <Amazon.DirectConnect.Model.RouteFilterPrefix>(this.NewPublicVirtualInterfaceAllocation_RouteFilterPrefix);
            }
            if (this.NewPublicVirtualInterfaceAllocation_Tag != null)
            {
                context.NewPublicVirtualInterfaceAllocation_Tag = new List <Amazon.DirectConnect.Model.Tag>(this.NewPublicVirtualInterfaceAllocation_Tag);
            }
            context.NewPublicVirtualInterfaceAllocation_VirtualInterfaceName = this.NewPublicVirtualInterfaceAllocation_VirtualInterfaceName;
            #if MODULAR
            if (this.NewPublicVirtualInterfaceAllocation_VirtualInterfaceName == null && ParameterWasBound(nameof(this.NewPublicVirtualInterfaceAllocation_VirtualInterfaceName)))
            {
                WriteWarning("You are passing $null as a value for parameter NewPublicVirtualInterfaceAllocation_VirtualInterfaceName 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.NewPublicVirtualInterfaceAllocation_Vlan = this.NewPublicVirtualInterfaceAllocation_Vlan;
            #if MODULAR
            if (this.NewPublicVirtualInterfaceAllocation_Vlan == null && ParameterWasBound(nameof(this.NewPublicVirtualInterfaceAllocation_Vlan)))
            {
                WriteWarning("You are passing $null as a value for parameter NewPublicVirtualInterfaceAllocation_Vlan 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.OwnerAccount = this.OwnerAccount;
            #if MODULAR
            if (this.OwnerAccount == null && ParameterWasBound(nameof(this.OwnerAccount)))
            {
                WriteWarning("You are passing $null as a value for parameter OwnerAccount 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);
        }
 internal static void LoadNavigation(CmdletContext ctx, Microsoft.SharePoint.Client.Navigation navigation)
 {
     ctx.Load(navigation, n => n.QuickLaunch, n => n.TopNavigationBar, n => n.UseShared);
     ctx.ExecuteQuery();
 }
Example #37
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.RepositoryName), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Write-CCFile (PutFile)"))
            {
                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 <Amazon.CodeCommit.Model.PutFileResponse, WriteCCFileCmdlet>(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.RepositoryName;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.BranchName = this.BranchName;
            #if MODULAR
            if (this.BranchName == null && ParameterWasBound(nameof(this.BranchName)))
            {
                WriteWarning("You are passing $null as a value for parameter BranchName 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.CommitMessage = this.CommitMessage;
            context.Email         = this.Email;
            context.FileContent   = this.FileContent;
            #if MODULAR
            if (this.FileContent == null && ParameterWasBound(nameof(this.FileContent)))
            {
                WriteWarning("You are passing $null as a value for parameter FileContent 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.FileMode = this.FileMode;
            context.FilePath = this.FilePath;
            #if MODULAR
            if (this.FilePath == null && ParameterWasBound(nameof(this.FilePath)))
            {
                WriteWarning("You are passing $null as a value for parameter FilePath 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.Name           = this.Name;
            context.ParentCommitId = this.ParentCommitId;
            context.RepositoryName = this.RepositoryName;
            #if MODULAR
            if (this.RepositoryName == null && ParameterWasBound(nameof(this.RepositoryName)))
            {
                WriteWarning("You are passing $null as a value for parameter RepositoryName 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);
        }
Example #38
0
 internal static void LoadFolder(CmdletContext ctx, Folder folder, bool detailed, bool isListContext)
 {
     ctx.Load(folder);
     ctx.Load(folder, f => f.Name, f => f.ServerRelativeUrl);
     if (detailed)
     {
         if (isListContext)
         {
             ctx.Load(folder,
                 f => f.ContentTypeOrder,
                 f => f.Folders,
                 f => f.Properties,
                 f => f.UniqueContentTypeOrder);
         }
         else
         {
             ctx.Load(folder,
                 f => f.Folders,
                 f => f.Properties);
         }
     }
     ctx.ExecuteQuery();
     if (!isListContext && detailed)
     {
         // There are some cases where we don't know if it's a list context until it's loaded.
         if (folder.Properties.FieldValues.ContainsKey("vti_listname") && folder.Properties["vti_listname"] != null)
         {
             ctx.Load(folder,
                 f => f.ContentTypeOrder,
                 f => f.Folders,
                 f => f.Properties,
                 f => f.UniqueContentTypeOrder);
             ctx.ExecuteQuery();
         }
     }
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ApplicationId), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-SARCloudFormationChangeSet (CreateCloudFormationChangeSet)"))
            {
                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 <Amazon.ServerlessApplicationRepository.Model.CreateCloudFormationChangeSetResponse, NewSARCloudFormationChangeSetCmdlet>(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.SemanticVersion;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.ApplicationId = this.ApplicationId;
            #if MODULAR
            if (this.ApplicationId == null && ParameterWasBound(nameof(this.ApplicationId)))
            {
                WriteWarning("You are passing $null as a value for parameter ApplicationId 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
            if (this.Capability != null)
            {
                context.Capability = new List <System.String>(this.Capability);
            }
            context.ChangeSetName = this.ChangeSetName;
            context.ClientToken   = this.ClientToken;
            context.Description   = this.Description;
            if (this.NotificationArn != null)
            {
                context.NotificationArn = new List <System.String>(this.NotificationArn);
            }
            if (this.ParameterOverride != null)
            {
                context.ParameterOverride = new List <Amazon.ServerlessApplicationRepository.Model.ParameterValue>(this.ParameterOverride);
            }
            if (this.ResourceType != null)
            {
                context.ResourceType = new List <System.String>(this.ResourceType);
            }
            context.RollbackConfiguration_MonitoringTimeInMinute = this.RollbackConfiguration_MonitoringTimeInMinute;
            if (this.RollbackConfiguration_RollbackTrigger != null)
            {
                context.RollbackConfiguration_RollbackTrigger = new List <Amazon.ServerlessApplicationRepository.Model.RollbackTrigger>(this.RollbackConfiguration_RollbackTrigger);
            }
            context.SemanticVersion = this.SemanticVersion;
            context.StackName       = this.StackName;
            #if MODULAR
            if (this.StackName == null && ParameterWasBound(nameof(this.StackName)))
            {
                WriteWarning("You are passing $null as a value for parameter StackName 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
            if (this.Tag != null)
            {
                context.Tag = new List <Amazon.ServerlessApplicationRepository.Model.Tag>(this.Tag);
            }
            context.TemplateId = this.TemplateId;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
        internal static SPOContentType GetContentType(CmdletContext ctx, ContentTypeCollection contentTypes, string name)
        {
            ctx.Load(contentTypes);
            ctx.ExecuteQuery();

            foreach (ContentType ct in contentTypes)
            {
                if (ct.Name.ToLower() == name.ToLower())
                {
                    SPOContentType.LoadContentType(ctx, ct);
                    return new SPOContentType(ct);
                }
            }
            return null;
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.Name), MyInvocation.BoundParameters);

            if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-OPSStack (CreateStack)"))
            {
                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 <Amazon.OpsWorks.Model.CreateStackResponse, NewOPSStackCmdlet>(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.Name;
            }
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
            context.AgentVersion = this.AgentVersion;
            if (this.Attribute != null)
            {
                context.Attribute = new Dictionary <System.String, System.String>(StringComparer.Ordinal);
                foreach (var hashKey in this.Attribute.Keys)
                {
                    context.Attribute.Add((String)hashKey, (String)(this.Attribute[hashKey]));
                }
            }
            context.ChefConfiguration_BerkshelfVersion = this.ChefConfiguration_BerkshelfVersion;
            context.ChefConfiguration_ManageBerkshelf  = this.ChefConfiguration_ManageBerkshelf;
            context.ConfigurationManager_Name          = this.ConfigurationManager_Name;
            context.ConfigurationManager_Version       = this.ConfigurationManager_Version;
            context.CustomCookbooksSource_Password     = this.CustomCookbooksSource_Password;
            context.CustomCookbooksSource_Revision     = this.CustomCookbooksSource_Revision;
            context.CustomCookbooksSource_SshKey       = this.CustomCookbooksSource_SshKey;
            context.CustomCookbooksSource_Type         = this.CustomCookbooksSource_Type;
            context.CustomCookbooksSource_Url          = this.CustomCookbooksSource_Url;
            context.CustomCookbooksSource_Username     = this.CustomCookbooksSource_Username;
            context.CustomJson = this.CustomJson;
            context.DefaultAvailabilityZone   = this.DefaultAvailabilityZone;
            context.DefaultInstanceProfileArn = this.DefaultInstanceProfileArn;
            #if MODULAR
            if (this.DefaultInstanceProfileArn == null && ParameterWasBound(nameof(this.DefaultInstanceProfileArn)))
            {
                WriteWarning("You are passing $null as a value for parameter DefaultInstanceProfileArn 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.DefaultOs             = this.DefaultOs;
            context.DefaultRootDeviceType = this.DefaultRootDeviceType;
            context.DefaultSshKeyName     = this.DefaultSshKeyName;
            context.DefaultSubnetId       = this.DefaultSubnetId;
            context.HostnameTheme         = this.HostnameTheme;
            context.Name = this.Name;
            #if MODULAR
            if (this.Name == null && ParameterWasBound(nameof(this.Name)))
            {
                WriteWarning("You are passing $null as a value for parameter Name 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.StackRegion = this.StackRegion;
            #if MODULAR
            if (this.StackRegion == null && ParameterWasBound(nameof(this.StackRegion)))
            {
                WriteWarning("You are passing $null as a value for parameter StackRegion 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.ServiceRoleArn = this.ServiceRoleArn;
            #if MODULAR
            if (this.ServiceRoleArn == null && ParameterWasBound(nameof(this.ServiceRoleArn)))
            {
                WriteWarning("You are passing $null as a value for parameter ServiceRoleArn 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.UseCustomCookbook        = this.UseCustomCookbook;
            context.UseOpsworksSecurityGroup = this.UseOpsworksSecurityGroup;
            context.VpcId = this.VpcId;

            // allow further manipulation of loaded context prior to processing
            PostExecutionContextLoad(context);

            var output = Execute(context) as CmdletOutput;
            ProcessOutput(output);
        }
Example #42
0
 private void IterateWebs(CmdletContext ctx, Web parentWeb, bool detailed)
 {
     var childWebs = parentWeb.Webs;
     ctx.Load(childWebs);
     ctx.ExecuteQuery();
     foreach (Web childWeb in childWebs)
     {
         SPOWeb.LoadWeb(ctx, childWeb, detailed);
         SPOWeb web = new SPOWeb(childWeb);
         if (web.WebTemplate != "APP" || (web.WebTemplate == "APP" && IncludeAppWebs))
             WriteObject(web);
         IterateWebs(ctx, childWeb, detailed);
     }
 }
Example #43
0
 internal static SPOField GetField(CmdletContext ctx, FieldCollection fields, XmlDocument schemaXmlDoc)
 {
     Guid fieldId = Guid.Parse(schemaXmlDoc.DocumentElement.GetAttribute("Id"));
     Field field = fields.GetById(fieldId);
     ctx.Load(field);
     ctx.ExecuteQuery();
     if (!field.ServerObjectIsNull.Value)
     {
         return new SPOField(field);
     }
     field = fields.GetByInternalNameOrTitle(schemaXmlDoc.DocumentElement.GetAttribute("Name"));
     ctx.Load(field);
     ctx.ExecuteQuery();
     if (!field.ServerObjectIsNull.Value)
     {
         return new SPOField(field);
     }
     return null;
 }