本文整理汇总了Golang中github.com/skelterjohn/gcloud_apis/commands_util.AngrySnakes函数的典型用法代码示例。如果您正苦于以下问题:Golang AngrySnakes函数的具体用法?Golang AngrySnakes怎么用?Golang AngrySnakes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AngrySnakes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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
}
示例3: 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
}
示例4: 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
}
示例5: Bigquery_v2_JobsList
func Bigquery_v2_JobsList(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"))
if len(pathParams) != 0 {
if strings.Contains("projects/{projectId}/jobs", "+") {
usageBits += " @" + strings.Join(pathParams, "@")
} else {
usageBits += " " + strings.Join(pathParams, "/")
}
}
usageBits += " [--allUsers=VALUE]"
usageBits += " [--maxResults=VALUE]"
usageBits += " [--pageToken=VALUE]"
usageBits += " [--projection=VALUE]"
usageBits += " [--stateFilter=VALUE]"
fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits)
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewJobsService(api_service)
queryParamNames := map[string]bool{
"allUsers": false,
"maxResults": false,
"pageToken": false,
"projection": false,
"stateFilter": 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 := 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
}
call := service.List(param_projectId)
// Set query parameters.
if value, ok := flagValues["allUsers"]; ok {
query_allUsers, err := commands_util.ConvertValue_bool(value)
if err != nil {
return err
}
call.AllUsers(query_allUsers)
}
if value, ok := flagValues["maxResults"]; ok {
query_maxResults, err := commands_util.ConvertValue_int64(value)
if err != nil {
return err
}
call.MaxResults(query_maxResults)
}
if value, ok := flagValues["pageToken"]; ok {
query_pageToken, err := commands_util.ConvertValue_string(value)
if err != nil {
return err
}
call.PageToken(query_pageToken)
}
if value, ok := flagValues["projection"]; ok {
query_projection, err := commands_util.ConvertValue_string(value)
if err != nil {
//.........这里部分代码省略.........
示例6: Clouduseraccounts_alpha_UsersRemovePublicKey
func Clouduseraccounts_alpha_UsersRemovePublicKey(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("user"))
pathParams = append(pathParams, commands_util.AngrySnakes("fingerprint"))
if len(pathParams) != 0 {
if strings.Contains("{project}/global/users/{user}/removePublicKey", "+") {
usageBits += " @" + strings.Join(pathParams, "@")
} else {
usageBits += " " + strings.Join(pathParams, "/")
}
}
usageBits += " --fingerprint=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.NewUsersService(api_service)
queryParamNames := map[string]bool{
"fingerprint": 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",
"user",
}
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_user, err := commands_util.ConvertValue_string(paramValues[1])
if err != nil {
return err
}
param_fingerprint, err := commands_util.ConvertValue_string(flagValues["fingerprint"])
if err != nil {
return err
}
call := service.RemovePublicKey(param_project, param_user, param_fingerprint)
response, err := call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例7: Bigquery_v2_JobsInsert
func Bigquery_v2_JobsInsert(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"))
if len(pathParams) != 0 {
if strings.Contains("projects/{projectId}/jobs", "+") {
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.Job{})
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewJobsService(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.Job{}
if len(args) == 2 {
err = commands_util.PopulateRequestFromFilename(&request, args[1])
if err != nil {
return err
}
}
var media io.Reader
if len(args) == 3 {
if args[2] == "-" {
media = os.Stdin
} else {
media, err = os.Open(args[2])
if err != nil {
return err
}
}
}
keyValues := flagValues
err = commands_util.OverwriteRequestWithValues(&request, keyValues)
if err != nil {
return err
}
expectedParams := []string{
"projectId",
}
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
}
call := service.Insert(param_projectId,
request,
)
if media != nil {
call.Media(media)
}
response, err := call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例8: 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
}
示例9: Cloudfunctions_v1beta1_ProjectsRegionsFunctionsCreate
func Cloudfunctions_v1beta1_ProjectsRegionsFunctionsCreate(context Context, args ...string) error {
usageFunc := func() {
usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod)
var pathParams []string
pathParams = append(pathParams, commands_util.AngrySnakes("location"))
if len(pathParams) != 0 {
if strings.Contains("v1beta1/{+location}/functions", "+") {
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.HostedFunction{})
os.Exit(1)
}
api_service, err := api_client.New(context.Client)
if err != nil {
return err
}
service := api_client.NewProjectsRegionsFunctionsService(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.HostedFunction{}
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{
"location",
}
paramValues := commands_util.SplitParamValues(args[0])
if len(paramValues) != len(expectedParams) {
return commands_util.ErrForWrongParams(expectedParams, paramValues, args)
}
param_location, err := commands_util.ConvertValue_string(paramValues[0])
if err != nil {
return err
}
call := service.Create(param_location,
request,
)
response, err := call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例10: Sql_v1beta3_BackupRunsGet
func Sql_v1beta3_BackupRunsGet(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("instance"))
pathParams = append(pathParams, commands_util.AngrySnakes("backupConfiguration"))
pathParams = append(pathParams, commands_util.AngrySnakes("dueTime"))
if len(pathParams) != 0 {
if strings.Contains("projects/{project}/instances/{instance}/backupRuns/{backupConfiguration}", "+") {
usageBits += " @" + strings.Join(pathParams, "@")
} else {
usageBits += " " + strings.Join(pathParams, "/")
}
}
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.NewBackupRunsService(api_service)
queryParamNames := map[string]bool{
"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",
"backupConfiguration",
}
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_instance, err := commands_util.ConvertValue_string(paramValues[1])
if err != nil {
return err
}
param_backupConfiguration, err := commands_util.ConvertValue_string(paramValues[2])
if err != nil {
return err
}
param_dueTime, err := commands_util.ConvertValue_string(flagValues["dueTime"])
if err != nil {
return err
}
call := service.Get(param_project, param_instance, param_backupConfiguration, param_dueTime)
response, err := call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例11: Runtimeconfig_v1beta1_ProjectsConfigsWaitersDelete
func Runtimeconfig_v1beta1_ProjectsConfigsWaitersDelete(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("waitersId"))
if len(pathParams) != 0 {
if strings.Contains("v1beta1/projects/{projectsId}/configs/{configsId}/waiters/{waitersId}", "+") {
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.NewProjectsConfigsWaitersService(api_service)
// Only positional arguments should remain in args.
if len(args) != 1 {
usageFunc()
}
expectedParams := []string{
"projectsId",
"configsId",
"waitersId",
}
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_waitersId, err := commands_util.ConvertValue_string(paramValues[2])
if err != nil {
return err
}
call := service.Delete(param_projectsId, param_configsId, param_waitersId)
response, err := call.Do()
if err != nil {
return err
}
err = commands_util.PrintResponse(response)
if err != nil {
return err
}
return nil
}
示例12: 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
}
示例13: 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 {
//.........这里部分代码省略.........
示例14: 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
}
示例15: 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)
}
//.........这里部分代码省略.........