Skip to content

Commit

Permalink
feat: [CDS-98117]: Provider API terraform onboarding (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakkasat authored Oct 11, 2024
1 parent fa93ec1 commit 3c34c2a
Show file tree
Hide file tree
Showing 17 changed files with 1,041 additions and 0 deletions.
696 changes: 696 additions & 0 deletions harness/nextgen/api_provider.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions harness/nextgen/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ type APIClient struct {

ServiceOverridesApi *ServiceOverridesApiService
OverridesApi *OverridesApiService
ProviderApi *ProviderApiService

SettingsApi *SettingsApiService

Expand Down Expand Up @@ -318,6 +319,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
c.ServicesApi = (*ServicesApiService)(&c.common)
c.ServiceOverridesApi = (*ServiceOverridesApiService)(&c.common)
c.OverridesApi = (*OverridesApiService)(&c.common)
c.ProviderApi = (*ProviderApiService)(&c.common)
c.SettingsApi = (*SettingsApiService)(&c.common)
c.SloApi = (*SloApiService)(&c.common)
c.SrmNotificationApiService = (*SrmNotificationApiService)(&c.common)
Expand Down
17 changes: 17 additions & 0 deletions harness/nextgen/enum_provider_type.go
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)
}
19 changes: 19 additions & 0 deletions harness/nextgen/model_bitbucket_server_response.go
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"`
}
25 changes: 25 additions & 0 deletions harness/nextgen/model_provider_create_request.go
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:"-"`
}
18 changes: 18 additions & 0 deletions harness/nextgen/model_provider_create_response.go
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"`
}
19 changes: 19 additions & 0 deletions harness/nextgen/model_provider_delete_response.go
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"`
}
28 changes: 28 additions & 0 deletions harness/nextgen/model_provider_get_response.go
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:"-"`
}
18 changes: 18 additions & 0 deletions harness/nextgen/model_provider_response.go
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"`
}
53 changes: 53 additions & 0 deletions harness/nextgen/model_provider_serializer.go
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))
}
23 changes: 23 additions & 0 deletions harness/nextgen/model_provider_update_request.go
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:"-"`
}
18 changes: 18 additions & 0 deletions harness/nextgen/model_provider_update_response.go
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"`
}
21 changes: 21 additions & 0 deletions harness/nextgen/model_response_create_provider.go
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"`
}
21 changes: 21 additions & 0 deletions harness/nextgen/model_response_delete_provider.go
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"`
}
21 changes: 21 additions & 0 deletions harness/nextgen/model_response_get_provider.go
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"`
}
21 changes: 21 additions & 0 deletions harness/nextgen/model_response_list_provider.go
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"`
}
21 changes: 21 additions & 0 deletions harness/nextgen/model_response_update_provider.go
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"`
}

0 comments on commit 3c34c2a

Please sign in to comment.