github.com/sleungcy-sap/cli@v7.1.0+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) containsGlobalFields() []string {
    32  	globalFields := []string{}
    33  
    34  	if raw.GlobalBuildpack != nil {
    35  		globalFields = append(globalFields, "buildpack")
    36  	}
    37  	if raw.GlobalCommand != nil {
    38  		globalFields = append(globalFields, "command")
    39  	}
    40  	if raw.GlobalDiskQuota != nil {
    41  		globalFields = append(globalFields, "disk_quota")
    42  	}
    43  	if raw.GlobalDocker != nil {
    44  		globalFields = append(globalFields, "docker")
    45  	}
    46  	if raw.GlobalDomain != nil {
    47  		globalFields = append(globalFields, "domain")
    48  	}
    49  	if raw.GlobalDomains != nil {
    50  		globalFields = append(globalFields, "domains")
    51  	}
    52  	if raw.GlobalEnv != nil {
    53  		globalFields = append(globalFields, "env")
    54  	}
    55  	if raw.GlobalHealthCheckHTTPEndpoint != nil {
    56  		globalFields = append(globalFields, "health-check-http-endpoint")
    57  	}
    58  	if raw.GlobalHealthCheckTimeout != nil {
    59  		globalFields = append(globalFields, "timeout")
    60  	}
    61  	if raw.GlobalHealthCheckType != nil {
    62  		globalFields = append(globalFields, "health-check-type")
    63  	}
    64  	if raw.GlobalHost != nil {
    65  		globalFields = append(globalFields, "host")
    66  	}
    67  	if raw.GlobalHosts != nil {
    68  		globalFields = append(globalFields, "hosts")
    69  	}
    70  	if raw.GlobalInstances != nil {
    71  		globalFields = append(globalFields, "instances")
    72  	}
    73  	if raw.GlobalMemory != nil {
    74  		globalFields = append(globalFields, "memory")
    75  	}
    76  	if raw.GlobalName != nil {
    77  		globalFields = append(globalFields, "name")
    78  	}
    79  	if raw.GlobalNoHostname != nil {
    80  		globalFields = append(globalFields, "no-hostname")
    81  	}
    82  	if raw.GlobalNoRoute != nil {
    83  		globalFields = append(globalFields, "no-route")
    84  	}
    85  	if raw.GlobalPath != nil {
    86  		globalFields = append(globalFields, "path")
    87  	}
    88  	if raw.GlobalRandomRoute != nil {
    89  		globalFields = append(globalFields, "random-route")
    90  	}
    91  	if raw.GlobalRoutes != nil {
    92  		globalFields = append(globalFields, "routes")
    93  	}
    94  	if raw.GlobalServices != nil {
    95  		globalFields = append(globalFields, "services")
    96  	}
    97  	if raw.GlobalStack != nil {
    98  		globalFields = append(globalFields, "stack")
    99  	}
   100  	return globalFields
   101  }
   102  
   103  func (raw rawManifest) containsInheritanceField() bool {
   104  	return raw.Inherit != nil
   105  }