Skip to content

Commit

Permalink
Fix emppty string validation for GetEntity (Azure#32452)
Browse files Browse the repository at this point in the history
  • Loading branch information
christothes authored and sofiar-msft committed Dec 7, 2022
1 parent c077d42 commit 85d9b88
Show file tree
Hide file tree
Showing 9 changed files with 808 additions and 66 deletions.
1 change: 1 addition & 0 deletions sdk/tables/Azure.Data.Tables/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Breaking Changes

### Bugs Fixed
- Removed client side validation which prevented `GetEntity` and `GetEntityAsync` from getting an entity with an empty string as its RowKey value. ([#32447](https://github.com/Azure/azure-sdk-for-net/issues/32447))

### Other Changes

Expand Down
66 changes: 0 additions & 66 deletions sdk/tables/Azure.Data.Tables/src/Generated/TableRestClient.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions sdk/tables/Azure.Data.Tables/src/TableRestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,71 @@ public Response<IReadOnlyList<Response>> SendBatchRequest(HttpMessage message, C
throw ClientDiagnostics.CreateRequestFailedException(message.Response);
}
}

/// <summary> Queries a single entity in a table. </summary>
/// <param name="table"> The name of the table. </param>
/// <param name="partitionKey"> The partition key of the entity. </param>
/// <param name="rowKey"> The row key of the entity. </param>
/// <param name="timeout"> The timeout parameter is expressed in seconds. </param>
/// <param name="format"> Specifies the media type for the response. Allowed values: &quot;application/json;odata=nometadata&quot; | &quot;application/json;odata=minimalmetadata&quot; | &quot;application/json;odata=fullmetadata&quot;. </param>
/// <param name="select"> Select expression using OData notation. Limits the columns on each record to just those requested, e.g. &quot;$select=PolicyAssignmentId, ResourceId&quot;. </param>
/// <param name="filter"> OData filter expression. </param>
/// <param name="context"> The request context, which can override default behaviors of the client pipeline on a per-call basis. </param>
/// <exception cref="ArgumentNullException"> <paramref name="table"/>, <paramref name="partitionKey"/> or <paramref name="rowKey"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="table"/>, <paramref name="partitionKey"/> or <paramref name="rowKey"/> is an empty string, and was expected to be non-empty. </exception>
/// <exception cref="RequestFailedException"> Service returned a non-success status code. </exception>
/// <returns> The response returned from the service. </returns>
public virtual Response QueryEntityWithPartitionAndRowKey(string table, string partitionKey, string rowKey, int? timeout = null, string format = null, string select = null, string filter = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(table, nameof(table));
Argument.AssertNotNull(partitionKey, nameof(partitionKey));
Argument.AssertNotNull(rowKey, nameof(rowKey));

using var scope = ClientDiagnostics.CreateScope("Table.QueryEntityWithPartitionAndRowKey");
scope.Start();
try
{
using HttpMessage message = CreateQueryEntityWithPartitionAndRowKeyRequest(table, partitionKey, rowKey, timeout, format, select, filter, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}

/// <summary> Queries a single entity in a table. </summary>
/// <param name="table"> The name of the table. </param>
/// <param name="partitionKey"> The partition key of the entity. </param>
/// <param name="rowKey"> The row key of the entity. </param>
/// <param name="timeout"> The timeout parameter is expressed in seconds. </param>
/// <param name="format"> Specifies the media type for the response. Allowed values: &quot;application/json;odata=nometadata&quot; | &quot;application/json;odata=minimalmetadata&quot; | &quot;application/json;odata=fullmetadata&quot;. </param>
/// <param name="select"> Select expression using OData notation. Limits the columns on each record to just those requested, e.g. &quot;$select=PolicyAssignmentId, ResourceId&quot;. </param>
/// <param name="filter"> OData filter expression. </param>
/// <param name="context"> The request context, which can override default behaviors of the client pipeline on a per-call basis. </param>
/// <exception cref="ArgumentNullException"> <paramref name="table"/>, <paramref name="partitionKey"/> or <paramref name="rowKey"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="table"/>, <paramref name="partitionKey"/> or <paramref name="rowKey"/> is an empty string, and was expected to be non-empty. </exception>
/// <exception cref="RequestFailedException"> Service returned a non-success status code. </exception>
/// <returns> The response returned from the service. </returns>
public virtual async Task<Response> QueryEntityWithPartitionAndRowKeyAsync(string table, string partitionKey, string rowKey, int? timeout = null, string format = null, string select = null, string filter = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(table, nameof(table));
Argument.AssertNotNull(partitionKey, nameof(partitionKey));
Argument.AssertNotNull(rowKey, nameof(rowKey));

using var scope = ClientDiagnostics.CreateScope("Table.QueryEntityWithPartitionAndRowKey");
scope.Start();
try
{
using HttpMessage message = CreateQueryEntityWithPartitionAndRowKeyRequest(table, partitionKey, rowKey, timeout, format, select, filter, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 85d9b88

Please sign in to comment.