func Sql_v1beta1_OperationsGet(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) 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) // Only positional arguments should remain in args. if len(args) != 1 { usageFunc() } expectedParams := []string{ "project", "instance", "operation", } 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_operation := paramValues[2] call := service.Get(param_project, param_instance, param_operation) var response *api_client.InstanceOperation response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Sql_v1beta1_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 Sql_v1beta1_InstancesUpdate(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.NewInstancesService(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.DatabaseInstance{} 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{ "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.Update(param_project, param_instance, request, ) var response *api_client.InstancesUpdateResponse response, err = call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Sql_v1beta1_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 }