private async Task <ProductSet> CreateProductSet(ProductSearchClient client, CreateProductSetsOptions opts) { // Create a product set with the product set specification in the region. var request = new CreateProductSetRequest { // A resource that represents Google Cloud Platform location ParentAsLocationName = new LocationName(opts.ProjectID, opts.ComputeRegion), ProductSetId = opts.ProductSetId, ProductSet = new ProductSet { DisplayName = opts.ProductSetDisplayName } }; // The response is the product set with the `name` populated var response = await client.CreateProductSetAsync(request); return(response); }
public async Task CreateTargetSet(string targetSetId, string displayName) { GoogleCredential cred = this.CreateCredentials(); var channel = new Channel(ProductSearchClient.DefaultEndpoint.Host, ProductSearchClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); try { var client = ProductSearchClient.Create(channel); var createProductSetOptions = new CreateProductSetsOptions { ProjectID = this.options.Value.ProjectId, ComputeRegion = this.options.Value.LocationId, ProductSetId = targetSetId, ProductSetDisplayName = displayName, }; var productSet = await this.CreateProductSet(client, createProductSetOptions); } finally { await channel.ShutdownAsync(); } }