public override Task <UserResponse> ReplaceAsync( UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(TaskHelper.RunInlineIfNeededAsync(() => base.ReplaceAsync(userProperties, requestOptions, cancellationToken))); }
public override Task <UserResponse> ReplaceAsync( UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(this.ClientContext.OperationHelperAsync( nameof(ReplaceAsync), requestOptions, (diagnostics) => base.ReplaceAsync(diagnostics, userProperties, requestOptions, cancellationToken))); }
public override Task <UserResponse> ReplaceAsync( UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(this.ClientContext.OperationHelperAsync( nameof(ReplaceAsync), requestOptions, (trace) => base.ReplaceAsync(userProperties, requestOptions, trace, cancellationToken), (response) => new OpenTelemetryResponse <UserProperties>(response))); }
internal Task <UserResponse> CreateUserResponseAsync( User user, Task <ResponseMessage> cosmosResponseMessageTask) { return(this.ProcessMessageAsync(cosmosResponseMessageTask, (cosmosResponseMessage) => { UserProperties userProperties = this.ToObjectInternal <UserProperties>(cosmosResponseMessage, this.propertiesSerializer); return new UserResponse( cosmosResponseMessage.StatusCode, cosmosResponseMessage.Headers, userProperties, user); })); }
public override UserResponse CreateUserResponse( User user, ResponseMessage responseMessage) { return(this.ProcessMessage(responseMessage, (cosmosResponseMessage) => { UserProperties userProperties = this.ToObjectpublic <UserProperties>(cosmosResponseMessage); return new UserResponse( cosmosResponseMessage.StatusCode, cosmosResponseMessage.Headers, userProperties, user, cosmosResponseMessage.Diagnostics); })); }
public Task <ResponseMessage> ReplaceStreamAsync(UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userProperties == null) { throw new ArgumentNullException(nameof(userProperties)); } this.ClientContext.ValidateResource(userProperties.Id); return(this.ReplaceStreamInternalAsync( streamPayload: this.ClientContext.PropertiesSerializer.ToStream(userProperties), requestOptions: requestOptions, cancellationToken: cancellationToken)); }
/// <inheritdoc/> public override Task <UserResponse> ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userProperties == null) { throw new ArgumentNullException(nameof(userProperties)); } this.ClientContext.ValidateResource(userProperties.Id); Task <ResponseMessage> response = this.ReplaceStreamInternalAsync( streamPayload: this.ClientContext.SerializerCore.ToStream(userProperties), requestOptions: requestOptions, cancellationToken: cancellationToken); return(this.ClientContext.ResponseFactory.CreateUserResponseAsync(this, response)); }
public Task <ResponseMessage> ReplaceStreamAsync( CosmosDiagnosticsContext diagnosticsContext, UserProperties userProperties, RequestOptions requestOptions, CancellationToken cancellationToken) { if (userProperties == null) { throw new ArgumentNullException(nameof(userProperties)); } this.ClientContext.ValidateResource(userProperties.Id); return(this.ReplaceStreamInternalAsync( diagnosticsContext: diagnosticsContext, streamPayload: this.ClientContext.SerializerCore.ToStream(userProperties), requestOptions: requestOptions, cancellationToken: cancellationToken)); }
public Task <ResponseMessage> CreateUserStreamAsync( UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { if (userProperties == null) { throw new ArgumentNullException(nameof(userProperties)); } this.ClientContext.ValidateResource(userProperties.Id); Stream streamPayload = this.ClientContext.SerializerCore.ToStream(userProperties); return(this.ProcessUserCreateAsync( streamPayload: streamPayload, requestOptions: requestOptions, cancellationToken: cancellationToken)); }
public override Task <UserResponse> CreateUserAsync( string id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken)) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } UserProperties userProperties = new UserProperties(id); Task <ResponseMessage> response = this.CreateUserStreamAsync( userProperties: userProperties, requestOptions: requestOptions, cancellationToken: cancellationToken); return(this.ClientContext.ResponseFactory.CreateUserResponseAsync(this.GetUser(userProperties.Id), response)); }
public async Task <UserResponse> ReplaceAsync( UserProperties userProperties, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { if (userProperties == null) { throw new ArgumentNullException(nameof(userProperties)); } this.ClientContext.ValidateResource(userProperties.Id); ResponseMessage response = await this.ReplaceStreamInternalAsync( streamPayload : this.ClientContext.SerializerCore.ToStream(userProperties), requestOptions : requestOptions, trace : trace, cancellationToken : cancellationToken); return(this.ClientContext.ResponseFactory.CreateUserResponse(this, response)); }
public async Task <UserResponse> CreateUserAsync( string id, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } UserProperties userProperties = new UserProperties(id); ResponseMessage response = await this.CreateUserStreamAsync( userProperties : userProperties, requestOptions : requestOptions, trace : trace, cancellationToken : cancellationToken); return(this.ClientContext.ResponseFactory.CreateUserResponse(this.GetUser(userProperties.Id), response)); }
public Task <ResponseMessage> CreateUserStreamAsync( CosmosDiagnosticsContext diagnosticsContext, UserProperties userProperties, RequestOptions requestOptions, ITrace trace, CancellationToken cancellationToken) { if (userProperties == null) { throw new ArgumentNullException(nameof(userProperties)); } this.ClientContext.ValidateResource(userProperties.Id); Stream streamPayload = this.ClientContext.SerializerCore.ToStream(userProperties); return(this.ProcessUserCreateAsync( diagnosticsContext: diagnosticsContext, streamPayload: streamPayload, requestOptions: requestOptions, trace: trace, cancellationToken: cancellationToken)); }
/// <summary> /// Replace a <see cref="UserProperties"/> from the Azure Cosmos service as an asynchronous operation. /// </summary> /// <param name="userProperties">The <see cref="UserProperties"/> object.</param> /// <param name="requestOptions">(Optional) The options for the user request.</param> /// <param name="cancellationToken">(Optional) <see cref="CancellationToken"/> representing request cancellation.</param> /// <returns> /// A <see cref="Task"/> containing a <see cref="UserResponse"/> which wraps a <see cref="UserProperties"/> containing the replace resource record. /// </returns> /// <exception cref="CosmosException">This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a user are: /// <list type="table"> /// <listheader> /// <term>StatusCode</term><description>Reason for exception</description> /// </listheader> /// <item> /// <term>404</term><description>NotFound - This means the resource or parent resource you tried to read did not exist.</description> /// </item> /// <item> /// <term>429</term><description>TooManyRequests - This means you have exceeded the number of request units per second. Consult the DocumentClientException.RetryAfter value to see how long you should wait before retrying this operation.</description> /// </item> /// </list> /// </exception> /// <example> /// <code language="c#"> /// <![CDATA[ /// UserProperties userProperties = userReadResponse; /// userProperties.Id = "newuser"; /// UserResponse response = await user.ReplaceUserAsync(userProperties); /// UserProperties replacedProperties = response; /// ]]> /// </code> /// </example> public abstract Task <UserResponse> ReplaceAsync( UserProperties userProperties, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken));