diff --git a/harness/nextgen/api_provider.go b/harness/nextgen/api_provider.go new file mode 100644 index 00000000..7fd92953 --- /dev/null +++ b/harness/nextgen/api_provider.go @@ -0,0 +1,696 @@ +/* + - 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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +*/ +package nextgen + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "strings" + + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type ProviderApiService service + +/* +ProviderApiService Create an Provider Entity + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. +Passed from http.Request or context.Background(). + * @param accountIdentifier + * @param optional nil or *ProviderApiProviderOpts - Optional Parameters: + * @param "Body" (optional.Interface of ProviderRequestDtov2) - +@return ProviderCreateResponse +*/ + +type ProviderApiCreateProviderOpts struct { + Body optional.Interface +} + +func (a *ProviderApiService) CreateProvider(ctx context.Context, accountIdentifier string, localVarOptionals *ProviderApiCreateProviderOpts) (ProviderCreateResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ProviderCreateResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ng/api/provider" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody := localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, + localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ProviderCreateResponse + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ProviderApiService Delete a Provider entity + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. +Passed from http.Request or context.Background(). + * @param providerIdentifier + * @param accountIdentifier +@return ProviderDeleteResponse +*/ + +func (a *ProviderApiService) DeleteProvider(ctx context.Context, providerIdentifier string, accountIdentifier string) (ProviderDeleteResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ProviderDeleteResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ng/api/provider/{providerIdentifier}" + localVarPath = strings.Replace(localVarPath, "{"+"providerIdentifier"+"}", fmt.Sprintf("%v", + providerIdentifier), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, + localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ResponseDtoBoolean + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ProviderApiService Gets Provider by Identifier + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. +Passed from http.Request or context.Background(). + * @param providerIdentifier + * @param accountIdentifier +@return ProviderGetResponse +*/ + +func (a *ProviderApiService) GetProvider(ctx context.Context, providerIdentifier string, accountIdentifier string) (ProviderGetResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ProviderGetResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ng/api/provider/{providerIdentifier}" + localVarPath = strings.Replace(localVarPath, "{"+"providerIdentifier"+"}", fmt.Sprintf("%v", + providerIdentifier), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, + localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ProviderGetResponse + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ProviderApiService Update an Provider Entity + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param providerIdentifier + * @param accountIdentifier + * @param optional nil or *ProviderApiUpdateProviderOpts - Optional Parameters: + * @param "Body" (optional.Interface of ProviderUpdateResponse) - +@return ProviderUpdateResponse +*/ + +type ProviderApiUpdateProviderOpts struct { + Body optional.Interface +} + +func (a *ProviderApiService) UpdateProvider(ctx context.Context, providerIdentifier string, accountIdentifier string, localVarOptionals *ProviderApiUpdateProviderOpts) (ProviderUpdateResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ProviderUpdateResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ng/api/provider/{providerIdentifier}" + localVarPath = strings.Replace(localVarPath, "{"+"providerIdentifier"+"}", fmt.Sprintf("%v", + providerIdentifier), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody := localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, + localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ResponseServiceOverridesResponseDtov2 + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, + localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} + +/* +ProviderApiService Gets Provider list + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param accountIdentifier Account Identifier for the Entity. +@return ProviderListResponse +*/ + +func (a *ProviderApiService) ListProvider(ctx context.Context, accountIdentifier string) (ProviderListResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ProviderListResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ng/api/provider" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["x-api-key"] = key + + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v Failure + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v ModelError + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 0 { + var v ResponseDtoPageResponseServiceResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/harness/nextgen/client.go b/harness/nextgen/client.go index da133b04..ca2c8a6f 100644 --- a/harness/nextgen/client.go +++ b/harness/nextgen/client.go @@ -192,6 +192,7 @@ type APIClient struct { ServiceOverridesApi *ServiceOverridesApiService OverridesApi *OverridesApiService + ProviderApi *ProviderApiService SettingsApi *SettingsApiService @@ -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) diff --git a/harness/nextgen/enum_provider_type.go b/harness/nextgen/enum_provider_type.go new file mode 100644 index 00000000..738d6efa --- /dev/null +++ b/harness/nextgen/enum_provider_type.go @@ -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) +} diff --git a/harness/nextgen/model_bitbucket_server_response.go b/harness/nextgen/model_bitbucket_server_response.go new file mode 100644 index 00000000..3de2cfa6 --- /dev/null +++ b/harness/nextgen/model_bitbucket_server_response.go @@ -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 + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +} diff --git a/harness/nextgen/model_provider_create_request.go b/harness/nextgen/model_provider_create_request.go new file mode 100644 index 00000000..fbb70a09 --- /dev/null +++ b/harness/nextgen/model_provider_create_request.go @@ -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: contact@harness.io + * 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:"-"` +} diff --git a/harness/nextgen/model_provider_create_response.go b/harness/nextgen/model_provider_create_response.go new file mode 100644 index 00000000..ba10d7de --- /dev/null +++ b/harness/nextgen/model_provider_create_response.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +*/ +package nextgen + +type ProviderCreateApiResponse struct { + Identifier string `json:"identifier,omitempty"` +} diff --git a/harness/nextgen/model_provider_delete_response.go b/harness/nextgen/model_provider_delete_response.go new file mode 100644 index 00000000..2c387b59 --- /dev/null +++ b/harness/nextgen/model_provider_delete_response.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +} diff --git a/harness/nextgen/model_provider_get_response.go b/harness/nextgen/model_provider_get_response.go new file mode 100644 index 00000000..e7107be0 --- /dev/null +++ b/harness/nextgen/model_provider_get_response.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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:"-"` +} diff --git a/harness/nextgen/model_provider_response.go b/harness/nextgen/model_provider_response.go new file mode 100644 index 00000000..2583fa1b --- /dev/null +++ b/harness/nextgen/model_provider_response.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +*/ +package nextgen + +type ProviderApiResponse struct { + Identifier string `json:"identifier,omitempty"` +} diff --git a/harness/nextgen/model_provider_serializer.go b/harness/nextgen/model_provider_serializer.go new file mode 100644 index 00000000..be692973 --- /dev/null +++ b/harness/nextgen/model_provider_serializer.go @@ -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)) +} diff --git a/harness/nextgen/model_provider_update_request.go b/harness/nextgen/model_provider_update_request.go new file mode 100644 index 00000000..327f7ea4 --- /dev/null +++ b/harness/nextgen/model_provider_update_request.go @@ -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: contact@harness.io + * 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:"-"` +} diff --git a/harness/nextgen/model_provider_update_response.go b/harness/nextgen/model_provider_update_response.go new file mode 100644 index 00000000..43656d9b --- /dev/null +++ b/harness/nextgen/model_provider_update_response.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) +*/ +package nextgen + +type ProviderUpdateApiResponse struct { + Identifier string `json:"identifier,omitempty"` +} diff --git a/harness/nextgen/model_response_create_provider.go b/harness/nextgen/model_response_create_provider.go new file mode 100644 index 00000000..9e8e6719 --- /dev/null +++ b/harness/nextgen/model_response_create_provider.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +} diff --git a/harness/nextgen/model_response_delete_provider.go b/harness/nextgen/model_response_delete_provider.go new file mode 100644 index 00000000..f8107887 --- /dev/null +++ b/harness/nextgen/model_response_delete_provider.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +} diff --git a/harness/nextgen/model_response_get_provider.go b/harness/nextgen/model_response_get_provider.go new file mode 100644 index 00000000..b5972d32 --- /dev/null +++ b/harness/nextgen/model_response_get_provider.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +} diff --git a/harness/nextgen/model_response_list_provider.go b/harness/nextgen/model_response_list_provider.go new file mode 100644 index 00000000..e15da4a1 --- /dev/null +++ b/harness/nextgen/model_response_list_provider.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +} diff --git a/harness/nextgen/model_response_update_provider.go b/harness/nextgen/model_response_update_provider.go new file mode 100644 index 00000000..d52450c5 --- /dev/null +++ b/harness/nextgen/model_response_update_provider.go @@ -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 + + * + * API version: 3.0 + * Contact: contact@harness.io + * 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"` +}