_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q180700 | parseDataType | test | func (p *ParamAnalyzer) parseDataType(path string, child *gen.ActionParam) gen.DataType {
param := p.rawParams[path].(map[string]interface{})
class := "String"
if c, ok := param["class"].(string); ok {
class = c
}
var res gen.DataType
switch class {
case "Integer":
i := gen.BasicDataType("int")
res = &i
c... | go | {
"resource": ""
} |
q180701 | parseParam | test | func (p *ParamAnalyzer) parseParam(path string, param map[string]interface{}, child *gen.ActionParam) *gen.ActionParam {
dType := p.parseDataType(path, child)
return p.newParam(path, param, dType)
} | go | {
"resource": ""
} |
q180702 | newParam | test | func (p *ParamAnalyzer) newParam(path string, param map[string]interface{}, dType gen.DataType) *gen.ActionParam {
var description, regexp string
var mandatory, nonBlank bool
var validValues []interface{}
if d, ok := param["description"]; ok {
description = d.(string)
}
if m, ok := param["mandatory"]; ok {
ma... | go | {
"resource": ""
} |
q180703 | toGoReturnTypeName | test | func toGoReturnTypeName(name string, slice bool) string {
slicePrefix := ""
if slice {
slicePrefix = "[]"
}
return fmt.Sprintf("%s*%s", slicePrefix, toGoTypeName(name))
} | go | {
"resource": ""
} |
q180704 | toGoTypeName | test | func toGoTypeName(name string) string {
switch name {
case "String", "Symbol":
return "string"
case "Integer":
return "int"
case "Boolean":
return "bool"
case "Struct", "Collection":
panic("Uh oh, trying to infer a go type name for a unnamed struct or collection (" + name + ")")
default:
if strings.Cont... | go | {
"resource": ""
} |
q180705 | prettify | test | func prettify(o interface{}) string {
s, err := json.MarshalIndent(o, "", " ")
if err != nil {
return fmt.Sprintf("%+v", o)
}
return string(s)
} | go | {
"resource": ""
} |
q180706 | isBuiltInType | test | func isBuiltInType(name string) bool {
for _, n := range BuiltInTypes {
if name == n {
return true
}
}
return false
} | go | {
"resource": ""
} |
q180707 | MatchHref | test | func (a *Action) MatchHref(href string) bool {
hrefs := []string{href, href + "/"}
for _, pattern := range a.PathPatterns {
for _, href := range hrefs {
indices := pattern.Regexp.FindStringIndex(href)
// it is only an exact match if the pattern matches from the beginning to the length of the string
if indi... | go | {
"resource": ""
} |
q180708 | Substitute | test | func (p *PathPattern) Substitute(vars []*PathVariable) (string, []string) {
values := make([]interface{}, len(p.Variables))
var missing []string
var used []string
for i, n := range p.Variables {
for _, v := range vars {
if v.Name == n {
values[i] = v.Value
used = append(used, n)
break
}
}
if... | go | {
"resource": ""
} |
q180709 | MarshalJSON | test | func (f *FileUpload) MarshalJSON() ([]byte, error) {
b, err := ioutil.ReadAll(f.Reader)
if err != nil {
return nil, err
}
return json.Marshal(string(b))
} | go | {
"resource": ""
} |
q180710 | writeMultipartParams | test | func writeMultipartParams(w *multipart.Writer, payload APIParams, prefix string) error {
for k, v := range payload {
fieldName := k
if prefix != "" {
fieldName = fmt.Sprintf("%s[%s]", prefix, k)
}
// Add more types as needed. These two cover both CM15 and SS.
switch v.(type) {
case string:
err := w.W... | go | {
"resource": ""
} |
q180711 | PerformRequest | test | func (a *API) PerformRequest(req *http.Request) (*http.Response, error) {
// Sign last so auth headers don't get printed or logged
if a.Auth != nil {
if err := a.Auth.Sign(req); err != nil {
return nil, err
}
}
resp, err := a.Client.Do(req)
if err != nil {
return nil, err
}
return resp, err
} | go | {
"resource": ""
} |
q180712 | PerformRequestWithContext | test | func (a *API) PerformRequestWithContext(ctx context.Context, req *http.Request) (*http.Response, error) {
// Sign last so auth headers don't get printed or logged
if a.Auth != nil {
if err := a.Auth.Sign(req); err != nil {
return nil, err
}
}
resp, err := a.Client.DoWithContext(ctx, req)
if err != nil {
r... | go | {
"resource": ""
} |
q180713 | LoadResponse | test | func (a *API) LoadResponse(resp *http.Response) (interface{}, error) {
defer resp.Body.Close()
var respBody interface{}
jsonResp, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("Failed to read response (%s)", err)
}
if len(jsonResp) > 0 {
err = json.Unmarshal(jsonResp, &respBody)
if... | go | {
"resource": ""
} |
q180714 | ScheduleLocator | test | func (api *API) ScheduleLocator(href string) *ScheduleLocator {
return &ScheduleLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180715 | TemplateLocator | test | func (api *API) TemplateLocator(href string) *TemplateLocator {
return &TemplateLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180716 | fetchDetails | test | func fetchDetails(client *cm15.API, envName string, envDetail EnvironmentDetail, sshConfig *[]SSHConfig) {
for nickname, name := range envDetail.ServerArrays {
// Obtain the resource
instances := serverArray(client, name)
// Obtain the IP address of the first instance (only one instance is considered here -- for... | go | {
"resource": ""
} |
q180717 | buildAliases | test | func buildAliases(sshConfig []SSHConfig, sshOptions, sshUser string) string {
var aliases string
for _, conf := range sshConfig {
aliases = aliases + fmt.Sprintf("alias %v='ssh %v %v@%v'\n", conf.Name, sshOptions, sshUser, conf.IPAddress)
}
return aliases
} | go | {
"resource": ""
} |
q180718 | serverArray | test | func serverArray(client *cm15.API, name string) []*cm15.Instance {
serverArrayLocator := client.ServerArrayLocator("/api/server_arrays")
serverArrays, err := serverArrayLocator.Index(rsapi.APIParams{"view": "default", "filter": []string{"name==" + name}})
if err != nil {
fail("Failed to retrieve server array: %v\n... | go | {
"resource": ""
} |
q180719 | server | test | func server(client *cm15.API, name string) *cm15.Instance {
serverLocator := client.ServerLocator("/api/servers")
servers, err := serverLocator.Index(rsapi.APIParams{"view": "instance_detail", "filter": []string{"name==" + name}})
if err != nil {
fail("Failed to retrieve server: %v\n", err.Error())
}
if len(serv... | go | {
"resource": ""
} |
q180720 | toPackageName | test | func toPackageName(version string) string {
if version == "unversioned" {
return "v0"
}
parts := strings.Split(version, ".")
i := 1
p := parts[len(parts)-i]
for p == "0" && i <= len(parts) {
i++
p = parts[len(parts)-i]
}
version = strings.Join(parts, "_")
return fmt.Sprintf("v%s", version)
} | go | {
"resource": ""
} |
q180721 | loadFile | test | func loadFile(file string) ([]byte, error) {
if _, err := os.Stat(file); err != nil {
return nil, fmt.Errorf("Cannot find '%s'", file)
}
js, err := ioutil.ReadFile(file)
if err != nil {
return nil, fmt.Errorf("Cannot read '%s': %s", file, err)
}
return js, nil
} | go | {
"resource": ""
} |
q180722 | main | test | func main() {
app := kingpin.New("rsc", "A RightScale API client")
app.Writer(os.Stdout)
app.Version(VV)
cmdLine, err := ParseCommandLine(app)
if err != nil {
line := strings.Join(os.Args, " ")
PrintFatal("%s: %s", line, err.Error())
}
resp, err := ExecuteCommand(app, cmdLine)
if err != nil {
PrintFatal... | go | {
"resource": ""
} |
q180723 | runCommand | test | func runCommand(client cmd.CommandClient, cmdLine *cmd.CommandLine) (resp *http.Response, err error) {
cmds := strings.Split(cmdLine.Command, " ")
if cmdLine.ShowHelp {
err = client.ShowCommandHelp(cmdLine.Command)
} else if len(cmds) > 1 && cmds[1] == "actions" {
err = client.ShowAPIActions(cmdLine.Command)
} ... | go | {
"resource": ""
} |
q180724 | CreateJSONResponse | test | func CreateJSONResponse(b []byte) (resp *http.Response) {
// Remove UTF-8 Byte Order Mark if it exists
b = bytes.TrimPrefix(b, []byte{0xef, 0xbb, 0xbf})
resp = &http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBuffer(b)),
}
return resp
} | go | {
"resource": ""
} |
q180725 | AccountLocator | test | func (api *API) AccountLocator(href string) *AccountLocator {
return &AccountLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180726 | AccountGroupLocator | test | func (api *API) AccountGroupLocator(href string) *AccountGroupLocator {
return &AccountGroupLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180727 | AlertLocator | test | func (api *API) AlertLocator(href string) *AlertLocator {
return &AlertLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180728 | AlertSpecLocator | test | func (api *API) AlertSpecLocator(href string) *AlertSpecLocator {
return &AlertSpecLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180729 | AuditEntryLocator | test | func (api *API) AuditEntryLocator(href string) *AuditEntryLocator {
return &AuditEntryLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180730 | BackupLocator | test | func (api *API) BackupLocator(href string) *BackupLocator {
return &BackupLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180731 | ChildAccountLocator | test | func (api *API) ChildAccountLocator(href string) *ChildAccountLocator {
return &ChildAccountLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180732 | CloudLocator | test | func (api *API) CloudLocator(href string) *CloudLocator {
return &CloudLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180733 | CloudAccountLocator | test | func (api *API) CloudAccountLocator(href string) *CloudAccountLocator {
return &CloudAccountLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180734 | CookbookLocator | test | func (api *API) CookbookLocator(href string) *CookbookLocator {
return &CookbookLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180735 | CookbookAttachmentLocator | test | func (api *API) CookbookAttachmentLocator(href string) *CookbookAttachmentLocator {
return &CookbookAttachmentLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180736 | CredentialLocator | test | func (api *API) CredentialLocator(href string) *CredentialLocator {
return &CredentialLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180737 | DatacenterLocator | test | func (api *API) DatacenterLocator(href string) *DatacenterLocator {
return &DatacenterLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180738 | DeploymentLocator | test | func (api *API) DeploymentLocator(href string) *DeploymentLocator {
return &DeploymentLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180739 | HealthCheckLocator | test | func (api *API) HealthCheckLocator(href string) *HealthCheckLocator {
return &HealthCheckLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180740 | IdentityProviderLocator | test | func (api *API) IdentityProviderLocator(href string) *IdentityProviderLocator {
return &IdentityProviderLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180741 | ImageLocator | test | func (api *API) ImageLocator(href string) *ImageLocator {
return &ImageLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180742 | InputLocator | test | func (api *API) InputLocator(href string) *InputLocator {
return &InputLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180743 | InstanceLocator | test | func (api *API) InstanceLocator(href string) *InstanceLocator {
return &InstanceLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180744 | InstanceTypeLocator | test | func (api *API) InstanceTypeLocator(href string) *InstanceTypeLocator {
return &InstanceTypeLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180745 | IpAddressLocator | test | func (api *API) IpAddressLocator(href string) *IpAddressLocator {
return &IpAddressLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180746 | IpAddressBindingLocator | test | func (api *API) IpAddressBindingLocator(href string) *IpAddressBindingLocator {
return &IpAddressBindingLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180747 | MonitoringMetricLocator | test | func (api *API) MonitoringMetricLocator(href string) *MonitoringMetricLocator {
return &MonitoringMetricLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180748 | MultiCloudImageLocator | test | func (api *API) MultiCloudImageLocator(href string) *MultiCloudImageLocator {
return &MultiCloudImageLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180749 | MultiCloudImageMatcherLocator | test | func (api *API) MultiCloudImageMatcherLocator(href string) *MultiCloudImageMatcherLocator {
return &MultiCloudImageMatcherLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180750 | MultiCloudImageSettingLocator | test | func (api *API) MultiCloudImageSettingLocator(href string) *MultiCloudImageSettingLocator {
return &MultiCloudImageSettingLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180751 | NetworkLocator | test | func (api *API) NetworkLocator(href string) *NetworkLocator {
return &NetworkLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180752 | NetworkGatewayLocator | test | func (api *API) NetworkGatewayLocator(href string) *NetworkGatewayLocator {
return &NetworkGatewayLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180753 | NetworkOptionGroupLocator | test | func (api *API) NetworkOptionGroupLocator(href string) *NetworkOptionGroupLocator {
return &NetworkOptionGroupLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180754 | NetworkOptionGroupAttachmentLocator | test | func (api *API) NetworkOptionGroupAttachmentLocator(href string) *NetworkOptionGroupAttachmentLocator {
return &NetworkOptionGroupAttachmentLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180755 | Oauth2Locator | test | func (api *API) Oauth2Locator(href string) *Oauth2Locator {
return &Oauth2Locator{Href(href), api}
} | go | {
"resource": ""
} |
q180756 | PermissionLocator | test | func (api *API) PermissionLocator(href string) *PermissionLocator {
return &PermissionLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180757 | PlacementGroupLocator | test | func (api *API) PlacementGroupLocator(href string) *PlacementGroupLocator {
return &PlacementGroupLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180758 | PreferenceLocator | test | func (api *API) PreferenceLocator(href string) *PreferenceLocator {
return &PreferenceLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180759 | PublicationLocator | test | func (api *API) PublicationLocator(href string) *PublicationLocator {
return &PublicationLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180760 | PublicationLineageLocator | test | func (api *API) PublicationLineageLocator(href string) *PublicationLineageLocator {
return &PublicationLineageLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180761 | RecurringVolumeAttachmentLocator | test | func (api *API) RecurringVolumeAttachmentLocator(href string) *RecurringVolumeAttachmentLocator {
return &RecurringVolumeAttachmentLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180762 | RepositoryLocator | test | func (api *API) RepositoryLocator(href string) *RepositoryLocator {
return &RepositoryLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180763 | RepositoryAssetLocator | test | func (api *API) RepositoryAssetLocator(href string) *RepositoryAssetLocator {
return &RepositoryAssetLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180764 | ResourceGroupLocator | test | func (api *API) ResourceGroupLocator(href string) *ResourceGroupLocator {
return &ResourceGroupLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180765 | RightScriptLocator | test | func (api *API) RightScriptLocator(href string) *RightScriptLocator {
return &RightScriptLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180766 | RightScriptAttachmentLocator | test | func (api *API) RightScriptAttachmentLocator(href string) *RightScriptAttachmentLocator {
return &RightScriptAttachmentLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180767 | RouteLocator | test | func (api *API) RouteLocator(href string) *RouteLocator {
return &RouteLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180768 | RouteTableLocator | test | func (api *API) RouteTableLocator(href string) *RouteTableLocator {
return &RouteTableLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180769 | RunnableBindingLocator | test | func (api *API) RunnableBindingLocator(href string) *RunnableBindingLocator {
return &RunnableBindingLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180770 | SchedulerLocator | test | func (api *API) SchedulerLocator(href string) *SchedulerLocator {
return &SchedulerLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180771 | SecurityGroupLocator | test | func (api *API) SecurityGroupLocator(href string) *SecurityGroupLocator {
return &SecurityGroupLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180772 | SecurityGroupRuleLocator | test | func (api *API) SecurityGroupRuleLocator(href string) *SecurityGroupRuleLocator {
return &SecurityGroupRuleLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180773 | ServerLocator | test | func (api *API) ServerLocator(href string) *ServerLocator {
return &ServerLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180774 | ServerArrayLocator | test | func (api *API) ServerArrayLocator(href string) *ServerArrayLocator {
return &ServerArrayLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180775 | ServerTemplateLocator | test | func (api *API) ServerTemplateLocator(href string) *ServerTemplateLocator {
return &ServerTemplateLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180776 | ServerTemplateMultiCloudImageLocator | test | func (api *API) ServerTemplateMultiCloudImageLocator(href string) *ServerTemplateMultiCloudImageLocator {
return &ServerTemplateMultiCloudImageLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180777 | SessionLocator | test | func (api *API) SessionLocator(href string) *SessionLocator {
return &SessionLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180778 | SshKeyLocator | test | func (api *API) SshKeyLocator(href string) *SshKeyLocator {
return &SshKeyLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180779 | SubnetLocator | test | func (api *API) SubnetLocator(href string) *SubnetLocator {
return &SubnetLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180780 | TagLocator | test | func (api *API) TagLocator(href string) *TagLocator {
return &TagLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180781 | TaskLocator | test | func (api *API) TaskLocator(href string) *TaskLocator {
return &TaskLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180782 | UserLocator | test | func (api *API) UserLocator(href string) *UserLocator {
return &UserLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180783 | UserDataLocator | test | func (api *API) UserDataLocator(href string) *UserDataLocator {
return &UserDataLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180784 | VolumeLocator | test | func (api *API) VolumeLocator(href string) *VolumeLocator {
return &VolumeLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180785 | VolumeAttachmentLocator | test | func (api *API) VolumeAttachmentLocator(href string) *VolumeAttachmentLocator {
return &VolumeAttachmentLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180786 | VolumeSnapshotLocator | test | func (api *API) VolumeSnapshotLocator(href string) *VolumeSnapshotLocator {
return &VolumeSnapshotLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180787 | VolumeTypeLocator | test | func (api *API) VolumeTypeLocator(href string) *VolumeTypeLocator {
return &VolumeTypeLocator{Href(href), api}
} | go | {
"resource": ""
} |
q180788 | RegisterCommands | test | func RegisterCommands(registrar rsapi.APICommandRegistrar) {
commandValues = rsapi.ActionCommands{}
registrar.RegisterActionCommands(APIName, GenMetadata, commandValues)
} | go | {
"resource": ""
} |
q180789 | ShowCommandHelp | test | func (a *API) ShowCommandHelp(cmd string) error {
return a.ShowHelp(cmd, "/rll", commandValues)
} | go | {
"resource": ""
} |
q180790 | ShowAPIActions | test | func (a *API) ShowAPIActions(cmd string) error {
return a.ShowActions(cmd, "/rll", commandValues)
} | go | {
"resource": ""
} |
q180791 | ShowHelp | test | func (a *API) ShowHelp(cmd, hrefPrefix string, values ActionCommands) error {
target, _, err := a.ParseCommandAndFlags(cmd, hrefPrefix, values)
if err != nil {
return err
}
_, action, href := target.Resource, target.Action, target.Href
if len(action.CommandFlags) == 0 {
fmt.Printf("usage: rsc [<FLAGS>] %s %s %... | go | {
"resource": ""
} |
q180792 | ParseCommandAndFlags | test | func (a *API) ParseCommandAndFlags(cmd, hrefPrefix string, values ActionCommands) (*CommandTarget, []string, error) {
resource, vars, err := a.parseResource(cmd, hrefPrefix, values)
if err != nil {
return nil, nil, err
}
var action *metadata.Action
elems := strings.Split(cmd, " ")
actionName := elems[len(elems)... | go | {
"resource": ""
} |
q180793 | validateFlagValue | test | func validateFlagValue(value string, param *metadata.ActionParam) error {
if param.Regexp != nil {
if !param.Regexp.MatchString(value) {
return fmt.Errorf("Invalid value '%s' for '%s', value must validate /%s/",
value, param.Name, param.Regexp.String())
}
}
if param.NonBlank && value == "" {
return fmt.... | go | {
"resource": ""
} |
q180794 | buildQuery | test | func buildQuery(values []APIParams) (APIParams, error) {
query := APIParams{}
for _, value := range values {
// Only one iteration below, flatten params only have one element each
for name, param := range value {
if q, ok := query[name]; ok {
if a, ok := q.([]interface{}); ok {
query[name] = append(a,... | go | {
"resource": ""
} |
q180795 | buildPayload | test | func buildPayload(values []APIParams) (APIParams, error) {
payload := APIParams{}
for _, value := range values {
// Only one iteration below, flatten params only have one element each
for name, param := range value {
if _, err := Normalize(payload, name, param); err != nil {
return nil, err
}
}
}
re... | go | {
"resource": ""
} |
q180796 | shortenPattern | test | func shortenPattern(res *metadata.Resource, pattern, suffix string) (string, bool) {
if strings.HasSuffix(pattern, suffix) {
pat := strings.TrimSuffix(pattern, suffix)
for _, action := range res.Actions {
for _, pattern2 := range action.PathPatterns {
vars := pattern2.Variables
ivars := make([]interface... | go | {
"resource": ""
} |
q180797 | cleanDescription | test | func cleanDescription(doc string) string {
docBits := strings.Split(doc, "Required security scope")
doc = docBits[0]
lines := strings.Split(doc, "\n")
fullLines := make([]string, len(lines))
i := 0
for _, line := range lines {
if len(line) > 0 && !blankRegexp.MatchString(line) {
fullLines[i] = line
i++
... | go | {
"resource": ""
} |
q180798 | fileExists | test | func fileExists(file string) bool {
_, err := os.Stat(file)
return err == nil
} | go | {
"resource": ""
} |
q180799 | AnalysisSnapshotLocator | test | func (api *API) AnalysisSnapshotLocator(href string) *AnalysisSnapshotLocator {
return &AnalysisSnapshotLocator{Href(href), api}
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.