Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add friendly name arg #344

Merged
merged 1 commit into from
Aug 24, 2023
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
5 changes: 3 additions & 2 deletions Meadow.CLI.Core/CloudServices/DeviceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DeviceService(IConfiguration config, IdentityManager identityManager) : b
_config = config;
}

public async Task<(bool isSuccess, string message)> AddDevice(string orgId, string id, string publicKey, string collectionId, string host, CancellationToken cancellationToken = default)
public async Task<(bool isSuccess, string message)> AddDevice(string orgId, string id, string publicKey, string collectionId, string name, string host, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(host))
{
Expand All @@ -31,7 +31,8 @@ public DeviceService(IConfiguration config, IdentityManager identityManager) : b
orgId,
id,
publicKey,
collectionId
collectionId,
name
};

var json = JsonSerializer.Serialize<dynamic>(payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public ProvisionDeviceCommand(DownloadManager downloadManager, ILoggerFactory lo
public string OrgId { get; set; }
[CommandOption("collectionId", 'c', Description = "The target collection for device registration", IsRequired = false)]
public string CollectionId { get; set; }
[CommandOption("name", 'n', Description = "Device friendly name", IsRequired = false)]
public string Name { get; set; }
[CommandOption("host", 'h', Description = "Optionally set a host (default is https://www.meadowcloud.co)", IsRequired = false)]
public string Host { get; set; }

Expand Down Expand Up @@ -84,7 +86,7 @@ public override async ValueTask ExecuteAsync(IConsole console)
var delim = "-----END PUBLIC KEY-----\n";
publicKey = publicKey.Substring(0, publicKey.IndexOf(delim) + delim.Length);

var result = await _deviceService.AddDevice(OrgId, device.DeviceInfo.ProcessorId, publicKey, CollectionId, Host);
var result = await _deviceService.AddDevice(OrgId, device.DeviceInfo.ProcessorId, publicKey, CollectionId, Name, Host);

if (result.isSuccess)
{
Expand Down
Loading