id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c180700
res = new(gen.SourceUploadDataType) case "FileUpload", "Tempfile": res = &gen.UploadDataType{TypeName: "FileUpload"} case "Enumerable": res = new(gen.EnumerableDataType) case "Hash": if current, ok := p.parsed[path]; ok { res = current.Type o := res.(*gen.ObjectDataType) o.Fields = appendSorted(o.Fields, child) } else { oname := p.typeName(path) res = &gen.ObjectDataType{oname, []*gen.ActionParam{child}} } } return res }
c180701
dType := p.parseDataType(path, child) return p.newParam(path, param, dType) }
c180702
queryName := path if _, ok := dType.(*gen.ArrayDataType); ok { queryName += "[]" } actionParam := &gen.ActionParam{ Name: native, QueryName: queryName, Description: removeBlankLines(description), VarName: parseParamName(native), Type: dType, Mandatory: mandatory, NonBlank: nonBlank, Regexp: regexp, ValidValues: validValues, } if isLeaf { p.LeafParams = append(p.LeafParams, actionParam) } return actionParam }
c180703
"" if slice { slicePrefix = "[]" } return fmt.Sprintf("%s*%s", slicePrefix, toGoTypeName(name)) }
c180704
(" + name + ")") default: if strings.Contains(name, "::") { elems := strings.Split(name, "::") return strings.Join(elems[2:len(elems)], "") } return name } }
c180705
!= nil { return fmt.Sprintf("%+v", o) } return string(s) }
c180706
{ return true } } return false }
c180707
to the length of the string if indices != nil && indices[0] == 0 && indices[1] == len(href) { return true } } } return false }
c180708
break } } if values[i] == nil { missing = append(missing, n) } } if len(missing) > 0 { return "", missing } return fmt.Sprintf(p.Pattern, values...), used }
c180709
if err != nil { return nil, err } return json.Marshal(string(b)) }
c180710
} case APIParams: err := writeMultipartParams(w, v.(APIParams), fieldName) if err != nil { return err } default: return fmt.Errorf("Unknown type for multipart form section %s: %#v", fieldName, v) } } return nil }
c180711
return nil, err } } resp, err := a.Client.Do(req) if err != nil { return nil, err } return resp, err }
c180712
{ return nil, err } } resp, err := a.Client.DoWithContext(ctx, req) if err != nil { return nil, err } return resp, err }
c180713
if there is a location there is no body loc := resp.Header.Get("Location") if len(loc) > 0 { var bodyMap = make(map[string]interface{}) bodyMap["Location"] = loc respBody = interface{}(bodyMap) } return respBody, err }
c180714
&ScheduleLocator{Href(href), api} }
c180715
&TemplateLocator{Href(href), api} }
c180716
ipAddress}) } } for nickname, name := range envDetail.Servers { instance := server(client, name) ipAddress := instance.PublicIpAddresses[0] *sshConfig = append(*sshConfig, SSHConfig{Name: envName + "_" + nickname, IPAddress: ipAddress}) } }
c180717
aliases + fmt.Sprintf("alias %v='ssh %v %v@%v'\n", conf.Name, sshOptions, sshUser, conf.IPAddress) } return aliases }
c180718
else if len(serverArrays) != 1 { fail("More than one server array found with name: %v\n", name) } array := serverArrays[0] var instancesHref string for _, l := range array.Links { if l["rel"] == "current_instances" { instancesHref = l["href"] break } } instanceLocator := client.InstanceLocator(instancesHref) instances, err := instanceLocator.Index(rsapi.APIParams{}) if err != nil { fail("Failed to retrieve current instances of the server array: %v\n", err.Error()) } if len(instances) == 0 { fail("No instances found in server array: %v\n", name) } return instances }
c180719
if len(servers) == 0 { fail("Could not find server with name: %v\n", name) } else if len(servers) != 1 { fail("More than one server found with name: %v\n", name) } return servers[0].CurrentInstance }
c180720
{ i++ p = parts[len(parts)-i] } version = strings.Join(parts, "_") return fmt.Sprintf("v%s", version) }
c180721
'%s'", file) } js, err := ioutil.ReadFile(file) if err != nil { return nil, fmt.Errorf("Cannot read '%s': %s", file, err) } return js, nil }
c180722
"" { err = displayer.ApplyExtract(cmdLine.ExtractSelectorJSON, true) } else if cmdLine.ExtractHeader != "" { err = displayer.ApplyHeaderExtract(cmdLine.ExtractHeader) } if err != nil { PrintFatal("%s", err.Error()) } else if cmdLine.Pretty { displayer.Pretty() } fmt.Fprint(out, displayer.Output()) } // Figure out exit code exitStatus := 0 switch { case notExactlyOneError: exitStatus = 6 case resp.StatusCode == 401: exitStatus = 1 case resp.StatusCode == 403: exitStatus = 3 case resp.StatusCode == 404: exitStatus = 4 case resp.StatusCode > 399 && resp.StatusCode < 500: exitStatus = 2 case resp.StatusCode > 499: exitStatus = 5 } //fmt.Fprintf(os.Stderr, "exitStatus=%d\n", exitStatus) osExit(exitStatus) }
c180723
err = client.ShowAPIActions(cmdLine.Command) } else { resp, err = client.RunCommand(cmdLine.Command) } return }
c180724
StatusCode: 200, Body: ioutil.NopCloser(bytes.NewBuffer(b)), } return resp }
c180725
&AccountLocator{Href(href), api} }
c180726
&AccountGroupLocator{Href(href), api} }
c180727
&AlertLocator{Href(href), api} }
c180728
&AlertSpecLocator{Href(href), api} }
c180729
&AuditEntryLocator{Href(href), api} }
c180730
&BackupLocator{Href(href), api} }
c180731
&ChildAccountLocator{Href(href), api} }
c180732
&CloudLocator{Href(href), api} }
c180733
&CloudAccountLocator{Href(href), api} }
c180734
&CookbookLocator{Href(href), api} }
c180735
&CookbookAttachmentLocator{Href(href), api} }
c180736
&CredentialLocator{Href(href), api} }
c180737
&DatacenterLocator{Href(href), api} }
c180738
&DeploymentLocator{Href(href), api} }
c180739
&HealthCheckLocator{Href(href), api} }
c180740
&IdentityProviderLocator{Href(href), api} }
c180741
&ImageLocator{Href(href), api} }
c180742
&InputLocator{Href(href), api} }
c180743
&InstanceLocator{Href(href), api} }
c180744
&InstanceTypeLocator{Href(href), api} }
c180745
&IpAddressLocator{Href(href), api} }
c180746
&IpAddressBindingLocator{Href(href), api} }
c180747
&MonitoringMetricLocator{Href(href), api} }
c180748
&MultiCloudImageLocator{Href(href), api} }
c180749
{ return &MultiCloudImageMatcherLocator{Href(href), api} }
c180750
{ return &MultiCloudImageSettingLocator{Href(href), api} }
c180751
&NetworkLocator{Href(href), api} }
c180752
&NetworkGatewayLocator{Href(href), api} }
c180753
&NetworkOptionGroupLocator{Href(href), api} }
c180754
{ return &NetworkOptionGroupAttachmentLocator{Href(href), api} }
c180755
&Oauth2Locator{Href(href), api} }
c180756
&PermissionLocator{Href(href), api} }
c180757
&PlacementGroupLocator{Href(href), api} }
c180758
&PreferenceLocator{Href(href), api} }
c180759
&PublicationLocator{Href(href), api} }
c180760
&PublicationLineageLocator{Href(href), api} }
c180761
{ return &RecurringVolumeAttachmentLocator{Href(href), api} }
c180762
&RepositoryLocator{Href(href), api} }
c180763
&RepositoryAssetLocator{Href(href), api} }
c180764
&ResourceGroupLocator{Href(href), api} }
c180765
&RightScriptLocator{Href(href), api} }
c180766
{ return &RightScriptAttachmentLocator{Href(href), api} }
c180767
&RouteLocator{Href(href), api} }
c180768
&RouteTableLocator{Href(href), api} }
c180769
&RunnableBindingLocator{Href(href), api} }
c180770
&SchedulerLocator{Href(href), api} }
c180771
&SecurityGroupLocator{Href(href), api} }
c180772
&SecurityGroupRuleLocator{Href(href), api} }
c180773
&ServerLocator{Href(href), api} }
c180774
&ServerArrayLocator{Href(href), api} }
c180775
&ServerTemplateLocator{Href(href), api} }
c180776
{ return &ServerTemplateMultiCloudImageLocator{Href(href), api} }
c180777
&SessionLocator{Href(href), api} }
c180778
&SshKeyLocator{Href(href), api} }
c180779
&SubnetLocator{Href(href), api} }
c180780
&TagLocator{Href(href), api} }
c180781
&TaskLocator{Href(href), api} }
c180782
&UserLocator{Href(href), api} }
c180783
&UserDataLocator{Href(href), api} }
c180784
&VolumeLocator{Href(href), api} }
c180785
&VolumeAttachmentLocator{Href(href), api} }
c180786
&VolumeSnapshotLocator{Href(href), api} }
c180787
&VolumeTypeLocator{Href(href), api} }
c180788
= rsapi.ActionCommands{} registrar.RegisterActionCommands(APIName, GenMetadata, commandValues) }
c180789
a.ShowHelp(cmd, "/rll", commandValues) }
c180790
a.ShowActions(cmd, "/rll", commandValues) }
c180791
+= ", /" + f.Regexp.String() + "/" } flagHelp[i] = fmt.Sprintf("%s=%s\n <%s> %s", f.Name, f.Type, attrs, f.Description) } fmt.Printf("usage: rsc [<FLAGS>] %s %s %s [<PARAMS>]\n\n%s\n\n", strings.Split(cmd, " ")[0], action.Name, href, action.Description) fmt.Printf("PARAMS:\n%s\n", strings.Join(flagHelp, "\n\n")) return nil }
c180792
for i, a := range resource.Actions { supported[i] = a.Name } return nil, nil, fmt.Errorf("Unknown %s action '%s'. Supported actions are: %s", resource.Name, actionName, strings.Join(supported, ", ")) } path, err := action.URL(vars) if err != nil { return nil, nil, err } flags := values[cmd] return &CommandTarget{resource, action, path, flags.Href}, flags.Params, nil }
c180793
them found := false for _, v := range param.ValidValues { if v == value { found = true break } } if !found { return fmt.Errorf("Invalid value for '%s', value must be one of %s, value provided was '%s'", param.Name, strings.Join(param.ValidValues, ", "), value) } } return nil }
c180794
= append(a, param) } else { query[name] = []interface{}{q, param} } } else { query[name] = param } } } return query, nil }
c180795
if _, err := Normalize(payload, name, param); err != nil { return nil, err } } } return payload, nil }
c180796
interface{}(":" + v) } subPattern := pattern2.Pattern pat2 := fmt.Sprintf(subPattern, ivars...) if pat == pat2 { return pat, true } } } } return pattern, false }
c180797
if len(line) > 0 && !blankRegexp.MatchString(line) { fullLines[i] = line i++ } } return strings.Join(fullLines[:i], "\n") }
c180798
:= os.Stat(file) return err == nil }
c180799
&AnalysisSnapshotLocator{Href(href), api} }