-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(gce): introduce a WaitableComputeOperation (#3715)
* refactor(gce): move the GoogleServerGroupManagers and related classes * refactor(gce): introduce a WaitableComputeOperation
- Loading branch information
Showing
17 changed files
with
127 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ups/GoogleServerGroupManagersFactory.java → ...ute/GoogleServerGroupManagersFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ups/GoogleServerGroupOperationPoller.java → ...ute/GoogleServerGroupOperationPoller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...e/src/main/groovy/com/netflix/spinnaker/clouddriver/google/compute/RegionalOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.netflix.spinnaker.clouddriver.google.compute; | ||
|
||
import com.google.api.services.compute.model.Operation; | ||
import com.netflix.spinnaker.clouddriver.data.task.Task; | ||
import com.netflix.spinnaker.clouddriver.google.deploy.GCEUtil; | ||
import com.netflix.spinnaker.clouddriver.google.deploy.GoogleOperationPoller; | ||
import com.netflix.spinnaker.clouddriver.google.security.GoogleNamedAccountCredentials; | ||
|
||
class RegionalOperation implements WaitableComputeOperation { | ||
|
||
private final Operation operation; | ||
private final GoogleNamedAccountCredentials credentials; | ||
private final GoogleOperationPoller poller; | ||
|
||
RegionalOperation( | ||
Operation operation, | ||
GoogleNamedAccountCredentials credentials, | ||
GoogleOperationPoller poller) { | ||
this.operation = operation; | ||
this.credentials = credentials; | ||
this.poller = poller; | ||
} | ||
|
||
@Override | ||
public Operation waitForDone(Task task, String phase) { | ||
return poller.waitForRegionalOperation( | ||
credentials.getCompute(), | ||
credentials.getProject(), | ||
operation.getRegion(), | ||
operation.getName(), | ||
/* timeoutSeconds= */ null, | ||
task, | ||
GCEUtil.getLocalName(operation.getTargetLink()), | ||
phase); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...ain/groovy/com/netflix/spinnaker/clouddriver/google/compute/WaitableComputeOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.netflix.spinnaker.clouddriver.google.compute; | ||
|
||
import com.google.api.services.compute.model.Operation; | ||
import com.netflix.spinnaker.clouddriver.data.task.Task; | ||
|
||
public interface WaitableComputeOperation { | ||
|
||
Operation waitForDone(Task task, String phase); | ||
} |
36 changes: 36 additions & 0 deletions
36
...ogle/src/main/groovy/com/netflix/spinnaker/clouddriver/google/compute/ZonalOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.netflix.spinnaker.clouddriver.google.compute; | ||
|
||
import com.google.api.services.compute.model.Operation; | ||
import com.netflix.spinnaker.clouddriver.data.task.Task; | ||
import com.netflix.spinnaker.clouddriver.google.deploy.GCEUtil; | ||
import com.netflix.spinnaker.clouddriver.google.deploy.GoogleOperationPoller; | ||
import com.netflix.spinnaker.clouddriver.google.security.GoogleNamedAccountCredentials; | ||
|
||
class ZonalOperation implements WaitableComputeOperation { | ||
|
||
private final Operation operation; | ||
private final GoogleNamedAccountCredentials credentials; | ||
private final GoogleOperationPoller poller; | ||
|
||
ZonalOperation( | ||
Operation operation, | ||
GoogleNamedAccountCredentials credentials, | ||
GoogleOperationPoller poller) { | ||
this.operation = operation; | ||
this.credentials = credentials; | ||
this.poller = poller; | ||
} | ||
|
||
@Override | ||
public Operation waitForDone(Task task, String phase) { | ||
return poller.waitForZonalOperation( | ||
credentials.getCompute(), | ||
credentials.getProject(), | ||
GCEUtil.getLocalName(operation.getZone()), | ||
operation.getName(), | ||
/* timeoutSeconds= */ null, | ||
task, | ||
GCEUtil.getLocalName(operation.getTargetLink()), | ||
phase); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...innaker/clouddriver/google/deploy/converters/SetStatefulDiskAtomicOperationConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.