private Amazon.EC2.Model.CreateFlowLogsResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateFlowLogsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateFlowLogs"); try { #if DESKTOP return(client.CreateFlowLogs(request)); #elif CORECLR return(client.CreateFlowLogsAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.CreateFlowLogsRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.DeliverLogsPermissionArn != null) { request.DeliverLogsPermissionArn = cmdletContext.DeliverLogsPermissionArn; } if (cmdletContext.LogDestination != null) { request.LogDestination = cmdletContext.LogDestination; } if (cmdletContext.LogDestinationType != null) { request.LogDestinationType = cmdletContext.LogDestinationType; } if (cmdletContext.LogFormat != null) { request.LogFormat = cmdletContext.LogFormat; } if (cmdletContext.LogGroupName != null) { request.LogGroupName = cmdletContext.LogGroupName; } if (cmdletContext.ResourceId != null) { request.ResourceIds = cmdletContext.ResourceId; } if (cmdletContext.ResourceType != null) { request.ResourceType = cmdletContext.ResourceType; } if (cmdletContext.TrafficType != null) { request.TrafficType = cmdletContext.TrafficType; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// Initiates the asynchronous execution of the CreateFlowLogs operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateFlowLogs operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CreateFlowLogsResponse> CreateFlowLogsAsync(CreateFlowLogsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateFlowLogsRequestMarshaller(); var unmarshaller = CreateFlowLogsResponseUnmarshaller.Instance; return InvokeAsync<CreateFlowLogsRequest,CreateFlowLogsResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates one or more flow logs to capture IP traffic for a specific network interface, /// subnet, or VPC. Flow logs are delivered to a specified log group in Amazon CloudWatch /// Logs. If you specify a VPC or subnet in the request, a log stream is created in CloudWatch /// Logs for each network interface in the subnet or VPC. Log streams can include information /// about accepted and rejected traffic to a network interface. You can view the data /// in your log streams using Amazon CloudWatch Logs. /// /// /// <para> /// In your request, you must also specify an IAM role that has permission to publish /// logs to CloudWatch Logs. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateFlowLogs service method.</param> /// /// <returns>The response from the CreateFlowLogs service method, as returned by EC2.</returns> public CreateFlowLogsResponse CreateFlowLogs(CreateFlowLogsRequest request) { var marshaller = new CreateFlowLogsRequestMarshaller(); var unmarshaller = CreateFlowLogsResponseUnmarshaller.Instance; return Invoke<CreateFlowLogsRequest,CreateFlowLogsResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateFlowLogs operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateFlowLogs operation on AmazonEC2Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateFlowLogs /// operation.</returns> public IAsyncResult BeginCreateFlowLogs(CreateFlowLogsRequest request, AsyncCallback callback, object state) { var marshaller = new CreateFlowLogsRequestMarshaller(); var unmarshaller = CreateFlowLogsResponseUnmarshaller.Instance; return BeginInvoke<CreateFlowLogsRequest>(request, marshaller, unmarshaller, callback, state); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.CreateFlowLogsRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.DeliverLogsPermissionArn != null) { request.DeliverLogsPermissionArn = cmdletContext.DeliverLogsPermissionArn; } // populate DestinationOptions var requestDestinationOptionsIsNull = true; request.DestinationOptions = new Amazon.EC2.Model.DestinationOptionsRequest(); Amazon.EC2.DestinationFileFormat requestDestinationOptions_destinationOptions_FileFormat = null; if (cmdletContext.DestinationOptions_FileFormat != null) { requestDestinationOptions_destinationOptions_FileFormat = cmdletContext.DestinationOptions_FileFormat; } if (requestDestinationOptions_destinationOptions_FileFormat != null) { request.DestinationOptions.FileFormat = requestDestinationOptions_destinationOptions_FileFormat; requestDestinationOptionsIsNull = false; } System.Boolean?requestDestinationOptions_destinationOptions_HiveCompatiblePartition = null; if (cmdletContext.DestinationOptions_HiveCompatiblePartition != null) { requestDestinationOptions_destinationOptions_HiveCompatiblePartition = cmdletContext.DestinationOptions_HiveCompatiblePartition.Value; } if (requestDestinationOptions_destinationOptions_HiveCompatiblePartition != null) { request.DestinationOptions.HiveCompatiblePartitions = requestDestinationOptions_destinationOptions_HiveCompatiblePartition.Value; requestDestinationOptionsIsNull = false; } System.Boolean?requestDestinationOptions_destinationOptions_PerHourPartition = null; if (cmdletContext.DestinationOptions_PerHourPartition != null) { requestDestinationOptions_destinationOptions_PerHourPartition = cmdletContext.DestinationOptions_PerHourPartition.Value; } if (requestDestinationOptions_destinationOptions_PerHourPartition != null) { request.DestinationOptions.PerHourPartition = requestDestinationOptions_destinationOptions_PerHourPartition.Value; requestDestinationOptionsIsNull = false; } // determine if request.DestinationOptions should be set to null if (requestDestinationOptionsIsNull) { request.DestinationOptions = null; } if (cmdletContext.LogDestination != null) { request.LogDestination = cmdletContext.LogDestination; } if (cmdletContext.LogDestinationType != null) { request.LogDestinationType = cmdletContext.LogDestinationType; } if (cmdletContext.LogFormat != null) { request.LogFormat = cmdletContext.LogFormat; } if (cmdletContext.LogGroupName != null) { request.LogGroupName = cmdletContext.LogGroupName; } if (cmdletContext.MaxAggregationInterval != null) { request.MaxAggregationInterval = cmdletContext.MaxAggregationInterval.Value; } if (cmdletContext.ResourceId != null) { request.ResourceIds = cmdletContext.ResourceId; } if (cmdletContext.ResourceType != null) { request.ResourceType = cmdletContext.ResourceType; } if (cmdletContext.TagSpecification != null) { request.TagSpecifications = cmdletContext.TagSpecification; } if (cmdletContext.TrafficType != null) { request.TrafficType = cmdletContext.TrafficType; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }