Пример #1
0
        private async Task <Product> CreateProduct(string productName)
        {
            var client  = _clientFactory.CreateProductSearchClient();
            var request = new CreateProductRequest
            {
                ParentAsLocationName = new LocationName(_projectInfo.ProjectID,
                                                        _projectInfo.ComputeRegion),
                Product = new Product
                {
                    DisplayName     = productName,
                    ProductCategory = "packagedgoods-v1"
                },
                ProductId = productName
            };

            // The response is the product with the `name` field populated.
            var product = await client.CreateProductAsync(request);

            return(product);
        }