public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; } if (this.IsParameterBound(c => c.InputObject)) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.DeviceName = this.InputObject.DeviceName; this.Name = this.InputObject.Name; } if (this.ShouldProcess(this.Name, string.Format("Updating '{0}' in device '{1}' with name '{2}'.", HelpMessageBandwidthSchedule.ObjectName, this.DeviceName, this.Name))) { var result = UpdateResourceModel(); WriteObject(result); } }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => this.InputObject)) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.DeviceName = this.InputObject.DeviceName; this.Name = this.InputObject.Name; } if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; } var resourceModel = GetResourceModel(); if (this.IsParameterBound(c => c.ShareName)) { resourceModel = SetShareMountPoint(resourceModel); } resourceModel = UpdateResourceModel(resourceModel); WriteObject(new PSResourceModel(resourceModel), true); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var identifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.Name = Name; this.DeviceName = identifier.DeviceName; this.ResourceGroupName = identifier.ResourceGroupName; } if (this.IsParameterBound(c => c.InputObject)) { this.Name = this.InputObject.Name; this.DeviceName = this.InputObject.DeviceName; this.ResourceGroupName = this.InputObject.ResourceGroupName; } if (this.ShouldProcess(this.Name, string.Format("Updating '{0}' in device '{1}' with name '{2}'.", HelpMessageUsers.ObjectName, this.DeviceName, this.Name))) { var results = new List <PSResourceModel>() { SetResourceModel() }; WriteObject(results, true); } }
public override void ExecuteCmdlet() { var result = false; if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.Name = resourceIdentifier.ResourceName; } else if (this.IsParameterBound(c => c.DeviceObject)) { this.ResourceGroupName = DeviceObject.ResourceGroupName; this.Name = DeviceObject.Name; } if (this.ScanForUpdate.IsPresent) { result = ScanForUpdates(); } else if (this.FetchUpdate.IsPresent) { result = DownloadUpdates(); } else if (this.InstallUpdate.IsPresent) { result = InstallUpdates(); } if (this.PassThru.IsPresent) { WriteObject(result); } }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; } if (this.IsParameterBound(c => c.InputObject)) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.DeviceName = this.InputObject.DeviceName; this.Name = this.InputObject.Name; } if (this.ShouldProcess(this.Name, string.Format("Removing '{0}' in device '{1}' with name '{2}'.", HelpMessageShare.ObjectName, this.DeviceName, this.Name))) { var removed = Remove(); if (this.PassThru.IsPresent) { WriteObject(removed); } } }
public override void ExecuteCmdlet() { var results = new List <PSResourceModel>(); if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.Name = resourceIdentifier.ResourceName; } results = ListForEverything(); if (this.ExtendedInfo.IsPresent) { WriteObject(GetExtendedInfo(), true); } else if (this.NetworkSetting.IsPresent) { WriteObject(GetNetworkSettings(), enumerateCollection: true); } else if (this.UpdateSummary.IsPresent) { var info = GetUpdatedSummary(); WriteObject(info, enumerateCollection: true); } else if (this.Alert.IsPresent) { WriteObject(GetAlert(), enumerateCollection: true); } else { WriteObject(results, true); } }
public PSDataBoxEdgeBandWidthSchedule(BandwidthSchedule bandwidthSchedule) { this.BandwidthSchedule = bandwidthSchedule ?? throw new ArgumentNullException("bandwidthSchedule"); this.Id = bandwidthSchedule.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(bandwidthSchedule.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSDataBoxEdgeUser(User user) { this.User = user ?? throw new ArgumentNullException(nameof(user)); this.Id = user.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(user.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSDataBoxEdgeStorageAccountCredential(StorageAccountCredential storageAccountCredential) { this.StorageAccountCredential = storageAccountCredential; this.Id = storageAccountCredential.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(storageAccountCredential.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSDataBoxEdgeJob(Job job) { this.Job = job ?? throw new ArgumentNullException("job"); this.Id = job.Id; var dataBoxResourceIdentifier = new DataBoxEdgeResourceIdentifier(this.Id); this.Name = dataBoxResourceIdentifier.Name; this.DeviceName = dataBoxResourceIdentifier.DeviceName; this.ResourceGroupName = dataBoxResourceIdentifier.ResourceGroupName; }
public PSDataBoxEdgeRole(Role role) { this.Role = role ?? throw new ArgumentNullException("role"); this.Id = role.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(role.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSDataBoxEdgeTrigger(Trigger trigger, string kind) { this.Trigger = trigger ?? throw new ArgumentNullException("trigger"); this.Id = trigger.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(trigger.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; this.Kind = kind; }
public PSDataBoxEdgeShare(Share share) { this.Share = share ?? throw new ArgumentNullException("share"); this.Id = share.Id; this.StorageAccountName = GetStorageAccountCredentialAccountName(share.AzureContainerInfo .StorageAccountCredentialId); var resourceIdentifier = new DataBoxEdgeResourceIdentifier(share.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSDataBoxEdgeAlert(Alert alert) { this.Alert = alert ?? throw new ArgumentNullException("alert"); this.Id = alert.Id; var dataBoxResourceIdentifier = new DataBoxEdgeResourceIdentifier(this.Id); this.Name = dataBoxResourceIdentifier.Name; this.DeviceName = dataBoxResourceIdentifier.DeviceName; this.ResourceGroupName = dataBoxResourceIdentifier.ResourceGroupName; this.DetailedInformation = alert.DetailedInformation; this.ApeearedDateTime = alert.AppearedAtDateTime; this.Severity = alert.Severity; }
public PSDataBoxEdgeDeviceExtendedInfo(DataBoxEdgeDeviceExtendedInfo dataBoxEdgeDeviceExtendedInfo) { this.DataBoxEdgeDeviceExtendedInfo = dataBoxEdgeDeviceExtendedInfo ?? throw new ArgumentNullException("dataBoxEdgeDeviceExtendedInfo"); this.Id = DataBoxEdgeDeviceExtendedInfo.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(dataBoxEdgeDeviceExtendedInfo.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.DeviceName; this.EncryptionKey = DataBoxEdgeDeviceExtendedInfo.EncryptionKey; this.ResourceKey = DataBoxEdgeDeviceExtendedInfo.ResourceKey; }
public PSDataBoxEdgeStorageAccount(StorageAccount edgeStorageAccount) { this.EdgeStorageAccount = edgeStorageAccount ?? throw new ArgumentNullException("edgeStorageAccount"); this.Id = edgeStorageAccount.Id; var resourceIdentifier = new DataBoxEdgeResourceIdentifier(EdgeStorageAccount.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; if (edgeStorageAccount.DataPolicy == "Cloud") { this.StorageAccountName = GetStorageAccountCredentialAccountName(edgeStorageAccount.StorageAccountCredentialId); } }
public PSDataBoxEdgeDevice(DataBoxEdgeDevice dataBoxEdgeDevice) { if (dataBoxEdgeDevice == null) { throw new ArgumentNullException("dataBoxEdgeDevice"); } this.DataBoxEdgeDevice = dataBoxEdgeDevice; this.Id = dataBoxEdgeDevice.Id; var dataBoxEdgeResourceIdentifier = new DataBoxEdgeResourceIdentifier(dataBoxEdgeDevice.Id); this.ResourceGroupName = dataBoxEdgeResourceIdentifier.ResourceGroupName; this.Name = dataBoxEdgeResourceIdentifier.Name; }
public PSDataBoxEdgeShare(Share share) { this.Share = share ?? throw new ArgumentNullException("share"); this.Id = share.Id; if (share.AzureContainerInfo != null) { this.StorageAccountName = GetStorageAccountCredentialAccountName(share.AzureContainerInfo .StorageAccountCredentialId); } else { this.StorageAccountName = "N/A"; } var resourceIdentifier = new DataBoxEdgeResourceIdentifier(share.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; if (share.AccessProtocol.Equals("SMB") && share.UserAccessRights != null && share.UserAccessRights.Count > 0) { UserAccessRight = new List <Dictionary <string, string> >(); foreach (var userAccessRight in share.UserAccessRights) { var userIdentifier = new DataBoxEdgeResourceIdentifier(userAccessRight.UserId); var username = userIdentifier.Name; var accessRight = new Dictionary <string, string>() { { "Username", username }, { "AccessRight", userAccessRight.AccessType } }; UserAccessRight.Add(accessRight); } } else if (share.ClientAccessRights != null && share.ClientAccessRights.Count > 0) { ClientAccessRight = new List <Dictionary <string, string> >(); foreach (var shareClientAccessRight in share.ClientAccessRights) { var accessRight = new Dictionary <string, string>() { { "ClientId", shareClientAccessRight.Client }, { "AccessRight", shareClientAccessRight.AccessPermission } }; ClientAccessRight.Add(accessRight); } } }
public PSDataBoxEdgeUpdateSummary(UpdateSummary updateSummary) { if (updateSummary == null) { throw new ArgumentNullException(nameof(updateSummary)); } this.UpdateSummary = updateSummary; this.Id = UpdateSummary.Id; var dataBoxEdgeResourceIdentifier = new DataBoxEdgeResourceIdentifier(UpdateSummary.Id); this.ResourceGroupName = dataBoxEdgeResourceIdentifier.ResourceGroupName; this.DeviceName = dataBoxEdgeResourceIdentifier.DeviceName; this.Name = dataBoxEdgeResourceIdentifier.Name; }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; } if (this.IsParameterBound(c => c.DeviceObject)) { this.ResourceGroupName = this.DeviceObject.ResourceGroupName; this.DeviceName = this.DeviceObject.Name; } WriteObject(ListResource(), true); }
public PSDataBoxEdgeNetworkSetting(NetworkSettings networkSettings) { if (networkSettings == null) { throw new ArgumentNullException(nameof(networkSettings)); } this.NetworkSettings = networkSettings; this.Id = networkSettings.Id; var dataBoxEdgeResourceIdentifier = new DataBoxEdgeResourceIdentifier(networkSettings.Id); this.ResourceGroupName = dataBoxEdgeResourceIdentifier.ResourceGroupName; this.DeviceName = dataBoxEdgeResourceIdentifier.DeviceName; this.Name = dataBoxEdgeResourceIdentifier.Name; this.NetworkAdapters = networkSettings.NetworkAdapters.Select(t => new PSDataBoxEdgeNetworkAdapter(this.DeviceName, t)).ToList(); }
public PSDataBoxEdgeOrder(DataBoxEdgeOrder dataBoxEdgeOrder) { if (dataBoxEdgeOrder == null) { throw new ArgumentNullException("dataBoxEdgeOrder"); } this.DataBoxEdgeOrder = dataBoxEdgeOrder; this.Id = dataBoxEdgeOrder.Id; var dataBoxEdgeResourceIdentifier = new DataBoxEdgeResourceIdentifier(dataBoxEdgeOrder.Id); this.ResourceGroupName = dataBoxEdgeResourceIdentifier.ResourceGroupName; this.DeviceName = dataBoxEdgeResourceIdentifier.DeviceName; OrderHistory = dataBoxEdgeOrder.OrderHistory.Select(t => new PSDataBoxEdgeOrderStatus(t)).ToList(); ForwardTrackingInfo = dataBoxEdgeOrder.DeliveryTrackingInfo .Select(t => new PSDataBoxEdgeOrderTrackingInfo(t)).ToList(); ReturnTrackingInfo = dataBoxEdgeOrder.ReturnTrackingInfo.Select(t => new PSDataBoxEdgeOrderTrackingInfo(t)) .ToList(); ShippingAddress = dataBoxEdgeOrder.ShippingAddress; }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => this.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = this.ResourceGroupName; this.DeviceName = this.DeviceName; this.Name = this.Name; } if (this.IsParameterBound(c => this.DeviceObject)) { this.ResourceGroupName = this.DeviceObject.ResourceGroupName; this.DeviceName = this.DeviceObject.Name; } var results = new List <PSResourceModel>(); if (!string.IsNullOrEmpty(this.Name) && !string.IsNullOrEmpty(this.DeviceName) && !string.IsNullOrEmpty(this.ResourceGroupName)) { results.Add( new PSResourceModel( JobsOperationsExtensions.Get( this.DataBoxEdgeManagementClient.Jobs, this.DeviceName, this.Name, this.ResourceGroupName ) ) ); } WriteObject(results, true); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; } if (this.IsParameterBound(c => this.InputObject)) { this.ResourceGroupName = this.InputObject.ResourceGroupName; this.DeviceName = this.InputObject.DeviceName; this.Name = this.InputObject.Name; } var results = new List <PSDataBoxEdgeStorageAccountCredential>() { UpdateResource(GetResource()) }; WriteObject(results, true); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.InputObject)) { this.DeviceName = this.InputObject.DeviceName; this.Name = this.InputObject.Name; this.ResourceGroupName = this.InputObject.ResourceGroupName; } if (this.IsParameterBound(c => c.ResourceId)) { var resource = new DataBoxEdgeResourceIdentifier(this.ResourceId); this.DeviceName = resource.DeviceName; this.ResourceGroupName = resource.ResourceGroupName; this.Name = resource.Name; } var share = this.GetResourceModel(); 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") )); } } if (this.ShouldProcess(this.Name, string.Format("Updating '{0}' in device '{1}' with name '{2}'.", HelpMessageShare.ObjectName, this.DeviceName, this.Name))) { share = SharesOperationsExtensions.CreateOrUpdate( DataBoxEdgeManagementClient.Shares, this.DeviceName, this.Name, share, this.ResourceGroupName); var results = new List <PSResourceModel>() { new PSResourceModel(share) }; WriteObject(results, true); } }