public static void Example() { // Create an Amazon Athena client var athenaConfig = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.USEast1, Timeout = TimeSpan.FromMilliseconds(ExampleConstants.CLIENT_EXECUTION_TIMEOUT) }; var athenaClient = new AmazonAthenaClient(config: athenaConfig); String sampleQueryExecutionId = submitAthenaQuery(athenaClient); // Submit the stop query Request var stopQueryExecutionRequest = new StopQueryExecutionRequest() { QueryExecutionId = sampleQueryExecutionId }; var stopQueryExecutionResponse = athenaClient.StopQueryExecution(stopQueryExecutionRequest); // Ensure that the query was stopped var getQueryExecutionRequest = new GetQueryExecutionRequest() { QueryExecutionId = sampleQueryExecutionId }; var getQueryExecutionResponse = athenaClient.GetQueryExecution(getQueryExecutionRequest); if (getQueryExecutionResponse.QueryExecution.Status.State == QueryExecutionState.CANCELLED) { Console.WriteLine("Query has been cancelled"); } }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonAthenaConfig config = new AmazonAthenaConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonAthenaClient client = new AmazonAthenaClient(creds, config); GetQueryResultsResponse resp = new GetQueryResultsResponse(); do { GetQueryResultsRequest req = new GetQueryResultsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.GetQueryResults(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.UpdateCount) { AddObject(obj); } foreach (var obj in resp.ResultSet) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
private AmazonAthenaClient CreateAthenaClient() { AmazonAthenaClient athenaClient = new AmazonAthenaClient(Functions.AwsAccessKeyId, Functions.AwsSecretAccessKey, Functions.DatabaseName); AmazonAthenaConfig config = new AmazonAthenaConfig(); config.Timeout = new TimeSpan(0, 0, 30); return(athenaClient); }
// This code shows how to create and configure an Amazon Athena client. public static void Example() { // Create an Amazon Athena client var athenaConfig = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.USEast1, Timeout = TimeSpan.FromMilliseconds(ExampleConstants.CLIENT_EXECUTION_TIMEOUT) }; var athenaClient = new AmazonAthenaClient(config: athenaConfig); }
protected IAmazonAthena CreateClient(AWSCredentials credentials, RegionEndpoint region) { var config = new AmazonAthenaConfig { RegionEndpoint = region }; Amazon.PowerShell.Utils.Common.PopulateConfig(this, config); this.CustomizeClientConfig(config); var client = new AmazonAthenaClient(credentials, config); client.BeforeRequestEvent += RequestEventHandler; client.AfterResponseEvent += ResponseEventHandler; return(client); }
public IAmazonAthena Create() { if (_ec2InstanceMetadataProvider.InstanceId() != null) { return(new AmazonAthenaClient()); } var amazonEC2Config = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.EUWest1, ProxyCredentials = CredentialCache.DefaultCredentials }; return(new AmazonAthenaClient(amazonEC2Config)); }
public static void Example() { // Create an Amazon Athena client var athenaConfig = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.USEast1, Timeout = TimeSpan.FromMilliseconds(ExampleConstants.CLIENT_EXECUTION_TIMEOUT) }; var athenaClient = new AmazonAthenaClient(config: athenaConfig); String queryExecutionId = submitAthenaQuery(athenaClient); waitForQueryToComplete(athenaClient, queryExecutionId); processResultRows(athenaClient, queryExecutionId); }
public static void Example() { // Create an Amazon Athena client var athenaConfig = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.USEast1, Timeout = TimeSpan.FromMilliseconds(ExampleConstants.CLIENT_EXECUTION_TIMEOUT) }; var athenaClient = new AmazonAthenaClient(config: athenaConfig); String sampleNamedQueryId = getNamedQueryId(athenaClient); // Create the delete named query request var deleteNamedQueryRequest = new DeleteNamedQueryRequest() { NamedQueryId = sampleNamedQueryId }; // Delete the named query var deleteNamedQueryResponse = athenaClient.DeleteNamedQuery(deleteNamedQueryRequest); }
public static void Example() { // Create an Amazon Athena client var athenaConfig = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.USEast1, Timeout = TimeSpan.FromMilliseconds(ExampleConstants.CLIENT_EXECUTION_TIMEOUT) }; var athenaClient = new AmazonAthenaClient(config: athenaConfig); // Create the named query request. var createNamedQueryRequest = new CreateNamedQueryRequest() { Database = ExampleConstants.ATHENA_DEFAULT_DATABASE, QueryString = ExampleConstants.ATHENA_SAMPLE_QUERY, Description = "Sample Description", Name = "SampleQuery2", }; // Call Athena to create the named query. If it fails, an exception is thrown. var createNamedQueryResponse = athenaClient.CreateNamedQuery(createNamedQueryRequest); }
public static void Example() { // Create an Amazon Athena client var athenaConfig = new AmazonAthenaConfig { RegionEndpoint = RegionEndpoint.USEast1, Timeout = TimeSpan.FromMilliseconds(ExampleConstants.CLIENT_EXECUTION_TIMEOUT) }; var athenaClient = new AmazonAthenaClient(config: athenaConfig); // Build the request var listNamedQueriesRequest = new ListNamedQueriesRequest(); // Get the list results. var listNamedQueriesResponse = athenaClient.ListNamedQueries(listNamedQueriesRequest); // Process the results. bool hasMoreResults = true; while (hasMoreResults) { var namedQueryIds = listNamedQueriesResponse.NamedQueryIds; // process named query IDs // If nextToken is not null, there are more results. Get the next page of results. if (!String.IsNullOrEmpty(listNamedQueriesResponse.NextToken)) { listNamedQueriesRequest.NextToken = listNamedQueriesResponse.NextToken; listNamedQueriesResponse = athenaClient.ListNamedQueries(listNamedQueriesRequest); } else { hasMoreResults = false; } } }