當前位置: 首頁>>代碼示例>>Golang>>正文


Golang commands_util.PrintResponse函數代碼示例

本文整理匯總了Golang中github.com/skelterjohn/gcloud_apis/commands_util.PrintResponse函數的典型用法代碼示例。如果您正苦於以下問題:Golang PrintResponse函數的具體用法?Golang PrintResponse怎麽用?Golang PrintResponse使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了PrintResponse函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: 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

示例2: 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

示例3: Sql_v1beta3_FlagsList

func Sql_v1beta3_FlagsList(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("flags", "+") {
                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.NewFlagsService(api_service)

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

    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,代碼行數:50,代碼來源:sqladmin_v1beta3.go

示例4: Replicapoolupdater_v1beta1_RollingUpdatesListInstanceUpdates


//.........這裏部分代碼省略.........

        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 := 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_zone, err := commands_util.ConvertValue_string(paramValues[1])
    if err != nil {
        return err
    }
    param_rollingUpdate, err := commands_util.ConvertValue_string(paramValues[2])
    if err != nil {
        return err
    }

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

    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,代碼行數:101,代碼來源:replicapoolupdater_v1beta1.go

示例5: Clouduseraccounts_alpha_GlobalAccountsOperationsGet

func Clouduseraccounts_alpha_GlobalAccountsOperationsGet(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.Get(param_project, param_operation)

    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,代碼行數:64,代碼來源:clouduseraccounts_alpha.go

示例6: Clouderrorreporting_v1beta1_ProjectsGroupStatsList


//.........這裏部分代碼省略.........

    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)
        if err != nil {
            return err
        }
        call.AlignmentTime(query_alignmentTime)
    }
    if value, ok := flagValues["groupId"]; ok {
        query_groupId, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.GroupId(query_groupId)
    }
    if value, ok := flagValues["order"]; ok {
        query_order, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.Order(query_order)
    }
    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["serviceFilter_service"]; ok {
        query_serviceFilter_service, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.ServiceFilterService(query_serviceFilter_service)
    }
    if value, ok := flagValues["serviceFilter_version"]; ok {
        query_serviceFilter_version, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.ServiceFilterVersion(query_serviceFilter_version)
    }
    if value, ok := flagValues["timeRange_period"]; ok {
        query_timeRange_period, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.TimeRangePeriod(query_timeRange_period)
    }
    if value, ok := flagValues["timedCountDuration"]; ok {
        query_timedCountDuration, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.TimedCountDuration(query_timedCountDuration)
    }

    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,代碼行數:101,代碼來源:clouderrorreporting_v1beta1.go

示例7: Clouddebugger_v2_DebuggerDebuggeesBreakpointsSet


//.........這裏部分代碼省略.........
            } 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 {
        return err
    }

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

    return nil
}
開發者ID:skelterjohn,項目名稱:gcloud_apis,代碼行數:101,代碼來源:clouddebugger_v2.go

示例8: Clouddebugger_v2_ControllerDebuggeesRegister

func Clouddebugger_v2_ControllerDebuggeesRegister(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("v2/controller/debuggees/register", "+") {
                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.RegisterDebuggeeRequest{})

        os.Exit(1)
    }

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

    call := service.Register(
        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,代碼行數:75,代碼來源:clouddebugger_v2.go

示例9: Appengine_v1beta5_AppsServicesPatch


//.........這裏部分代碼省略.........

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

        os.Exit(1)
    }

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

    queryParamNames := map[string]bool{
        "mask":           false,
        "migrateTraffic": 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.Service{}
    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{
        "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.Patch(param_name,
        request,
    )

    // Set query parameters.
    if value, ok := flagValues["mask"]; ok {
        query_mask, err := commands_util.ConvertValue_string(value)
        if err != nil {
            return err
        }
        call.Mask(query_mask)
    }
    if value, ok := flagValues["migrateTraffic"]; ok {
        query_migrateTraffic, err := commands_util.ConvertValue_bool(value)
        if err != nil {
            return err
        }
        call.MigrateTraffic(query_migrateTraffic)
    }

    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,代碼行數:101,代碼來源:appengine_v1beta5.go

示例10: 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

示例11: 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

示例12: 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

示例13: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsPatch


//.........這裏部分代碼省略.........
    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 {
        return err
    }

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

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

    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,代碼行數:101,代碼來源:toolresults_v1beta3.go

示例14: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsThumbnailsList


//.........這裏部分代碼省略.........
                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)
    }

    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,代碼行數:101,代碼來源:toolresults_v1beta3.go

示例15: 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_historyId, param_executionId, param_stepId,
        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,代碼行數:101,代碼來源:toolresults_v1beta3.go


注:本文中的github.com/skelterjohn/gcloud_apis/commands_util.PrintResponse函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。