Пример #1
0
        /// <summary>
        /// Obtains the volume by Id
        /// </summary>
        /// <param name="volumeId">Volume id</param>
        /// <returns></returns>
        public async Task <VolumeReply> GetVolume(string volumeId)
        {
            return(await grpcCallerService.CallService(urls.Volumes, async channel =>
            {
                var client = new Volume.VolumeClient(channel);
                logger.LogDebug("grpc client created, request = {@id}", "");

                var response = await client.GetAsync(new GetVolume()
                {
                    Id = volumeId
                });
                logger.LogDebug("grpc response {@response}", response);

                return response;
            }));
        }
Пример #2
0
        /// <summary>
        /// Launch a new instance by the provided confiduration
        /// </summary>
        /// <param name="configuration">Configurations</param>
        /// <returns></returns>
        public async Task <InstanceGrpc> LaunchAsync(LaunchInstanceConfiguration configuration)
        {
            return(await grpcCallerService.CallService(urls.Volumes, async channel =>
            {
                var client = new Instances.API.Instances.InstancesClient(channel);
                //new Instances.InstanceClient()

                logger.LogDebug("grpc client created, request = {@id}", "");

                LaunchInstanceRequest launchInstanceRequest = new LaunchInstanceRequest()
                {
                    Name = configuration.Name,
                    InstanceType = configuration.InstanceType,
                    SystemVolume = configuration.SystemVolumeId
                };
                launchInstanceRequest.DataVolumes.AddRange(configuration.DataVolumeIds);

                var response = await client.LaunchAsync(launchInstanceRequest);

                logger.LogDebug("grpc response {@response}", response);

                return response;
            }));
        }