Skip to content

[DeviceProvisioningService] Manage Azure IoT Hub Device Provisioning Service registrations.#11979

Merged
VeryEarly merged 3 commits intoAzure:masterfrom
anusapan:dps-reg
May 27, 2020
Merged

[DeviceProvisioningService] Manage Azure IoT Hub Device Provisioning Service registrations.#11979
VeryEarly merged 3 commits intoAzure:masterfrom
anusapan:dps-reg

Conversation

@anusapan
Copy link
Copy Markdown
Contributor

Description

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

@anusapan
Copy link
Copy Markdown
Contributor Author

@VeryEarly VeryEarly self-assigned this May 25, 2020
}

public class PSDeviceRegistrationStates : PSDeviceRegistrationState
{ }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this PSDeviceRegistrationStates neede?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The command will return either a single object or multiple objects, So having different output types is required to mention in .ps1xml format file to display the output of multiple objects in table format and single object in list format.
PSDeviceRegistrationStates: Use to display the output in table format
PSDeviceRegistrationState: Use to display the output in list format

{
string query = this.IsParameterBound(c => c.Query) ? this.Query : "select * from enrollments";
QueryResult results = client.CreateEnrollmentGroupRegistrationStateQuery(new QuerySpecification(query), this.EnrollmentId).NextAsync().GetAwaiter().GetResult();
this.WriteObject(IotDpsUtils.ToPSDeviceRegistrationStates(results.Items), true);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please explain why not return PSDeviceRegistrationState?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This section will return multiple items of Registration


[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "IoTDeviceProvisioningServiceRegistration", DefaultParameterSetName = ResourceParameterSet)]
[Alias("Get-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "IoTDpsRegistration")]
[OutputType(typeof(PSDeviceRegistrationState), typeof(PSDeviceRegistrationStates[]))]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like it's not necessary to have two output types

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is only to display the output in different format

@anusapan anusapan requested a review from VeryEarly May 26, 2020 01:15
@VeryEarly VeryEarly merged commit 648946b into Azure:master May 27, 2020
@anusapan anusapan deleted the dps-reg branch May 27, 2020 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants