public override void ExecuteCmdlet() { var result = false; if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new StackEdgeResourceIdentifier(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 StackEdgeResourceIdentifier(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.ResourceId)) { var resourceIdentifier = new StackEdgeResourceIdentifier(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 <PSStackEdgeJob>(); if (!string.IsNullOrEmpty(this.Name) && !string.IsNullOrEmpty(this.DeviceName) && !string.IsNullOrEmpty(this.ResourceGroupName)) { results.Add( new PSStackEdgeJob( this.StackEdgeManagementClient.Jobs.Get( this.DeviceName, this.Name, this.ResourceGroupName ) ) ); } WriteObject(results, true); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var identifier = new StackEdgeResourceIdentifier(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 <PSStackEdgeUser>() { SetResource() }; WriteObject(results, true); } }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new StackEdgeResourceIdentifier(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}'.", HelpMessageEdgeStorageAccount.ObjectName, this.DeviceName, this.Name))) { var removed = Remove(); if (this.PassThru.IsPresent) { WriteObject(removed); } } }
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 StackEdgeResourceIdentifier(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 PSStackEdgeRole(resourceModel), true); }
public PSStackEdgeStorageAccountCredential(StorageAccountCredential storageAccountCredential) { this.StorageAccountCredential = storageAccountCredential; this.Id = storageAccountCredential.Id; var resourceIdentifier = new StackEdgeResourceIdentifier(storageAccountCredential.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSStackEdgeRole(Role role) { this.Role = role ?? throw new ArgumentNullException("role"); this.Id = role.Id; var resourceIdentifier = new StackEdgeResourceIdentifier(role.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSStackEdgeJob(Job job) { this.Job = job ?? throw new ArgumentNullException("job"); this.Id = job.Id; var dataBoxResourceIdentifier = new StackEdgeResourceIdentifier(this.Id); this.Name = dataBoxResourceIdentifier.Name; this.DeviceName = dataBoxResourceIdentifier.DeviceName; this.ResourceGroupName = dataBoxResourceIdentifier.ResourceGroupName; }
public PSStackEdgeUser(User user) { this.User = user ?? throw new ArgumentNullException(nameof(user)); this.Id = user.Id; var resourceIdentifier = new StackEdgeResourceIdentifier(user.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; }
public PSStackEdgeTrigger(Trigger trigger, string kind) { this.Trigger = trigger ?? throw new ArgumentNullException("trigger"); this.Id = trigger.Id; var resourceIdentifier = new StackEdgeResourceIdentifier(trigger.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; this.Kind = kind; }
public PSStackEdgeAlert(Alert alert) { this.Alert = alert ?? throw new ArgumentNullException("alert"); this.Id = alert.Id; var dataBoxResourceIdentifier = new StackEdgeResourceIdentifier(this.Id); this.Name = dataBoxResourceIdentifier.Name; this.DeviceName = dataBoxResourceIdentifier.DeviceName; this.ResourceGroupName = dataBoxResourceIdentifier.ResourceGroupName; this.DetailedInformation = alert.DetailedInformation; this.AppearedDateTime = alert.AppearedAtDateTime; this.Severity = alert.Severity; }
public PSStackEdgeDeviceExtendedInfo(StackEdgeDeviceExtendedInfo stackEdgeDeviceExtendedInfo) { this.StackEdgeDeviceExtendedInfo = stackEdgeDeviceExtendedInfo ?? throw new ArgumentNullException("stackEdgeDeviceExtendedInfo"); this.Id = StackEdgeDeviceExtendedInfo.Id; var resourceIdentifier = new StackEdgeResourceIdentifier(stackEdgeDeviceExtendedInfo.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.DeviceName; this.EncryptionKey = StackEdgeDeviceExtendedInfo.EncryptionKey; this.ResourceKey = StackEdgeDeviceExtendedInfo.ResourceKey; }
public PSStackEdgeStorageAccount(StorageAccount edgeStorageAccount) { this.EdgeStorageAccount = edgeStorageAccount ?? throw new ArgumentNullException("edgeStorageAccount"); this.Id = edgeStorageAccount.Id; var resourceIdentifier = new StackEdgeResourceIdentifier(EdgeStorageAccount.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.DeviceName = resourceIdentifier.DeviceName; this.Name = resourceIdentifier.ResourceName; if (edgeStorageAccount.DataPolicy == "Cloud") { this.StorageAccountName = GetStorageAccountCredentialAccountName(edgeStorageAccount.StorageAccountCredentialId); } }
public PSStackEdgeDevice(EdgeDevice edgeDevice) { if (edgeDevice == null) { throw new ArgumentNullException("edgeDevice"); } this.EdgeDevice = edgeDevice; this.Id = edgeDevice.Id; var stackEdgeResourceIdentifier = new StackEdgeResourceIdentifier(edgeDevice.Id); this.ResourceGroupName = stackEdgeResourceIdentifier.ResourceGroupName; this.Name = stackEdgeResourceIdentifier.Name; }
public PSStackEdgeShare(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 StackEdgeResourceIdentifier(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 StackEdgeResourceIdentifier(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 PSStackEdgeUpdateSummary(UpdateSummary updateSummary) { if (updateSummary == null) { throw new ArgumentNullException(nameof(updateSummary)); } this.UpdateSummary = updateSummary; this.Id = UpdateSummary.Id; var stackEdgeResourceIdentifier = new StackEdgeResourceIdentifier(UpdateSummary.Id); this.ResourceGroupName = stackEdgeResourceIdentifier.ResourceGroupName; this.DeviceName = stackEdgeResourceIdentifier.DeviceName; this.Name = stackEdgeResourceIdentifier.Name; }
public override void ExecuteCmdlet() { var results = new List <PSStackEdgeDevice>(); if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new StackEdgeResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.Name = resourceIdentifier.ResourceName; } results = ListForEverything(); WriteObject(results, true); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new StackEdgeResourceIdentifier(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.DeviceName; } WriteObject(ListPSResource(), true); }
public PSStackEdgeNetworkSetting(NetworkSettings networkSettings) { if (networkSettings == null) { throw new ArgumentNullException(nameof(networkSettings)); } this.NetworkSettings = networkSettings; this.Id = networkSettings.Id; var stackEdgeResourceIdentifier = new StackEdgeResourceIdentifier(networkSettings.Id); this.ResourceGroupName = stackEdgeResourceIdentifier.ResourceGroupName; this.DeviceName = stackEdgeResourceIdentifier.DeviceName; this.Name = stackEdgeResourceIdentifier.Name; this.NetworkAdapters = networkSettings.NetworkAdapters.Select(t => new PSStackEdgeNetworkAdapter(t)).ToList(); }
public PSStackEdgeOrder(StackEdgeOrder stackEdgeOrder) { if (stackEdgeOrder == null) { throw new ArgumentNullException("stackEdgeOrder"); } this.StackEdgeOrder = stackEdgeOrder; this.Id = stackEdgeOrder.Id; var stackEdgeResourceIdentifier = new StackEdgeResourceIdentifier(stackEdgeOrder.Id); this.ResourceGroupName = stackEdgeResourceIdentifier.ResourceGroupName; this.DeviceName = stackEdgeResourceIdentifier.DeviceName; OrderHistory = stackEdgeOrder.OrderHistory.Select(t => new PSStackEdgeOrderStatus(t)).ToList(); ForwardTrackingInfo = stackEdgeOrder.DeliveryTrackingInfo .Select(t => new PSStackEdgeOrderTrackingInfo(t)).ToList(); ReturnTrackingInfo = stackEdgeOrder.ReturnTrackingInfo.Select(t => new PSStackEdgeOrderTrackingInfo(t)) .ToList(); ShippingAddress = stackEdgeOrder.ShippingAddress; }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new StackEdgeResourceIdentifier(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 <PSStackEdgeStorageAccountCredential>() { 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 StackEdgeResourceIdentifier(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 = this.StackEdgeManagementClient.Shares.CreateOrUpdate( this.DeviceName, this.Name, share, this.ResourceGroupName); var results = new List <PSStackEdgeShare>() { new PSStackEdgeShare(share) }; WriteObject(results, true); } }