-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [CDS-98117]: Provider API terraform onboarding (#583)
- Loading branch information
1 parent
fa93ec1
commit 3c34c2a
Showing
17 changed files
with
1,041 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package nextgen | ||
|
||
type ProviderType string | ||
|
||
var ProviderTypes = struct { | ||
BitbucketServer ProviderType | ||
}{ | ||
BitbucketServer: "BITBUCKET_SERVER", | ||
} | ||
|
||
var ProviderTypeValues = []string{ | ||
ProviderTypes.BitbucketServer.String(), | ||
} | ||
|
||
func (e ProviderType) String() string { | ||
return string(e) | ||
} |
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,19 @@ | ||
/* | ||
* Harness NextGen Software Delivery Platform API Reference | ||
* | ||
* This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: <security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type BitbucketServerSpec struct { | ||
Domain string `json:"domain,omitempty"` | ||
DelegateSelectors []string `json:"delegateSelectors,omitempty"` | ||
SecretManagerRef string `json:"secretManagerRef,omitempty"` | ||
ClientId string `json:"clientId,omitempty"` | ||
ClientSecretRef string `json:"clientSecretRef,omitempty"` | ||
Type_ ProviderType `json:"type"` | ||
} |
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,25 @@ | ||
/* | ||
* Harness NextGen Software Delivery Platform API Reference | ||
* | ||
* This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of the breaking change with respect to the generated code stub | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
import "encoding/json" | ||
|
||
type ProviderCreateRequest struct { | ||
// Name for the Entity. | ||
Name string `json:"name,omitempty"` | ||
// Identifier for the Entity. | ||
Identifier string `json:"identifier,omitempty"` | ||
// Description for the Entity. | ||
Description string `json:"description,omitempty"` | ||
// Provider Info Details of the Entity. | ||
Spec json.RawMessage `json:"spec"` | ||
// Bitbucket Server Spec | ||
BitbucketServerSpec *BitbucketServerSpec `json:"-"` | ||
} |
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,18 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderCreateApiResponse struct { | ||
Identifier string `json:"identifier,omitempty"` | ||
} |
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,19 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderDeleteApiResponse struct { | ||
Identifier string `json:"identifier,omitempty"` | ||
SuccessfullyDeleted bool `json:"successfullyDeleted,omitempty"` | ||
} |
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,28 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
import "encoding/json" | ||
|
||
type Provider struct { | ||
Identifier string `json:"identifier,omitempty"` | ||
AccountIdentifier string `json:"accountIdentifier,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Description string `json:"description,omitempty"` | ||
LastModifiedAt int64 `json:"lastModifiedAt,omitempty"` | ||
Type_ ProviderType `json:"type"` | ||
Spec json.RawMessage `json:"providerResponseInfo"` | ||
|
||
BitbucketServerSpec *BitbucketServerSpec `json:"-"` | ||
} |
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,18 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderApiResponse struct { | ||
Identifier string `json:"identifier,omitempty"` | ||
} |
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,53 @@ | ||
package nextgen | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
) | ||
|
||
func (a *Provider) UnmarshalJSON(data []byte) error { | ||
|
||
type Alias Provider | ||
|
||
aux := &struct { | ||
*Alias | ||
}{ | ||
Alias: (*Alias)(a), | ||
} | ||
|
||
err := json.Unmarshal(data, &aux) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
switch a.Type_ { | ||
case ProviderTypes.BitbucketServer: | ||
err = json.Unmarshal(aux.Spec, &a.BitbucketServerSpec) | ||
default: | ||
panic(fmt.Sprintf("unknown provider type %s", a.Type_)) | ||
} | ||
|
||
return err | ||
} | ||
|
||
func (a *Provider) MarshalJSON() ([]byte, error) { | ||
type Alias Provider | ||
|
||
var spec []byte | ||
var err error | ||
|
||
switch a.Type_ { | ||
case ProviderTypes.BitbucketServer: | ||
spec, err = json.Marshal(a.BitbucketServerSpec) | ||
default: | ||
panic(fmt.Sprintf("unknown secret type %s", a.Type_)) | ||
} | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
a.Spec = json.RawMessage(spec) | ||
|
||
return json.Marshal((*Alias)(a)) | ||
} |
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,23 @@ | ||
/* | ||
* Harness NextGen Software Delivery Platform API Reference | ||
* | ||
* This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of the breaking change with respect to the generated code stub | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
import "encoding/json" | ||
|
||
type ProviderUpdateRequest struct { | ||
// Name for the Entity. | ||
Name string `json:"name,omitempty"` | ||
// Description for the Entity. | ||
Description string `json:"description,omitempty"` | ||
// Provider Info Details of the Entity. | ||
Spec json.RawMessage `json:"spec"` | ||
// Bitbucket Server Spec | ||
BitbucketServerSpec *BitbucketServerSpec `json:"-"` | ||
} |
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,18 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderUpdateApiResponse struct { | ||
Identifier string `json:"identifier,omitempty"` | ||
} |
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,21 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderCreateResponse struct { | ||
Status string `json:"status,omitempty"` | ||
Data *ProviderCreateApiResponse `json:"data,omitempty"` | ||
MetaData *interface{} `json:"metaData,omitempty"` | ||
CorrelationId string `json:"correlationId,omitempty"` | ||
} |
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,21 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderDeleteResponse struct { | ||
Status string `json:"status,omitempty"` | ||
Data *ProviderDeleteApiResponse `json:"data,omitempty"` | ||
MetaData *interface{} `json:"metaData,omitempty"` | ||
CorrelationId string `json:"correlationId,omitempty"` | ||
} |
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,21 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderGetResponse struct { | ||
Status string `json:"status,omitempty"` | ||
Data *Provider `json:"data,omitempty"` | ||
MetaData *interface{} `json:"metaData,omitempty"` | ||
CorrelationId string `json:"correlationId,omitempty"` | ||
} |
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,21 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderListResponse struct { | ||
Status string `json:"status,omitempty"` | ||
Data []Provider `json:"data,omitempty"` | ||
MetaData *interface{} `json:"metaData,omitempty"` | ||
CorrelationId string `json:"correlationId,omitempty"` | ||
} |
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,21 @@ | ||
/* | ||
- Harness NextGen Software Delivery Platform API Reference | ||
* | ||
- This is the Open Api Spec 3 for the NextGen Manager. This is under active development. Beware of | ||
the breaking change with respect to the generated code stub # Authentication <!-- ReDoc-Inject: | ||
<security-definitions> --> | ||
* | ||
* API version: 3.0 | ||
* Contact: [email protected] | ||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) | ||
*/ | ||
package nextgen | ||
|
||
type ProviderUpdateResponse struct { | ||
Status string `json:"status,omitempty"` | ||
Data *ProviderUpdateApiResponse `json:"data,omitempty"` | ||
MetaData *interface{} `json:"metaData,omitempty"` | ||
CorrelationId string `json:"correlationId,omitempty"` | ||
} |