mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-01 20:52:10 -04:00
Check for 404 errors in GCP termination
This commit is contained in:
parent
9f599c3993
commit
c954ec089f
6 changed files with 179 additions and 43 deletions
|
@ -4,8 +4,10 @@ import (
|
|||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"net/http"
|
||||
|
||||
compute "cloud.google.com/go/compute/apiv1"
|
||||
admin "cloud.google.com/go/iam/admin/apiv1"
|
||||
|
@ -15,6 +17,7 @@ import (
|
|||
"github.com/edgelesssys/constellation/internal/state"
|
||||
"go.uber.org/multierr"
|
||||
"golang.org/x/oauth2/google"
|
||||
"google.golang.org/api/googleapi"
|
||||
)
|
||||
|
||||
// Client is a client for the Google Compute Engine.
|
||||
|
@ -318,3 +321,11 @@ func closeAll(closers []closer) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func isNotFoundError(err error) bool {
|
||||
var gAPIErr *googleapi.Error
|
||||
if !errors.As(err, &gAPIErr) {
|
||||
return false
|
||||
}
|
||||
return gAPIErr.Code == http.StatusNotFound
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue