github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/util/manifest/raw_manifest.go (about)

     1  package manifest
     2  
     3  type rawManifest struct {
     4  	Applications []Application `yaml:"applications"`
     5  
     6  	GlobalBuildpack               interface{} `yaml:"buildpack"`
     7  	GlobalCommand                 interface{} `yaml:"command"`
     8  	GlobalDiskQuota               interface{} `yaml:"disk_quota"`
     9  	GlobalDocker                  interface{} `yaml:"docker"`
    10  	GlobalDomain                  interface{} `yaml:"domain"`
    11  	GlobalDomains                 interface{} `yaml:"domains"`
    12  	GlobalEnv                     interface{} `yaml:"env"`
    13  	GlobalHealthCheckHTTPEndpoint interface{} `yaml:"health-check-http-endpoint"`
    14  	GlobalHealthCheckTimeout      interface{} `yaml:"timeout"`
    15  	GlobalHealthCheckType         interface{} `yaml:"health-check-type"`
    16  	GlobalHost                    interface{} `yaml:"host"`
    17  	GlobalHosts                   interface{} `yaml:"hosts"`
    18  	GlobalInstances               interface{} `yaml:"instances"`
    19  	GlobalMemory                  interface{} `yaml:"memory"`
    20  	GlobalName                    interface{} `yaml:"name"`
    21  	GlobalNoHostname              interface{} `yaml:"no-hostname"`
    22  	GlobalNoRoute                 interface{} `yaml:"no-route"`
    23  	GlobalPath                    interface{} `yaml:"path"`
    24  	GlobalRandomRoute             interface{} `yaml:"random-route"`
    25  	GlobalRoutes                  interface{} `yaml:"routes"`
    26  	GlobalServices                interface{} `yaml:"services"`
    27  	GlobalStack                   interface{} `yaml:"stack"`
    28  	Inherit                       interface{} `yaml:"inherit"`
    29  }
    30  
    31  func (raw rawManifest) containsInheritanceField() bool {
    32  	return raw.Inherit != nil
    33  }
    34  
    35  func (raw rawManifest) containsGlobalFields() []string {
    36  	globalFields := []string{}
    37  
    38  	if raw.GlobalBuildpack != nil {
    39  		globalFields = append(globalFields, "buildpack")
    40  	}
    41  	if raw.GlobalCommand != nil {
    42  		globalFields = append(globalFields, "command")
    43  	}
    44  	if raw.GlobalDiskQuota != nil {
    45  		globalFields = append(globalFields, "disk_quota")
    46  	}
    47  	if raw.GlobalDocker != nil {
    48  		globalFields = append(globalFields, "docker")
    49  	}
    50  	if raw.GlobalDomain != nil {
    51  		globalFields = append(globalFields, "domain")
    52  	}
    53  	if raw.GlobalDomains != nil {
    54  		globalFields = append(globalFields, "domains")
    55  	}
    56  	if raw.GlobalEnv != nil {
    57  		globalFields = append(globalFields, "env")
    58  	}
    59  	if raw.GlobalHealthCheckHTTPEndpoint != nil {
    60  		globalFields = append(globalFields, "health-check-http-endpoint")
    61  	}
    62  	if raw.GlobalHealthCheckTimeout != nil {
    63  		globalFields = append(globalFields, "timeout")
    64  	}
    65  	if raw.GlobalHealthCheckType != nil {
    66  		globalFields = append(globalFields, "health-check-type")
    67  	}
    68  	if raw.GlobalHost != nil {
    69  		globalFields = append(globalFields, "host")
    70  	}
    71  	if raw.GlobalHosts != nil {
    72  		globalFields = append(globalFields, "hosts")
    73  	}
    74  	if raw.GlobalInstances != nil {
    75  		globalFields = append(globalFields, "instances")
    76  	}
    77  	if raw.GlobalMemory != nil {
    78  		globalFields = append(globalFields, "memory")
    79  	}
    80  	if raw.GlobalName != nil {
    81  		globalFields = append(globalFields, "name")
    82  	}
    83  	if raw.GlobalNoHostname != nil {
    84  		globalFields = append(globalFields, "no-hostname")
    85  	}
    86  	if raw.GlobalNoRoute != nil {
    87  		globalFields = append(globalFields, "no-route")
    88  	}
    89  	if raw.GlobalPath != nil {
    90  		globalFields = append(globalFields, "path")
    91  	}
    92  	if raw.GlobalRandomRoute != nil {
    93  		globalFields = append(globalFields, "random-route")
    94  	}
    95  	if raw.GlobalRoutes != nil {
    96  		globalFields = append(globalFields, "routes")
    97  	}
    98  	if raw.GlobalServices != nil {
    99  		globalFields = append(globalFields, "services")
   100  	}
   101  	if raw.GlobalStack != nil {
   102  		globalFields = append(globalFields, "stack")
   103  	}
   104  	return globalFields
   105  }