in internal/client/connections/custom-connections.go [243:283]
func CreateCustomWithVersion(name string, version string, contents []byte,
serviceAccount string, serviceAccountProject string,
) (err error) {
c := customConnectorOverrides{}
err = json.Unmarshal(contents, &c)
if err != nil {
return err
}
createCustomBody, err := CreateCustom(name, c.Description, c.DisplayName, c.CustomConnectorType, c.Labels)
if err != nil {
return err
}
var createCustomMap map[string]interface{}
err = json.Unmarshal(createCustomBody, &createCustomMap)
if err != nil {
return err
}
// wait for custom connection to be created
if len(strings.Split(fmt.Sprintf("%s", createCustomMap["name"]), "/")) > 4 {
operationName := strings.Split(fmt.Sprintf("%s", createCustomMap["name"]), "/")[5]
err = waitForCustom(operationName)
if err != nil {
return err
}
}
connectionVersionContents, err := json.Marshal(c.CustomConnectorVersion)
if err != nil {
return err
}
_, err = CreateCustomVersion(name, version, connectionVersionContents, serviceAccount, serviceAccountProject)
if err != nil {
return err
}
// wait for custom version to be created
err = waitForCustomVersion(name, version)
return err
}