|
| 1 | +// This file was automatically generated. DO NOT EDIT. |
| 2 | +// If you have any remark or suggestion do not hesitate to open an issue. |
| 3 | + |
| 4 | +package product_catalog |
| 5 | + |
| 6 | +import ( |
| 7 | + "context" |
| 8 | + "reflect" |
| 9 | + |
| 10 | + "github.com/scaleway/scaleway-cli/v2/core" |
| 11 | + product_catalog "github.com/scaleway/scaleway-sdk-go/api/product_catalog/v2alpha1" |
| 12 | + "github.com/scaleway/scaleway-sdk-go/scw" |
| 13 | +) |
| 14 | + |
| 15 | +// always import dependencies |
| 16 | +var ( |
| 17 | + _ = scw.RegionFrPar |
| 18 | +) |
| 19 | + |
| 20 | +func GetGeneratedCommands() *core.Commands { |
| 21 | + return core.NewCommands( |
| 22 | + productCatalogRoot(), |
| 23 | + productCatalogProduct(), |
| 24 | + productCatalogProductList(), |
| 25 | + ) |
| 26 | +} |
| 27 | + |
| 28 | +func productCatalogRoot() *core.Command { |
| 29 | + return &core.Command{ |
| 30 | + Short: `Product Catalog API`, |
| 31 | + Long: ``, |
| 32 | + Namespace: "product-catalog", |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +func productCatalogProduct() *core.Command { |
| 37 | + return &core.Command{ |
| 38 | + Short: `Scaleway Product Catalog API`, |
| 39 | + Long: `Scaleway's Product Catalog is an extensive list of the Scaleway products. |
| 40 | +The catalog includes details about each product including: description, |
| 41 | +locations, prices and properties.`, |
| 42 | + Namespace: "product-catalog", |
| 43 | + Resource: "product", |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +func productCatalogProductList() *core.Command { |
| 48 | + return &core.Command{ |
| 49 | + Short: `List all available products`, |
| 50 | + Long: `List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the ` + "`" + `page` + "`" + ` number and ` + "`" + `page_size` + "`" + ` for your query in the request.`, |
| 51 | + Namespace: "product-catalog", |
| 52 | + Resource: "product", |
| 53 | + Verb: "list", |
| 54 | + // Deprecated: false, |
| 55 | + ArgsType: reflect.TypeOf( |
| 56 | + product_catalog.PublicCatalogAPIListPublicCatalogProductsRequest{}, |
| 57 | + ), |
| 58 | + ArgSpecs: core.ArgSpecs{ |
| 59 | + { |
| 60 | + Name: "product-types.{index}", |
| 61 | + Short: `The list of filtered product categories.`, |
| 62 | + Required: false, |
| 63 | + Deprecated: false, |
| 64 | + Positional: false, |
| 65 | + EnumValues: []string{ |
| 66 | + "unknown_product_type", |
| 67 | + "instance", |
| 68 | + "apple_silicon", |
| 69 | + "elastic_metal", |
| 70 | + "dedibox", |
| 71 | + "block_storage", |
| 72 | + "object_storage", |
| 73 | + "managed_inference", |
| 74 | + "generative_apis", |
| 75 | + "load_balancer", |
| 76 | + "secret_manager", |
| 77 | + "key_manager", |
| 78 | + "managed_redis_database", |
| 79 | + "kubernetes", |
| 80 | + "managed_relational_database", |
| 81 | + "managed_mongodb", |
| 82 | + }, |
| 83 | + }, |
| 84 | + { |
| 85 | + Name: "global", |
| 86 | + Short: `Filter global products.`, |
| 87 | + Required: false, |
| 88 | + Deprecated: false, |
| 89 | + Positional: false, |
| 90 | + }, |
| 91 | + { |
| 92 | + Name: "region", |
| 93 | + Short: `Filter products by region.`, |
| 94 | + Required: false, |
| 95 | + Deprecated: false, |
| 96 | + Positional: false, |
| 97 | + }, |
| 98 | + { |
| 99 | + Name: "zone", |
| 100 | + Short: `Filter products by zone.`, |
| 101 | + Required: false, |
| 102 | + Deprecated: false, |
| 103 | + Positional: false, |
| 104 | + }, |
| 105 | + { |
| 106 | + Name: "datacenter", |
| 107 | + Short: `Filter products by datacenter.`, |
| 108 | + Required: false, |
| 109 | + Deprecated: false, |
| 110 | + Positional: false, |
| 111 | + }, |
| 112 | + { |
| 113 | + Name: "status.{index}", |
| 114 | + Short: `The lists of filtered product status, if empty only products with status public_beta, general_availability, preview, end_of_new_features, end_of_growth, end_of_deployment, end_of_support, end_of_sale, end_of_life or retired will be returned.`, |
| 115 | + Required: false, |
| 116 | + Deprecated: false, |
| 117 | + Positional: false, |
| 118 | + EnumValues: []string{ |
| 119 | + "unknown_status", |
| 120 | + "public_beta", |
| 121 | + "preview", |
| 122 | + "general_availability", |
| 123 | + "end_of_new_features", |
| 124 | + "end_of_growth", |
| 125 | + "end_of_deployment", |
| 126 | + "end_of_support", |
| 127 | + "end_of_sale", |
| 128 | + "end_of_life", |
| 129 | + "retired", |
| 130 | + }, |
| 131 | + }, |
| 132 | + }, |
| 133 | + Run: func(ctx context.Context, args any) (i any, e error) { |
| 134 | + request := args.(*product_catalog.PublicCatalogAPIListPublicCatalogProductsRequest) |
| 135 | + |
| 136 | + client := core.ExtractClient(ctx) |
| 137 | + api := product_catalog.NewPublicCatalogAPI(client) |
| 138 | + opts := []scw.RequestOption{scw.WithAllPages()} |
| 139 | + resp, err := api.ListPublicCatalogProducts(request, opts...) |
| 140 | + if err != nil { |
| 141 | + return nil, err |
| 142 | + } |
| 143 | + |
| 144 | + return resp.Products, nil |
| 145 | + }, |
| 146 | + } |
| 147 | +} |
0 commit comments