private ResourceModel GetResourceModel() { return(StorageAccountCredentialsOperationsExtensions.Get( this.DataBoxEdgeManagementClient.StorageAccountCredentials, this.DeviceName, this.Name, this.ResourceGroupName)); }
public override void ExecuteCmdlet() { var sac = StorageAccountCredentialsOperationsExtensions.Get( this.DataBoxEdgeManagementClient.StorageAccountCredentials, this.DeviceName, this.StorageAccountCredentialName, this.ResourceGroupName); _share = InitShareObject(); if (this.IsParameterBound(c => c.ClientAccessRight)) { _share.ClientAccessRights = new List <ClientAccessRight>(); foreach (var clientAccessRight in this.ClientAccessRight) { var accessRightPolicy = HashtableToDictionary <string, string>(clientAccessRight); _share.ClientAccessRights.Add( new ClientAccessRight( accessRightPolicy.GetOrNull("ClientId"), accessRightPolicy.GetOrNull("AccessRight") ) ); } } if (this.IsParameterBound(c => c.UserAccessRight)) { _share.UserAccessRights = new List <UserAccessRight>(); foreach (var userAccessRight in this.UserAccessRight) { var accessRightPolicy = HashtableToDictionary <string, string>(userAccessRight); _share.UserAccessRights.Add( new UserAccessRight( GetUserId(accessRightPolicy.GetOrNull("Username")), accessRightPolicy.GetOrNull("AccessRight") )); } } _share.AzureContainerInfo = new AzureContainerInfo(sac.Id, this.Name, this.DataFormat); if (this.ShouldProcess(this.Name, string.Format("Creating '{0}' in device '{1}' with name '{2}'.", HelpMessageShare.ObjectName, this.DeviceName, this.Name))) { DoesResourceExists(); var results = new List <PSResourceModel>() { CreateResourceModel() }; WriteObject(results, true); } }