diff --git a/src/guestconfig/azext_guestconfig/__init__.py b/src/guestconfig/azext_guestconfig/__init__.py index 011b2bd1059..a3cd44101b7 100644 --- a/src/guestconfig/azext_guestconfig/__init__.py +++ b/src/guestconfig/azext_guestconfig/__init__.py @@ -10,16 +10,20 @@ from azure.cli.core import AzCommandsLoader from azext_guestconfig.generated._help import helps # pylint: disable=unused-import +try: + from azext_guestconfig.manual._help import helps # pylint: disable=reimported +except ImportError: + pass class GuestConfigurationClientCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType - from azext_guestconfig.generated._client_factory import cf_guestconfig + from azext_guestconfig.generated._client_factory import cf_guestconfig_cl guestconfig_custom = CliCommandType( operations_tmpl='azext_guestconfig.custom#{}', - client_factory=cf_guestconfig) + client_factory=cf_guestconfig_cl) parent = super(GuestConfigurationClientCommandsLoader, self) parent.__init__(cli_ctx=cli_ctx, custom_command_type=guestconfig_custom) diff --git a/src/guestconfig/azext_guestconfig/azext_metadata.json b/src/guestconfig/azext_guestconfig/azext_metadata.json index 13025150393..4f48fa652a5 100644 --- a/src/guestconfig/azext_guestconfig/azext_metadata.json +++ b/src/guestconfig/azext_guestconfig/azext_metadata.json @@ -1,4 +1,4 @@ { "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.3.1" + "azext.minCliCoreVersion": "2.11.0" } \ No newline at end of file diff --git a/src/guestconfig/azext_guestconfig/generated/_client_factory.py b/src/guestconfig/azext_guestconfig/generated/_client_factory.py index 43931b02c83..3ecd80049bd 100644 --- a/src/guestconfig/azext_guestconfig/generated/_client_factory.py +++ b/src/guestconfig/azext_guestconfig/generated/_client_factory.py @@ -9,23 +9,24 @@ # -------------------------------------------------------------------------- -def cf_guestconfig(cli_ctx, *_): +def cf_guestconfig_cl(cli_ctx, *_): from azure.cli.core.commands.client_factory import get_mgmt_service_client from ..vendored_sdks.guestconfig import GuestConfigurationClient - return get_mgmt_service_client(cli_ctx, GuestConfigurationClient) + return get_mgmt_service_client(cli_ctx, + GuestConfigurationClient) def cf_guest_configuration_assignment(cli_ctx, *_): - return cf_guestconfig(cli_ctx).guest_configuration_assignment + return cf_guestconfig_cl(cli_ctx).guest_configuration_assignment def cf_guest_configuration_assignment_report(cli_ctx, *_): - return cf_guestconfig(cli_ctx).guest_configuration_assignment_report + return cf_guestconfig_cl(cli_ctx).guest_configuration_assignment_report def cf_guest_configuration_hcrp_assignment(cli_ctx, *_): - return cf_guestconfig(cli_ctx).guest_configuration_hcrp_assignment + return cf_guestconfig_cl(cli_ctx).guest_configuration_hcrp_assignment def cf_guest_configuration_hcrp_assignment_report(cli_ctx, *_): - return cf_guestconfig(cli_ctx).guest_configuration_hcrp_assignment_report + return cf_guestconfig_cl(cli_ctx).guest_configuration_hcrp_assignment_report diff --git a/src/guestconfig/azext_guestconfig/generated/_help.py b/src/guestconfig/azext_guestconfig/generated/_help.py index efc8f5b8eea..40c04f81ba3 100644 --- a/src/guestconfig/azext_guestconfig/generated/_help.py +++ b/src/guestconfig/azext_guestconfig/generated/_help.py @@ -19,139 +19,22 @@ helps['guestconfig guest-configuration-assignment list'] = """ type: command - short-summary: List all guest configuration assignments for a virtual machine. + short-summary: "List all guest configuration assignments for a virtual machine." examples: - name: List all guest configuration assignments for a virtual machine text: |- - az guestconfig guest-configuration-assignment list --resource-group "myResourceGroupName" --vm-name "myV\ -MName" + az guestconfig guest-configuration-assignment list --resource-group "myResourceGroupName" --vm-name \ +"myVMName" """ helps['guestconfig guest-configuration-assignment show'] = """ type: command - short-summary: Get information about a guest configuration assignment + short-summary: "Get information about a guest configuration assignment." examples: - name: Get a guest configuration assignment text: |- - az guestconfig guest-configuration-assignment show --name "SecureProtocol" --resource-group "myResourceG\ -roupName" --vm-name "myVMName" -""" - -helps['guestconfig guest-configuration-assignment create'] = """ - type: command - short-summary: Creates an association between a VM and guest configuration - parameters: - - name: --guest-configuration-configuration-parameter - short-summary: The configuration parameters for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-parameter name=XX value=XX - - name: Name of the configuration parameter. - value: Value of the configuration parameter. - - Multiple actions can be specified by using more than one --guest-configuration-configuration-parameter argu\ -ment. - - name: --guest-configuration-configuration-setting - short-summary: The configuration setting for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-setting configuration-mode=XX allow-module-overwrite=XX action-a\ -fter-reboot=XX refresh-frequency-mins=XX reboot-if-needed=XX configuration-mode-frequency-mins=XX - - configuration-mode: Specifies how the LCM(Local Configuration Manager) actually applies the configuration t\ -o the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. - allow-module-overwrite: If true - new configurations downloaded from the pull service are allowed to overwr\ -ite the old ones on the target node. Otherwise, false - action-after-reboot: Specifies what happens after a reboot during the application of a configuration. The p\ -ossible values are ContinueConfiguration and StopConfiguration - refresh-frequency-mins: The time interval, in minutes, at which the LCM checks a pull service to get update\ -d configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. - reboot-if-needed: Set this to true to automatically reboot the node after a configuration that requires reb\ -oot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The defaul\ -t value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows I\ -nstaller), combine this setting with the xPendingReboot module. - configuration-mode-frequency-mins: How often, in minutes, the current configuration is checked and applied.\ - This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. - examples: - - name: Create or update guest configuration assignment - text: |- - az guestconfig guest-configuration-assignment create --guest-configuration-assignment-name "WhitelistedA\ -pplication" --guest-configuration-name "WhitelistedApplication" --location "westcentralus" --context "Azure policy" --g\ -uest-configuration-name "WhitelistedApplication" --guest-configuration-configuration-parameter name="[InstalledApplicat\ -ion]bwhitelistedapp;Name" value="NotePad,sql" --guest-configuration-configuration-setting action-after-reboot="Continue\ -Configuration" configuration-mode="MonitorOnly" configuration-mode-frequency-mins=15 reboot-if-needed="False" --guest-c\ -onfiguration-version "1.*" --resource-group "myResourceGroupName" --vm-name "myVMName" -""" - -helps['guestconfig guest-configuration-assignment update'] = """ - type: command - short-summary: Creates an association between a VM and guest configuration - parameters: - - name: --guest-configuration-configuration-parameter - short-summary: The configuration parameters for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-parameter name=XX value=XX - - name: Name of the configuration parameter. - value: Value of the configuration parameter. - - Multiple actions can be specified by using more than one --guest-configuration-configuration-parameter argu\ -ment. - - name: --guest-configuration-configuration-setting - short-summary: The configuration setting for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-setting configuration-mode=XX allow-module-overwrite=XX action-a\ -fter-reboot=XX refresh-frequency-mins=XX reboot-if-needed=XX configuration-mode-frequency-mins=XX - - configuration-mode: Specifies how the LCM(Local Configuration Manager) actually applies the configuration t\ -o the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. - allow-module-overwrite: If true - new configurations downloaded from the pull service are allowed to overwr\ -ite the old ones on the target node. Otherwise, false - action-after-reboot: Specifies what happens after a reboot during the application of a configuration. The p\ -ossible values are ContinueConfiguration and StopConfiguration - refresh-frequency-mins: The time interval, in minutes, at which the LCM checks a pull service to get update\ -d configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. - reboot-if-needed: Set this to true to automatically reboot the node after a configuration that requires reb\ -oot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The defaul\ -t value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows I\ -nstaller), combine this setting with the xPendingReboot module. - configuration-mode-frequency-mins: How often, in minutes, the current configuration is checked and applied.\ - This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. - examples: - - name: Create or update guest configuration assignment - text: |- - az guestconfig guest-configuration-assignment update --guest-configuration-assignment-name "WhitelistedA\ -pplication" --guest-configuration-name "WhitelistedApplication" --location "westcentralus" --context "Azure policy" --g\ -uest-configuration-name "WhitelistedApplication" --guest-configuration-configuration-parameter name="[InstalledApplicat\ -ion]bwhitelistedapp;Name" value="NotePad,sql" --guest-configuration-configuration-setting action-after-reboot="Continue\ -Configuration" configuration-mode="MonitorOnly" configuration-mode-frequency-mins=15 reboot-if-needed="False" --guest-c\ -onfiguration-version "1.*" --resource-group "myResourceGroupName" --vm-name "myVMName" -""" - -helps['guestconfig guest-configuration-assignment delete'] = """ - type: command - short-summary: Delete a guest configuration assignment - examples: - - name: Delete an guest configuration assignment - text: |- - az guestconfig guest-configuration-assignment delete --name "SecureProtocol" --resource-group "myResourc\ -eGroupName" --vm-name "myVMName" -""" - -helps['guestconfig guest-configuration-assignment wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the guestconfig guest-configuration-assignment\ - is met. - examples: - - name: Pause executing next line of CLI script until the guestconfig guest-configuration-assignment is successfu\ -lly created. - text: |- - az guestconfig guest-configuration-assignment wait --name "SecureProtocol" --resource-group "myResourceG\ -roupName" --vm-name "myVMName" --created - - name: Pause executing next line of CLI script until the guestconfig guest-configuration-assignment is successfu\ -lly deleted. - text: |- - az guestconfig guest-configuration-assignment wait --name "SecureProtocol" --resource-group "myResourceG\ -roupName" --vm-name "myVMName" --deleted + az guestconfig guest-configuration-assignment show --name "SecureProtocol" --resource-group \ +"myResourceGroupName" --vm-name "myVMName" """ helps['guestconfig guest-configuration-assignment-report'] = """ @@ -161,23 +44,23 @@ helps['guestconfig guest-configuration-assignment-report list'] = """ type: command - short-summary: List all reports for the guest configuration assignment, latest report first. + short-summary: "List all reports for the guest configuration assignment, latest report first." examples: - name: List all guest configuration assignments for a virtual machine text: |- - az guestconfig guest-configuration-assignment-report list --guest-configuration-assignment-name "AuditSe\ -cureProtocol" --resource-group "myResourceGroupName" --vm-name "myVMName" + az guestconfig guest-configuration-assignment-report list --guest-configuration-assignment-name \ +"AuditSecureProtocol" --resource-group "myResourceGroupName" --vm-name "myVMName" """ helps['guestconfig guest-configuration-assignment-report show'] = """ type: command - short-summary: Get a report for the guest configuration assignment, by reportId. + short-summary: "Get a report for the guest configuration assignment, by reportId." examples: - name: Get a guest configuration assignment report by Id for a virtual machine text: |- - az guestconfig guest-configuration-assignment-report show --guest-configuration-assignment-name "AuditSe\ -cureProtocol" --report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" --resource-group "myResourceGroupName" --vm-name "myvm\ -" + az guestconfig guest-configuration-assignment-report show --guest-configuration-assignment-name \ +"AuditSecureProtocol" --report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" --resource-group "myResourceGroupName" \ +--vm-name "myvm" """ helps['guestconfig guest-configuration-hcrp-assignment'] = """ @@ -187,7 +70,7 @@ helps['guestconfig guest-configuration-hcrp-assignment list'] = """ type: command - short-summary: List all guest configuration assignments for an ARC machine. + short-summary: "List all guest configuration assignments for an ARC machine." examples: - name: List all guest configuration assignments for a virtual machine text: |- @@ -197,129 +80,12 @@ helps['guestconfig guest-configuration-hcrp-assignment show'] = """ type: command - short-summary: Get information about a guest configuration assignment + short-summary: "Get information about a guest configuration assignment." examples: - name: Get a guest configuration assignment text: |- - az guestconfig guest-configuration-hcrp-assignment show --guest-configuration-assignment-name "SecurePro\ -tocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" -""" - -helps['guestconfig guest-configuration-hcrp-assignment create'] = """ - type: command - short-summary: Creates an association between a ARC machine and guest configuration - parameters: - - name: --guest-configuration-configuration-parameter - short-summary: The configuration parameters for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-parameter name=XX value=XX - - name: Name of the configuration parameter. - value: Value of the configuration parameter. - - Multiple actions can be specified by using more than one --guest-configuration-configuration-parameter argu\ -ment. - - name: --guest-configuration-configuration-setting - short-summary: The configuration setting for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-setting configuration-mode=XX allow-module-overwrite=XX action-a\ -fter-reboot=XX refresh-frequency-mins=XX reboot-if-needed=XX configuration-mode-frequency-mins=XX - - configuration-mode: Specifies how the LCM(Local Configuration Manager) actually applies the configuration t\ -o the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. - allow-module-overwrite: If true - new configurations downloaded from the pull service are allowed to overwr\ -ite the old ones on the target node. Otherwise, false - action-after-reboot: Specifies what happens after a reboot during the application of a configuration. The p\ -ossible values are ContinueConfiguration and StopConfiguration - refresh-frequency-mins: The time interval, in minutes, at which the LCM checks a pull service to get update\ -d configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. - reboot-if-needed: Set this to true to automatically reboot the node after a configuration that requires reb\ -oot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The defaul\ -t value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows I\ -nstaller), combine this setting with the xPendingReboot module. - configuration-mode-frequency-mins: How often, in minutes, the current configuration is checked and applied.\ - This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. - examples: - - name: Create or update guest configuration assignment - text: |- - az guestconfig guest-configuration-hcrp-assignment create --guest-configuration-assignment-name "Whiteli\ -stedApplication" --machine-name "myMachineName" --guest-configuration-name "WhitelistedApplication" --location "westcen\ -tralus" --context "Azure policy" --guest-configuration-name "WhitelistedApplication" --guest-configuration-configuratio\ -n-parameter name="[InstalledApplication]bwhitelistedapp;Name" value="NotePad,sql" --guest-configuration-configuration-s\ -etting action-after-reboot="ContinueConfiguration" configuration-mode="MonitorOnly" configuration-mode-frequency-mins=1\ -5 reboot-if-needed="False" --guest-configuration-version "1.*" --resource-group "myResourceGroupName" -""" - -helps['guestconfig guest-configuration-hcrp-assignment update'] = """ - type: command - short-summary: Creates an association between a ARC machine and guest configuration - parameters: - - name: --guest-configuration-configuration-parameter - short-summary: The configuration parameters for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-parameter name=XX value=XX - - name: Name of the configuration parameter. - value: Value of the configuration parameter. - - Multiple actions can be specified by using more than one --guest-configuration-configuration-parameter argu\ -ment. - - name: --guest-configuration-configuration-setting - short-summary: The configuration setting for the guest configuration. - long-summary: | - Usage: --guest-configuration-configuration-setting configuration-mode=XX allow-module-overwrite=XX action-a\ -fter-reboot=XX refresh-frequency-mins=XX reboot-if-needed=XX configuration-mode-frequency-mins=XX - - configuration-mode: Specifies how the LCM(Local Configuration Manager) actually applies the configuration t\ -o the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. - allow-module-overwrite: If true - new configurations downloaded from the pull service are allowed to overwr\ -ite the old ones on the target node. Otherwise, false - action-after-reboot: Specifies what happens after a reboot during the application of a configuration. The p\ -ossible values are ContinueConfiguration and StopConfiguration - refresh-frequency-mins: The time interval, in minutes, at which the LCM checks a pull service to get update\ -d configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. - reboot-if-needed: Set this to true to automatically reboot the node after a configuration that requires reb\ -oot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The defaul\ -t value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows I\ -nstaller), combine this setting with the xPendingReboot module. - configuration-mode-frequency-mins: How often, in minutes, the current configuration is checked and applied.\ - This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. - examples: - - name: Create or update guest configuration assignment - text: |- - az guestconfig guest-configuration-hcrp-assignment update --guest-configuration-assignment-name "Whiteli\ -stedApplication" --machine-name "myMachineName" --guest-configuration-name "WhitelistedApplication" --location "westcen\ -tralus" --context "Azure policy" --guest-configuration-name "WhitelistedApplication" --guest-configuration-configuratio\ -n-parameter name="[InstalledApplication]bwhitelistedapp;Name" value="NotePad,sql" --guest-configuration-configuration-s\ -etting action-after-reboot="ContinueConfiguration" configuration-mode="MonitorOnly" configuration-mode-frequency-mins=1\ -5 reboot-if-needed="False" --guest-configuration-version "1.*" --resource-group "myResourceGroupName" -""" - -helps['guestconfig guest-configuration-hcrp-assignment delete'] = """ - type: command - short-summary: Delete a guest configuration assignment - examples: - - name: Delete an guest configuration assignment - text: |- - az guestconfig guest-configuration-hcrp-assignment delete --guest-configuration-assignment-name "SecureP\ -rotocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" -""" - -helps['guestconfig guest-configuration-hcrp-assignment wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the guestconfig guest-configuration-hcrp-assig\ -nment is met. - examples: - - name: Pause executing next line of CLI script until the guestconfig guest-configuration-hcrp-assignment is succ\ -essfully created. - text: |- - az guestconfig guest-configuration-hcrp-assignment wait --guest-configuration-assignment-name "SecurePro\ -tocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" --created - - name: Pause executing next line of CLI script until the guestconfig guest-configuration-hcrp-assignment is succ\ -essfully deleted. - text: |- - az guestconfig guest-configuration-hcrp-assignment wait --guest-configuration-assignment-name "SecurePro\ -tocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" --deleted + az guestconfig guest-configuration-hcrp-assignment show --guest-configuration-assignment-name \ +"SecureProtocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" """ helps['guestconfig guest-configuration-hcrp-assignment-report'] = """ @@ -329,21 +95,21 @@ helps['guestconfig guest-configuration-hcrp-assignment-report list'] = """ type: command - short-summary: List all reports for the guest configuration assignment, latest report first. + short-summary: "List all reports for the guest configuration assignment, latest report first." examples: - name: List all guest configuration assignments for a virtual machine text: |- - az guestconfig guest-configuration-hcrp-assignment-report list --guest-configuration-assignment-name "Au\ -ditSecureProtocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" + az guestconfig guest-configuration-hcrp-assignment-report list --guest-configuration-assignment-name \ +"AuditSecureProtocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" """ helps['guestconfig guest-configuration-hcrp-assignment-report show'] = """ type: command - short-summary: Get a report for the guest configuration assignment, by reportId. + short-summary: "Get a report for the guest configuration assignment, by reportId." examples: - name: Get a guest configuration assignment report by Id for a virtual machine text: |- - az guestconfig guest-configuration-hcrp-assignment-report show --guest-configuration-assignment-name "Au\ -ditSecureProtocol" --machine-name "myMachineName" --report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" --resource-group "\ -myResourceGroupName" + az guestconfig guest-configuration-hcrp-assignment-report show --guest-configuration-assignment-name \ +"AuditSecureProtocol" --machine-name "myMachineName" --report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" \ +--resource-group "myResourceGroupName" """ diff --git a/src/guestconfig/azext_guestconfig/generated/_params.py b/src/guestconfig/azext_guestconfig/generated/_params.py index 0a1d2ac4a47..d980cd24caf 100644 --- a/src/guestconfig/azext_guestconfig/generated/_params.py +++ b/src/guestconfig/azext_guestconfig/generated/_params.py @@ -10,154 +10,54 @@ # pylint: disable=too-many-lines # pylint: disable=too-many-statements -from knack.arguments import CLIArgumentType -from azure.cli.core.commands.parameters import ( - resource_group_name_type, - get_location_type -) -from azure.cli.core.commands.validators import get_default_location_from_resource_group -from azext_guestconfig.action import ( - AddGuestConfigurationConfigurationParameter, - AddGuestConfigurationConfigurationSetting -) +from azure.cli.core.commands.parameters import resource_group_name_type def load_arguments(self, _): with self.argument_context('guestconfig guest-configuration-assignment list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('vm_name', help='The name of the virtual machine.') + c.argument('vm_name', type=str, help='The name of the virtual machine.') with self.argument_context('guestconfig guest-configuration-assignment show') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='The guest configuration ' - 'assignment name.', id_part='child_name_1') - c.argument('vm_name', help='The name of the virtual machine.', id_part='name') - - with self.argument_context('guestconfig guest-configuration-assignment create') as c: - c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.') - c.argument('resource_group_name', resource_group_name_type) - c.argument('vm_name', help='The name of the virtual machine.') - c.argument('name', help='Name of the guest configuration assignment.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) - c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy') - c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r' - 'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.')) - c.argument('guest_configuration_name', help='Name of the guest configuration.') - c.argument('guest_configuration_version', help='Version of the guest configuration.') - c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter, - nargs='+', help='The configuration parameters for the guest configuration.') - c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting, - nargs='+', help='The configuration setting for the guest configuration.') - - with self.argument_context('guestconfig guest-configuration-assignment update') as c: - c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.', id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - c.argument('vm_name', help='The name of the virtual machine.', id_part='name') - c.argument('name', help='Name of the guest configuration assignment.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) - c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy') - c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r' - 'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.')) - c.argument('guest_configuration_name', help='Name of the guest configuration.') - c.argument('guest_configuration_version', help='Version of the guest configuration.') - c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter, - nargs='+', help='The configuration parameters for the guest configuration.') - c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting, - nargs='+', help='The configuration setting for the guest configuration.') - - with self.argument_context('guestconfig guest-configuration-assignment delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='Name of the guest config' - 'uration assignment', id_part='child_name_1') - c.argument('vm_name', help='The name of the virtual machine.', id_part='name') - - with self.argument_context('guestconfig guest-configuration-assignment wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', options_list=['--name', '-n'], help='The guest configuration ' - 'assignment name.', id_part='child_name_1') - c.argument('vm_name', help='The name of the virtual machine.', id_part='name') + c.argument('guest_configuration_assignment_name', options_list=['--name', '-n', '' + '--guest-configuration-assignment-name'], + type=str, help='The guest configuration assignment name.', id_part='child_name_1') + c.argument('vm_name', type=str, help='The name of the virtual machine.', id_part='name') with self.argument_context('guestconfig guest-configuration-assignment-report list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.') - c.argument('vm_name', help='The name of the virtual machine.') + c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.') + c.argument('vm_name', type=str, help='The name of the virtual machine.') with self.argument_context('guestconfig guest-configuration-assignment-report show') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi' - 'ld_name_1') - c.argument('report_id', help='The GUID for the guest configuration assignment report.', - id_part='child_name_2') - c.argument('vm_name', help='The name of the virtual machine.', id_part='name') + c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.', + id_part='child_name_1') + c.argument('report_id', type=str, help='The GUID for the guest configuration assignment report.', id_part='' + 'child_name_2') + c.argument('vm_name', type=str, help='The name of the virtual machine.', id_part='name') with self.argument_context('guestconfig guest-configuration-hcrp-assignment list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the ARC machine.') + c.argument('machine_name', type=str, help='The name of the ARC machine.') with self.argument_context('guestconfig guest-configuration-hcrp-assignment show') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi' - 'ld_name_1') - c.argument('machine_name', help='The name of the ARC machine.', id_part='name') - - with self.argument_context('guestconfig guest-configuration-hcrp-assignment create') as c: - c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.') - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the ARC machine.') - c.argument('name', help='Name of the guest configuration assignment.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) - c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy') - c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r' - 'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.')) - c.argument('guest_configuration_name', help='Name of the guest configuration.') - c.argument('guest_configuration_version', help='Version of the guest configuration.') - c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter, - nargs='+', help='The configuration parameters for the guest configuration.') - c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting, - nargs='+', help='The configuration setting for the guest configuration.') - - with self.argument_context('guestconfig guest-configuration-hcrp-assignment update') as c: - c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment.', id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - c.argument('machine_name', help='The name of the ARC machine.', id_part='name') - c.argument('name', help='Name of the guest configuration assignment.') - c.argument('location', arg_type=get_location_type(self.cli_ctx), - validator=get_default_location_from_resource_group) - c.argument('context', help='The source which initiated the guest configuration assignment. Ex: Azure Policy') - c.argument('latest_assignment_report_assignment', arg_type=CLIArgumentType(options_list=['--latest-assignment-r' - 'eport-assignment'], help='Configuration details of the guest configuration assignment. Expected val' 'ue: json-string/@json-file.')) - c.argument('guest_configuration_name', help='Name of the guest configuration.') - c.argument('guest_configuration_version', help='Version of the guest configuration.') - c.argument('guest_configuration_configuration_parameter', action=AddGuestConfigurationConfigurationParameter, - nargs='+', help='The configuration parameters for the guest configuration.') - c.argument('guest_configuration_configuration_setting', action=AddGuestConfigurationConfigurationSetting, - nargs='+', help='The configuration setting for the guest configuration.') - - with self.argument_context('guestconfig guest-configuration-hcrp-assignment delete') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='Name of the guest configuration assignment', id_part='c' - 'hild_name_1') - c.argument('machine_name', help='The name of the ARC machine.', id_part='name') - - with self.argument_context('guestconfig guest-configuration-hcrp-assignment wait') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi' - 'ld_name_1') - c.argument('machine_name', help='The name of the ARC machine.', id_part='name') + c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.', + id_part='child_name_1') + c.argument('machine_name', type=str, help='The name of the ARC machine.', id_part='name') with self.argument_context('guestconfig guest-configuration-hcrp-assignment-report list') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.') - c.argument('machine_name', help='The name of the ARC machine.') + c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.') + c.argument('machine_name', type=str, help='The name of the ARC machine.') with self.argument_context('guestconfig guest-configuration-hcrp-assignment-report show') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('guest_configuration_assignment_name', help='The guest configuration assignment name.', id_part='chi' - 'ld_name_1') - c.argument('report_id', help='The GUID for the guest configuration assignment report.', - id_part='child_name_2') - c.argument('machine_name', help='The name of the ARC machine.', id_part='name') + c.argument('guest_configuration_assignment_name', type=str, help='The guest configuration assignment name.', + id_part='child_name_1') + c.argument('report_id', type=str, help='The GUID for the guest configuration assignment report.', id_part='' + 'child_name_2') + c.argument('machine_name', type=str, help='The name of the ARC machine.', id_part='name') diff --git a/src/guestconfig/azext_guestconfig/generated/action.py b/src/guestconfig/azext_guestconfig/generated/action.py index 5ca01f8907b..b49bfaeeefe 100644 --- a/src/guestconfig/azext_guestconfig/generated/action.py +++ b/src/guestconfig/azext_guestconfig/generated/action.py @@ -8,66 +8,3 @@ # regenerated. # -------------------------------------------------------------------------- # pylint: disable=protected-access - -import argparse -from knack.util import CLIError -from collections import defaultdict - - -class AddGuestConfigurationConfigurationParameter(argparse._AppendAction): - def __call__(self, parser, namespace, values, option_string=None): - action = self.get_action(values, option_string) - super(AddGuestConfigurationConfigurationParameter, self).__call__(parser, namespace, action, option_string) - - def get_action(self, values, option_string): # pylint: disable=no-self-use - try: - properties = defaultdict(list) - for (k, v) in (x.split('=', 1) for x in values): - properties[k].append(v) - properties = dict(properties) - except ValueError: - raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) - d = {} - for k in properties: - kl = k.lower() - v = properties[k] - if kl == 'name': - d['name'] = v[0] - elif kl == 'value': - d['value'] = v[0] - return d - - -class AddGuestConfigurationConfigurationSetting(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - action = self.get_action(values, option_string) - namespace.guest_configuration_configuration_setting = action - - def get_action(self, values, option_string): # pylint: disable=no-self-use - try: - properties = defaultdict(list) - for (k, v) in (x.split('=', 1) for x in values): - properties[k].append(v) - properties = dict(properties) - except ValueError: - raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) - d = {} - d['refresh_frequency_mins'] = 30 - d['reboot_if_needed'] = "False" - d['configuration_mode_frequency_mins'] = 15 - for k in properties: - kl = k.lower() - v = properties[k] - if kl == 'configuration-mode': - d['configuration_mode'] = v[0] - elif kl == 'allow-module-overwrite': - d['allow_module_overwrite'] = v[0] - elif kl == 'action-after-reboot': - d['action_after_reboot'] = v[0] - elif kl == 'refresh-frequency-mins': - d['refresh_frequency_mins'] = v[0] - elif kl == 'reboot-if-needed': - d['reboot_if_needed'] = v[0] - elif kl == 'configuration-mode-frequency-mins': - d['configuration_mode_frequency_mins'] = v[0] - return d diff --git a/src/guestconfig/azext_guestconfig/generated/commands.py b/src/guestconfig/azext_guestconfig/generated/commands.py index d902a678590..bb4d9457d99 100644 --- a/src/guestconfig/azext_guestconfig/generated/commands.py +++ b/src/guestconfig/azext_guestconfig/generated/commands.py @@ -7,6 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals from azure.cli.core.commands import CliCommandType @@ -22,10 +24,6 @@ def load_command_table(self, _): client_factory=cf_guest_configuration_assignment, is_experimental=True) as g: g.custom_command('list', 'guestconfig_guest_configuration_assignment_list') g.custom_show_command('show', 'guestconfig_guest_configuration_assignment_show') - g.custom_command('create', 'guestconfig_guest_configuration_assignment_create', supports_no_wait=True) - g.custom_command('update', 'guestconfig_guest_configuration_assignment_update', supports_no_wait=True) - g.custom_command('delete', 'guestconfig_guest_configuration_assignment_delete', supports_no_wait=True) - g.custom_wait_command('wait', 'guestconfig_guest_configuration_assignment_show') from azext_guestconfig.generated._client_factory import cf_guest_configuration_assignment_report guestconfig_guest_configuration_assignment_report = CliCommandType( @@ -48,10 +46,6 @@ def load_command_table(self, _): client_factory=cf_guest_configuration_hcrp_assignment, is_experimental=True) as g: g.custom_command('list', 'guestconfig_guest_configuration_hcrp_assignment_list') g.custom_show_command('show', 'guestconfig_guest_configuration_hcrp_assignment_show') - g.custom_command('create', 'guestconfig_guest_configuration_hcrp_assignment_create', supports_no_wait=True) - g.custom_command('update', 'guestconfig_guest_configuration_hcrp_assignment_update', supports_no_wait=True) - g.custom_command('delete', 'guestconfig_guest_configuration_hcrp_assignment_delete', supports_no_wait=True) - g.custom_wait_command('wait', 'guestconfig_guest_configuration_hcrp_assignment_show') from azext_guestconfig.generated._client_factory import cf_guest_configuration_hcrp_assignment_report guestconfig_guest_configuration_hcrp_assignment_report = CliCommandType( diff --git a/src/guestconfig/azext_guestconfig/generated/custom.py b/src/guestconfig/azext_guestconfig/generated/custom.py index afaaa2c3335..55a625bdf95 100644 --- a/src/guestconfig/azext_guestconfig/generated/custom.py +++ b/src/guestconfig/azext_guestconfig/generated/custom.py @@ -9,9 +9,6 @@ # -------------------------------------------------------------------------- # pylint: disable=too-many-lines -import json -from azure.cli.core.util import sdk_no_wait - def guestconfig_guest_configuration_assignment_list(client, resource_group_name, @@ -29,82 +26,6 @@ def guestconfig_guest_configuration_assignment_show(client, vm_name=vm_name) -def guestconfig_guest_configuration_assignment_create(client, - guest_configuration_assignment_name, - resource_group_name, - vm_name, - name=None, - location=None, - context=None, - latest_assignment_report_assignment=None, - guest_configuration_name=None, - guest_configuration_version=None, - guest_configuration_configuration_parameter=None, - guest_configuration_configuration_setting=None, - no_wait=False): - if isinstance(latest_assignment_report_assignment, str): - latest_assignment_report_assignment = json.loads(latest_assignment_report_assignment) - return sdk_no_wait(no_wait, - client.begin_create_or_update, - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - vm_name=vm_name, - name=name, - location=location, - context=context, - assignment=latest_assignment_report_assignment, - vm=json.loads("{}"), - resources="{}", - guest_configuration_navigation_name=guest_configuration_name, - version=guest_configuration_version, - configuration_parameter=guest_configuration_configuration_parameter, - configuration_setting=guest_configuration_configuration_setting) - - -def guestconfig_guest_configuration_assignment_update(client, - guest_configuration_assignment_name, - resource_group_name, - vm_name, - name=None, - location=None, - context=None, - latest_assignment_report_assignment=None, - guest_configuration_name=None, - guest_configuration_version=None, - guest_configuration_configuration_parameter=None, - guest_configuration_configuration_setting=None, - no_wait=False): - if isinstance(latest_assignment_report_assignment, str): - latest_assignment_report_assignment = json.loads(latest_assignment_report_assignment) - return sdk_no_wait(no_wait, - client.begin_create_or_update, - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - vm_name=vm_name, - name=name, - location=location, - context=context, - assignment=latest_assignment_report_assignment, - vm=json.loads("{}"), - resources="{}", - guest_configuration_navigation_name=guest_configuration_name, - version=guest_configuration_version, - configuration_parameter=guest_configuration_configuration_parameter, - configuration_setting=guest_configuration_configuration_setting) - - -def guestconfig_guest_configuration_assignment_delete(client, - resource_group_name, - guest_configuration_assignment_name, - vm_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - guest_configuration_assignment_name=guest_configuration_assignment_name, - vm_name=vm_name) - - def guestconfig_guest_configuration_assignment_report_list(client, resource_group_name, guest_configuration_assignment_name, @@ -141,82 +62,6 @@ def guestconfig_guest_configuration_hcrp_assignment_show(client, machine_name=machine_name) -def guestconfig_guest_configuration_hcrp_assignment_create(client, - guest_configuration_assignment_name, - resource_group_name, - machine_name, - name=None, - location=None, - context=None, - latest_assignment_report_assignment=None, - guest_configuration_name=None, - guest_configuration_version=None, - guest_configuration_configuration_parameter=None, - guest_configuration_configuration_setting=None, - no_wait=False): - if isinstance(latest_assignment_report_assignment, str): - latest_assignment_report_assignment = json.loads(latest_assignment_report_assignment) - return sdk_no_wait(no_wait, - client.begin_create_or_update, - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - machine_name=machine_name, - name=name, - location=location, - context=context, - assignment=latest_assignment_report_assignment, - vm=json.loads("{}"), - resources="{}", - guest_configuration_navigation_name=guest_configuration_name, - version=guest_configuration_version, - configuration_parameter=guest_configuration_configuration_parameter, - configuration_setting=guest_configuration_configuration_setting) - - -def guestconfig_guest_configuration_hcrp_assignment_update(client, - guest_configuration_assignment_name, - resource_group_name, - machine_name, - name=None, - location=None, - context=None, - latest_assignment_report_assignment=None, - guest_configuration_name=None, - guest_configuration_version=None, - guest_configuration_configuration_parameter=None, - guest_configuration_configuration_setting=None, - no_wait=False): - if isinstance(latest_assignment_report_assignment, str): - latest_assignment_report_assignment = json.loads(latest_assignment_report_assignment) - return sdk_no_wait(no_wait, - client.begin_create_or_update, - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - machine_name=machine_name, - name=name, - location=location, - context=context, - assignment=latest_assignment_report_assignment, - vm=json.loads("{}"), - resources="{}", - guest_configuration_navigation_name=guest_configuration_name, - version=guest_configuration_version, - configuration_parameter=guest_configuration_configuration_parameter, - configuration_setting=guest_configuration_configuration_setting) - - -def guestconfig_guest_configuration_hcrp_assignment_delete(client, - resource_group_name, - guest_configuration_assignment_name, - machine_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - guest_configuration_assignment_name=guest_configuration_assignment_name, - machine_name=machine_name) - - def guestconfig_guest_configuration_hcrp_assignment_report_list(client, resource_group_name, guest_configuration_assignment_name, diff --git a/src/guestconfig/azext_guestconfig/tests/__init__.py b/src/guestconfig/azext_guestconfig/tests/__init__.py index 9b7ec942a0b..50e0627daff 100644 --- a/src/guestconfig/azext_guestconfig/tests/__init__.py +++ b/src/guestconfig/azext_guestconfig/tests/__init__.py @@ -9,15 +9,23 @@ # regenerated. # -------------------------------------------------------------------------- import inspect +import logging import os import sys import traceback +import datetime as dt + from azure.core.exceptions import AzureError from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) __path__ = __import__('pkgutil').extend_path(__path__, __name__) exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" def try_manual(func): @@ -39,29 +47,64 @@ def get_func_to_call(): func_to_call = func try: func_to_call = import_manual_function(func) - print("Found manual override for {}(...)".format(func.__name__)) + func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) except (ImportError, AttributeError): pass return func_to_call def wrapper(*args, **kwargs): func_to_call = get_func_to_call() - print("running {}()...".format(func.__name__)) + logger.info("running %s()...", func.__name__) try: - return func_to_call(*args, **kwargs) - except (AssertionError, AzureError, CliTestError, CliExecutionError, JMESPathCheckAssertionError) as e: - print("--------------------------------------") - print("step exception: ", e) - print("--------------------------------------", file=sys.stderr) - print("step exception in {}: {}".format(func.__name__, e), file=sys.stderr) - traceback.print_exc() + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret if inspect.isclass(func): return get_func_to_call() return wrapper +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + def raise_if(): if exceptions: if len(exceptions) <= 1: diff --git a/src/guestconfig/azext_guestconfig/tests/latest/test_guestconfig_scenario.py b/src/guestconfig/azext_guestconfig/tests/latest/test_guestconfig_scenario.py index 08b8dd07608..7d3eccb0eb5 100644 --- a/src/guestconfig/azext_guestconfig/tests/latest/test_guestconfig_scenario.py +++ b/src/guestconfig/azext_guestconfig/tests/latest/test_guestconfig_scenario.py @@ -11,13 +11,14 @@ import os from azure.cli.testsdk import ScenarioTest -from .. import try_manual, raise_if +from .. import try_manual, raise_if, calc_coverage from azure.cli.testsdk import ResourceGroupPreparer TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) +# Env setup @try_manual def setup(test, rg): pass @@ -25,120 +26,116 @@ def setup(test, rg): # EXAMPLE: /GuestConfigurationAssignments/get/Get a guest configuration assignment @try_manual -def step__guestconfigurationassignments_get_get_a_guest_configuration_assignment(test, rg): +def step__guestconfigurationassignments_get(test, rg): test.cmd('az guestconfig guest-configuration-assignment show ' - '--name "{GuestConfigurationAssignments}" ' - '--resource-group "{RGroup}" ' - '--vm-name "{VMName}"', + '--name "{myGuestConfigurationAssignment}" ' + '--resource-group "{rg}" ' + '--vm-name "myVMName"', checks=[]) # EXAMPLE: /GuestConfigurationAssignments/get/List all guest configuration assignments for a virtual machine @try_manual -def step__guestconfigurationassignments_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg): +def step__guestconfigurationassignments_get2(test, rg): test.cmd('az guestconfig guest-configuration-assignment list ' - '--resource-group "{RGroup}" ' - '--vm-name "{VMName}"', + '--resource-group "{rg}" ' + '--vm-name "myVMName"', checks=[]) # EXAMPLE: /GuestConfigurationAssignmentReports/get/Get a guest configuration assignment report by Id for a virtual machine @try_manual -def step__guestconfigurationassignmentreports_get_get_a_guest_configuration_assignment_report_by_id_for_a_virtual_machine(test, rg): +def step__guestconfigurationassignmentreports_get(test, rg): test.cmd('az guestconfig guest-configuration-assignment-report show ' - '--guest-configuration-assignment-name "{GuestConfigurationAssignments}" ' - '--report-id "{GuestConfigurationReportId}" ' - '--resource-group "{RGroup}" ' - '--vm-name "{VMName}"', + '--guest-configuration-assignment-name "{myGuestConfigurationAssignment2}" ' + '--report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" ' + '--resource-group "{rg}" ' + '--vm-name "myvm"', checks=[]) # EXAMPLE: /GuestConfigurationAssignmentReports/get/List all guest configuration assignments for a virtual machine @try_manual -def step__guestconfigurationassignmentreports_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg): +def step__guestconfigurationassignmentreports_get2(test, rg): test.cmd('az guestconfig guest-configuration-assignment-report list ' - '--guest-configuration-assignment-name "{GuestConfigurationAssignments}" ' - '--resource-group "{RGroup}" ' - '--vm-name "{VMName}"', + '--guest-configuration-assignment-name "{myGuestConfigurationAssignment2}" ' + '--resource-group "{rg}" ' + '--vm-name "myVMName"', checks=[]) # EXAMPLE: /GuestConfigurationHCRPAssignmentReports/get/Get a guest configuration assignment report by Id for a virtual machine @try_manual -def step__guestconfigurationhcrpassignmentreports_get_get_a_guest_configuration_assignment_report_by_id_for_a_virtual_machine(test, rg): +def step__guestconfigurationhcrpassignmentreports_get(test, rg): test.cmd('az guestconfig guest-configuration-hcrp-assignment-report show ' - '--guest-configuration-assignment-name "{HybridGuestConfigurationAssignments}" ' - '--machine-name "{HybridMName}" ' - '--report-id "{HybridGuestConfigurationReportId}" ' - '--resource-group "{HybridRGroup}"', + '--guest-configuration-assignment-name "{myGuestConfigurationAssignment2}" ' + '--machine-name "myMachineName" ' + '--report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" ' + '--resource-group "{rg}"', checks=[]) # EXAMPLE: /GuestConfigurationHCRPAssignmentReports/get/List all guest configuration assignments for a virtual machine @try_manual -def step__guestconfigurationhcrpassignmentreports_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg): +def step__guestconfigurationhcrpassignmentreports_get2(test, rg): test.cmd('az guestconfig guest-configuration-hcrp-assignment-report list ' - '--guest-configuration-assignment-name "{HybridGuestConfigurationAssignments}" ' - '--machine-name "{HybridMName}" ' - '--resource-group "{HybridRGroup}"', + '--guest-configuration-assignment-name "{myGuestConfigurationAssignment2}" ' + '--machine-name "myMachineName" ' + '--resource-group "{rg}"', checks=[]) # EXAMPLE: /GuestConfigurationHCRPAssignments/get/Get a guest configuration assignment @try_manual -def step__guestconfigurationhcrpassignments_get_get_a_guest_configuration_assignment(test, rg): +def step__guestconfigurationhcrpassignments_get(test, rg): test.cmd('az guestconfig guest-configuration-hcrp-assignment show ' - '--guest-configuration-assignment-name "{HybridGuestConfigurationAssignments}" ' - '--machine-name "{HybridMName}" ' - '--resource-group "{HybridRGroup}"', + '--guest-configuration-assignment-name "{myGuestConfigurationAssignment}" ' + '--machine-name "myMachineName" ' + '--resource-group "{rg}"', checks=[]) # EXAMPLE: /GuestConfigurationHCRPAssignments/get/List all guest configuration assignments for a virtual machine @try_manual -def step__guestconfigurationhcrpassignments_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg): +def step__guestconfigurationhcrpassignments_get2(test, rg): test.cmd('az guestconfig guest-configuration-hcrp-assignment list ' - '--machine-name "{HybridMName}" ' - '--resource-group "{HybridRGroup}"', + '--machine-name "myMachineName" ' + '--resource-group "{rg}"', checks=[]) +# Env cleanup @try_manual def cleanup(test, rg): pass +# Testcase @try_manual def call_scenario(test, rg): setup(test, rg) - step__guestconfigurationassignments_get_get_a_guest_configuration_assignment(test, rg) - step__guestconfigurationassignments_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg) - step__guestconfigurationassignmentreports_get_get_a_guest_configuration_assignment_report_by_id_for_a_virtual_machine(test, rg) - step__guestconfigurationassignmentreports_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg) - step__guestconfigurationhcrpassignmentreports_get_get_a_guest_configuration_assignment_report_by_id_for_a_virtual_machine(test, rg) - step__guestconfigurationhcrpassignmentreports_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg) - step__guestconfigurationhcrpassignments_get_get_a_guest_configuration_assignment(test, rg) - step__guestconfigurationhcrpassignments_get_list_all_guest_configuration_assignments_for_a_virtual_machine(test, rg) + step__guestconfigurationassignments_get(test, rg) + step__guestconfigurationassignments_get2(test, rg) + step__guestconfigurationassignmentreports_get(test, rg) + step__guestconfigurationassignmentreports_get2(test, rg) + step__guestconfigurationhcrpassignmentreports_get(test, rg) + step__guestconfigurationhcrpassignmentreports_get2(test, rg) + step__guestconfigurationhcrpassignments_get(test, rg) + step__guestconfigurationhcrpassignments_get2(test, rg) cleanup(test, rg) @try_manual class GuestConfigurationClientScenarioTest(ScenarioTest): - @ResourceGroupPreparer(name_prefix='geTestResourceGroup002', key='rg', parameter_name='rg') + @ResourceGroupPreparer(name_prefix='clitestguestconfig_myResourceGroupName'[:7], key='rg', parameter_name='rg') def test_guestconfig(self, rg): self.kwargs.update({ - 'WhitelistedApplication': 'WhitelistedApplication', - 'RGroup': 'geTestResourceGroup002', - 'VMName': 'geubuntu18.04-20200722', - 'GuestConfigurationAssignments': 'linux-password-baseline', - 'GuestConfigurationReportId': '8ed6b155-3627-41ee-a96c-bcb9b026eec0', - 'HybridRGroup': 'geTestResourceGroup002', - 'HybridMName': 'MSFT-LMR', - 'HybridGuestConfigurationAssignments': 'WindowsTimeZone', - 'HybridGuestConfigurationReportId': '2ecfc027-3dfa-4146-9d33-dee3cb5c7c94', + 'myGuestConfigurationAssignment': 'SecureProtocol', + 'myGuestConfigurationAssignment2': 'AuditSecureProtocol', }) call_scenario(self, rg) + calc_coverage(__file__) raise_if() diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/__init__.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/__init__.py index 244b40bca5f..775ab0d2f63 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/__init__.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/__init__.py @@ -10,7 +10,7 @@ __all__ = ['GuestConfigurationClient'] try: - from ._patch import patch_sdk + from ._patch import patch_sdk # type: ignore patch_sdk() except ImportError: pass diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/_configuration.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/_configuration.py index 390a7843411..c1cc0ec8da1 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/_configuration.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/_configuration.py @@ -10,6 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -47,8 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2020-06-25" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'guestconfigurationclient/{}'.format(VERSION)) self._configure(**kwargs) @@ -61,6 +61,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/__init__.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/__init__.py index 08acaef4f72..87d64022a9d 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/__init__.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/__init__.py @@ -6,5 +6,5 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._guest_configuration_client_async import GuestConfigurationClient +from ._guest_configuration_client import GuestConfigurationClient __all__ = ['GuestConfigurationClient'] diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_configuration_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_configuration.py similarity index 91% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_configuration_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_configuration.py index 3fdd386f998..1a313b9e281 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_configuration_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_configuration.py @@ -10,6 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -44,8 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.api_version = "2020-06-25" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'guestconfigurationclient/{}'.format(VERSION)) self._configure(**kwargs) @@ -57,6 +57,7 @@ def _configure( self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_guest_configuration_client_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_guest_configuration_client.py similarity index 84% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_guest_configuration_client_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_guest_configuration_client.py index ee72ec68393..f67095186f3 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_guest_configuration_client_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/_guest_configuration_client.py @@ -15,12 +15,12 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration_async import GuestConfigurationClientConfiguration -from .operations_async import GuestConfigurationAssignmentOperations -from .operations_async import GuestConfigurationAssignmentReportOperations -from .operations_async import GuestConfigurationHcrpAssignmentOperations -from .operations_async import GuestConfigurationHcrpAssignmentReportOperations -from .operations_async import OperationOperations +from ._configuration import GuestConfigurationClientConfiguration +from .operations import GuestConfigurationAssignmentOperations +from .operations import GuestConfigurationAssignmentReportOperations +from .operations import GuestConfigurationHcrpAssignmentOperations +from .operations import GuestConfigurationHcrpAssignmentReportOperations +from .operations import OperationOperations from .. import models @@ -28,15 +28,15 @@ class GuestConfigurationClient(object): """Guest Configuration Client. :ivar guest_configuration_assignment: GuestConfigurationAssignmentOperations operations - :vartype guest_configuration_assignment: guest_configuration_client.aio.operations_async.GuestConfigurationAssignmentOperations + :vartype guest_configuration_assignment: guest_configuration_client.aio.operations.GuestConfigurationAssignmentOperations :ivar guest_configuration_assignment_report: GuestConfigurationAssignmentReportOperations operations - :vartype guest_configuration_assignment_report: guest_configuration_client.aio.operations_async.GuestConfigurationAssignmentReportOperations + :vartype guest_configuration_assignment_report: guest_configuration_client.aio.operations.GuestConfigurationAssignmentReportOperations :ivar guest_configuration_hcrp_assignment: GuestConfigurationHcrpAssignmentOperations operations - :vartype guest_configuration_hcrp_assignment: guest_configuration_client.aio.operations_async.GuestConfigurationHcrpAssignmentOperations + :vartype guest_configuration_hcrp_assignment: guest_configuration_client.aio.operations.GuestConfigurationHcrpAssignmentOperations :ivar guest_configuration_hcrp_assignment_report: GuestConfigurationHcrpAssignmentReportOperations operations - :vartype guest_configuration_hcrp_assignment_report: guest_configuration_client.aio.operations_async.GuestConfigurationHcrpAssignmentReportOperations + :vartype guest_configuration_hcrp_assignment_report: guest_configuration_client.aio.operations.GuestConfigurationHcrpAssignmentReportOperations :ivar operation: OperationOperations operations - :vartype operation: guest_configuration_client.aio.operations_async.OperationOperations + :vartype operation: guest_configuration_client.aio.operations.OperationOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/__init__.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/__init__.py similarity index 58% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/__init__.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/__init__.py index adf59f69e07..50d30bbc553 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/__init__.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/__init__.py @@ -6,11 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._guest_configuration_assignment_operations_async import GuestConfigurationAssignmentOperations -from ._guest_configuration_assignment_report_operations_async import GuestConfigurationAssignmentReportOperations -from ._guest_configuration_hcrp_assignment_operations_async import GuestConfigurationHcrpAssignmentOperations -from ._guest_configuration_hcrp_assignment_report_operations_async import GuestConfigurationHcrpAssignmentReportOperations -from ._operation_operations_async import OperationOperations +from ._guest_configuration_assignment_operations import GuestConfigurationAssignmentOperations +from ._guest_configuration_assignment_report_operations import GuestConfigurationAssignmentReportOperations +from ._guest_configuration_hcrp_assignment_operations import GuestConfigurationHcrpAssignmentOperations +from ._guest_configuration_hcrp_assignment_report_operations import GuestConfigurationHcrpAssignmentReportOperations +from ._operation_operations import OperationOperations __all__ = [ 'GuestConfigurationAssignmentOperations', diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_assignment_operations_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_assignment_operations.py similarity index 74% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_assignment_operations_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_assignment_operations.py index b1dfe1d24db..75b01631b96 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_assignment_operations_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_assignment_operations.py @@ -9,10 +9,10 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -54,19 +54,22 @@ async def _create_or_update_initial( assignment: Optional["models.AssignmentInfo"] = None, vm: Optional["models.VmInfo"] = None, resources: Optional[List["models.AssignmentReportResource"]] = None, - guest_configuration_navigation_name: Optional[str] = None, + kind: Optional[Union[str, "models.Kind"]] = None, version: Optional[str] = None, configuration_parameter: Optional[List["models.ConfigurationParameter"]] = None, configuration_setting: Optional["models.ConfigurationSetting"] = None, **kwargs ) -> "models.GuestConfigurationAssignment": cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - _parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, name_properties_guest_configuration_name=guest_configuration_navigation_name, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) + parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, kind=kind, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) api_version = "2020-06-25" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -85,14 +88,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'GuestConfigurationAssignment') + body_content = self._serialize.body(parameters, 'GuestConfigurationAssignment') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,7 +102,6 @@ async def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -114,7 +114,7 @@ async def _create_or_update_initial( return deserialized _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore - async def create_or_update( + async def begin_create_or_update( self, guest_configuration_assignment_name: str, resource_group_name: str, @@ -125,12 +125,12 @@ async def create_or_update( assignment: Optional["models.AssignmentInfo"] = None, vm: Optional["models.VmInfo"] = None, resources: Optional[List["models.AssignmentReportResource"]] = None, - guest_configuration_navigation_name: Optional[str] = None, + kind: Optional[Union[str, "models.Kind"]] = None, version: Optional[str] = None, configuration_parameter: Optional[List["models.ConfigurationParameter"]] = None, configuration_setting: Optional["models.ConfigurationSetting"] = None, **kwargs - ) -> "models.GuestConfigurationAssignment": + ) -> AsyncLROPoller["models.GuestConfigurationAssignment"]: """Creates an association between a VM and guest configuration. :param guest_configuration_assignment_name: Name of the guest configuration assignment. @@ -144,17 +144,17 @@ async def create_or_update( :param location: Region where the VM is located. :type location: str :param context: The source which initiated the guest configuration assignment. Ex: Azure - Policy. + Policy. :type context: str :param assignment: Configuration details of the guest configuration assignment. :type assignment: ~guest_configuration_client.models.AssignmentInfo :param vm: Information about the VM. :type vm: ~guest_configuration_client.models.VmInfo :param resources: The list of resources for which guest configuration assignment compliance is - checked. + checked. :type resources: list[~guest_configuration_client.models.AssignmentReportResource] - :param guest_configuration_navigation_name: Name of the guest configuration. - :type guest_configuration_navigation_name: str + :param kind: Kind of the guest configuration. For example:DSC. + :type kind: str or ~guest_configuration_client.models.Kind :param version: Version of the guest configuration. :type version: str :param configuration_parameter: The configuration parameters for the guest configuration. @@ -162,12 +162,13 @@ async def create_or_update( :param configuration_setting: The configuration setting for the guest configuration. :type configuration_setting: ~guest_configuration_client.models.ConfigurationSetting :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GuestConfigurationAssignment, or the result of cls(response) - :rtype: ~guest_configuration_client.models.GuestConfigurationAssignment + :return: An instance of AsyncLROPoller that returns either GuestConfigurationAssignment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~guest_configuration_client.models.GuestConfigurationAssignment] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -176,23 +177,25 @@ async def create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = await self._create_or_update_initial( - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - vm_name=vm_name, - name=name, - location=location, - context=context, - assignment=assignment, - vm=vm, - resources=resources, - guest_configuration_navigation_name=guest_configuration_navigation_name, - version=version, - configuration_parameter=configuration_parameter, - configuration_setting=configuration_setting, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + guest_configuration_assignment_name=guest_configuration_assignment_name, + resource_group_name=resource_group_name, + vm_name=vm_name, + name=name, + location=location, + context=context, + assignment=assignment, + vm=vm, + resources=resources, + kind=kind, + version=version, + configuration_parameter=configuration_parameter, + configuration_setting=configuration_setting, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -204,11 +207,26 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore async def get( self, @@ -231,9 +249,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -251,9 +272,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -279,9 +299,12 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -299,8 +322,8 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,13 +338,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore - async def delete( + async def begin_delete( self, resource_group_name: str, guest_configuration_assignment_name: str, vm_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Delete a guest configuration assignment. :param resource_group_name: The resource group name. @@ -331,12 +354,13 @@ async def delete( :param vm_name: The name of the virtual machine. :type vm_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -345,13 +369,15 @@ async def delete( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - guest_configuration_assignment_name=guest_configuration_assignment_name, - vm_name=vm_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -360,11 +386,26 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore def list( self, @@ -384,11 +425,18 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -402,15 +450,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_assignment_report_operations_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_assignment_report_operations.py similarity index 92% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_assignment_report_operations_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_assignment_report_operations.py index 4125b128698..fab0c27a83f 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_assignment_report_operations_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_assignment_report_operations.py @@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -61,9 +61,12 @@ async def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReportList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.list.metadata['url'] # type: ignore @@ -81,9 +84,8 @@ async def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -125,9 +127,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReport"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -146,9 +151,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_hcrp_assignment_operations_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_operations.py similarity index 74% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_hcrp_assignment_operations_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_operations.py index 2a36f329963..e192d42c033 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_hcrp_assignment_operations_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_operations.py @@ -9,10 +9,10 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -54,19 +54,22 @@ async def _create_or_update_initial( assignment: Optional["models.AssignmentInfo"] = None, vm: Optional["models.VmInfo"] = None, resources: Optional[List["models.AssignmentReportResource"]] = None, - guest_configuration_navigation_name: Optional[str] = None, + kind: Optional[Union[str, "models.Kind"]] = None, version: Optional[str] = None, configuration_parameter: Optional[List["models.ConfigurationParameter"]] = None, configuration_setting: Optional["models.ConfigurationSetting"] = None, **kwargs ) -> "models.GuestConfigurationAssignment": cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - _parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, name_properties_guest_configuration_name=guest_configuration_navigation_name, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) + parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, kind=kind, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) api_version = "2020-06-25" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -85,14 +88,12 @@ async def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'GuestConfigurationAssignment') + body_content = self._serialize.body(parameters, 'GuestConfigurationAssignment') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,7 +102,6 @@ async def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -114,7 +114,7 @@ async def _create_or_update_initial( return deserialized _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore - async def create_or_update( + async def begin_create_or_update( self, guest_configuration_assignment_name: str, resource_group_name: str, @@ -125,12 +125,12 @@ async def create_or_update( assignment: Optional["models.AssignmentInfo"] = None, vm: Optional["models.VmInfo"] = None, resources: Optional[List["models.AssignmentReportResource"]] = None, - guest_configuration_navigation_name: Optional[str] = None, + kind: Optional[Union[str, "models.Kind"]] = None, version: Optional[str] = None, configuration_parameter: Optional[List["models.ConfigurationParameter"]] = None, configuration_setting: Optional["models.ConfigurationSetting"] = None, **kwargs - ) -> "models.GuestConfigurationAssignment": + ) -> AsyncLROPoller["models.GuestConfigurationAssignment"]: """Creates an association between a ARC machine and guest configuration. :param guest_configuration_assignment_name: Name of the guest configuration assignment. @@ -144,17 +144,17 @@ async def create_or_update( :param location: Region where the VM is located. :type location: str :param context: The source which initiated the guest configuration assignment. Ex: Azure - Policy. + Policy. :type context: str :param assignment: Configuration details of the guest configuration assignment. :type assignment: ~guest_configuration_client.models.AssignmentInfo :param vm: Information about the VM. :type vm: ~guest_configuration_client.models.VmInfo :param resources: The list of resources for which guest configuration assignment compliance is - checked. + checked. :type resources: list[~guest_configuration_client.models.AssignmentReportResource] - :param guest_configuration_navigation_name: Name of the guest configuration. - :type guest_configuration_navigation_name: str + :param kind: Kind of the guest configuration. For example:DSC. + :type kind: str or ~guest_configuration_client.models.Kind :param version: Version of the guest configuration. :type version: str :param configuration_parameter: The configuration parameters for the guest configuration. @@ -162,12 +162,13 @@ async def create_or_update( :param configuration_setting: The configuration setting for the guest configuration. :type configuration_setting: ~guest_configuration_client.models.ConfigurationSetting :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: GuestConfigurationAssignment, or the result of cls(response) - :rtype: ~guest_configuration_client.models.GuestConfigurationAssignment + :return: An instance of AsyncLROPoller that returns either GuestConfigurationAssignment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~guest_configuration_client.models.GuestConfigurationAssignment] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -176,23 +177,25 @@ async def create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = await self._create_or_update_initial( - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - machine_name=machine_name, - name=name, - location=location, - context=context, - assignment=assignment, - vm=vm, - resources=resources, - guest_configuration_navigation_name=guest_configuration_navigation_name, - version=version, - configuration_parameter=configuration_parameter, - configuration_setting=configuration_setting, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + guest_configuration_assignment_name=guest_configuration_assignment_name, + resource_group_name=resource_group_name, + machine_name=machine_name, + name=name, + location=location, + context=context, + assignment=assignment, + vm=vm, + resources=resources, + kind=kind, + version=version, + configuration_parameter=configuration_parameter, + configuration_setting=configuration_setting, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -204,11 +207,26 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'machineName': self._serialize.url("machine_name", machine_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore async def get( self, @@ -231,9 +249,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -251,9 +272,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -279,9 +299,12 @@ async def _delete_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -299,8 +322,8 @@ async def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,13 +338,13 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore - async def delete( + async def begin_delete( self, resource_group_name: str, guest_configuration_assignment_name: str, machine_name: str, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Delete a guest configuration assignment. :param resource_group_name: The resource group name. @@ -331,12 +354,13 @@ async def delete( :param machine_name: The name of the ARC machine. :type machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -345,13 +369,15 @@ async def delete( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - guest_configuration_assignment_name=guest_configuration_assignment_name, - machine_name=machine_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + machine_name=machine_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -360,11 +386,26 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'machineName': self._serialize.url("machine_name", machine_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore def list( self, @@ -384,11 +425,18 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -402,15 +450,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_hcrp_assignment_report_operations_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_report_operations.py similarity index 92% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_hcrp_assignment_report_operations_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_report_operations.py index 52830d15b2c..3e6ece67f44 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_guest_configuration_hcrp_assignment_report_operations_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_guest_configuration_hcrp_assignment_report_operations.py @@ -8,7 +8,7 @@ from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -61,9 +61,12 @@ async def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReportList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.list.metadata['url'] # type: ignore @@ -81,9 +84,8 @@ async def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -125,9 +127,12 @@ async def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReport"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -146,9 +151,8 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_operation_operations_async.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_operation_operations.py similarity index 88% rename from src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_operation_operations_async.py rename to src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_operation_operations.py index 24d15812a84..cca7e1005ef 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations_async/_operation_operations_async.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/aio/operations/_operation_operations.py @@ -9,7 +9,7 @@ import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat @@ -53,11 +53,18 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -65,15 +72,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/__init__.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/__init__.py index f3f8114101f..f187ed8051f 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/__init__.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/__init__.py @@ -54,6 +54,7 @@ AllowModuleOverwrite, ComplianceStatus, ConfigurationMode, + Kind, ProvisioningState, RebootIfNeeded, Type, @@ -84,6 +85,7 @@ 'AllowModuleOverwrite', 'ComplianceStatus', 'ConfigurationMode', + 'Kind', 'ProvisioningState', 'RebootIfNeeded', 'Type', diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_guest_configuration_client_enums.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_guest_configuration_client_enums.py index 420bd0f0510..0d9d6681cfd 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_guest_configuration_client_enums.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_guest_configuration_client_enums.py @@ -6,51 +6,75 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass -class ActionAfterReboot(str, Enum): +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ActionAfterReboot(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration """ - continue_configuration = "ContinueConfiguration" - stop_configuration = "StopConfiguration" + CONTINUE_CONFIGURATION = "ContinueConfiguration" + STOP_CONFIGURATION = "StopConfiguration" -class AllowModuleOverwrite(str, Enum): +class AllowModuleOverwrite(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """If true - new configurations downloaded from the pull service are allowed to overwrite the old ones on the target node. Otherwise, false """ - true = "True" - false = "False" + TRUE = "True" + FALSE = "False" -class ComplianceStatus(str, Enum): +class ComplianceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """A value indicating compliance status of the machine for the assigned guest configuration. """ - compliant = "Compliant" - non_compliant = "NonCompliant" - pending = "Pending" + COMPLIANT = "Compliant" + NON_COMPLIANT = "NonCompliant" + PENDING = "Pending" -class ConfigurationMode(str, Enum): +class ConfigurationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Specifies how the LCM(Local Configuration Manager) actually applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. """ - apply_only = "ApplyOnly" - apply_and_monitor = "ApplyAndMonitor" - apply_and_auto_correct = "ApplyAndAutoCorrect" + APPLY_ONLY = "ApplyOnly" + APPLY_AND_MONITOR = "ApplyAndMonitor" + APPLY_AND_AUTO_CORRECT = "ApplyAndAutoCorrect" + +class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Kind of the guest configuration. For example:DSC + """ + + DSC = "DSC" -class ProvisioningState(str, Enum): +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state, which only appears in the response. """ - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" - created = "Created" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATED = "Created" -class RebootIfNeeded(str, Enum): +class RebootIfNeeded(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Set this to true to automatically reboot the node after a configuration that requires reboot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The default value is false. To use this setting when a reboot condition is enacted @@ -58,12 +82,12 @@ class RebootIfNeeded(str, Enum): xPendingReboot module. """ - true = "True" - false = "False" + TRUE = "True" + FALSE = "False" -class Type(str, Enum): +class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of report, Consistency or Initial """ - consistency = "Consistency" - initial = "Initial" + CONSISTENCY = "Consistency" + INITIAL = "Initial" diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models.py index f9575199fc8..d18b0b9890f 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models.py @@ -101,6 +101,8 @@ class AssignmentReportResource(msrest.serialization.Model): :ivar compliance_status: A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". :vartype compliance_status: str or ~guest_configuration_client.models.ComplianceStatus + :ivar resource_id: Name of the guest configuration assignment resource setting. + :vartype resource_id: str :param reasons: Compliance reason and reason code for a resource. :type reasons: list[~guest_configuration_client.models.AssignmentReportResourceComplianceReason] @@ -110,11 +112,13 @@ class AssignmentReportResource(msrest.serialization.Model): _validation = { 'compliance_status': {'readonly': True}, + 'resource_id': {'readonly': True}, 'properties': {'readonly': True}, } _attribute_map = { 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'reasons': {'key': 'reasons', 'type': '[AssignmentReportResourceComplianceReason]'}, 'properties': {'key': 'properties', 'type': 'object'}, } @@ -125,6 +129,7 @@ def __init__( ): super(AssignmentReportResource, self).__init__(**kwargs) self.compliance_status = None + self.resource_id = None self.reasons = kwargs.get('reasons', None) self.properties = None @@ -406,8 +411,8 @@ class GuestConfigurationAssignment(Resource): :param resources: The list of resources for which guest configuration assignment compliance is checked. :type resources: list[~guest_configuration_client.models.AssignmentReportResource] - :ivar kind: Kind of the guest configuration. For example:DSC. Default value: "DSC". - :vartype kind: str + :param kind: Kind of the guest configuration. For example:DSC. Possible values include: "DSC". + :type kind: str or ~guest_configuration_client.models.Kind :param name_properties_guest_configuration_name: Name of the guest configuration. :type name_properties_guest_configuration_name: str :param version: Version of the guest configuration. @@ -438,7 +443,6 @@ class GuestConfigurationAssignment(Resource): 'end_time': {'readonly': True}, 'compliance_status_properties_latest_assignment_report_compliance_status': {'readonly': True}, 'operation_type': {'readonly': True}, - 'kind': {'constant': True}, 'content_uri': {'readonly': True}, 'content_hash': {'readonly': True}, } @@ -473,8 +477,6 @@ class GuestConfigurationAssignment(Resource): 'configuration_setting': {'key': 'properties.guestConfiguration.configurationSetting', 'type': 'ConfigurationSetting'}, } - kind = "DSC" - def __init__( self, **kwargs @@ -496,6 +498,7 @@ def __init__( self.compliance_status_properties_latest_assignment_report_compliance_status = None self.operation_type = None self.resources = kwargs.get('resources', None) + self.kind = kwargs.get('kind', None) self.name_properties_guest_configuration_name = kwargs.get('name_properties_guest_configuration_name', None) self.version = kwargs.get('version', None) self.content_uri = None diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models_py3.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models_py3.py index 691af6ca03a..fc8424f39c1 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models_py3.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models_py3.py @@ -109,6 +109,8 @@ class AssignmentReportResource(msrest.serialization.Model): :ivar compliance_status: A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: "Compliant", "NonCompliant", "Pending". :vartype compliance_status: str or ~guest_configuration_client.models.ComplianceStatus + :ivar resource_id: Name of the guest configuration assignment resource setting. + :vartype resource_id: str :param reasons: Compliance reason and reason code for a resource. :type reasons: list[~guest_configuration_client.models.AssignmentReportResourceComplianceReason] @@ -118,11 +120,13 @@ class AssignmentReportResource(msrest.serialization.Model): _validation = { 'compliance_status': {'readonly': True}, + 'resource_id': {'readonly': True}, 'properties': {'readonly': True}, } _attribute_map = { 'compliance_status': {'key': 'complianceStatus', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, 'reasons': {'key': 'reasons', 'type': '[AssignmentReportResourceComplianceReason]'}, 'properties': {'key': 'properties', 'type': 'object'}, } @@ -135,6 +139,7 @@ def __init__( ): super(AssignmentReportResource, self).__init__(**kwargs) self.compliance_status = None + self.resource_id = None self.reasons = reasons self.properties = None @@ -434,8 +439,8 @@ class GuestConfigurationAssignment(Resource): :param resources: The list of resources for which guest configuration assignment compliance is checked. :type resources: list[~guest_configuration_client.models.AssignmentReportResource] - :ivar kind: Kind of the guest configuration. For example:DSC. Default value: "DSC". - :vartype kind: str + :param kind: Kind of the guest configuration. For example:DSC. Possible values include: "DSC". + :type kind: str or ~guest_configuration_client.models.Kind :param name_properties_guest_configuration_name: Name of the guest configuration. :type name_properties_guest_configuration_name: str :param version: Version of the guest configuration. @@ -466,7 +471,6 @@ class GuestConfigurationAssignment(Resource): 'end_time': {'readonly': True}, 'compliance_status_properties_latest_assignment_report_compliance_status': {'readonly': True}, 'operation_type': {'readonly': True}, - 'kind': {'constant': True}, 'content_uri': {'readonly': True}, 'content_hash': {'readonly': True}, } @@ -501,8 +505,6 @@ class GuestConfigurationAssignment(Resource): 'configuration_setting': {'key': 'properties.guestConfiguration.configurationSetting', 'type': 'ConfigurationSetting'}, } - kind = "DSC" - def __init__( self, *, @@ -512,6 +514,7 @@ def __init__( assignment: Optional["AssignmentInfo"] = None, vm: Optional["VmInfo"] = None, resources: Optional[List["AssignmentReportResource"]] = None, + kind: Optional[Union[str, "Kind"]] = None, name_properties_guest_configuration_name: Optional[str] = None, version: Optional[str] = None, configuration_parameter: Optional[List["ConfigurationParameter"]] = None, @@ -535,6 +538,7 @@ def __init__( self.compliance_status_properties_latest_assignment_report_compliance_status = None self.operation_type = None self.resources = resources + self.kind = kind self.name_properties_guest_configuration_name = name_properties_guest_configuration_name self.version = version self.content_uri = None diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_operations.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_operations.py index 7304258b910..81e3b853ee0 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_operations.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -58,7 +58,7 @@ def _create_or_update_initial( assignment=None, # type: Optional["models.AssignmentInfo"] vm=None, # type: Optional["models.VmInfo"] resources=None, # type: Optional[List["models.AssignmentReportResource"]] - guest_configuration_navigation_name=None, # type: Optional[str] + kind=None, # type: Optional[Union[str, "models.Kind"]] version=None, # type: Optional[str] configuration_parameter=None, # type: Optional[List["models.ConfigurationParameter"]] configuration_setting=None, # type: Optional["models.ConfigurationSetting"] @@ -66,12 +66,15 @@ def _create_or_update_initial( ): # type: (...) -> "models.GuestConfigurationAssignment" cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - _parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, name_properties_guest_configuration_name=guest_configuration_navigation_name, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) + parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, kind=kind, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) api_version = "2020-06-25" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -90,14 +93,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'GuestConfigurationAssignment') + body_content = self._serialize.body(parameters, 'GuestConfigurationAssignment') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,7 +107,6 @@ def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -130,13 +130,13 @@ def begin_create_or_update( assignment=None, # type: Optional["models.AssignmentInfo"] vm=None, # type: Optional["models.VmInfo"] resources=None, # type: Optional[List["models.AssignmentReportResource"]] - guest_configuration_navigation_name=None, # type: Optional[str] + kind=None, # type: Optional[Union[str, "models.Kind"]] version=None, # type: Optional[str] configuration_parameter=None, # type: Optional[List["models.ConfigurationParameter"]] configuration_setting=None, # type: Optional["models.ConfigurationSetting"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GuestConfigurationAssignment"] """Creates an association between a VM and guest configuration. :param guest_configuration_assignment_name: Name of the guest configuration assignment. @@ -150,17 +150,17 @@ def begin_create_or_update( :param location: Region where the VM is located. :type location: str :param context: The source which initiated the guest configuration assignment. Ex: Azure - Policy. + Policy. :type context: str :param assignment: Configuration details of the guest configuration assignment. :type assignment: ~guest_configuration_client.models.AssignmentInfo :param vm: Information about the VM. :type vm: ~guest_configuration_client.models.VmInfo :param resources: The list of resources for which guest configuration assignment compliance is - checked. + checked. :type resources: list[~guest_configuration_client.models.AssignmentReportResource] - :param guest_configuration_navigation_name: Name of the guest configuration. - :type guest_configuration_navigation_name: str + :param kind: Kind of the guest configuration. For example:DSC. + :type kind: str or ~guest_configuration_client.models.Kind :param version: Version of the guest configuration. :type version: str :param configuration_parameter: The configuration parameters for the guest configuration. @@ -168,6 +168,7 @@ def begin_create_or_update( :param configuration_setting: The configuration setting for the guest configuration. :type configuration_setting: ~guest_configuration_client.models.ConfigurationSetting :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -182,23 +183,25 @@ def begin_create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = self._create_or_update_initial( - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - vm_name=vm_name, - name=name, - location=location, - context=context, - assignment=assignment, - vm=vm, - resources=resources, - guest_configuration_navigation_name=guest_configuration_navigation_name, - version=version, - configuration_parameter=configuration_parameter, - configuration_setting=configuration_setting, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + guest_configuration_assignment_name=guest_configuration_assignment_name, + resource_group_name=resource_group_name, + vm_name=vm_name, + name=name, + location=location, + context=context, + assignment=assignment, + vm=vm, + resources=resources, + kind=kind, + version=version, + configuration_parameter=configuration_parameter, + configuration_setting=configuration_setting, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -210,10 +213,25 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore def get( @@ -238,9 +256,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -258,9 +279,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,9 +307,12 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -307,8 +330,8 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -330,7 +353,7 @@ def begin_delete( vm_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Delete a guest configuration assignment. :param resource_group_name: The resource group name. @@ -340,6 +363,7 @@ def begin_delete( :param vm_name: The name of the virtual machine. :type vm_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -354,13 +378,15 @@ def begin_delete( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - guest_configuration_assignment_name=guest_configuration_assignment_name, - vm_name=vm_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -369,10 +395,25 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore def list( @@ -394,11 +435,18 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -412,15 +460,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_report_operations.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_report_operations.py index 719f2b8d05b..cd26fb2098b 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_report_operations.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_assignment_report_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -66,9 +66,12 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReportList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.list.metadata['url'] # type: ignore @@ -86,9 +89,8 @@ def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -131,9 +133,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReport"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -152,9 +157,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_operations.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_operations.py index 099f0cfbd2d..2f2514cce37 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_operations.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -58,7 +58,7 @@ def _create_or_update_initial( assignment=None, # type: Optional["models.AssignmentInfo"] vm=None, # type: Optional["models.VmInfo"] resources=None, # type: Optional[List["models.AssignmentReportResource"]] - guest_configuration_navigation_name=None, # type: Optional[str] + kind=None, # type: Optional[Union[str, "models.Kind"]] version=None, # type: Optional[str] configuration_parameter=None, # type: Optional[List["models.ConfigurationParameter"]] configuration_setting=None, # type: Optional["models.ConfigurationSetting"] @@ -66,12 +66,15 @@ def _create_or_update_initial( ): # type: (...) -> "models.GuestConfigurationAssignment" cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) - _parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, name_properties_guest_configuration_name=guest_configuration_navigation_name, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) + parameters = models.GuestConfigurationAssignment(name=name, location=location, context=context, assignment=assignment, vm=vm, resources=resources, kind=kind, version=version, configuration_parameter=configuration_parameter, configuration_setting=configuration_setting) api_version = "2020-06-25" content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL url = self._create_or_update_initial.metadata['url'] # type: ignore @@ -90,14 +93,12 @@ def _create_or_update_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_parameters, 'GuestConfigurationAssignment') + body_content = self._serialize.body(parameters, 'GuestConfigurationAssignment') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,7 +107,6 @@ def _create_or_update_initial( error = self._deserialize(models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: deserialized = self._deserialize('GuestConfigurationAssignment', pipeline_response) @@ -130,13 +130,13 @@ def begin_create_or_update( assignment=None, # type: Optional["models.AssignmentInfo"] vm=None, # type: Optional["models.VmInfo"] resources=None, # type: Optional[List["models.AssignmentReportResource"]] - guest_configuration_navigation_name=None, # type: Optional[str] + kind=None, # type: Optional[Union[str, "models.Kind"]] version=None, # type: Optional[str] configuration_parameter=None, # type: Optional[List["models.ConfigurationParameter"]] configuration_setting=None, # type: Optional["models.ConfigurationSetting"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.GuestConfigurationAssignment"] """Creates an association between a ARC machine and guest configuration. :param guest_configuration_assignment_name: Name of the guest configuration assignment. @@ -150,17 +150,17 @@ def begin_create_or_update( :param location: Region where the VM is located. :type location: str :param context: The source which initiated the guest configuration assignment. Ex: Azure - Policy. + Policy. :type context: str :param assignment: Configuration details of the guest configuration assignment. :type assignment: ~guest_configuration_client.models.AssignmentInfo :param vm: Information about the VM. :type vm: ~guest_configuration_client.models.VmInfo :param resources: The list of resources for which guest configuration assignment compliance is - checked. + checked. :type resources: list[~guest_configuration_client.models.AssignmentReportResource] - :param guest_configuration_navigation_name: Name of the guest configuration. - :type guest_configuration_navigation_name: str + :param kind: Kind of the guest configuration. For example:DSC. + :type kind: str or ~guest_configuration_client.models.Kind :param version: Version of the guest configuration. :type version: str :param configuration_parameter: The configuration parameters for the guest configuration. @@ -168,6 +168,7 @@ def begin_create_or_update( :param configuration_setting: The configuration setting for the guest configuration. :type configuration_setting: ~guest_configuration_client.models.ConfigurationSetting :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -182,23 +183,25 @@ def begin_create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = self._create_or_update_initial( - guest_configuration_assignment_name=guest_configuration_assignment_name, - resource_group_name=resource_group_name, - machine_name=machine_name, - name=name, - location=location, - context=context, - assignment=assignment, - vm=vm, - resources=resources, - guest_configuration_navigation_name=guest_configuration_navigation_name, - version=version, - configuration_parameter=configuration_parameter, - configuration_setting=configuration_setting, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + guest_configuration_assignment_name=guest_configuration_assignment_name, + resource_group_name=resource_group_name, + machine_name=machine_name, + name=name, + location=location, + context=context, + assignment=assignment, + vm=vm, + resources=resources, + kind=kind, + version=version, + configuration_parameter=configuration_parameter, + configuration_setting=configuration_setting, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -210,10 +213,25 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'machineName': self._serialize.url("machine_name", machine_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore def get( @@ -238,9 +256,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -258,9 +279,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,9 +307,12 @@ def _delete_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self._delete_initial.metadata['url'] # type: ignore @@ -307,8 +330,8 @@ def _delete_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -330,7 +353,7 @@ def begin_delete( machine_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Delete a guest configuration assignment. :param resource_group_name: The resource group name. @@ -340,6 +363,7 @@ def begin_delete( :param machine_name: The name of the ARC machine. :type machine_name: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -354,13 +378,15 @@ def begin_delete( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - guest_configuration_assignment_name=guest_configuration_assignment_name, - machine_name=machine_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + guest_configuration_assignment_name=guest_configuration_assignment_name, + machine_name=machine_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -369,10 +395,25 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'), + 'guestConfigurationAssignmentName': self._serialize.url("guest_configuration_assignment_name", guest_configuration_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'machineName': self._serialize.url("machine_name", machine_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}'} # type: ignore def list( @@ -394,11 +435,18 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -412,15 +460,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_report_operations.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_report_operations.py index 32a62a6dbba..81ab1dff76c 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_report_operations.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_guest_configuration_hcrp_assignment_report_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat @@ -66,9 +66,12 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReportList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.list.metadata['url'] # type: ignore @@ -86,9 +89,8 @@ def list( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -131,9 +133,12 @@ def get( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.GuestConfigurationAssignmentReport"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" # Construct URL url = self.get.metadata['url'] # type: ignore @@ -152,9 +157,8 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_operation_operations.py b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_operation_operations.py index 6e4e0a431ed..b81b9289004 100644 --- a/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_operation_operations.py +++ b/src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/operations/_operation_operations.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -58,11 +58,18 @@ def list( :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } error_map.update(kwargs.pop('error_map', {})) api_version = "2020-06-25" + accept = "application/json" def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore @@ -70,15 +77,11 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): diff --git a/src/guestconfig/report.md b/src/guestconfig/report.md index 701cf1aafea..9e05e9032d9 100644 --- a/src/guestconfig/report.md +++ b/src/guestconfig/report.md @@ -1,160 +1,159 @@ # Azure CLI Module Creation Report -### guestconfig guest-configuration-assignment create - -create a guestconfig guest-configuration-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--guest-configuration-assignment-name**|string|Name of the guest configuration assignment.|guest_configuration_assignment_name| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -|**--name**|string|Name of the guest configuration assignment.|name| -|**--location**|string|Region where the VM is located.|location| -|**--context**|string|The source which initiated the guest configuration assignment. Ex: Azure Policy|context| -|**--latest-assignment-report-assignment**|object|Configuration details of the guest configuration assignment.|assignment| -|**--guest-configuration-name**|string|Name of the guest configuration.|name_properties_guest_configuration_name| -|**--guest-configuration-version**|string|Version of the guest configuration.|version| -|**--guest-configuration-configuration-parameter**|array|The configuration parameters for the guest configuration.|configuration_parameter| -|**--guest-configuration-configuration-setting**|object|The configuration setting for the guest configuration.|configuration_setting| -### guestconfig guest-configuration-assignment delete - -delete a guestconfig guest-configuration-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|Name of the guest configuration assignment|guest_configuration_assignment_name| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -### guestconfig guest-configuration-assignment list - -list a guestconfig guest-configuration-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -### guestconfig guest-configuration-assignment show - -show a guestconfig guest-configuration-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -### guestconfig guest-configuration-assignment update - -create a guestconfig guest-configuration-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--guest-configuration-assignment-name**|string|Name of the guest configuration assignment.|guest_configuration_assignment_name| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -|**--name**|string|Name of the guest configuration assignment.|name| -|**--location**|string|Region where the VM is located.|location| -|**--context**|string|The source which initiated the guest configuration assignment. Ex: Azure Policy|context| -|**--latest-assignment-report-assignment**|object|Configuration details of the guest configuration assignment.|assignment| -|**--guest-configuration-name**|string|Name of the guest configuration.|name_properties_guest_configuration_name| -|**--guest-configuration-version**|string|Version of the guest configuration.|version| -|**--guest-configuration-configuration-parameter**|array|The configuration parameters for the guest configuration.|configuration_parameter| -|**--guest-configuration-configuration-setting**|object|The configuration setting for the guest configuration.|configuration_setting| -### guestconfig guest-configuration-assignment-report list - -list a guestconfig guest-configuration-assignment-report. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -### guestconfig guest-configuration-assignment-report show - -show a guestconfig guest-configuration-assignment-report. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name| -|**--report-id**|string|The GUID for the guest configuration assignment report.|report_id| -|**--vm-name**|string|The name of the virtual machine.|vm_name| -### guestconfig guest-configuration-hcrp-assignment create - -create a guestconfig guest-configuration-hcrp-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--guest-configuration-assignment-name**|string|Name of the guest configuration assignment.|guest_configuration_assignment_name| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--machine-name**|string|The name of the ARC machine.|machine_name| -|**--name**|string|Name of the guest configuration assignment.|name| -|**--location**|string|Region where the VM is located.|location| -|**--context**|string|The source which initiated the guest configuration assignment. Ex: Azure Policy|context| -|**--latest-assignment-report-assignment**|object|Configuration details of the guest configuration assignment.|assignment| -|**--guest-configuration-name**|string|Name of the guest configuration.|name_properties_guest_configuration_name| -|**--guest-configuration-version**|string|Version of the guest configuration.|version| -|**--guest-configuration-configuration-parameter**|array|The configuration parameters for the guest configuration.|configuration_parameter| -|**--guest-configuration-configuration-setting**|object|The configuration setting for the guest configuration.|configuration_setting| -### guestconfig guest-configuration-hcrp-assignment delete - -delete a guestconfig guest-configuration-hcrp-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|Name of the guest configuration assignment|guest_configuration_assignment_name| -|**--machine-name**|string|The name of the ARC machine.|machine_name| -### guestconfig guest-configuration-hcrp-assignment list - -list a guestconfig guest-configuration-hcrp-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--machine-name**|string|The name of the ARC machine.|machine_name| -### guestconfig guest-configuration-hcrp-assignment show - -show a guestconfig guest-configuration-hcrp-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name| -|**--machine-name**|string|The name of the ARC machine.|machine_name| -### guestconfig guest-configuration-hcrp-assignment update - -create a guestconfig guest-configuration-hcrp-assignment. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--guest-configuration-assignment-name**|string|Name of the guest configuration assignment.|guest_configuration_assignment_name| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--machine-name**|string|The name of the ARC machine.|machine_name| -|**--name**|string|Name of the guest configuration assignment.|name| -|**--location**|string|Region where the VM is located.|location| -|**--context**|string|The source which initiated the guest configuration assignment. Ex: Azure Policy|context| -|**--latest-assignment-report-assignment**|object|Configuration details of the guest configuration assignment.|assignment| -|**--guest-configuration-name**|string|Name of the guest configuration.|name_properties_guest_configuration_name| -|**--guest-configuration-version**|string|Version of the guest configuration.|version| -|**--guest-configuration-configuration-parameter**|array|The configuration parameters for the guest configuration.|configuration_parameter| -|**--guest-configuration-configuration-setting**|object|The configuration setting for the guest configuration.|configuration_setting| -### guestconfig guest-configuration-hcrp-assignment-report list - -list a guestconfig guest-configuration-hcrp-assignment-report. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name| -|**--machine-name**|string|The name of the ARC machine.|machine_name| -### guestconfig guest-configuration-hcrp-assignment-report show - -show a guestconfig guest-configuration-hcrp-assignment-report. - -|Option|Type|Description|Path (SDK)|Path (swagger)| -|------|----|-----------|----------|--------------| -|**--resource-group-name**|string|The resource group name.|resource_group_name| -|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name| -|**--report-id**|string|The GUID for the guest configuration assignment report.|report_id| -|**--machine-name**|string|The name of the ARC machine.|machine_name| \ No newline at end of file +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az guestconfig|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az guestconfig` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az guestconfig guest-configuration-assignment|GuestConfigurationAssignments|[commands](#CommandsInGuestConfigurationAssignments)| +|az guestconfig guest-configuration-assignment-report|GuestConfigurationAssignmentReports|[commands](#CommandsInGuestConfigurationAssignmentReports)| +|az guestconfig guest-configuration-hcrp-assignment|GuestConfigurationHCRPAssignments|[commands](#CommandsInGuestConfigurationHCRPAssignments)| +|az guestconfig guest-configuration-hcrp-assignment-report|GuestConfigurationHCRPAssignmentReports|[commands](#CommandsInGuestConfigurationHCRPAssignmentReports)| + +## COMMANDS +### Commands in `az guestconfig guest-configuration-assignment` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az guestconfig guest-configuration-assignment list](#GuestConfigurationAssignmentsList)|List|[Parameters](#ParametersGuestConfigurationAssignmentsList)|[Example](#ExamplesGuestConfigurationAssignmentsList)| +|[az guestconfig guest-configuration-assignment show](#GuestConfigurationAssignmentsGet)|Get|[Parameters](#ParametersGuestConfigurationAssignmentsGet)|[Example](#ExamplesGuestConfigurationAssignmentsGet)| + +### Commands in `az guestconfig guest-configuration-assignment-report` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az guestconfig guest-configuration-assignment-report list](#GuestConfigurationAssignmentReportsList)|List|[Parameters](#ParametersGuestConfigurationAssignmentReportsList)|[Example](#ExamplesGuestConfigurationAssignmentReportsList)| +|[az guestconfig guest-configuration-assignment-report show](#GuestConfigurationAssignmentReportsGet)|Get|[Parameters](#ParametersGuestConfigurationAssignmentReportsGet)|[Example](#ExamplesGuestConfigurationAssignmentReportsGet)| + +### Commands in `az guestconfig guest-configuration-hcrp-assignment` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az guestconfig guest-configuration-hcrp-assignment list](#GuestConfigurationHCRPAssignmentsList)|List|[Parameters](#ParametersGuestConfigurationHCRPAssignmentsList)|[Example](#ExamplesGuestConfigurationHCRPAssignmentsList)| +|[az guestconfig guest-configuration-hcrp-assignment show](#GuestConfigurationHCRPAssignmentsGet)|Get|[Parameters](#ParametersGuestConfigurationHCRPAssignmentsGet)|[Example](#ExamplesGuestConfigurationHCRPAssignmentsGet)| + +### Commands in `az guestconfig guest-configuration-hcrp-assignment-report` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az guestconfig guest-configuration-hcrp-assignment-report list](#GuestConfigurationHCRPAssignmentReportsList)|List|[Parameters](#ParametersGuestConfigurationHCRPAssignmentReportsList)|[Example](#ExamplesGuestConfigurationHCRPAssignmentReportsList)| +|[az guestconfig guest-configuration-hcrp-assignment-report show](#GuestConfigurationHCRPAssignmentReportsGet)|Get|[Parameters](#ParametersGuestConfigurationHCRPAssignmentReportsGet)|[Example](#ExamplesGuestConfigurationHCRPAssignmentReportsGet)| + + +## COMMAND DETAILS + +### group `az guestconfig guest-configuration-assignment` +#### Command `az guestconfig guest-configuration-assignment list` + +##### Example +``` +az guestconfig guest-configuration-assignment list --resource-group "myResourceGroupName" --vm-name "myVMName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--vm-name**|string|The name of the virtual machine.|vm_name|vmName| + +#### Command `az guestconfig guest-configuration-assignment show` + +##### Example +``` +az guestconfig guest-configuration-assignment show --name "SecureProtocol" --resource-group "myResourceGroupName" \ +--vm-name "myVMName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name|guestConfigurationAssignmentName| +|**--vm-name**|string|The name of the virtual machine.|vm_name|vmName| + +### group `az guestconfig guest-configuration-assignment-report` +#### Command `az guestconfig guest-configuration-assignment-report list` + +##### Example +``` +az guestconfig guest-configuration-assignment-report list --guest-configuration-assignment-name "AuditSecureProtocol" \ +--resource-group "myResourceGroupName" --vm-name "myVMName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name|guestConfigurationAssignmentName| +|**--vm-name**|string|The name of the virtual machine.|vm_name|vmName| + +#### Command `az guestconfig guest-configuration-assignment-report show` + +##### Example +``` +az guestconfig guest-configuration-assignment-report show --guest-configuration-assignment-name "AuditSecureProtocol" \ +--report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" --resource-group "myResourceGroupName" --vm-name "myvm" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name|guestConfigurationAssignmentName| +|**--report-id**|string|The GUID for the guest configuration assignment report.|report_id|reportId| +|**--vm-name**|string|The name of the virtual machine.|vm_name|vmName| + +### group `az guestconfig guest-configuration-hcrp-assignment` +#### Command `az guestconfig guest-configuration-hcrp-assignment list` + +##### Example +``` +az guestconfig guest-configuration-hcrp-assignment list --machine-name "myMachineName" --resource-group \ +"myResourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--machine-name**|string|The name of the ARC machine.|machine_name|machineName| + +#### Command `az guestconfig guest-configuration-hcrp-assignment show` + +##### Example +``` +az guestconfig guest-configuration-hcrp-assignment show --guest-configuration-assignment-name "SecureProtocol" \ +--machine-name "myMachineName" --resource-group "myResourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name|guestConfigurationAssignmentName| +|**--machine-name**|string|The name of the ARC machine.|machine_name|machineName| + +### group `az guestconfig guest-configuration-hcrp-assignment-report` +#### Command `az guestconfig guest-configuration-hcrp-assignment-report list` + +##### Example +``` +az guestconfig guest-configuration-hcrp-assignment-report list --guest-configuration-assignment-name \ +"AuditSecureProtocol" --machine-name "myMachineName" --resource-group "myResourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name|guestConfigurationAssignmentName| +|**--machine-name**|string|The name of the ARC machine.|machine_name|machineName| + +#### Command `az guestconfig guest-configuration-hcrp-assignment-report show` + +##### Example +``` +az guestconfig guest-configuration-hcrp-assignment-report show --guest-configuration-assignment-name \ +"AuditSecureProtocol" --machine-name "myMachineName" --report-id "7367cbb8-ae99-47d0-a33b-a283564d2cb1" \ +--resource-group "myResourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The resource group name.|resource_group_name|resourceGroupName| +|**--guest-configuration-assignment-name**|string|The guest configuration assignment name.|guest_configuration_assignment_name|guestConfigurationAssignmentName| +|**--report-id**|string|The GUID for the guest configuration assignment report.|report_id|reportId| +|**--machine-name**|string|The name of the ARC machine.|machine_name|machineName| diff --git a/src/guestconfig/setup.py b/src/guestconfig/setup.py index 8ee5f27a54f..320eda5f9ab 100644 --- a/src/guestconfig/setup.py +++ b/src/guestconfig/setup.py @@ -12,7 +12,7 @@ # HISTORY.rst entry. VERSION = '0.1.0' try: - from .manual.version import VERSION + from azext_guestconfig.manual.version import VERSION except ImportError: pass @@ -31,8 +31,9 @@ ] DEPENDENCIES = [] + try: - from .manual.dependency import DEPENDENCIES + from azext_guestconfig.manual.dependency import DEPENDENCIES except ImportError: pass