func Cloudresourcemanager_v1beta1_ProjectsGet(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("v1beta1/projects/{projectId}", "+") { 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.NewProjectsService(api_service) // 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.Get(param_projectId) response, err := call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Cloudresourcemanager_v1beta1_ProjectsList(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("v1beta1/projects", "+") { usageBits += " @" + strings.Join(pathParams, "@") } else { usageBits += " " + strings.Join(pathParams, "/") } } usageBits += " [--filter=VALUE]" 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.NewProjectsService(api_service) queryParamNames := map[string]bool{ "filter": 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{} 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["filter"]; ok { query_filter, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.Filter(query_filter) } 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 }
func Cloudresourcemanager_v1beta1_ProjectsGetIamPolicy(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) var pathParams []string pathParams = append(pathParams, commands_util.AngrySnakes("resource")) if len(pathParams) != 0 { if strings.Contains("v1beta1/projects/{resource}:getIamPolicy", "+") { 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.GetIamPolicyRequest{}) os.Exit(1) } api_service, err := api_client.New(context.Client) if err != nil { return err } service := api_client.NewProjectsService(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.GetIamPolicyRequest{} 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{ "resource", } paramValues := commands_util.SplitParamValues(args[0]) if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_resource, err := commands_util.ConvertValue_string(paramValues[0]) if err != nil { return err } call := service.GetIamPolicy(param_resource, request, ) response, err := call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Cloudresourcemanager_v1beta1_ProjectsCreate(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("v1beta1/projects", "+") { usageBits += " @" + strings.Join(pathParams, "@") } else { usageBits += " " + strings.Join(pathParams, "/") } } usageBits += " [REQUEST_FILE|-] [--REQUEST_KEY=VALUE]*" usageBits += " [--useLegacyStack=VALUE]" fmt.Fprintf(os.Stderr, "Usage:\n\t%s\n", usageBits) commands_util.PrintRequestExample(&api_client.Project{}) 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{ "useLegacyStack": 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 := commands_util.SplitParamValues(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["useLegacyStack"]; ok { query_useLegacyStack, err := commands_util.ConvertValue_bool(value) if err != nil { return err } call.UseLegacyStack(query_useLegacyStack) } response, err := call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }
func Cloudresourcemanager_v1beta1_OrganizationsGet(context Context, args ...string) error { usageFunc := func() { usageBits := fmt.Sprintf("gcloud_apis %s", context.InvocationMethod) var pathParams []string pathParams = append(pathParams, commands_util.AngrySnakes("organizationsId")) if len(pathParams) != 0 { if strings.Contains("v1beta1/organizations/{organizationsId}", "+") { usageBits += " @" + strings.Join(pathParams, "@") } else { usageBits += " " + strings.Join(pathParams, "/") } } usageBits += " [--organizationId=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.NewOrganizationsService(api_service) queryParamNames := map[string]bool{ "organizationId": 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{ "organizationsId", } paramValues := commands_util.SplitParamValues(args[0]) if len(paramValues) != len(expectedParams) { return commands_util.ErrForWrongParams(expectedParams, paramValues, args) } param_organizationsId, err := commands_util.ConvertValue_string(paramValues[0]) if err != nil { return err } call := service.Get(param_organizationsId) // Set query parameters. if value, ok := flagValues["organizationId"]; ok { query_organizationId, err := commands_util.ConvertValue_string(value) if err != nil { return err } call.OrganizationId(query_organizationId) } response, err := call.Do() if err != nil { return err } err = commands_util.PrintResponse(response) if err != nil { return err } return nil }