Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/CloudToDeviceMessagesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// C2D Messages Client place holder
/// </summary>
public class CloudToDeviceMessagesClient
{
/// <summary>
/// place holder
/// </summary>
#pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
public CloudToDeviceMessagesClient()
#pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
{

}
}
}
25 changes: 25 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/DevicesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;
using Azure.Iot.Hub.Service.Models;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// Device Client place holder
/// </summary>
public class DevicesClient
{
/// <summary>
/// place holder
/// </summary>
#pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
public DevicesClient()
#pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
{
}
}
}
25 changes: 25 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/FilesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// Files Client place holder
/// </summary>
public class FilesClient
{
/// <summary>
/// place holder
/// </summary>
#pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
public FilesClient()
#pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
{

}
}
}
61 changes: 61 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/IoTHubServiceClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// The IoT Hub Service Client
/// </summary>
public class IoTHubServiceClient
{
/// <summary>
/// place holder for Devices
/// </summary>
public DevicesClient Devices { get; private set; }
/// <summary>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not going to have query at this level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good one to discuss. We decided CL grouping for twins under Devices and Modules as per onenote. Do we want to keep Query as a separate client instead?

Copy link
Member

@vinagesh vinagesh May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that is right - groupings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well query spans over several areas i.e not just twins but also jobs and also raw queries. What about those?

Copy link
Contributor Author

@bikamani bikamani May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed later if this approach we decided does not work well. We thought Query for each individual sub client would be more discoverable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is raw queries?

/// place holder for Modules
/// </summary>
public ModulesClient Modules { get; private set; }
/// <summary>
/// place holder for Statistics
/// </summary>
public StatisticsClient Statistics { get; private set; }
/// <summary>
/// place holder for Messages
/// </summary>
public CloudToDeviceMessagesClient Messages { get; private set; }
/// <summary>
/// place holder for Files
/// </summary>
public FilesClient Files { get; private set; }
/// <summary>
/// place holder for Jobs
/// </summary>
public JobsClient Jobs { get; private set; }

/// <summary>
/// Initializes a new instance of the <see cref="IoTHubServiceClient"/> class.
/// </summary>
public IoTHubServiceClient()
: this(new IoTHubServiceClientOptions())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="IoTHubServiceClient"/> class.
/// </summary>
public IoTHubServiceClient(IoTHubServiceClientOptions options)
{
Argument.AssertNotNull(options, nameof(options));

Devices = new DevicesClient();
Modules = new ModulesClient();
Statistics = new StatisticsClient();
Messages = new CloudToDeviceMessagesClient();
Files = new FilesClient();
Jobs = new JobsClient();
}
}
}
55 changes: 55 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/IoTHubServiceClientOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Core;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// Options that allow configuration of requests sent to the IoTHub service.
/// </summary>
public class IoTHubServiceClientOptions : ClientOptions
{
internal const ServiceVersion LatestVersion = ServiceVersion.V2020_03_13;

/// <summary>
/// The versions of IoTHub Service supported by this client
/// library.
/// </summary>
public enum ServiceVersion
{
/// <summary>
/// 2020-03-13
/// </summary>
#pragma warning disable CA1707 // Identifiers should not contain underscores
V2020_03_13 = 1
#pragma warning restore CA1707 // Identifiers should not contain underscores
}

/// <summary>
/// Gets the <see cref="ServiceVersion"/> of the service API used when
/// making requests.
/// </summary>
public ServiceVersion Version { get; }

/// <summary>
/// Initializes a new instance of the <see cref="IoTHubServiceClientOptions"/>
/// class.
/// </summary>
public IoTHubServiceClientOptions(ServiceVersion version = LatestVersion)
{
Version = version;
}


internal string GetVersionString()
{
return Version switch
{
ServiceVersion.V2020_03_13 => "2020-03-13",
_ => throw new ArgumentException(Version.ToString()),
};
}
}
}
25 changes: 25 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/JobsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// Jobs Client place holder
/// </summary>
public class JobsClient
{
/// <summary>
/// place holder
/// </summary>
#pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
public JobsClient()
#pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
{

}
}
}
25 changes: 25 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/ModulesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// Modules Client place holder
/// </summary>
public class ModulesClient
{
/// <summary>
/// place holder
/// </summary>
#pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
public ModulesClient()
#pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
{

}
}
}
25 changes: 25 additions & 0 deletions sdk/iot/Azure.Iot.Hub.Service/src/StatisticsClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace Azure.Iot.Hub.Service
{
/// <summary>
/// Statistics Client place holder
/// </summary>
public class StatisticsClient
{
/// <summary>
/// place holder
/// </summary>
#pragma warning disable AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
public StatisticsClient()
#pragma warning restore AZC0007 // DO provide a minimal constructor that takes only the parameters required to connect to the service.
{

}
}
}