internal GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest request) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; return(Invoke <GetSendQuotaRequest, GetSendQuotaResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// <para>Returns the user's current sending limits.</para> <para>This action is throttled at one request per second.</para> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as returned by AmazonSimpleEmailService.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task <GetSendQuotaResponse> GetSendQuotaAsync(GetSendQuotaRequest getSendQuotaRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.GetInstance(); return(Invoke <IRequest, GetSendQuotaRequest, GetSendQuotaResponse>(getSendQuotaRequest, marshaller, unmarshaller, signer, cancellationToken)); }
private void RefreshQuotaIfNeeded() { if (!IsRefreshNeeded()) { return; } lock (locker) { if (IsRefreshNeeded())//Double check { log.DebugFormat("refreshing qouta. interval: {0} Last refresh was at: {1}", refreshTimeout, lastRefresh); //Do quota refresh lastRefresh = DateTime.UtcNow.AddMinutes(1); try { var r = new GetSendQuotaRequest(); quota = ses.GetSendQuota(r); sendWindow = TimeSpan.FromSeconds(1.0 / quota.MaxSendRate); log.DebugFormat("quota: {0}/{1} at {2} mps. send window:{3}", quota.SentLast24Hours, quota.Max24HourSend, quota.MaxSendRate, sendWindow); } catch (Exception e) { log.Error("error refreshing quota", e); } } } }
/// <summary> /// <para>Returns the user's current activity limits.</para> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary /// parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as /// returned by AmazonSimpleEmailService.</returns> /// public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest getSendQuotaRequest) { IRequest <GetSendQuotaRequest> request = new GetSendQuotaRequestMarshaller().Marshall(getSendQuotaRequest); GetSendQuotaResponse response = Invoke <GetSendQuotaRequest, GetSendQuotaResponse> (request, this.signer, GetSendQuotaResponseUnmarshaller.GetInstance()); return(response); }
private void RefreshQuotaIfNeeded() { if (!IsRefreshNeeded()) { return; } lock (SynchRoot) { if (IsRefreshNeeded())//Double check { _log.DebugFormat("refreshing qouta. interval: {0} Last refresh was at: {1}", RefreshTimeout, _lastRefresh); //Do quota refresh _lastRefresh = DateTime.UtcNow.AddMinutes(1); try { var quotaRequest = new GetSendQuotaRequest(); _quota = _emailService.GetSendQuota(quotaRequest).GetSendQuotaResult; _sendWindow = TimeSpan.FromSeconds(1.0 / _quota.MaxSendRate); _log.DebugFormat("quota: {0}/{1} at {2} mps. send window:{3}", _quota.SentLast24Hours, _quota.Max24HourSend, _quota.MaxSendRate, _sendWindow); } catch (Exception e) { _log.Error("error refreshing quota", e); } } } }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota 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 <GetSendQuotaResponse> GetSendQuotaAsync(GetSendQuotaRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; return(InvokeAsync <GetSendQuotaRequest, GetSendQuotaResponse>(request, marshaller, unmarshaller, cancellationToken)); }
IAsyncResult invokeGetSendQuota(GetSendQuotaRequest getSendQuotaRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetSendQuotaRequestMarshaller().Marshall(getSendQuotaRequest); var unmarshaller = GetSendQuotaResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return(result); }
internal GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest request) { var task = GetSendQuotaAsync(request); try { return(task.Result); } catch (AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return(null); } }
/// <summary> /// Retrieves send statistics from SES /// </summary> /// <returns></returns> public GetSendQuotaResult getQuota() { GetSendQuotaResult ret = null; using (AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient(_accessKeyID, _secretAccessKeyID)) { GetSendQuotaRequest request = new GetSendQuotaRequest(); GetSendQuotaResponse response = client.GetSendQuota(request); ret = response.GetSendQuotaResult; } return ret; }
/// <summary> /// <para>Returns the user's current activity limits.</para> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary /// parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as /// returned by AmazonSimpleEmailService.</returns> /// public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest getSendQuotaRequest) { IRequest<GetSendQuotaRequest> request = new GetSendQuotaRequestMarshaller().Marshall(getSendQuotaRequest); GetSendQuotaResponse response = Invoke<GetSendQuotaRequest, GetSendQuotaResponse> (request, this.signer, GetSendQuotaResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// <para>Returns the user's current sending limits.</para> <para>This action is throttled at one request per second.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as returned by AmazonSimpleEmailService.</returns> public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest request) { var task = GetSendQuotaAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Returns the user's current sending limits. /// /// /// <para> /// This action is throttled at one request per second. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetSendQuota service method.</param> /// /// <returns>The response from the GetSendQuota service method, as returned by SimpleEmailService.</returns> public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest request) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; return Invoke<GetSendQuotaRequest,GetSendQuotaResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota 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<GetSendQuotaResponse> GetSendQuotaAsync(GetSendQuotaRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; return InvokeAsync<GetSendQuotaRequest,GetSendQuotaResponse>(request, marshaller, unmarshaller, cancellationToken); }
private void RefreshQuotaIfNeeded() { if (!IsRefreshNeeded()) return; lock (SynchRoot) { if (IsRefreshNeeded())//Double check { _log.DebugFormat("refreshing qouta. interval: {0} Last refresh was at: {1}", RefreshTimeout, _lastRefresh); //Do quota refresh _lastRefresh = DateTime.UtcNow.AddMinutes(1); try { var quotaRequest = new GetSendQuotaRequest(); _quota = _emailService.GetSendQuota(quotaRequest).GetSendQuotaResult; _sendWindow = TimeSpan.FromSeconds(1.0 / _quota.MaxSendRate); _log.DebugFormat("quota: {0}/{1} at {2} mps. send window:{3}", _quota.SentLast24Hours, _quota.Max24HourSend, _quota.MaxSendRate, _sendWindow); } catch (Exception e) { _log.Error("error refreshing quota", e); } } } }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota operation on AmazonSimpleEmailServiceClient.</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 EndGetSendQuota /// operation.</returns> public IAsyncResult BeginGetSendQuota(GetSendQuotaRequest request, AsyncCallback callback, object state) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; return BeginInvoke<GetSendQuotaRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Returns the user's current sending limits.</para> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as returned by AmazonSimpleEmailService.</returns> /// public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest getSendQuotaRequest) { IAsyncResult asyncResult = invokeGetSendQuota(getSendQuotaRequest, null, null, true); return EndGetSendQuota(asyncResult); }
/// <summary> /// <para>Returns the user's current sending limits.</para> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as returned by AmazonSimpleEmailService.</returns> /// public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest getSendQuotaRequest) { IAsyncResult asyncResult = invokeGetSendQuota(getSendQuotaRequest, null, null, true); return(EndGetSendQuota(asyncResult)); }
IAsyncResult invokeGetSendQuota(GetSendQuotaRequest getSendQuotaRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetSendQuotaRequestMarshaller().Marshall(getSendQuotaRequest); var unmarshaller = GetSendQuotaResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// <seealso cref="Amazon.SimpleEmail.AmazonSimpleEmailService.GetSendQuota"/> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary parameters to execute the GetSendQuota operation on /// AmazonSimpleEmailService.</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 EndGetSendQuota /// operation.</returns> public IAsyncResult BeginGetSendQuota(GetSendQuotaRequest getSendQuotaRequest, AsyncCallback callback, object state) { return invokeGetSendQuota(getSendQuotaRequest, callback, state, false); }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota operation on AmazonSimpleEmailServiceClient.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">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> public void GetSendQuotaAsync(GetSendQuotaRequest request, AmazonServiceCallback<GetSendQuotaRequest, GetSendQuotaResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<GetSendQuotaRequest,GetSendQuotaResponse> responseObject = new AmazonServiceResult<GetSendQuotaRequest,GetSendQuotaResponse>((GetSendQuotaRequest)req, (GetSendQuotaResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<GetSendQuotaRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
IAsyncResult invokeGetSendQuota(GetSendQuotaRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// <seealso cref="Amazon.SimpleEmail.IAmazonSimpleEmailService.GetSendQuota"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota 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 async Task<GetSendQuotaResponse> GetSendQuotaAsync(GetSendQuotaRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, GetSendQuotaRequest, GetSendQuotaResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Returns the user's current sending limits.</para> <para>This action is throttled at one request per second.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota service method on /// AmazonSimpleEmailService.</param> /// /// <returns>The response from the GetSendQuota service method, as returned by AmazonSimpleEmailService.</returns> public GetSendQuotaResponse GetSendQuota(GetSendQuotaRequest request) { var task = GetSendQuotaAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private void RefreshQuotaIfNeeded() { if (!IsRefreshNeeded()) return; lock (locker) { if (IsRefreshNeeded())//Double check { log.DebugFormat("refreshing qouta. interval: {0} Last refresh was at: {1}", refreshTimeout, lastRefresh); //Do quota refresh lastRefresh = DateTime.UtcNow.AddMinutes(1); try { var r = new GetSendQuotaRequest(); quota = ses.GetSendQuota(r).GetSendQuotaResult; sendWindow = TimeSpan.FromSeconds(1.0 / quota.MaxSendRate); log.DebugFormat("quota: {0}/{1} at {2} mps. send window:{3}", quota.SentLast24Hours, quota.Max24HourSend, quota.MaxSendRate, sendWindow); } catch (Exception e) { log.Error("error refreshing quota", e); } } } }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// <seealso cref="Amazon.SimpleEmail.IAmazonSimpleEmailService.GetSendQuota"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetSendQuota 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<GetSendQuotaResponse> GetSendQuotaAsync(GetSendQuotaRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetSendQuotaRequestMarshaller(); var unmarshaller = GetSendQuotaResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetSendQuotaRequest, GetSendQuotaResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the GetSendQuota operation. /// <seealso cref="Amazon.SimpleEmail.AmazonSimpleEmailService.GetSendQuota"/> /// </summary> /// /// <param name="getSendQuotaRequest">Container for the necessary parameters to execute the GetSendQuota operation on /// AmazonSimpleEmailService.</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 EndGetSendQuota /// operation.</returns> public IAsyncResult BeginGetSendQuota(GetSendQuotaRequest getSendQuotaRequest, AsyncCallback callback, object state) { return(invokeGetSendQuota(getSendQuotaRequest, callback, state, false)); }