/// <inheritdoc /> public async Task DeleteAsync(CancellationToken ct = default) { await this.client.DeleteAsync(this.Name, ct) .ConfigureAwait(false); this.volume = new VolumeResponse(); }
/// <inheritdoc /> public async Task CreateAsync(CancellationToken ct = default) { var name = await this.client.CreateAsync(this.configuration, ct) .ConfigureAwait(false); this.volume = await this.client.ByNameAsync(name, ct) .ConfigureAwait(false); }
public async Task <VolumeResponse> CreateVolume() { VolumeResponse vr = await this.DockerClient.Volumes.CreateAsync ( new VolumesCreateParameters { Name = $"{this.Name}data", } ); return(vr); }
public async Task <bool> CheckVolumeExist() { VolumesListResponse vlr = await this.DockerClient.Volumes.ListAsync(); VolumeResponse vr = vlr.Volumes.Where(x => x.Name == $"{this.Name}data").FirstOrDefault(); if (vr != null) { return(true); } return(false); }
public DenMongoService(DenServicesController controller) : base(controller, MONGO_NAME) { this.ImageName = this.DenConfig.DenImageConfigObject.DenMongoImage; Task.Run(async delegate { if (!await this.CheckVolumeExist()) { VolumeResponse volume = await this.CreateVolume(); } }); string mountPoint = this.DenConfig.DenDockerConfigObject.Platform == Platforms.Linux.ToString() ? MONGO_LINUX_PATH : MONGO_WINDOWS_PATH; this.Volumes.Add($"{this.Name}data:{mountPoint}"); }
//This is currently being used for the Dashboard Widget //public static VolumeCollection GetCustomerVolumes2(GetCustomerVolumesRequest request) //{ // // Establish the query // var query = Exigo.OData().PeriodVolumes // .Where(c => c.CustomerID == request.CustomerID) // .Where(c => c.PeriodTypeID == PeriodTypes.Monthly) // .Where(c => c.Period.IsCurrentPeriod); // //.Where(c => c.Period.StartDate <= DateTime.Now); // // Fetch the data // var data = query.Select(c => new PeriodVolume() // { // CustomerID = c.CustomerID, // PeriodID = c.PeriodID, // Period = c.Period, // PeriodTypeID = c.PeriodTypeID, // Volume1 = c.Volume1, // Volume2 = c.Volume2, // Volume3 = c.Volume3, // Volume9 = c.Volume9, // Volume10 = c.Volume10, // Volume12 = c.Volume12, // Volume13 = c.Volume13, // Volume14 = c.Volume14 // }).FirstOrDefault(); // return (VolumeCollection)data; //} //This uses an api call rather then OData public static VolumeCollection GetCustomerVolumes3(GetCustomerVolumesRequest request) { var vc = new VolumeCollection(); //var api = Exigo.WebService(); ////Create Request //var volumeRequest = new GetVolumesRequest //{ // CustomerID = request.CustomerID, // PeriodType = request.PeriodTypeID //}; ////Get Response //var response = api.GetVolumes(volumeRequest).Volumes.FirstOrDefault(); //// here api call to SQl Server call VolumeResponse response = new VolumeResponse(); using (var context = Exigo.Sql()) { string sqlQuery = string.Format(@"GetCustomerVolumes3 {0},{1}", request.CustomerID, request.PeriodTypeID); response = context.Query <VolumeResponse>(sqlQuery).FirstOrDefault(); } if (response != null) { vc.CustomerID = response.CustomerID; vc.PayableAsRank.RankID = response.RankID; vc.Period.PeriodDescription = response.PeriodDescription; vc.Volume1 = response.Volume1; vc.Volume2 = response.Volume2; vc.Volume3 = response.Volume3; vc.Volume9 = response.Volume9; vc.Volume10 = response.Volume10; vc.Volume12 = response.Volume12; vc.Volume13 = response.Volume13; vc.Volume14 = response.Volume14; vc.PaidAsRank.RankID = response.PaidRankID; } ; return(vc); }
public VolumeResponse GetVolumes() { VolumeResponse response = new VolumeResponse(); // identify any claims ClaimsIdentity identity = User.Identity as ClaimsIdentity; foreach (Claim claim in identity.Claims) { response.Claims.Add("[" + claim.Type + "] " + claim.Value); } // add the data Random rnd = new Random(); response.Volumes.Add(new Volume { Category = "A", Value = rnd.Next(1, 100) }); response.Volumes.Add(new Volume { Category = "B", Value = rnd.Next(1, 100) }); response.Volumes.Add(new Volume { Category = "C", Value = rnd.Next(1, 100) }); response.Volumes.Add(new Volume { Category = "D", Value = rnd.Next(1, 100) }); response.Volumes.Add(new Volume { Category = "E", Value = rnd.Next(1, 100) }); return response; }
public AResponse CreateResponse(string responseData) { AResponse response = null; try { // validate length if (responseData.Length < Protocol.Instance.HeaderLength) { throw new ParserException("invalid responseData length"); } // get the header string header = responseData.Substring(0, (int)Protocol.Instance.HeaderLength); switch (_messageHeaderMapper[header]) { case MessageType.DisplayDevicesInfo: response = new DisplayDeviceInfoResponse(); break; case MessageType.Pause: response = new PauseResponse(); break; case MessageType.Play: response = new PlayResponse(); break; case MessageType.Resume: response = new ResumeResponse(); break; case MessageType.Seek: response = new SeekResponse(); break; case MessageType.SetImage: response = new SetImageResponse(); break; case MessageType.SetText: response = new SetTextResponse(); break; case MessageType.RemoveAddon: response = new RemoveAddonResponse(); break; case MessageType.Stop: response = new StopResponse(); break; case MessageType.Termination: response = new TerminationResponse(); break; case MessageType.VideoLayout: response = new VideoLayoutResponse(); break; case MessageType.Volume: response = new VolumeResponse(); break; case MessageType.WindowLayout: response = new WindowLayoutResponse(); break; case MessageType.SoundFx: response = new SoundFxResponse(); break; case MessageType.Sound3d: response = new Sound3dResponse(); break; case MessageType.MidiProperties: response = new MidiPropertiesResponse(); break; case MessageType.MidiOutputPortInfo: response = new MidiOutputPortInfoResponse(); break; case MessageType.SetMidiOutputPort: response = new SetMidiOutputPortResponse(); break; case MessageType.SetDls: response = new SetDlsResponse(); break; case MessageType.SetFrequency: response = new SetFrequencyResponse(); break; case MessageType.SetRate: response = new SetRateResponse(); break; case MessageType.SetPlayerType: response = new SetPlayerTypeResponse(); break; default: throw new ParserException("invalid message header"); } response.ParseFromString(responseData); } catch (System.Exception e) { throw e; } return(response); }