• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang commands_util.ConvertValue_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/skelterjohn/gcloud_apis/commands_util.ConvertValue_string函数的典型用法代码示例。如果您正苦于以下问题:Golang ConvertValue_string函数的具体用法?Golang ConvertValue_string怎么用?Golang ConvertValue_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ConvertValue_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Clouduseraccounts_alpha_GlobalAccountsOperationsDelete

func Clouduseraccounts_alpha_GlobalAccountsOperationsDelete(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("project"))
		pathParams = append(pathParams, commands_util.AngrySnakes("operation"))

		if len(pathParams) != 0 {
			if strings.Contains("{project}/global/operations/{operation}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		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.NewGlobalAccountsOperationsService(api_service)

	// Only positional arguments should remain in args.
	if len(args) != 1 {
		usageFunc()
	}

	expectedParams := []string{
		"project",
		"operation",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_project, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_operation, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}

	call := service.Delete(param_project, param_operation)

	if err := call.Do(); err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:58,代码来源:clouduseraccounts_alpha.go


示例2: Manager_v1beta2_TemplatesDelete

func Manager_v1beta2_TemplatesDelete(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("templateName"))

		if len(pathParams) != 0 {
			if strings.Contains("{projectId}/templates/{templateName}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		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.NewTemplatesService(api_service)

	// Only positional arguments should remain in args.
	if len(args) != 1 {
		usageFunc()
	}

	expectedParams := []string{
		"projectId",
		"templateName",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_templateName, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}

	call := service.Delete(param_projectId, param_templateName)

	if err := call.Do(); err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:58,代码来源:manager_v1beta2.go


示例3: Bigtableadmin_v2_OperationsCancel

func Bigtableadmin_v2_OperationsCancel(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("operationsId"))

		if len(pathParams) != 0 {
			if strings.Contains("v2/operations/{operationsId}:cancel", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		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{
		"operationsId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_operationsId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}

	call := service.Cancel(param_operationsId)

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:58,代码来源:bigtableadmin_v2.go


示例4: Cloudfunctions_v1beta1_ProjectsRegionsFunctionsGet

func Cloudfunctions_v1beta1_ProjectsRegionsFunctionsGet(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("name"))

		if len(pathParams) != 0 {
			if strings.Contains("v1beta1/{+name}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		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.NewProjectsRegionsFunctionsService(api_service)

	// Only positional arguments should remain in args.
	if len(args) != 1 {
		usageFunc()
	}

	expectedParams := []string{
		"name",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_name, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}

	call := service.Get(param_name)

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:58,代码来源:cloudfunctions_v1beta1.go


示例5: Clouduseraccounts_alpha_GroupsTestIamPermissions

func Clouduseraccounts_alpha_GroupsTestIamPermissions(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("project"))
		pathParams = append(pathParams, commands_util.AngrySnakes("resource"))

		if len(pathParams) != 0 {
			if strings.Contains("{project}/global/groups/{resource}/testIamPermissions", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"

		fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
		commands_util.PrintRequestExample(&api_client.TestPermissionsRequest{})

		os.Exit(1)
	}

	api_service, err := api_client.New(context.Client)
	if err != nil {
		return err
	}
	service := api_client.NewGroupsService(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.TestPermissionsRequest{}
	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",
		"resource",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_project, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_resource, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}

	call := service.TestIamPermissions(param_project, param_resource,
		request,
	)

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:89,代码来源:clouduseraccounts_alpha.go


示例6: Appengine_v1beta5_AppsGet

func Appengine_v1beta5_AppsGet(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("name"))

		if len(pathParams) != 0 {
			if strings.Contains("v1beta5/{+name}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [--ensureResourcesExist=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.NewAppsService(api_service)

	queryParamNames := map[string]bool{
		"ensureResourcesExist": 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{
		"name",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_name, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}

	call := service.Get(param_name)

	// Set query parameters.
	if value, ok := flagValues["ensureResourcesExist"]; ok {
		query_ensureResourcesExist, err := commands_util.ConvertValue_bool(value)
		if err != nil {
			return err
		}
		call.EnsureResourcesExist(query_ensureResourcesExist)
	}

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:84,代码来源:appengine_v1beta5.go


示例7: Clouderrorreporting_v1beta1_ProjectsGroupStatsList

func Clouderrorreporting_v1beta1_ProjectsGroupStatsList(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectName"))

		if len(pathParams) != 0 {
			if strings.Contains("v1beta1/{+projectName}/groupStats", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [--alignment=VALUE]"

		usageBits += " [--alignmentTime=VALUE]"

		usageBits += " [--groupId=VALUE]"

		usageBits += " [--order=VALUE]"

		usageBits += " [--pageSize=VALUE]"

		usageBits += " [--pageToken=VALUE]"

		usageBits += " [--serviceFilter.service=VALUE]"

		usageBits += " [--serviceFilter.version=VALUE]"

		usageBits += " [--timeRange.period=VALUE]"

		usageBits += " [--timedCountDuration=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.NewProjectsGroupStatsService(api_service)

	queryParamNames := map[string]bool{
		"alignment":             false,
		"alignmentTime":         false,
		"groupId":               false,
		"order":                 false,
		"pageSize":              false,
		"pageToken":             false,
		"serviceFilter.service": false,
		"serviceFilter.version": false,
		"timeRange.period":      false,
		"timedCountDuration":    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",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectName, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}

	call := service.List(param_projectName)

	// Set query parameters.
	if value, ok := flagValues["alignment"]; ok {
		query_alignment, err := commands_util.ConvertValue_string(value)
		if err != nil {
			return err
		}
		call.Alignment(query_alignment)
	}
	if value, ok := flagValues["alignmentTime"]; ok {
		query_alignmentTime, err := commands_util.ConvertValue_string(value)
//.........这里部分代码省略.........
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:101,代码来源:clouderrorreporting_v1beta1.go


示例8: Clouddebugger_v2_DebuggerDebuggeesBreakpointsSet

func Clouddebugger_v2_DebuggerDebuggeesBreakpointsSet(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("debuggeeId"))

		if len(pathParams) != 0 {
			if strings.Contains("v2/debugger/debuggees/{debuggeeId}/breakpoints/set", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"

		usageBits += " [--clientVersion=VALUE]"

		fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
		commands_util.PrintRequestExample(&api_client.Breakpoint{})

		os.Exit(1)
	}

	api_service, err := api_client.New(context.Client)
	if err != nil {
		return err
	}
	service := api_client.NewDebuggerDebuggeesBreakpointsService(api_service)

	queryParamNames := map[string]bool{
		"clientVersion": 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.Breakpoint{}
	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{
		"debuggeeId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_debuggeeId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}

	call := service.Set(param_debuggeeId,
		request,
	)

	// Set query parameters.
	if value, ok := flagValues["clientVersion"]; ok {
		query_clientVersion, err := commands_util.ConvertValue_string(value)
		if err != nil {
			return err
		}
		call.ClientVersion(query_clientVersion)
	}

	response, err := call.Do()
	if err != nil {
//.........这里部分代码省略.........
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:101,代码来源:clouddebugger_v2.go


示例9: Clouddebugger_v2_ControllerDebuggeesBreakpointsUpdate

func Clouddebugger_v2_ControllerDebuggeesBreakpointsUpdate(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("debuggeeId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("id"))

		if len(pathParams) != 0 {
			if strings.Contains("v2/controller/debuggees/{debuggeeId}/breakpoints/{id}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"

		fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
		commands_util.PrintRequestExample(&api_client.UpdateActiveBreakpointRequest{})

		os.Exit(1)
	}

	api_service, err := api_client.New(context.Client)
	if err != nil {
		return err
	}
	service := api_client.NewControllerDebuggeesBreakpointsService(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.UpdateActiveBreakpointRequest{}
	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{
		"debuggeeId",
		"id",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_debuggeeId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_id, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}

	call := service.Update(param_debuggeeId, param_id,
		request,
	)

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:89,代码来源:clouddebugger_v2.go


示例10: Genomics_v1alpha2_PipelinesList

func Genomics_v1alpha2_PipelinesList(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string

		if len(pathParams) != 0 {
			if strings.Contains("v1alpha2/pipelines", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [--namePrefix=VALUE]"

		usageBits += " [--pageSize=VALUE]"

		usageBits += " [--pageToken=VALUE]"

		usageBits += " [--projectId=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.NewPipelinesService(api_service)

	queryParamNames := map[string]bool{
		"namePrefix": false,
		"pageSize":   false,
		"pageToken":  false,
		"projectId":  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{}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	call := service.List()

	// Set query parameters.
	if value, ok := flagValues["namePrefix"]; ok {
		query_namePrefix, err := commands_util.ConvertValue_string(value)
		if err != nil {
			return err
		}
		call.NamePrefix(query_namePrefix)
	}
	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)
	}
	if value, ok := flagValues["projectId"]; ok {
		query_projectId, err := commands_util.ConvertValue_string(value)
		if err != nil {
			return err
		}
		call.ProjectId(query_projectId)
	}

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
//.........这里部分代码省略.........
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:101,代码来源:genomics_v1alpha2.go


示例11: Runtimeconfig_v1beta1_ProjectsConfigsVariablesDelete

func Runtimeconfig_v1beta1_ProjectsConfigsVariablesDelete(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectsId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("configsId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("variablesId"))

		if len(pathParams) != 0 {
			if strings.Contains("v1beta1/projects/{projectsId}/configs/{configsId}/variables/{variablesId}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [--recursive=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.NewProjectsConfigsVariablesService(api_service)

	queryParamNames := map[string]bool{
		"recursive": 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{
		"projectsId",
		"configsId",
		"variablesId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectsId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_configsId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_variablesId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}

	call := service.Delete(param_projectsId, param_configsId, param_variablesId)

	// Set query parameters.
	if value, ok := flagValues["recursive"]; ok {
		query_recursive, err := commands_util.ConvertValue_bool(value)
		if err != nil {
			return err
		}
		call.Recursive(query_recursive)
	}

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:96,代码来源:runtimeconfig_v1beta1.go


示例12: Bigtableadmin_v2_ProjectsInstancesTablesModifyColumnFamilies

func Bigtableadmin_v2_ProjectsInstancesTablesModifyColumnFamilies(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectsId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("instancesId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("tablesId"))

		if len(pathParams) != 0 {
			if strings.Contains("v2/projects/{projectsId}/instances/{instancesId}/tables/{tablesId}:modifyColumnFamilies", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"

		fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
		commands_util.PrintRequestExample(&api_client.ModifyColumnFamiliesRequest{})

		os.Exit(1)
	}

	api_service, err := api_client.New(context.Client)
	if err != nil {
		return err
	}
	service := api_client.NewProjectsInstancesTablesService(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.ModifyColumnFamiliesRequest{}
	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{
		"projectsId",
		"instancesId",
		"tablesId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectsId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_instancesId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_tablesId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}

	call := service.ModifyColumnFamilies(param_projectsId, param_instancesId, param_tablesId,
		request,
	)

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:95,代码来源:bigtableadmin_v2.go


示例13: Bigtableadmin_v2_ProjectsInstancesTablesGet

func Bigtableadmin_v2_ProjectsInstancesTablesGet(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectsId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("instancesId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("tablesId"))

		if len(pathParams) != 0 {
			if strings.Contains("v2/projects/{projectsId}/instances/{instancesId}/tables/{tablesId}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [--view=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.NewProjectsInstancesTablesService(api_service)

	queryParamNames := map[string]bool{
		"view": 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{
		"projectsId",
		"instancesId",
		"tablesId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectsId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_instancesId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_tablesId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}

	call := service.Get(param_projectsId, param_instancesId, param_tablesId)

	// Set query parameters.
	if value, ok := flagValues["view"]; ok {
		query_view, err := commands_util.ConvertValue_string(value)
		if err != nil {
			return err
		}
		call.View(query_view)
	}

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:96,代码来源:bigtableadmin_v2.go


示例14: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsPatch

func Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsPatch(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("historyId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("executionId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("stepId"))

		if len(pathParams) != 0 {
			if strings.Contains("{projectId}/histories/{historyId}/executions/{executionId}/steps/{stepId}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"

		usageBits += " [--requestId=VALUE]"

		fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
		commands_util.PrintRequestExample(&api_client.Step{})

		os.Exit(1)
	}

	api_service, err := api_client.New(context.Client)
	if err != nil {
		return err
	}
	service := api_client.NewProjectsHistoriesExecutionsStepsService(api_service)

	queryParamNames := map[string]bool{
		"requestId": 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.Step{}
	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{
		"projectId",
		"historyId",
		"executionId",
		"stepId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_historyId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_executionId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}
	param_stepId, err := commands_util.ConvertValue_string(paramValues[3])
	if err != nil {
//.........这里部分代码省略.........
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:101,代码来源:toolresults_v1beta3.go


示例15: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsGet

func Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsGet(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("historyId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("executionId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("stepId"))

		if len(pathParams) != 0 {
			if strings.Contains("{projectId}/histories/{historyId}/executions/{executionId}/steps/{stepId}", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		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.NewProjectsHistoriesExecutionsStepsService(api_service)

	// Only positional arguments should remain in args.
	if len(args) != 1 {
		usageFunc()
	}

	expectedParams := []string{
		"projectId",
		"historyId",
		"executionId",
		"stepId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_historyId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_executionId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}
	param_stepId, err := commands_util.ConvertValue_string(paramValues[3])
	if err != nil {
		return err
	}

	call := service.Get(param_projectId, param_historyId, param_executionId, param_stepId)

	response, err := call.Do()
	if err != nil {
		return err
	}

	err = commands_util.PrintResponse(response)
	if err != nil {
		return err
	}

	return nil
}
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:76,代码来源:toolresults_v1beta3.go


示例16: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsThumbnailsList

func Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsThumbnailsList(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("historyId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("executionId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("stepId"))

		if len(pathParams) != 0 {
			if strings.Contains("{projectId}/histories/{historyId}/executions/{executionId}/steps/{stepId}/thumbnails", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		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.NewProjectsHistoriesExecutionsStepsThumbnailsService(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",
		"historyId",
		"executionId",
		"stepId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_historyId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_executionId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}
	param_stepId, err := commands_util.ConvertValue_string(paramValues[3])
	if err != nil {
		return err
	}

	call := service.List(param_projectId, param_historyId, param_executionId, param_stepId)

	// 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)
	}

//.........这里部分代码省略.........
开发者ID:skelterjohn,项目名称:gcloud_apis,代码行数:101,代码来源:toolresults_v1beta3.go


示例17: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsPublishXunitXmlFiles

func Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsPublishXunitXmlFiles(context Context, args ...string) error {

	usageFunc := func() {
		usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
		var pathParams []string
		pathParams = append(pathParams, commands_util.AngrySnakes("projectId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("historyId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("executionId"))
		pathParams = append(pathParams, commands_util.AngrySnakes("stepId"))

		if len(pathParams) != 0 {
			if strings.Contains("{projectId}/histories/{historyId}/executions/{executionId}/steps/{stepId}:publishXunitXmlFiles", "+") {
				usageBits += " @" + strings.Join(pathParams, "@")
			} else {
				usageBits += " " + strings.Join(pathParams, "/")
			}
		}

		usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"

		fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
		commands_util.PrintRequestExample(&api_client.PublishXunitXmlFilesRequest{})

		os.Exit(1)
	}

	api_service, err := api_client.New(context.Client)
	if err != nil {
		return err
	}
	service := api_client.NewProjectsHistoriesExecutionsStepsService(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.PublishXunitXmlFilesRequest{}
	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",
		"historyId",
		"executionId",
		"stepId",
	}
	paramValues := commands_util.SplitParamValues(args[0])
	if len(paramValues) != len(expectedParams) {
		return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
	}

	param_projectId, err := commands_util.ConvertValue_string(paramValues[0])
	if err != nil {
		return err
	}
	param_historyId, err := commands_util.ConvertValue_string(paramValues[1])
	if err != nil {
		return err
	}
	param_executionId, err := commands_util.ConvertValue_string(paramValues[2])
	if err != nil {
		return err
	}
	param_stepId, err := commands_util.ConvertValue_string(paramValues[3])
	if err != nil {
		return err
	}

	call := service.PublishXunitXmlFiles(param_projectId, param_histor 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang commands_util.ErrForWrongParams函数代码示例发布时间:2022-05-28
下一篇:
Golang commands_util.ConvertValue_int64函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap