Skip to content

adding remove disk api, introducing zone, network fields in enable protection #9

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: asr_a2a_bug_fixes_hotadd
Choose a base branch
from

Conversation

ayfathim
Copy link

@ayfathim ayfathim commented Apr 11, 2019

Following changes are made in this:

  1. Added remove disk api
  2. Updated replicated Protected Item with new field "AllowedDisklevelOperation"
  3. Added Zone, recoveryNetwork, recoverySubnet in enable protection api.
  4. Updated replicated protected Item with new field zone
  5. updated to latest sdkForNet 2.0 Version.
  6. Commented unprotected disk field for temporary basis.
    (Note this is a temporary update, till the final sdkForNet with unProtectedDisk field is not published . The PR for this is already created AutoPr-RecoveryServices.SiteRecovery-ayfathim-REST Spec PrNumber 5576 Azure/azure-sdk-for-net#5754)

Also made fix for Bug#4227197: [A2A][Powershell]reprotect command fails when disk information is passed
Issue: When disk details are passed during reprotect, the log storage account is optional. And we were using the optional-logStorageAccount field.

Resolution: using the cache storage account passed as part of diskDetails.

@innosam and @mady4ever : please review the zone and network changes

Description


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@@ -261,6 +265,14 @@ public class NewAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
[ValidateNotNullOrEmpty]
public string RecoveryAvailabilitySetId { get; set; }

/// <summary>
/// Gets or sets ID of the AvailabilityZone to recover the machine to in the event of a failover.
Copy link
Member

Choose a reason for hiding this comment

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

Zone is just a number and not an ID.

/// <summary>
/// Gets or sets the disk Id.
/// </summary>
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureManagedDisk,
Copy link
Member

Choose a reason for hiding this comment

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

did not see any requirement of parameter sets - please remove.

Copy link

Choose a reason for hiding this comment

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

looks fine to me there will be two parameter set one for mananged disk other for non Managed disk.

Or we can call field some common identifier and take diskId or VhdUri in that .In that the approach Sriram you are suggesting ?

@viverm
Copy link

viverm commented Apr 18, 2019

Please add Test cases and recording

'Remove-ASRRecoveryPlan', 'Remove-ASRReplicationProtectedItem',
'Remove-ASRProtectionContainerMapping', 'Remove-ASRRP',
'Remove-ASRRecoveryPlan', 'Remove-ASRReplicationProtectedItem',
'Remove-ASRReplicationProtectedItemDisk',
Copy link

Choose a reason for hiding this comment

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

&nit;

};

if (!string.IsNullOrEmpty(this.RecoveryCloudServiceId))
{
providerSettings.RecoveryResourceGroupId = null;
}

