本文整理汇总了Golang中github.com/GoogleCloudPlatform/gcloud/gcloud_apis/commands_util.PrintResponse函数的典型用法代码示例。如果您正苦于以下问题:Golang PrintResponse函数的具体用法?Golang PrintResponse怎么用?Golang PrintResponse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrintResponse函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Replicapool_v1beta1_ReplicasRestart
func Replicapool_v1beta1_ReplicasRestart(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.NewReplicasService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"projectName",
"zone",
"poolName",
"replicaName",
}
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]
param_replicaName := paramValues[3]
call := service.Restart(param_projectName, param_zone, param_poolName, param_replicaName)
var response *api_client.Replica
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:51,代码来源:replicapool_v1beta1.go
示例2: Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsGet
func Toolresults_v1beta3_ProjectsHistoriesExecutionsStepsGet(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.NewProjectsHistoriesExecutionsStepsService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"projectId",
"historyId",
"executionId",
"stepId",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_projectId := paramValues[0]
param_historyId := paramValues[1]
param_executionId := paramValues[2]
param_stepId := paramValues[3]
call := service.Get(param_projectId, param_historyId, param_executionId, param_stepId)
var response *api_client.Step
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:51,代码来源:toolresults_v1beta3.go
示例3: Sql_v1beta3_SslCertsGet
func Sql_v1beta3_SslCertsGet(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.NewSslCertsService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"project",
"instance",
"sha1Fingerprint",
}
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_sha1Fingerprint := paramValues[2]
call := service.Get(param_project, param_instance, param_sha1Fingerprint)
var response *api_client.SslCert
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:49,代码来源:sqladmin_v1beta3.go
示例4: Autoscaler_v1beta2_AutoscalersDelete
func Autoscaler_v1beta2_AutoscalersDelete(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.NewAutoscalersService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"project",
"zone",
"autoscaler",
}
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_autoscaler := paramValues[2]
call := service.Delete(param_project, param_zone, param_autoscaler)
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
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:49,代码来源:autoscaler_v1beta2.go
示例5: Bigquery_v2_TablesGet
func Bigquery_v2_TablesGet(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.NewTablesService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"projectId",
"datasetId",
"tableId",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_projectId := paramValues[0]
param_datasetId := paramValues[1]
param_tableId := paramValues[2]
call := service.Get(param_projectId, param_datasetId, param_tableId)
var response *api_client.Table
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:49,代码来源:bigquery_v2.go
示例6: Test_v1_TestEnvironmentCatalogGet
func Test_v1_TestEnvironmentCatalogGet(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.NewTestEnvironmentCatalogService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"environmentType",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_environmentType := paramValues[0]
call := service.Get(param_environmentType)
var response *api_client.TestEnvironmentCatalog
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:45,代码来源:test_v1.go
示例7: Logging_v1beta_ProjectsLogsSinksList
func Logging_v1beta_ProjectsLogsSinksList(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.NewProjectsLogsSinksService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"log",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_log := paramValues[0]
call := service.List(param_log)
var response *api_client.ListLogSinksResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:45,代码来源:logging_v1beta.go
示例8: Test_v1_ProjectsDevicesCreate
func Test_v1_ProjectsDevicesCreate(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewProjectsDevicesService(api_service)
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
// Only positional arguments should remain in args.
if len(args) == 0 || len(args) > 2 {
usageFunc()
}
request := &api_client.Device{}
if len(args) == 2 {
err = commands_util.PopulateRequestFromFilename(&request, args[1])
if err != nil {
return err
}
}
keyValues := flagValues
err = commands_util.OverwriteRequestWithValues(&request, keyValues)
if err != nil {
return err
}
expectedParams := []string{
"projectId",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_projectId := paramValues[0]
call := service.Create(param_projectId,
request,
)
var response *api_client.Device
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:69,代码来源:test_v1.go
示例9: Test_v1_ProjectsTestMatricesList
func Test_v1_ProjectsTestMatricesList(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [--query=VALUE]"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewProjectsTestMatricesService(api_service)
queryParamNames := map[string]bool{
"query": false,
}
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
for k, r := range queryParamNames {
if _, ok := flagValues[k]; r && !ok {
return fmt.Errorf("missing required flag %q", "--"+k)
}
}
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"projectId",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_projectId := paramValues[0]
call := service.List(param_projectId)
// Set query parameters.
if value, ok := flagValues["query"]; ok {
query_query, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.Query(query_query)
}
var response *api_client.ListTestMatricesResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:71,代码来源:test_v1.go
示例10: Sql_v1beta3_InstancesRestoreBackup
func Sql_v1beta3_InstancesRestoreBackup(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " --backupConfiguration=VALUE"
usageBits += " --dueTime=VALUE"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewInstancesService(api_service)
queryParamNames := map[string]bool{
"backupConfiguration": true,
"dueTime": true,
}
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
for k, r := range queryParamNames {
if _, ok := flagValues[k]; r && !ok {
return fmt.Errorf("missing required flag %q", "--"+k)
}
}
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"project",
"instance",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_project := paramValues[0]
param_instance := paramValues[1]
param_backupConfiguration, err := commands_util.ConvertValue_string(flagValues["backupConfiguration"])
if err != nil {
return err
}
param_dueTime, err := commands_util.ConvertValue_string(flagValues["dueTime"])
if err != nil {
return err
}
call := service.RestoreBackup(param_project, param_instance, param_backupConfiguration, param_dueTime)
var response *api_client.InstancesRestoreBackupResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:75,代码来源:sqladmin_v1beta3.go
示例11: Sql_v1beta3_OperationsList
func Sql_v1beta3_OperationsList(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [--maxResults=VALUE]"
usageBits += " [--pageToken=VALUE]"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewOperationsService(api_service)
queryParamNames := map[string]bool{
"maxResults": false,
"pageToken": false,
}
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
for k, r := range queryParamNames {
if _, ok := flagValues[k]; r && !ok {
return fmt.Errorf("missing required flag %q", "--"+k)
}
}
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"project",
"instance",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_project := paramValues[0]
param_instance := paramValues[1]
call := service.List(param_project, param_instance)
// Set query parameters.
if value, ok := flagValues["maxResults"]; ok {
query_maxResults, err := commands_util.ConvertValue_int64(value)
if err != nil {
return err
}
call.MaxResults(query_maxResults)
}
if value, ok := flagValues["pageToken"]; ok {
query_pageToken, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.PageToken(query_pageToken)
}
var response *api_client.OperationsListResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:83,代码来源:sqladmin_v1beta3.go
示例12: 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
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:75,代码来源:replicapool_v1beta1.go
示例13: Developerprojects_v1_ProjectsCreate
func Developerprojects_v1_ProjectsCreate(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"
usageBits += " [--appengineStorageLocation=VALUE]"
usageBits += " [--createAppengineProject=VALUE]"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewProjectsService(api_service)
queryParamNames := map[string]bool{
"appengineStorageLocation": false,
"createAppengineProject": false,
}
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
for k, r := range queryParamNames {
if _, ok := flagValues[k]; r && !ok {
return fmt.Errorf("missing required flag %q", "--"+k)
}
}
// Only positional arguments should remain in args.
if len(args) == 0 || len(args) > 2 {
usageFunc()
}
request := &api_client.Project{}
if len(args) == 2 {
err = commands_util.PopulateRequestFromFilename(&request, args[1])
if err != nil {
return err
}
}
// Any flags that aren't query parameters are applied to the request.
keyValues := map[string]string{}
for k, v := range flagValues {
if _, ok := queryParamNames[k]; !ok {
keyValues[k] = v
}
}
err = commands_util.OverwriteRequestWithValues(&request, keyValues)
if err != nil {
return err
}
expectedParams := []string{}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
call := service.Create(
request,
)
// Set query parameters.
if value, ok := flagValues["appengineStorageLocation"]; ok {
query_appengineStorageLocation, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.AppengineStorageLocation(query_appengineStorageLocation)
}
if value, ok := flagValues["createAppengineProject"]; ok {
query_createAppengineProject, err := commands_util.ConvertValue_bool(value)
if err != nil {
return err
}
call.CreateAppengineProject(query_createAppengineProject)
}
var response *api_client.Project
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
//.........这里部分代码省略.........
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:101,代码来源:developerprojects_v1.go
示例14: Logging_v1beta3_ProjectsLogsSinksPatch
func Logging_v1beta3_ProjectsLogsSinksPatch(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*"
usageBits += " --sink=VALUE"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewProjectsLogsSinksService(api_service)
queryParamNames := map[string]bool{
"sink": true,
}
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
for k, r := range queryParamNames {
if _, ok := flagValues[k]; r && !ok {
return fmt.Errorf("missing required flag %q", "--"+k)
}
}
// Only positional arguments should remain in args.
if len(args) == 0 || len(args) > 2 {
usageFunc()
}
request := &api_client.LogSink{}
if len(args) == 2 {
err = commands_util.PopulateRequestFromFilename(&request, args[1])
if err != nil {
return err
}
}
// Any flags that aren't query parameters are applied to the request.
keyValues := map[string]string{}
for k, v := range flagValues {
if _, ok := queryParamNames[k]; !ok {
keyValues[k] = v
}
}
err = commands_util.OverwriteRequestWithValues(&request, keyValues)
if err != nil {
return err
}
expectedParams := []string{
"sinkName",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_sinkName := paramValues[0]
param_sink, err := commands_util.ConvertValue_string(flagValues["sink"])
if err != nil {
return err
}
call := service.Patch(param_sinkName, param_sink,
request,
)
var response *api_client.LogSink
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:91,代码来源:logging_v1beta3.go
示例15: Logging_v1beta3_ProjectsLogServicesIndexesList
//.........这里部分代码省略.........
usageBits += " [--pageSize=VALUE]"
usageBits += " [--pageToken=VALUE]"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewProjectsLogServicesIndexesService(api_service)
queryParamNames := map[string]bool{
"depth": false,
"indexPrefix": false,
"log": false,
"pageSize": false,
"pageToken": false,
}
args, flagValues, err := commands_util.ExtractFlagValues(args)
if err != nil {
return err
}
for k, r := range queryParamNames {
if _, ok := flagValues[k]; r && !ok {
return fmt.Errorf("missing required flag %q", "--"+k)
}
}
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"service",
}
paramValues := strings.Split(args[0], "/")
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_service := paramValues[0]
call := service.List(param_service)
// Set query parameters.
if value, ok := flagValues["depth"]; ok {
query_depth, err := commands_util.ConvertValue_int64(value)
if err != nil {
return err
}
call.Depth(query_depth)
}
if value, ok := flagValues["indexPrefix"]; ok {
query_indexPrefix, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.IndexPrefix(query_indexPrefix)
}
if value, ok := flagValues["log"]; ok {
query_log, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.Log(query_log)
}
if value, ok := flagValues["pageSize"]; ok {
query_pageSize, err := commands_util.ConvertValue_int64(value)
if err != nil {
return err
}
call.PageSize(query_pageSize)
}
if value, ok := flagValues["pageToken"]; ok {
query_pageToken, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.PageToken(query_pageToken)
}
var response *api_client.ListLogServiceIndexesResponse
response, err = call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:101,代码来源:logging_v1beta3.go
示例16: Replicapool_v1beta2_InstanceGroupManagersSetTargetPools
func Replicapool_v1beta2_InstanceGroupManagersSetTargetPools(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.NewInstanceGroupManagersService(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.InstanceGroupManagersSetTargetPoolsRequest{}
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",
"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]
call := service.SetTargetPools(param_project, param_zone, param_instanceGroupManager,
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
}
开发者ID:EDMunplugged,项目名称:gcloud,代码行数:73,代码来源:replicapool_v1beta2.go
注:本文中的github.com/GoogleCloudPlatform/gcloud/gcloud_apis/commands_util.PrintResponse函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论