def Run(self, args): catalog_ref = args.CONCEPTS.catalog.Parse() api_client = product_util.ProductsClient() return api_client.ListRefImages( catalog_ref.RelativeName(), args.product_id, args.page_size if args.page_size else 10, args.limit)
def Run(self, args): image_ref = args.CONCEPTS.reference_image.Parse() console_io.PromptContinue( 'ReferenceImage [{}] will be removed.'.format(image_ref.Name()), cancel_on_no=True) api_client = product_util.ProductsClient() result = api_client.DeleteRefImage(image_ref.RelativeName()) log.DeletedResource(image_ref.Name(), kind='ReferenceImage') return result
def Run(self, args): catalog_ref = args.CONCEPTS.catalog.Parse() console_io.PromptContinue( 'Catalog [{}] and all related ReferenceImages will be deleted.'.format( catalog_ref.Name()), cancel_on_no=True) api_client = product_util.ProductsClient() result = api_client.DeleteCatalog(catalog_ref.RelativeName()) log.DeletedResource(catalog_ref.Name(), kind='Catalog') return result
def Run(self, args): catalog_ref = args.CONCEPTS.catalog.Parse() console_io.PromptContinue( 'All images for product id [{}] will be deleted from catalog [{}].' .format(args.product_id, catalog_ref.Name()), cancel_on_no=True) api_client = product_util.ProductsClient() result = api_client.DeleteProductCatalogImages( catalog_ref.RelativeName(), args.product_id) log.status.Print('Deleted ReferenceImages for Catalog [{}] ' 'with product id [{}].'.format( catalog_ref.Name(), args.product_id)) return result
def Run(self, args): catalog_ref = args.CONCEPTS.catalog.Parse() api_client = product_util.ProductsClient() # TODO(b/69863480) Remove this once optional modal groups are fixed if (args.bounds or args.category) and not (args.bounds and args.category): missing = 'bounds' if not args.bounds else 'category' raise parser_errors.ArgumentError( 'Missing [{}]. Both category and bounds must be specified if ' 'either is provided'.format(missing)) ref_image = api_client.BuildRefImage( args.product_id, args.image_path, bounds=api_client.BuildBoundingPoly(args.bounds), product_category=args.category) created_image = api_client.CreateRefImage(ref_image, catalog_ref.RelativeName()) log.CreatedResource(created_image.name, kind='ReferenceImage') return created_image
def Run(self, args): api_client = product_util.ProductsClient() import_response = api_client.ImportCatalog(args.source) return import_response
def Run(self, args): api_client = product_util.ProductsClient() return api_client.ListCatalogs()
def Run(self, args): api_client = product_util.ProductsClient() catalog = api_client.CreateCatalog() log.CreatedResource(catalog.name, kind='Catalog') return catalog
def Run(self, args): api_client = product_util.ProductsClient() image_ref = args.CONCEPTS.reference_image.Parse() return api_client.DescribeRefImage(image_ref.RelativeName())