本文整理汇总了Golang中github.com/GoogleCloudPlatform/gcloud/gcloud_apis/commands_util.ConvertValue_int64函数的典型用法代码示例。如果您正苦于以下问题:Golang ConvertValue_int64函数的具体用法?Golang ConvertValue_int64怎么用?Golang ConvertValue_int64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConvertValue_int64函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Test_v1_ProjectsDevicesList
func Test_v1_ProjectsDevicesList(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
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.NewProjectsDevicesService(api_service)
queryParamNames := map[string]bool{
"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{
"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["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.ListDevicesResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例2: Replicapool_v1beta1_PoolsResize
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
}
示例3: Replicapoolupdater_v1beta1_RollingUpdatesListInstanceUpdates
func Replicapoolupdater_v1beta1_RollingUpdatesListInstanceUpdates(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [--filter=VALUE]"
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.NewRollingUpdatesService(api_service)
queryParamNames := map[string]bool{
"filter": false,
"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",
"zone",
"rollingUpdate",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_project := paramValues[0]
param_zone := paramValues[1]
param_rollingUpdate := paramValues[2]
call := service.ListInstanceUpdates(param_project, param_zone, param_rollingUpdate)
// Set query parameters.
if value, ok := flagValues["filter"]; ok {
query_filter, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.Filter(query_filter)
}
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.InstanceUpdateList
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例4: Replicapool_v1beta2_InstanceGroupManagersResize
func Replicapool_v1beta2_InstanceGroupManagersResize(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " --size=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.NewInstanceGroupManagersService(api_service)
queryParamNames := map[string]bool{
"size": 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",
"zone",
"instanceGroupManager",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_project := paramValues[0]
param_zone := paramValues[1]
param_instanceGroupManager := paramValues[2]
param_size, err := commands_util.ConvertValue_int64(flagValues["size"])
if err != nil {
return err
}
call := service.Resize(param_project, param_zone, param_instanceGroupManager, param_size)
var response *api_client.Operation
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例5: Replicapool_v1beta2_InstanceGroupManagersInsert
func Replicapool_v1beta2_InstanceGroupManagersInsert(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"
usageBits += " --size=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.NewInstanceGroupManagersService(api_service)
queryParamNames := map[string]bool{
"size": 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.InstanceGroupManager{}
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{
"project",
"zone",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_project := paramValues[0]
param_zone := paramValues[1]
param_size, err := commands_util.ConvertValue_int64(flagValues["size"])
if err != nil {
return err
}
call := service.Insert(param_project, param_zone, param_size,
request,
)
var response *api_client.Operation
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例6: Bigquery_v2_JobsGetQueryResults
func Bigquery_v2_JobsGetQueryResults(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [--maxResults=VALUE]"
usageBits += " [--pageToken=VALUE]"
usageBits += " [--startIndex=VALUE]"
usageBits += " [--timeoutMs=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.NewJobsService(api_service)
queryParamNames := map[string]bool{
"maxResults": false,
"pageToken": false,
"startIndex": false,
"timeoutMs": 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",
"jobId",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_projectId := paramValues[0]
param_jobId := paramValues[1]
call := service.GetQueryResults(param_projectId, param_jobId)
// 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)
}
if value, ok := flagValues["startIndex"]; ok {
query_startIndex, err := commands_util.ConvertValue_uint64(value)
if err != nil {
return err
}
call.StartIndex(query_startIndex)
}
if value, ok := flagValues["timeoutMs"]; ok {
query_timeoutMs, err := commands_util.ConvertValue_int64(value)
if err != nil {
return err
}
call.TimeoutMs(query_timeoutMs)
}
var response *api_client.GetQueryResultsResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
//.........这里部分代码省略.........