_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q35600
GetAWSServiceCatalogPortfolioShareWithName
train
func (t *Template) GetAWSServiceCatalogPortfolioShareWithName(name string) (*resources.AWSServiceCatalogPortfolioShare, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceCatalogPortfolioShare: return resource, nil } } return nil, fmt.Errorf("res...
go
{ "resource": "" }
q35601
GetAllAWSServiceCatalogTagOptionResources
train
func (t *Template) GetAllAWSServiceCatalogTagOptionResources() map[string]*resources.AWSServiceCatalogTagOption { results := map[string]*resources.AWSServiceCatalogTagOption{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServiceCatalogTagOption: results[name] ...
go
{ "resource": "" }
q35602
GetAWSServiceCatalogTagOptionWithName
train
func (t *Template) GetAWSServiceCatalogTagOptionWithName(name string) (*resources.AWSServiceCatalogTagOption, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceCatalogTagOption: return resource, nil } } return nil, fmt.Errorf("resource %q of typ...
go
{ "resource": "" }
q35603
GetAllAWSServiceCatalogTagOptionAssociationResources
train
func (t *Template) GetAllAWSServiceCatalogTagOptionAssociationResources() map[string]*resources.AWSServiceCatalogTagOptionAssociation { results := map[string]*resources.AWSServiceCatalogTagOptionAssociation{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServiceCa...
go
{ "resource": "" }
q35604
GetAWSServiceCatalogTagOptionAssociationWithName
train
func (t *Template) GetAWSServiceCatalogTagOptionAssociationWithName(name string) (*resources.AWSServiceCatalogTagOptionAssociation, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceCatalogTagOptionAssociation: return resource, nil } } return ni...
go
{ "resource": "" }
q35605
GetAllAWSServiceDiscoveryHttpNamespaceResources
train
func (t *Template) GetAllAWSServiceDiscoveryHttpNamespaceResources() map[string]*resources.AWSServiceDiscoveryHttpNamespace { results := map[string]*resources.AWSServiceDiscoveryHttpNamespace{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryHttpName...
go
{ "resource": "" }
q35606
GetAWSServiceDiscoveryHttpNamespaceWithName
train
func (t *Template) GetAWSServiceDiscoveryHttpNamespaceWithName(name string) (*resources.AWSServiceDiscoveryHttpNamespace, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryHttpNamespace: return resource, nil } } return nil, fmt.Errorf("...
go
{ "resource": "" }
q35607
GetAllAWSServiceDiscoveryInstanceResources
train
func (t *Template) GetAllAWSServiceDiscoveryInstanceResources() map[string]*resources.AWSServiceDiscoveryInstance { results := map[string]*resources.AWSServiceDiscoveryInstance{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryInstance: results[na...
go
{ "resource": "" }
q35608
GetAWSServiceDiscoveryInstanceWithName
train
func (t *Template) GetAWSServiceDiscoveryInstanceWithName(name string) (*resources.AWSServiceDiscoveryInstance, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryInstance: return resource, nil } } return nil, fmt.Errorf("resource %q of ...
go
{ "resource": "" }
q35609
GetAllAWSServiceDiscoveryPrivateDnsNamespaceResources
train
func (t *Template) GetAllAWSServiceDiscoveryPrivateDnsNamespaceResources() map[string]*resources.AWSServiceDiscoveryPrivateDnsNamespace { results := map[string]*resources.AWSServiceDiscoveryPrivateDnsNamespace{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServic...
go
{ "resource": "" }
q35610
GetAWSServiceDiscoveryPrivateDnsNamespaceWithName
train
func (t *Template) GetAWSServiceDiscoveryPrivateDnsNamespaceWithName(name string) (*resources.AWSServiceDiscoveryPrivateDnsNamespace, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryPrivateDnsNamespace: return resource, nil } } return...
go
{ "resource": "" }
q35611
GetAllAWSServiceDiscoveryPublicDnsNamespaceResources
train
func (t *Template) GetAllAWSServiceDiscoveryPublicDnsNamespaceResources() map[string]*resources.AWSServiceDiscoveryPublicDnsNamespace { results := map[string]*resources.AWSServiceDiscoveryPublicDnsNamespace{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServiceDi...
go
{ "resource": "" }
q35612
GetAWSServiceDiscoveryPublicDnsNamespaceWithName
train
func (t *Template) GetAWSServiceDiscoveryPublicDnsNamespaceWithName(name string) (*resources.AWSServiceDiscoveryPublicDnsNamespace, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryPublicDnsNamespace: return resource, nil } } return ni...
go
{ "resource": "" }
q35613
GetAllAWSServiceDiscoveryServiceResources
train
func (t *Template) GetAllAWSServiceDiscoveryServiceResources() map[string]*resources.AWSServiceDiscoveryService { results := map[string]*resources.AWSServiceDiscoveryService{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryService: results[name] ...
go
{ "resource": "" }
q35614
GetAWSServiceDiscoveryServiceWithName
train
func (t *Template) GetAWSServiceDiscoveryServiceWithName(name string) (*resources.AWSServiceDiscoveryService, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSServiceDiscoveryService: return resource, nil } } return nil, fmt.Errorf("resource %q of typ...
go
{ "resource": "" }
q35615
GetAllAWSStepFunctionsActivityResources
train
func (t *Template) GetAllAWSStepFunctionsActivityResources() map[string]*resources.AWSStepFunctionsActivity { results := map[string]*resources.AWSStepFunctionsActivity{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSStepFunctionsActivity: results[name] = resour...
go
{ "resource": "" }
q35616
GetAWSStepFunctionsActivityWithName
train
func (t *Template) GetAWSStepFunctionsActivityWithName(name string) (*resources.AWSStepFunctionsActivity, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSStepFunctionsActivity: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSS...
go
{ "resource": "" }
q35617
GetAllAWSStepFunctionsStateMachineResources
train
func (t *Template) GetAllAWSStepFunctionsStateMachineResources() map[string]*resources.AWSStepFunctionsStateMachine { results := map[string]*resources.AWSStepFunctionsStateMachine{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSStepFunctionsStateMachine: result...
go
{ "resource": "" }
q35618
GetAWSStepFunctionsStateMachineWithName
train
func (t *Template) GetAWSStepFunctionsStateMachineWithName(name string) (*resources.AWSStepFunctionsStateMachine, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSStepFunctionsStateMachine: return resource, nil } } return nil, fmt.Errorf("resource %q ...
go
{ "resource": "" }
q35619
GetAllAWSWAFByteMatchSetResources
train
func (t *Template) GetAllAWSWAFByteMatchSetResources() map[string]*resources.AWSWAFByteMatchSet { results := map[string]*resources.AWSWAFByteMatchSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFByteMatchSet: results[name] = resource } } return result...
go
{ "resource": "" }
q35620
GetAWSWAFByteMatchSetWithName
train
func (t *Template) GetAWSWAFByteMatchSetWithName(name string) (*resources.AWSWAFByteMatchSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFByteMatchSet: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFByteMatchSet not...
go
{ "resource": "" }
q35621
GetAllAWSWAFIPSetResources
train
func (t *Template) GetAllAWSWAFIPSetResources() map[string]*resources.AWSWAFIPSet { results := map[string]*resources.AWSWAFIPSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFIPSet: results[name] = resource } } return results }
go
{ "resource": "" }
q35622
GetAWSWAFIPSetWithName
train
func (t *Template) GetAWSWAFIPSetWithName(name string) (*resources.AWSWAFIPSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFIPSet: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFIPSet not found", name) }
go
{ "resource": "" }
q35623
GetAllAWSWAFRuleResources
train
func (t *Template) GetAllAWSWAFRuleResources() map[string]*resources.AWSWAFRule { results := map[string]*resources.AWSWAFRule{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRule: results[name] = resource } } return results }
go
{ "resource": "" }
q35624
GetAWSWAFRuleWithName
train
func (t *Template) GetAWSWAFRuleWithName(name string) (*resources.AWSWAFRule, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRule: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFRule not found", name) }
go
{ "resource": "" }
q35625
GetAllAWSWAFSizeConstraintSetResources
train
func (t *Template) GetAllAWSWAFSizeConstraintSetResources() map[string]*resources.AWSWAFSizeConstraintSet { results := map[string]*resources.AWSWAFSizeConstraintSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFSizeConstraintSet: results[name] = resource ...
go
{ "resource": "" }
q35626
GetAWSWAFSizeConstraintSetWithName
train
func (t *Template) GetAWSWAFSizeConstraintSetWithName(name string) (*resources.AWSWAFSizeConstraintSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFSizeConstraintSet: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFS...
go
{ "resource": "" }
q35627
GetAllAWSWAFSqlInjectionMatchSetResources
train
func (t *Template) GetAllAWSWAFSqlInjectionMatchSetResources() map[string]*resources.AWSWAFSqlInjectionMatchSet { results := map[string]*resources.AWSWAFSqlInjectionMatchSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFSqlInjectionMatchSet: results[name] ...
go
{ "resource": "" }
q35628
GetAWSWAFSqlInjectionMatchSetWithName
train
func (t *Template) GetAWSWAFSqlInjectionMatchSetWithName(name string) (*resources.AWSWAFSqlInjectionMatchSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFSqlInjectionMatchSet: return resource, nil } } return nil, fmt.Errorf("resource %q of typ...
go
{ "resource": "" }
q35629
GetAllAWSWAFWebACLResources
train
func (t *Template) GetAllAWSWAFWebACLResources() map[string]*resources.AWSWAFWebACL { results := map[string]*resources.AWSWAFWebACL{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFWebACL: results[name] = resource } } return results }
go
{ "resource": "" }
q35630
GetAWSWAFWebACLWithName
train
func (t *Template) GetAWSWAFWebACLWithName(name string) (*resources.AWSWAFWebACL, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFWebACL: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFWebACL not found", name) }
go
{ "resource": "" }
q35631
GetAllAWSWAFXssMatchSetResources
train
func (t *Template) GetAllAWSWAFXssMatchSetResources() map[string]*resources.AWSWAFXssMatchSet { results := map[string]*resources.AWSWAFXssMatchSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFXssMatchSet: results[name] = resource } } return results }
go
{ "resource": "" }
q35632
GetAWSWAFXssMatchSetWithName
train
func (t *Template) GetAWSWAFXssMatchSetWithName(name string) (*resources.AWSWAFXssMatchSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFXssMatchSet: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFXssMatchSet not fou...
go
{ "resource": "" }
q35633
GetAllAWSWAFRegionalByteMatchSetResources
train
func (t *Template) GetAllAWSWAFRegionalByteMatchSetResources() map[string]*resources.AWSWAFRegionalByteMatchSet { results := map[string]*resources.AWSWAFRegionalByteMatchSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalByteMatchSet: results[name] ...
go
{ "resource": "" }
q35634
GetAWSWAFRegionalByteMatchSetWithName
train
func (t *Template) GetAWSWAFRegionalByteMatchSetWithName(name string) (*resources.AWSWAFRegionalByteMatchSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalByteMatchSet: return resource, nil } } return nil, fmt.Errorf("resource %q of typ...
go
{ "resource": "" }
q35635
GetAllAWSWAFRegionalIPSetResources
train
func (t *Template) GetAllAWSWAFRegionalIPSetResources() map[string]*resources.AWSWAFRegionalIPSet { results := map[string]*resources.AWSWAFRegionalIPSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalIPSet: results[name] = resource } } return re...
go
{ "resource": "" }
q35636
GetAWSWAFRegionalIPSetWithName
train
func (t *Template) GetAWSWAFRegionalIPSetWithName(name string) (*resources.AWSWAFRegionalIPSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalIPSet: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFRegionalIPSet...
go
{ "resource": "" }
q35637
GetAllAWSWAFRegionalRuleResources
train
func (t *Template) GetAllAWSWAFRegionalRuleResources() map[string]*resources.AWSWAFRegionalRule { results := map[string]*resources.AWSWAFRegionalRule{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalRule: results[name] = resource } } return result...
go
{ "resource": "" }
q35638
GetAWSWAFRegionalRuleWithName
train
func (t *Template) GetAWSWAFRegionalRuleWithName(name string) (*resources.AWSWAFRegionalRule, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalRule: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFRegionalRule not...
go
{ "resource": "" }
q35639
GetAllAWSWAFRegionalSizeConstraintSetResources
train
func (t *Template) GetAllAWSWAFRegionalSizeConstraintSetResources() map[string]*resources.AWSWAFRegionalSizeConstraintSet { results := map[string]*resources.AWSWAFRegionalSizeConstraintSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalSizeConstraintSe...
go
{ "resource": "" }
q35640
GetAWSWAFRegionalSizeConstraintSetWithName
train
func (t *Template) GetAWSWAFRegionalSizeConstraintSetWithName(name string) (*resources.AWSWAFRegionalSizeConstraintSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalSizeConstraintSet: return resource, nil } } return nil, fmt.Errorf("res...
go
{ "resource": "" }
q35641
GetAllAWSWAFRegionalSqlInjectionMatchSetResources
train
func (t *Template) GetAllAWSWAFRegionalSqlInjectionMatchSetResources() map[string]*resources.AWSWAFRegionalSqlInjectionMatchSet { results := map[string]*resources.AWSWAFRegionalSqlInjectionMatchSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalSqlInje...
go
{ "resource": "" }
q35642
GetAWSWAFRegionalSqlInjectionMatchSetWithName
train
func (t *Template) GetAWSWAFRegionalSqlInjectionMatchSetWithName(name string) (*resources.AWSWAFRegionalSqlInjectionMatchSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalSqlInjectionMatchSet: return resource, nil } } return nil, fmt.Er...
go
{ "resource": "" }
q35643
GetAllAWSWAFRegionalWebACLResources
train
func (t *Template) GetAllAWSWAFRegionalWebACLResources() map[string]*resources.AWSWAFRegionalWebACL { results := map[string]*resources.AWSWAFRegionalWebACL{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalWebACL: results[name] = resource } } retur...
go
{ "resource": "" }
q35644
GetAWSWAFRegionalWebACLWithName
train
func (t *Template) GetAWSWAFRegionalWebACLWithName(name string) (*resources.AWSWAFRegionalWebACL, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalWebACL: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWAFRegionalWe...
go
{ "resource": "" }
q35645
GetAllAWSWAFRegionalWebACLAssociationResources
train
func (t *Template) GetAllAWSWAFRegionalWebACLAssociationResources() map[string]*resources.AWSWAFRegionalWebACLAssociation { results := map[string]*resources.AWSWAFRegionalWebACLAssociation{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalWebACLAssociatio...
go
{ "resource": "" }
q35646
GetAWSWAFRegionalWebACLAssociationWithName
train
func (t *Template) GetAWSWAFRegionalWebACLAssociationWithName(name string) (*resources.AWSWAFRegionalWebACLAssociation, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalWebACLAssociation: return resource, nil } } return nil, fmt.Errorf("res...
go
{ "resource": "" }
q35647
GetAllAWSWAFRegionalXssMatchSetResources
train
func (t *Template) GetAllAWSWAFRegionalXssMatchSetResources() map[string]*resources.AWSWAFRegionalXssMatchSet { results := map[string]*resources.AWSWAFRegionalXssMatchSet{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWAFRegionalXssMatchSet: results[name] = re...
go
{ "resource": "" }
q35648
GetAWSWAFRegionalXssMatchSetWithName
train
func (t *Template) GetAWSWAFRegionalXssMatchSetWithName(name string) (*resources.AWSWAFRegionalXssMatchSet, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWAFRegionalXssMatchSet: return resource, nil } } return nil, fmt.Errorf("resource %q of type A...
go
{ "resource": "" }
q35649
GetAllAWSWorkSpacesWorkspaceResources
train
func (t *Template) GetAllAWSWorkSpacesWorkspaceResources() map[string]*resources.AWSWorkSpacesWorkspace { results := map[string]*resources.AWSWorkSpacesWorkspace{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AWSWorkSpacesWorkspace: results[name] = resource } ...
go
{ "resource": "" }
q35650
GetAWSWorkSpacesWorkspaceWithName
train
func (t *Template) GetAWSWorkSpacesWorkspaceWithName(name string) (*resources.AWSWorkSpacesWorkspace, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AWSWorkSpacesWorkspace: return resource, nil } } return nil, fmt.Errorf("resource %q of type AWSWorkSpa...
go
{ "resource": "" }
q35651
GetAllAlexaASKSkillResources
train
func (t *Template) GetAllAlexaASKSkillResources() map[string]*resources.AlexaASKSkill { results := map[string]*resources.AlexaASKSkill{} for name, untyped := range t.Resources { switch resource := untyped.(type) { case *resources.AlexaASKSkill: results[name] = resource } } return results }
go
{ "resource": "" }
q35652
GetAlexaASKSkillWithName
train
func (t *Template) GetAlexaASKSkillWithName(name string) (*resources.AlexaASKSkill, error) { if untyped, ok := t.Resources[name]; ok { switch resource := untyped.(type) { case *resources.AlexaASKSkill: return resource, nil } } return nil, fmt.Errorf("resource %q of type AlexaASKSkill not found", name) }
go
{ "resource": "" }
q35653
OpenWithOptions
train
func OpenWithOptions(filename string, options *intrinsics.ProcessorOptions) (*cloudformation.Template, error) { data, err := ioutil.ReadFile(filename) if err != nil { return nil, err } if strings.HasSuffix(filename, ".json") { // This is definitely JSON return ParseJSONWithOptions(data, options) } return...
go
{ "resource": "" }
q35654
MarshalJSON
train
func (r AWSEFSFileSystem) MarshalJSON() ([]byte, error) { type Properties AWSEFSFileSystem return json.Marshal(&struct { Type string Properties Properties DependsOn []string `json:"DependsOn,omitempty"` Metadata map[string]interface{} `json:"Metadata,omitempty"` Dele...
go
{ "resource": "" }
q35655
UnmarshalJSON
train
func (r *AWSEFSFileSystem) UnmarshalJSON(b []byte) error { type Properties AWSEFSFileSystem res := &struct { Type string Properties *Properties DependsOn []string Metadata map[string]interface{} }{} dec := json.NewDecoder(bytes.NewReader(b)) dec.DisallowUnknownFields() // Force error if unknown f...
go
{ "resource": "" }
q35656
condition
train
func condition(name string, input interface{}, template interface{}, options *ProcessorOptions) interface{} { if v, ok := input.(string); ok { if v, ok := retrieveCondition(input, template); ok { return v } if c := getCondition(v, template); c != nil { res := search(c, template, options) // replace th...
go
{ "resource": "" }
q35657
Sub
train
func Sub(value string) string { i := `{ "Fn::Sub" : "` + value + `" }` return base64.StdEncoding.EncodeToString([]byte(i)) }
go
{ "resource": "" }
q35658
Generate
train
func (rg *ResourceGenerator) Generate() error { // Process the primary template first, since the primary template resources // are added to the JSON schema for fragment transform specs fmt.Printf("Downloading cloudformation specification from %s\n", rg.primaryUrl) primaryData, err := rg.downloadSpec(rg.primaryUrl)...
go
{ "resource": "" }
q35659
FindInMap
train
func FindInMap(mapName, topLevelKey, secondLevelKey interface{}) string { return encode(fmt.Sprintf(`{ "Fn::FindInMap" : [ "%v", "%v", "%v" ] }`, mapName, topLevelKey, secondLevelKey)) }
go
{ "resource": "" }
q35660
Select
train
func Select(index interface{}, list []string) string { return encode(fmt.Sprintf(`{ "Fn::Select": [ "%v", [ "%v" ] ] }`, index, strings.Trim(strings.Join(list, `", "`), `, "`))) }
go
{ "resource": "" }
q35661
Init
train
func (p *PartitionedMemoryIdx) Init() error { for _, m := range p.Partition { err := m.Init() if err != nil { return err } } return nil }
go
{ "resource": "" }
q35662
AddOrUpdate
train
func (p *PartitionedMemoryIdx) AddOrUpdate(mkey schema.MKey, data *schema.MetricData, partition int32) (idx.Archive, int32, bool) { return p.Partition[partition].AddOrUpdate(mkey, data, partition) }
go
{ "resource": "" }
q35663
Get
train
func (p *PartitionedMemoryIdx) Get(key schema.MKey) (idx.Archive, bool) { g, _ := errgroup.WithContext(context.Background()) resultChan := make(chan *idx.Archive, len(p.Partition)) for _, m := range p.Partition { m := m g.Go(func() error { if a, ok := m.Get(key); ok { resultChan <- &a } return nil ...
go
{ "resource": "" }
q35664
GetPath
train
func (p *PartitionedMemoryIdx) GetPath(orgId uint32, path string) []idx.Archive { g, _ := errgroup.WithContext(context.Background()) result := make([][]idx.Archive, len(p.Partition)) var i int for _, m := range p.Partition { pos, m := i, m g.Go(func() error { result[pos] = m.GetPath(orgId, path) return ni...
go
{ "resource": "" }
q35665
Prune
train
func (p *PartitionedMemoryIdx) Prune(oldest time.Time) ([]idx.Archive, error) { // Prune each partition sequentially. result := []idx.Archive{} for _, m := range p.Partition { found, err := m.Prune(oldest) if err != nil { return result, err } result = append(result, found...) } return result, nil }
go
{ "resource": "" }
q35666
FindTagValues
train
func (p *PartitionedMemoryIdx) FindTagValues(orgId uint32, tag string, prefix string, expressions []string, from int64, limit uint) ([]string, error) { g, _ := errgroup.WithContext(context.Background()) result := make([][]string, len(p.Partition)) var i int for _, m := range p.Partition { pos, m := i, m g.Go(fu...
go
{ "resource": "" }
q35667
TagDetails
train
func (p *PartitionedMemoryIdx) TagDetails(orgId uint32, key string, filter string, from int64) (map[string]uint64, error) { g, _ := errgroup.WithContext(context.Background()) result := make([]map[string]uint64, len(p.Partition)) var i int for _, m := range p.Partition { pos, m := i, m g.Go(func() error { fou...
go
{ "resource": "" }
q35668
Parse
train
func Parse(e string) (*expr, string, error) { // skip whitespace for len(e) > 1 && e[0] == ' ' { e = e[1:] } if len(e) == 0 { return nil, "", ErrMissingExpr } if '0' <= e[0] && e[0] <= '9' || e[0] == '-' || e[0] == '+' { return parseConst(e) } if val, ok := strToBool(e); ok { // 'false' is 5 chars, '...
go
{ "resource": "" }
q35669
parseArgList
train
func parseArgList(e string) (string, []*expr, map[string]*expr, string, error) { var ( posArgs []*expr namedArgs map[string]*expr ) if e[0] != '(' { panic("arg list should start with paren. calling code should have asserted this") } ArgString := e[1:] e = e[1:] for { var arg *expr var err error ...
go
{ "resource": "" }
q35670
parseString
train
func parseString(s string) (string, string, error) { if s[0] != '\'' && s[0] != '"' { panic("string should start with open quote. calling code should have asserted this") } match := s[0] s = s[1:] var i int for i < len(s) && s[i] != match { i++ } if i == len(s) { return "", "", ErrMissingQuote } ...
go
{ "resource": "" }
q35671
aggKey
train
func aggKey(serie models.Series, nodes []expr) string { metric := extractMetric(serie.Target) if len(metric) == 0 { metric = serie.Tags["name"] } // Trim off tags (if they are there) and split on '.' parts := strings.Split(strings.SplitN(metric, ";", 2)[0], ".") var name []string for _, n := range nodes { if...
go
{ "resource": "" }
q35672
summarizeCons
train
func summarizeCons(series []models.Series) (consolidation.Consolidator, consolidation.Consolidator) { for _, serie := range series { if serie.QueryCons != 0 { return serie.Consolidator, serie.QueryCons } } return series[0].Consolidator, series[0].QueryCons }
go
{ "resource": "" }
q35673
NewCCache
train
func NewCCache() *CCache { if maxSize == 0 { return nil } cc := &CCache{ metricCache: make(map[schema.AMKey]*CCacheMetric), metricRawKeys: make(map[schema.MKey]map[schema.Archive]struct{}), accnt: accnt.NewFlatAccnt(maxSize), stop: make(chan interface{}), tracer: opentracing.No...
go
{ "resource": "" }
q35674
DelMetric
train
func (c *CCache) DelMetric(rawMetric schema.MKey) (int, int) { if c == nil { return 0, 0 } archives, series := 0, 0 c.Lock() defer c.Unlock() archs, ok := c.metricRawKeys[rawMetric] if !ok { return archives, series } metric := schema.AMKey{MKey: rawMetric} for arch := range archs { metric.Archive = a...
go
{ "resource": "" }
q35675
AddIfHot
train
func (c *CCache) AddIfHot(metric schema.AMKey, prev uint32, itergen chunk.IterGen) { if c == nil { return } c.RLock() var met *CCacheMetric var ok bool // if this metric is not cached at all it is not hot if met, ok = c.metricCache[metric]; !ok { c.RUnlock() return } // if the previous chunk is not ca...
go
{ "resource": "" }
q35676
Search
train
func (c *CCache) Search(ctx context.Context, metric schema.AMKey, from, until uint32) (*CCSearchResult, error) { if from >= until { return nil, ErrInvalidRange } res := &CCSearchResult{ From: from, Until: until, } if c == nil { accnt.CacheMetricMiss.Inc() return res, nil } ctx, span := tracing.NewS...
go
{ "resource": "" }
q35677
GC
train
func (ms *AggMetrics) GC() { for { unix := time.Duration(time.Now().UnixNano()) diff := ms.gcInterval - (unix % ms.gcInterval) time.Sleep(diff + time.Minute) log.Info("checking for stale chunks that need persisting.") now := uint32(time.Now().Unix()) chunkMinTs := now - uint32(ms.chunkMaxStale) metricMin...
go
{ "resource": "" }
q35678
printChunkSummary
train
func printChunkSummary(ctx context.Context, store *cassandra.CassandraStore, tables []cassandra.Table, metrics []Metric, groupTTL string) error { now := uint32(time.Now().Unix()) endMonth := now / cassandra.Month_sec for _, tbl := range tables { // per store.FindExistingTables(), actual TTL may be up to 2x what's...
go
{ "resource": "" }
q35679
getMetricName
train
func getMetricName(file string) string { // remove all leading '/' from file name file = strings.TrimPrefix(file, *whisperDirectory) for file[0] == '/' { file = file[1:] } return *namePrefix + strings.Replace(strings.TrimSuffix(file, ".wsp"), "/", ".", -1) }
go
{ "resource": "" }
q35680
getFileListIntoChan
train
func getFileListIntoChan(pos *posTracker, fileChan chan string) { filepath.Walk( *whisperDirectory, func(path string, info os.FileInfo, err error) error { if path == *whisperDirectory { return nil } name := getMetricName(path) if !nameFilter.Match([]byte(getMetricName(name))) { log.Debugf("Skip...
go
{ "resource": "" }
q35681
ConvertTimeout
train
func ConvertTimeout(timeout string, defaultUnit time.Duration) time.Duration { if timeoutI, err := strconv.Atoi(timeout); err == nil { log.Warn("cassandra_store: specifying the timeout as integer is deprecated, please use a duration value") return time.Duration(timeoutI) * defaultUnit } timeoutD, err := time.Par...
go
{ "resource": "" }
q35682
Search
train
func (c *CassandraStore) Search(ctx context.Context, key schema.AMKey, ttl, start, end uint32) ([]chunk.IterGen, error) { table, ok := c.TTLTables[ttl] if !ok { return nil, errTableNotFound } return c.SearchTable(ctx, key, table, start, end) }
go
{ "resource": "" }
q35683
ReadIndexRules
train
func ReadIndexRules(file string) (IndexRules, error) { config, err := configparser.Read(file) if err != nil { return IndexRules{}, err } sections, err := config.AllSections() if err != nil { return IndexRules{}, err } result := NewIndexRules() for _, s := range sections { item := IndexRule{} item.Name...
go
{ "resource": "" }
q35684
Match
train
func (a IndexRules) Match(metric string) (uint16, IndexRule) { for i, s := range a.Rules { if s.Pattern.MatchString(metric) { return uint16(i), s } } return uint16(len(a.Rules)), a.Default }
go
{ "resource": "" }
q35685
Get
train
func (a IndexRules) Get(i uint16) IndexRule { if i >= uint16(len(a.Rules)) { return a.Default } return a.Rules[i] }
go
{ "resource": "" }
q35686
Prunable
train
func (a IndexRules) Prunable() bool { for _, r := range a.Rules { if r.MaxStale > 0 { return true } } return (a.Default.MaxStale > 0) }
go
{ "resource": "" }
q35687
Cutoffs
train
func (a IndexRules) Cutoffs(now time.Time) []int64 { out := make([]int64, len(a.Rules)+1) for i := 0; i <= len(a.Rules); i++ { var rule IndexRule if i < len(a.Rules) { rule = a.Rules[i] } else { rule = a.Default } if rule.MaxStale == 0 { out[i] = 0 } else { out[i] = int64(now.Add(rule.MaxStale...
go
{ "resource": "" }
q35688
newplan
train
func newplan(e *expr, context Context, stable bool, reqs []Req) (GraphiteFunc, []Req, error) { if e.etype != etFunc && e.etype != etName { return nil, nil, errors.New("request must be a function call or metric pattern") } if e.etype == etName { req := NewReq(e.str, context.from, context.to, context.consol) req...
go
{ "resource": "" }
q35689
newplanFunc
train
func newplanFunc(e *expr, fn GraphiteFunc, context Context, stable bool, reqs []Req) ([]Req, error) { // first comes the interesting task of validating the arguments as specified by the function, // against the arguments that were parsed. argsExp, _ := fn.Signature() var err error // note: // * signature may ha...
go
{ "resource": "" }
q35690
AggBoundary
train
func AggBoundary(ts uint32, span uint32) uint32 { return ts + span - ((ts-1)%span + 1) }
go
{ "resource": "" }
q35691
flush
train
func (agg *Aggregator) flush() { if agg.minMetric != nil { agg.minMetric.Add(agg.currentBoundary, agg.agg.Min) } if agg.maxMetric != nil { agg.maxMetric.Add(agg.currentBoundary, agg.agg.Max) } if agg.sumMetric != nil { agg.sumMetric.Add(agg.currentBoundary, agg.agg.Sum) } if agg.cntMetric != nil { agg.cn...
go
{ "resource": "" }
q35692
GC
train
func (agg *Aggregator) GC(now, chunkMinTs, metricMinTs, lastWriteTime uint32) (uint32, bool) { var points uint32 stale := true if lastWriteTime+agg.span > chunkMinTs { // Last datapoint was less than one aggregation window before chunkMinTs, hold out for more data return 0, false } // Haven't seen datapoints...
go
{ "resource": "" }
q35693
getTotalSeries
train
func getTotalSeries(totalSeriesLists, include map[string][]models.Series, cache map[Req][]models.Series) map[string]models.Series { totalSeries := make(map[string]models.Series, len(totalSeriesLists)) for key := range totalSeriesLists { if _, ok := include[key]; ok { totalSeries[key] = sumSeries(totalSeriesLists...
go
{ "resource": "" }
q35694
sumSeries
train
func sumSeries(series []models.Series, cache map[Req][]models.Series) models.Series { if len(series) == 1 { return series[0] } out := pointSlicePool.Get().([]schema.Point) crossSeriesSum(series, &out) var queryPatts []string Loop: for _, v := range series { // avoid duplicates for _, qp := range queryPatts...
go
{ "resource": "" }
q35695
getPercentileValue
train
func getPercentileValue(datapoints []schema.Point, n float64, sortedDatapointVals []float64) float64 { sortedDatapointVals = sortedDatapointVals[:0] for _, p := range datapoints { if !math.IsNaN(p.Val) { sortedDatapointVals = append(sortedDatapointVals, p.Val) } } sort.Float64s(sortedDatapointVals) index ...
go
{ "resource": "" }
q35696
MarshalJSON
train
func (n NodeMode) MarshalJSON() ([]byte, error) { buffer := bytes.NewBufferString(`"`) buffer.WriteString(n.String()) buffer.WriteString(`"`) return buffer.Bytes(), nil }
go
{ "resource": "" }
q35697
UnmarshalJSON
train
func (n *NodeMode) UnmarshalJSON(b []byte) error { var j string err := json.Unmarshal(b, &j) if err != nil { return err } *n, err = NodeModeFromString(j) return err }
go
{ "resource": "" }
q35698
UnmarshalJSON
train
func (n *NodeState) UnmarshalJSON(data []byte) error { s := string(data) switch s { case "0", `"NodeNotReady"`: *n = NodeNotReady case "1", `"NodeReady"`: *n = NodeReady case "2", `"NodeUnreachable"`: *n = NodeUnreachable default: return fmt.Errorf("unrecognized NodeState %q", s) } return nil }
go
{ "resource": "" }
q35699
readyStateGCHandler
train
func (n HTTPNode) readyStateGCHandler() { if gcPercent == gcPercentNotReady { return } var err error if n.IsReady() { prev := debug.SetGCPercent(gcPercent) if prev != gcPercent { log.Infof("CLU: node is ready. changing GOGC from %d to %d", prev, gcPercent) err = os.Setenv("GOGC", strconv.Itoa(gcPercent)...
go
{ "resource": "" }