func Test_v1_ProjectsDevicesCreate(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewProjectsDevicesService(api_service) args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } // Only positional arguments should remain in args. if len(args) == 0 || len(args) > 2 { usageFunc() } request := &api_client.Device{} if len(args) == 2 { err = commands_util.PopulateRequestFromFilename(&request, args[1]) if err != nil { return err } } keyValues := flagValues err = commands_util.OverwriteRequestWithValues(&request, keyValues) if err != nil { return err } expectedParams := []string{ "projectId", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_projectId := paramValues[0] call := service.Create(param_projectId, request, ) var response *api_client.Device response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Sql_v1beta3_InstancesRestoreBackup(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " --backupConfiguration=VALUE" usageBits += " --dueTime=VALUE" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewInstancesService(api_service) queryParamNames := map[string]bool{ "backupConfiguration": true, "dueTime": true, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "project", "instance", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_project := paramValues[0] param_instance := paramValues[1] param_backupConfiguration, err := commands_util.ConvertValue_string(flagValues["backupConfiguration"]) if err != nil { return err } param_dueTime, err := commands_util.ConvertValue_string(flagValues["dueTime"]) if err != nil { return err } call := service.RestoreBackup(param_project, param_instance, param_backupConfiguration, param_dueTime) var response *api_client.InstancesRestoreBackupResponse response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Test_v1_ProjectsTestMatricesList(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [--query=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewProjectsTestMatricesService(api_service) queryParamNames := map[string]bool{ "query": false, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "projectId", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_projectId := paramValues[0] call := service.List(param_projectId) // Set query parameters. if value, ok := flagValues["query"]; ok { query_query, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.Query(query_query) } var response *api_client.ListTestMatricesResponse response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Replicapool_v1beta1_PoolsUpdatetemplate(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewPoolsService(api_service) args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } // Only positional arguments should remain in args. if len(args) == 0 || len(args) > 2 { usageFunc() } request := &api_client.Template{} if len(args) == 2 { err = commands_util.PopulateRequestFromFilename(&request, args[1]) if err != nil { return err } } keyValues := flagValues err = commands_util.OverwriteRequestWithValues(&request, keyValues) if err != nil { return err } expectedParams := []string{ "projectName", "zone", "poolName", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_projectName := paramValues[0] param_zone := paramValues[1] param_poolName := paramValues[2] call := service.Updatetemplate(param_projectName, param_zone, param_poolName, request, ) err = call.Do() if err != nil { return err } return nil }
func Sql_v1beta3_OperationsList(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [--maxResults=VALUE]" usageBits += " [--pageToken=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewOperationsService(api_service) queryParamNames := map[string]bool{ "maxResults": false, "pageToken": false, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "project", "instance", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_project := paramValues[0] param_instance := paramValues[1] call := service.List(param_project, param_instance) // Set query parameters. if value, ok := flagValues["maxResults"]; ok { query_maxResults, err := commands_util.ConvertValue_int64(value) if err != nil { return err } call.MaxResults(query_maxResults) } if value, ok := flagValues["pageToken"]; ok { query_pageToken, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.PageToken(query_pageToken) } var response *api_client.OperationsListResponse response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Replicapool_v1beta1_PoolsResize(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [--numReplicas=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewPoolsService(api_service) queryParamNames := map[string]bool{ "numReplicas": false, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "projectName", "zone", "poolName", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_projectName := paramValues[0] param_zone := paramValues[1] param_poolName := paramValues[2] call := service.Resize(param_projectName, param_zone, param_poolName) // Set query parameters. if value, ok := flagValues["numReplicas"]; ok { query_numReplicas, err := commands_util.ConvertValue_int64(value) if err != nil { return err } call.NumReplicas(query_numReplicas) } var response *api_client.Pool response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Developerprojects_v1_ProjectsCreate(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*" usageBits += " [--appengineStorageLocation=VALUE]" usageBits += " [--createAppengineProject=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewProjectsService(api_service) queryParamNames := map[string]bool{ "appengineStorageLocation": false, "createAppengineProject": false, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) == 0 || len(args) > 2 { usageFunc() } request := &api_client.Project{} if len(args) == 2 { err = commands_util.PopulateRequestFromFilename(&request, args[1]) if err != nil { return err } } // Any flags that aren't query parameters are applied to the request. keyValues := map[string]string{} for k, v := range flagValues { if _, ok := queryParamNames[k]; !ok { keyValues[k] = v } } err = commands_util.OverwriteRequestWithValues(&request, keyValues) if err != nil { return err } expectedParams := []string{} paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } call := service.Create( request, ) // Set query parameters. if value, ok := flagValues["appengineStorageLocation"]; ok { query_appengineStorageLocation, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.AppengineStorageLocation(query_appengineStorageLocation) } if value, ok := flagValues["createAppengineProject"]; ok { query_createAppengineProject, err := commands_util.ConvertValue_bool(value) if err != nil { return err } call.CreateAppengineProject(query_createAppengineProject) } var response *api_client.Project response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Logging_v1beta3_ProjectsLogsSinksPatch(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*" usageBits += " --sink=VALUE" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewProjectsLogsSinksService(api_service) queryParamNames := map[string]bool{ "sink": true, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) == 0 || len(args) > 2 { usageFunc() } request := &api_client.LogSink{} if len(args) == 2 { err = commands_util.PopulateRequestFromFilename(&request, args[1]) if err != nil { return err } } // Any flags that aren't query parameters are applied to the request. keyValues := map[string]string{} for k, v := range flagValues { if _, ok := queryParamNames[k]; !ok { keyValues[k] = v } } err = commands_util.OverwriteRequestWithValues(&request, keyValues) if err != nil { return err } expectedParams := []string{ "sinkName", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_sinkName := paramValues[0] param_sink, err := commands_util.ConvertValue_string(flagValues["sink"]) if err != nil { return err } call := service.Patch(param_sinkName, param_sink, request, ) var response *api_client.LogSink response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Logging_v1beta3_ProjectsLogServicesIndexesList(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [--depth=VALUE]" usageBits += " [--indexPrefix=VALUE]" usageBits += " [--log=VALUE]" usageBits += " [--pageSize=VALUE]" usageBits += " [--pageToken=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewProjectsLogServicesIndexesService(api_service) queryParamNames := map[string]bool{ "depth": false, "indexPrefix": false, "log": false, "pageSize": false, "pageToken": false, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "service", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_service := paramValues[0] call := service.List(param_service) // Set query parameters. if value, ok := flagValues["depth"]; ok { query_depth, err := commands_util.ConvertValue_int64(value) if err != nil { return err } call.Depth(query_depth) } if value, ok := flagValues["indexPrefix"]; ok { query_indexPrefix, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.IndexPrefix(query_indexPrefix) } if value, ok := flagValues["log"]; ok { query_log, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.Log(query_log) } if value, ok := flagValues["pageSize"]; ok { query_pageSize, err := commands_util.ConvertValue_int64(value) if err != nil { return err } call.PageSize(query_pageSize) } if value, ok := flagValues["pageToken"]; ok { query_pageToken, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.PageToken(query_pageToken) } var response *api_client.ListLogServiceIndexesResponse response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Bigquery_v2_DatasetsDelete(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) usageBits += " [--deleteContents=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewDatasetsService(api_service) queryParamNames := map[string]bool{ "deleteContents": false, } args, flagValues, err := commands_util.ExtractFlagValues(args) if err != nil { return err } for k, r := range queryParamNames { if _, ok := flagValues[k]; r && !ok { return fmt.Errorf("missing required flag %q", "--"+k) } } // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "projectId", "datasetId", } paramValues := strings.Split(args[0], "/") if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_projectId := paramValues[0] param_datasetId := paramValues[1] call := service.Delete(param_projectId, param_datasetId) // Set query parameters. if value, ok := flagValues["deleteContents"]; ok { query_deleteContents, err := commands_util.ConvertValue_bool(value) if err != nil { return err } call.DeleteContents(query_deleteContents) } err = call.Do() if err != nil { return err } return nil }