if (!string.IsNullOrEmpty(this.RecoveryAvailabilityZone) &&
!string.IsNullOrEmpty(this.RecoveryAvailabilitySetId))
{
Copy link

Choose a reason for hiding this comment

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

use different parameter set instead of having this check.

/// <summary>
/// Gets or sets the disk Id.
/// </summary>
[Parameter(ParameterSetName = ASRParameterSets.AzureToAzureManagedDisk,
Copy link

Choose a reason for hiding this comment

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

looks fine to me there will be two parameter set one for mananged disk other for non Managed disk.

Or we can call field some common identifier and take diskId or VhdUri in that .In that the approach Sriram you are suggesting ?

public string[] DiskId { get; set; }

[Parameter]
public SwitchParameter WaitForCompletion { get; set; }
Copy link

Choose a reason for hiding this comment

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

This is not required any more. Powershell team has AsJob new flag to handle that .
We have to move all longrunning cmdlet to that pattern.

/// <summary>
/// Removes disks to replication protected item.
/// </summary>
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesAsrReplicationProtectedItemDisk", DefaultParameterSetName = ASRParameterSets.EnterpriseToEnterprise, SupportsShouldProcess = true)]
Copy link

Choose a reason for hiding this comment

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

namespace Microsoft.Azure.Commands.RecoveryServices.SiteRecovery
{
/// <summary>
/// Removes disks to replication protected item.
Copy link

Choose a reason for hiding this comment

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

$nit; from


/// <summary>
/// Writes Job.
/// </summary>
Copy link

Choose a reason for hiding this comment

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

no need for these method and private variables ,move the code to ExecuteSiteRecoveryCmdlet method

viverm pushed a commit that referenced this pull request Oct 21, 2019
singhabh27 pushed a commit that referenced this pull request Sep 26, 2022
* Generate Migrate & OffAzur

* custom

* using directives to customise properties

* made hash code

* complete branch

* adding interal files

* fixed internal cmdlet

* hid expanded

* fixed directive'

* cleanup

* cleanup

* m

* m

* revision

* fix

* added a variant

* fixed mistake

* added getremi and restartjobs

* added disable

* fixed bug

* fixed restart to resync

* added new enable

* mock

* good night

* m

* as

* s

* added changes

* designreview

* last commit before AMH (#1)

* merging 2 readmes in 1 (#2)

* merging 2 readmes

* merging 2 readmes

* Srsamh (#4)

* merging 2 readmes

* merging 2 readmes

* added changes after DR

* fix

* bug fix

* Az migrate staging219 (#7)

* added changes to fix bug

* fix bug

* Az migrate staging219 (#8)

* added changes to fix bug

* fix bug

* Az migrate staging219 (#9)

* added changes to fix bug

* fix bug

* fix bug

* merged AMH and SDS swagger generated cmdlets with SRS cmdlets.

* Delete Get-AzmigrateJob.md

* Delete Get-AzmigrateJob.md

* updated and added some tests. New/remove cmdlet tests remain

* Delete Get-AzmigrateJob.Tests.ps1

* fixed some syntax issues, exposed some cmdlets

* fixed some syntax issues, exposed some cmdlets

* test,rec,ex for job

* test,rec,ex for job

* fixed bug

* added fabric

* policy

* Update Get-AzMigrateReplicationPolicy.Tests.ps1

* container

* mapping

* provider,server,disk

* fix

* server

* disk

* disk

* policy

* maping

* enable

* added changes files

* set

* test

* New and Remove cmdlet tests added.

* fix syntax

* added remove

* added changes

* added register tool commandlet and its tests.

* leftovers

* Added examples.

* fixed machine get doc

* removed get by identity and updated docs

* adding env files

* added get sds machines by migrate project

* added recordings

* added code changes

* added set

* get server

* docs

* adding back file

* new

* remove

* restart

* set

* mig

* test

* vars

* leftovers

* removed whatif

* output

* removed asjob

* added if else

* docs

Co-authored-by: msJinLei <[email protected]>
Co-authored-by: Kunal Chaturvedi <[email protected]>
Co-authored-by: kuchatur-ms <[email protected]>
singhabh27 pushed a commit that referenced this pull request Aug 23, 2024
* init add powershell cmdlet

* add customization for filedetails

* correct readme to include file workspace create

* add custom cmdlet for creating and uploading the file

* chunking logic for larger files

* add error for custom cmdlet when file too big

* combined cmdlets

* edit custom file upload command to not use default subscriptionid

* no default value for subid in custom file upload

* separate subscription and no subscription commands

* remove comments from combined cmd for file

* fix cmd

* custom no subscription file upload commands

* autogen docs for no sub file upload

* hide individual file commands

* add back workspace commands

* add name as alias for fileworkspacename fileworkspacesnosubscription

* remove update files and add alias for nosubscription file commands

* tests for get service

* tests for problem classification

* try adding erroractionpreference = stop

* tests for new file workspace

* tests for get file workspace

* more tests

* add tests for new file and upload, removefile name as a parameter

* remove new files no subscription

* tests for get file

* erroraction stop

* remove unnecessary comments and print statements

* docs for get support service

* problem classification docs

* add titles

* documentation for file workspace commands

* documentation for file/file workspace cmdlets

* documentation for checkNameAvailability

* added tests and documentation for operations, support ticket, communication and chat transcript cmdlets

* added examples for operations, support ticket, communication and chat transcript cmdlets

* resolve merge conflicts

* resolved PR comments

* get conflict file changes from grhuang/azsupport-autorest

* resolved merge conflict

* removed update communication sub and no sub scenarios

* Revert "removed update communication sub and no sub scenarios"

This reverts commit ccbfdee.

* removed update communication sub and no sub scenarios , updated readme

* make communiation and support ticket properties required in readme, edit get operation file name, edit calling internal cmdlets for file upload

* fix documentation

* fix top query

* add custom error handler

* consolidate list and get communicationsnosubscription and chattranscriptsnosubscription

* init changes to allow no subscription recording tests-need to use csp partner account in tenant 2e6a0c9f-986d-480e-ad4b-bdfddc047aba

* changes to not create new resources in playback

* remove custom error handler csharp

* init add changes to split subscription and no subscription tests

* update skip

* Update recordings

* update recordings

* add more examples to new-azsupportticket documentation

* update documentation and readme

* add directive back in

* make advanced diagnostic consent required

* Add custom error handling for New- and Update- cmdlets to print full details of error (#9)

* Add custom error handler

* Add default filter to retrieve tickets from the past week for Get-AzSupportTickets and Get-AzSupportTicketsNoSubscription (#10)

* add custom filtering for list support ticket if no filter is applied

* make transformations in swagger in readme to make enrollment id not readonly and show isTempTicket (#11)

* Add argument completer (#12)

* add argument completers

* add quotes to argument completers

* remove repeated time zone

* Regenerate powershell module with GA swagger (#13)

* Rerecord tests using GA version (#14)

* add tests for file size (will add recordings once Ga swagger available)

* Regenerate powershell module with GA swagger

* Rerecord tests with GA version

* Fix documentation

* fix url for file upload

---------

Co-authored-by: Grace Huang (from Dev Box) <[email protected]>
Co-authored-by: grhuangmsft <[email protected]>
Co-authored-by: Shreya Kumar <[email protected]>
Co-authored-by: Yunchi Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants