Skip to content

Commit

Permalink
Fix class field constants casing (#2292)
Browse files Browse the repository at this point in the history
  • Loading branch information
David R. Williamson committed Feb 1, 2022
1 parent f4cee56 commit 1e02375
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 48 deletions.
20 changes: 10 additions & 10 deletions iothub/service/src/JobClient/JobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace Microsoft.Azure.Devices
/// </remarks>
public class JobClient : IDisposable
{
private const string _jobsUriFormat = "/jobs/v2/{0}?{1}";
private const string _jobsQueryFormat = "/jobs/v2/query?{0}";
private const string _CancelJobUriFormat = "/jobs/v2/{0}/cancel?{1}";
private const string JobsUriFormat = "/jobs/v2/{0}?{1}";
private const string JobsQueryFormat = "/jobs/v2/query?{0}";
private const string CancelJobUriFormat = "/jobs/v2/{0}/cancel?{1}";

private const string _continuationTokenHeader = "x-ms-continuation";
private const string _pageSizeHeader = "x-ms-max-item-count";
private const string ContinuationTokenHeader = "x-ms-continuation";
private const string PageSizeHeader = "x-ms-max-item-count";

private static readonly TimeSpan s_defaultOperationTimeout = TimeSpan.FromSeconds(100);

Expand Down Expand Up @@ -307,7 +307,7 @@ public virtual Task<JobResponse> CancelJobAsync(string jobId, CancellationToken
EnsureInstanceNotClosed();

return _httpClientHelper.PostAsync<string, JobResponse>(
new Uri(_CancelJobUriFormat.FormatInvariant(jobId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative),
new Uri(CancelJobUriFormat.FormatInvariant(jobId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative),
null,
null,
null,
Expand Down Expand Up @@ -411,7 +411,7 @@ private void EnsureInstanceNotClosed()

private static Uri GetJobUri(string jobId)
{
return new Uri(_jobsUriFormat.FormatInvariant(jobId ?? string.Empty, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(JobsUriFormat.FormatInvariant(jobId ?? string.Empty, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private Task<JobResponse> CreateJobAsync(JobRequest jobRequest, CancellationToken cancellationToken)
Expand Down Expand Up @@ -451,7 +451,7 @@ await ExceptionHandlingHelper.GetExceptionMessageAsync(responseMessage).Configur

private static Uri BuildQueryJobUri(JobType? jobType, JobStatus? jobStatus)
{
var stringBuilder = new StringBuilder(_jobsQueryFormat.FormatInvariant(ClientApiVersionHelper.ApiVersionQueryString));
var stringBuilder = new StringBuilder(JobsQueryFormat.FormatInvariant(ClientApiVersionHelper.ApiVersionQueryString));

if (jobType != null)
{
Expand All @@ -477,12 +477,12 @@ private async Task<QueryResult> GetJobsAsync(JobType? jobType, JobStatus? jobSta
var customHeaders = new Dictionary<string, string>();
if (!string.IsNullOrWhiteSpace(continuationToken))
{
customHeaders.Add(_continuationTokenHeader, continuationToken);
customHeaders.Add(ContinuationTokenHeader, continuationToken);
}

if (pageSize != null)
{
customHeaders.Add(_pageSizeHeader, pageSize.ToString());
customHeaders.Add(PageSizeHeader, pageSize.ToString());
}

HttpResponseMessage response = await _httpClientHelper.GetAsync<HttpResponseMessage>(
Expand Down
72 changes: 36 additions & 36 deletions iothub/service/src/RegistryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ namespace Microsoft.Azure.Devices
Justification = "Cannot change parameter names as it is considered a breaking change.")]
public class RegistryManager : IDisposable
{
private const string _adminUriFormat = "/$admin/{0}?{1}";
private const string _requestUriFormat = "/devices/{0}?{1}";
private const string _jobsUriFormat = "/jobs{0}?{1}";
private const string _statisticsUriFormat = "/statistics/devices?" + ClientApiVersionHelper.ApiVersionQueryString;
private const string _devicesRequestUriFormat = "/devices/?top={0}&{1}";
private const string _devicesQueryUriFormat = "/devices/query?" + ClientApiVersionHelper.ApiVersionQueryString;
private const string _wildcardEtag = "*";
private const string AdminUriFormat = "/$admin/{0}?{1}";
private const string RequestUriFormat = "/devices/{0}?{1}";
private const string JobsUriFormat = "/jobs{0}?{1}";
private const string StatisticsUriFormat = "/statistics/devices?" + ClientApiVersionHelper.ApiVersionQueryString;
private const string DevicesRequestUriFormat = "/devices/?top={0}&{1}";
private const string DevicesQueryUriFormat = "/devices/query?" + ClientApiVersionHelper.ApiVersionQueryString;
private const string WildcardEtag = "*";

private const string _continuationTokenHeader = "x-ms-continuation";
private const string _pageSizeHeader = "x-ms-max-item-count";
private const string ContinuationTokenHeader = "x-ms-continuation";
private const string PageSizeHeader = "x-ms-max-item-count";

private const string _twinUriFormat = "/twins/{0}?{1}";
private const string TwinUriFormat = "/twins/{0}?{1}";

private const string _modulesRequestUriFormat = "/devices/{0}/modules/{1}?{2}";
private const string _modulesOnDeviceRequestUriFormat = "/devices/{0}/modules?{1}";
private const string _moduleTwinUriFormat = "/twins/{0}/modules/{1}?{2}";
private const string ModulesRequestUriFormat = "/devices/{0}/modules/{1}?{2}";
private const string ModulesOnDeviceRequestUriFormat = "/devices/{0}/modules?{1}";
private const string ModuleTwinUriFormat = "/twins/{0}/modules/{1}?{2}";

private const string _configurationRequestUriFormat = "/configurations/{0}?{1}";
private const string _configurationsRequestUriFormat = "/configurations/?top={0}&{1}";
private const string ConfigurationRequestUriFormat = "/configurations/{0}?{1}";
private const string ConfigurationsRequestUriFormat = "/configurations/?top={0}&{1}";

private const string _applyConfigurationOnDeviceUriFormat = "/devices/{0}/applyConfigurationContent?" + ClientApiVersionHelper.ApiVersionQueryString;
private const string ApplyConfigurationOnDeviceUriFormat = "/devices/{0}/applyConfigurationContent?" + ClientApiVersionHelper.ApiVersionQueryString;

private static readonly TimeSpan s_regexTimeoutMilliseconds = TimeSpan.FromMilliseconds(500);

Expand Down Expand Up @@ -2483,14 +2483,14 @@ private Task<Twin> UpdateTwinInternalAsync(string deviceId, Twin twin, string et
GetTwinUri(deviceId),
twin,
etag,
etag == _wildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
etag == WildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
errorMappingOverrides,
cancellationToken)
: _httpClientHelper.PatchAsync<Twin, Twin>(
GetTwinUri(deviceId),
twin,
etag,
etag == _wildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
etag == WildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
errorMappingOverrides,
cancellationToken);
}
Expand Down Expand Up @@ -2535,14 +2535,14 @@ await ExceptionHandlingHelper.GetExceptionMessageAsync(responseMessage).Configur
GetModuleTwinRequestUri(deviceId, moduleId),
twin,
etag,
etag == _wildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
etag == WildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
errorMappingOverrides,
cancellationToken)
: _httpClientHelper.PatchAsync<Twin, Twin>(
GetModuleTwinRequestUri(deviceId, moduleId),
twin,
etag,
etag == _wildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
etag == WildcardEtag ? PutOperationType.ForceUpdateEntity : PutOperationType.UpdateEntity,
errorMappingOverrides,
cancellationToken);
}
Expand All @@ -2569,12 +2569,12 @@ private async Task<QueryResult> ExecuteQueryAsync(string sqlQueryString, int? pa
var customHeaders = new Dictionary<string, string>();
if (!string.IsNullOrWhiteSpace(continuationToken))
{
customHeaders.Add(_continuationTokenHeader, continuationToken);
customHeaders.Add(ContinuationTokenHeader, continuationToken);
}

if (pageSize != null)
{
customHeaders.Add(_pageSizeHeader, pageSize.ToString());
customHeaders.Add(PageSizeHeader, pageSize.ToString());
}

HttpResponseMessage response = await _httpClientHelper
Expand Down Expand Up @@ -2613,79 +2613,79 @@ private Task<JobProperties> CreateJobAsync(JobProperties jobProperties, Cancella
private static Uri GetRequestUri(string deviceId)
{
deviceId = WebUtility.UrlEncode(deviceId);
return new Uri(_requestUriFormat.FormatInvariant(deviceId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(RequestUriFormat.FormatInvariant(deviceId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetModulesRequestUri(string deviceId, string moduleId)
{
deviceId = WebUtility.UrlEncode(deviceId);
moduleId = WebUtility.UrlEncode(moduleId);
return new Uri(_modulesRequestUriFormat.FormatInvariant(deviceId, moduleId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(ModulesRequestUriFormat.FormatInvariant(deviceId, moduleId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetModulesOnDeviceRequestUri(string deviceId)
{
deviceId = WebUtility.UrlEncode(deviceId);
return new Uri(_modulesOnDeviceRequestUriFormat.FormatInvariant(deviceId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(ModulesOnDeviceRequestUriFormat.FormatInvariant(deviceId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetModuleTwinRequestUri(string deviceId, string moduleId)
{
deviceId = WebUtility.UrlEncode(deviceId);
moduleId = WebUtility.UrlEncode(moduleId);
return new Uri(_moduleTwinUriFormat.FormatInvariant(deviceId, moduleId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(ModuleTwinUriFormat.FormatInvariant(deviceId, moduleId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetConfigurationRequestUri(string configurationId)
{
configurationId = WebUtility.UrlEncode(configurationId);
return new Uri(_configurationRequestUriFormat.FormatInvariant(configurationId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(ConfigurationRequestUriFormat.FormatInvariant(configurationId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetConfigurationsRequestUri(int maxCount)
{
return new Uri(_configurationsRequestUriFormat.FormatInvariant(maxCount, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(ConfigurationsRequestUriFormat.FormatInvariant(maxCount, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetApplyConfigurationOnDeviceRequestUri(string deviceId)
{
return new Uri(_applyConfigurationOnDeviceUriFormat.FormatInvariant(deviceId), UriKind.Relative);
return new Uri(ApplyConfigurationOnDeviceUriFormat.FormatInvariant(deviceId), UriKind.Relative);
}

private static Uri GetBulkRequestUri(string apiVersionQueryString)
{
return new Uri(_requestUriFormat.FormatInvariant(string.Empty, apiVersionQueryString), UriKind.Relative);
return new Uri(RequestUriFormat.FormatInvariant(string.Empty, apiVersionQueryString), UriKind.Relative);
}

private static Uri GetJobUri(string jobId, string apiVersion = ClientApiVersionHelper.ApiVersionQueryString)
{
return new Uri(_jobsUriFormat.FormatInvariant(jobId, apiVersion), UriKind.Relative);
return new Uri(JobsUriFormat.FormatInvariant(jobId, apiVersion), UriKind.Relative);
}

private static Uri GetDevicesRequestUri(int maxCount)
{
return new Uri(_devicesRequestUriFormat.FormatInvariant(maxCount, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(DevicesRequestUriFormat.FormatInvariant(maxCount, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri QueryDevicesRequestUri()
{
return new Uri(_devicesQueryUriFormat, UriKind.Relative);
return new Uri(DevicesQueryUriFormat, UriKind.Relative);
}

private static Uri GetAdminUri(string operation)
{
return new Uri(_adminUriFormat.FormatInvariant(operation, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(AdminUriFormat.FormatInvariant(operation, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static Uri GetStatisticsUri()
{
return new Uri(_statisticsUriFormat, UriKind.Relative);
return new Uri(StatisticsUriFormat, UriKind.Relative);
}

private static Uri GetTwinUri(string deviceId)
{
deviceId = WebUtility.UrlEncode(deviceId);
return new Uri(_twinUriFormat.FormatInvariant(deviceId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
return new Uri(TwinUriFormat.FormatInvariant(deviceId, ClientApiVersionHelper.ApiVersionQueryString), UriKind.Relative);
}

private static void ValidateDeviceId(Device device)
Expand Down
4 changes: 2 additions & 2 deletions iothub/service/src/ServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ public class ServiceClient : IDisposable

private int _sendingDeliveryTag;

internal readonly IotHubConnection Connection;

/// <summary>
/// Creates an instance of <see cref="ServiceClient"/>, provided for unit testing purposes only.
/// Use the CreateFromConnectionString method to create an instance to use the client.
Expand Down Expand Up @@ -215,6 +213,8 @@ public static ServiceClient Create(

#endif

internal IotHubConnection Connection { get; }

/// <inheritdoc />
public void Dispose()
{
Expand Down

0 comments on commit 1e02375

Please sign in to comment.