public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CognitoSync.Model.DescribeDatasetRequest(); if (cmdletContext.DatasetName != null) { request.DatasetName = cmdletContext.DatasetName; } if (cmdletContext.IdentityId != null) { request.IdentityId = cmdletContext.IdentityId; } if (cmdletContext.IdentityPoolId != null) { request.IdentityPoolId = cmdletContext.IdentityPoolId; } 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 DescribeDataset operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeDataset operation on AmazonCognitoSyncClient.</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 DescribeDatasetAsync(DescribeDatasetRequest request, AmazonServiceCallback<DescribeDatasetRequest, DescribeDatasetResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new DescribeDatasetRequestMarshaller(); var unmarshaller = DescribeDatasetResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<DescribeDatasetRequest,DescribeDatasetResponse> responseObject = new AmazonServiceResult<DescribeDatasetRequest,DescribeDatasetResponse>((DescribeDatasetRequest)req, (DescribeDatasetResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<DescribeDatasetRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the DescribeDataset operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeDataset 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<DescribeDatasetResponse> DescribeDatasetAsync(DescribeDatasetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeDatasetRequestMarshaller(); var unmarshaller = DescribeDatasetResponseUnmarshaller.Instance; return InvokeAsync<DescribeDatasetRequest,DescribeDatasetResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Gets meta data about a dataset by identity and dataset name. With Amazon Cognito Sync, /// each identity has access only to its own data. Thus, the credentials used to make /// this API call need to have access to the identity data. /// /// /// <para> /// This API can be called with temporary user credentials provided by Cognito Identity /// or with developer credentials. You should use Cognito Identity credentials to make /// this API call. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeDataset service method.</param> /// /// <returns>The response from the DescribeDataset service method, as returned by CognitoSync.</returns> /// <exception cref="Amazon.CognitoSync.Model.InternalErrorException"> /// Indicates an internal service error. /// </exception> /// <exception cref="Amazon.CognitoSync.Model.InvalidParameterException"> /// Thrown when a request parameter does not comply with the associated constraints. /// </exception> /// <exception cref="Amazon.CognitoSync.Model.NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="Amazon.CognitoSync.Model.ResourceNotFoundException"> /// Thrown if the resource doesn't exist. /// </exception> /// <exception cref="Amazon.CognitoSync.Model.TooManyRequestsException"> /// Thrown if the request is throttled. /// </exception> public DescribeDatasetResponse DescribeDataset(DescribeDatasetRequest request) { var marshaller = new DescribeDatasetRequestMarshaller(); var unmarshaller = DescribeDatasetResponseUnmarshaller.Instance; return Invoke<DescribeDatasetRequest,DescribeDatasetResponse>(request, marshaller, unmarshaller); }
internal DescribeDatasetResponse DescribeDataset(DescribeDatasetRequest request) { var task = DescribeDatasetAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the DescribeDataset operation. /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync.DescribeDataset"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeDataset 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<DescribeDatasetResponse> DescribeDatasetAsync(DescribeDatasetRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeDatasetRequestMarshaller(); var unmarshaller = DescribeDatasetResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DescribeDatasetRequest, DescribeDatasetResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the DescribeDataset operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeDataset operation on AmazonCognitoSyncClient.</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 EndDescribeDataset /// operation.</returns> public IAsyncResult BeginDescribeDataset(DescribeDatasetRequest request, AsyncCallback callback, object state) { var marshaller = new DescribeDatasetRequestMarshaller(); var unmarshaller = DescribeDatasetResponseUnmarshaller.Instance; return BeginInvoke<DescribeDatasetRequest>(request, marshaller, unmarshaller, callback, state); }
public void GetDatasetMetadataAsync(string datasetName, AmazonCognitoSyncCallback<DatasetMetadata> callback, AsyncOptions options = null) { options = options ?? new AsyncOptions(); DescribeDatasetRequest request = new DescribeDatasetRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; client.DescribeDatasetAsync(request, (responseObj) => { Exception dataStorageException = null; DatasetMetadata metadata = null; if (responseObj.Exception != null) { dataStorageException = new DataStorageException("Failed to get metadata of dataset: " + datasetName, responseObj.Exception); } else { metadata = ModelToDatasetMetadata(responseObj.Response.Dataset); } InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult<DatasetMetadata>(metadata, dataStorageException, responseObj.state)), options); }, options); }
private DescribeDatasetRequest PrepareDescribeDatasetRequest(string datasetName) { DescribeDatasetRequest request = new DescribeDatasetRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; return request; }
/// <summary> /// Retrieves the metadata of a dataset. /// </summary> /// <param name="datasetName">Dataset name.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <exception cref="Amazon.CognitoSync.SyncManager.DataStorageException"></exception> public async Task<DatasetMetadata> GetDatasetMetadataAsync(string datasetName, CancellationToken cancellationToken) { DescribeDatasetRequest request = new DescribeDatasetRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; try { DescribeDatasetResponse describeDatasetResponse = await client.DescribeDatasetAsync(request, cancellationToken).ConfigureAwait(false); return ModelToDatasetMetadata(describeDatasetResponse.Dataset); } catch (Exception ex) { throw new DataStorageException("Failed to get metadata of dataset: " + datasetName, ex); } }
IAsyncResult invokeDescribeDataset(DescribeDatasetRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new DescribeDatasetRequestMarshaller(); var unmarshaller = DescribeDatasetResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// Initiates the asynchronous execution of the DescribeDataset operation. /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeDataset operation on AmazonCognitoSyncClient.</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 EndDescribeDataset /// operation.</returns> public IAsyncResult BeginDescribeDataset(DescribeDatasetRequest request, AsyncCallback callback, object state) { return invokeDescribeDataset(request, callback, state, false); }
/// <summary> /// Gets metadata about a dataset by identity and dataset name. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeDataset service method.</param> /// /// <returns>The response from the DescribeDataset service method, as returned by CognitoSync.</returns> /// <exception cref="InternalErrorException"> /// Indicates an internal service error. /// </exception> /// <exception cref="InvalidParameterException"> /// Thrown when a request parameter does not comply with the associated constraints. /// </exception> /// <exception cref="NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="ResourceNotFoundException"> /// Thrown if the resource doesn't exist. /// </exception> public DescribeDatasetResponse DescribeDataset(DescribeDatasetRequest request) { IAsyncResult asyncResult = invokeDescribeDataset(request, null, null, true); return EndDescribeDataset(asyncResult); }
private Amazon.CognitoSync.Model.DescribeDatasetResponse CallAWSServiceOperation(IAmazonCognitoSync client, Amazon.CognitoSync.Model.DescribeDatasetRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Sync", "DescribeDataset"); try { #if DESKTOP return(client.DescribeDataset(request)); #elif CORECLR return(client.DescribeDatasetAsync(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; } }
/// <summary> /// Retrieves the metadata of a dataset. /// </summary> /// <returns>The records.</returns> /// <param name="datasetName">Dataset name.</param> public DatasetMetadata GetDatasetMetadata(string datasetName) { DescribeDatasetRequest request = new DescribeDatasetRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; DatasetMetadata metadata = null; try { var describeResponse = client.DescribeDataset(request); metadata = ModelToDatasetMetadata(describeResponse.Dataset); } catch (Exception e) { throw new DataStorageException("Failed to get metadata of dataset: " + datasetName, e); } return metadata; }