@@ -43,18 +43,18 @@ public GCPMetadataConfig(String url) {
43
43
this .url = url ;
44
44
}
45
45
46
- boolean isRunningOnGcp () {
46
+ public boolean isRunningOnGcp () {
47
47
return getProjectId () != null && !getProjectId ().isEmpty ();
48
48
}
49
49
50
50
// Returns null on failure to retrieve from metadata server
51
- String getProjectId () {
51
+ public String getProjectId () {
52
52
return getAttribute ("project/project-id" );
53
53
}
54
54
55
55
// Example response: projects/640212054955/zones/australia-southeast1-a
56
56
// Returns null on failure to retrieve from metadata server
57
- String getZone () {
57
+ public String getZone () {
58
58
String zone = getAttribute ("instance/zone" );
59
59
if (zone != null && zone .contains ("/" )) {
60
60
zone = zone .substring (zone .lastIndexOf ('/' ) + 1 );
@@ -66,7 +66,7 @@ String getZone() {
66
66
// method involve detecting region in GAE standard environment
67
67
// Example response: projects/5689182099321/regions/us-central1
68
68
// Returns null on failure to retrieve from metadata server
69
- String getRegion () {
69
+ public String getRegion () {
70
70
String region = getAttribute ("instance/region" );
71
71
if (region != null && region .contains ("/" )) {
72
72
region = region .substring (region .lastIndexOf ('/' ) + 1 );
@@ -75,7 +75,7 @@ String getRegion() {
75
75
}
76
76
77
77
// Example response: projects/640212054955/machineTypes/e2-medium
78
- String getMachineType () {
78
+ public String getMachineType () {
79
79
String machineType = getAttribute ("instance/machine-type" );
80
80
if (machineType != null && machineType .contains ("/" )) {
81
81
machineType = machineType .substring (machineType .lastIndexOf ('/' ) + 1 );
@@ -84,27 +84,27 @@ String getMachineType() {
84
84
}
85
85
86
86
// Returns null on failure to retrieve from metadata server
87
- String getInstanceId () {
87
+ public String getInstanceId () {
88
88
return getAttribute ("instance/id" );
89
89
}
90
90
91
91
// Returns null on failure to retrieve from metadata server
92
- String getClusterName () {
92
+ public String getClusterName () {
93
93
return getAttribute ("instance/attributes/cluster-name" );
94
94
}
95
95
96
96
// Returns null on failure to retrieve from metadata server
97
- String getClusterLocation () {
97
+ public String getClusterLocation () {
98
98
return getAttribute ("instance/attributes/cluster-location" );
99
99
}
100
100
101
101
// Returns null on failure to retrieve from metadata server
102
- String getInstanceHostName () {
102
+ public String getInstanceHostName () {
103
103
return getAttribute ("instance/hostname" );
104
104
}
105
105
106
106
// Returns null on failure to retrieve from metadata server
107
- String getInstanceName () {
107
+ public String getInstanceName () {
108
108
return getAttribute ("instance/name" );
109
109
}
110
110
0 commit comments