Skip to content

Commit

Permalink
Assemble AppGetCertificates
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Nov 22, 2024
1 parent a810edb commit b97d66b
Show file tree
Hide file tree
Showing 10 changed files with 295 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Class | Method | HTTP request | Description
*AppApi* | [**AppDelete**](docs/AppApi.md#appdelete) | **Delete** /1.0/apps/{app} |
*AppApi* | [**AppDeploy**](docs/AppApi.md#appdeploy) | **Post** /1.0/apps/{app}/deploy |
*AppApi* | [**AppGet**](docs/AppApi.md#appget) | **Get** /1.0/apps/{app} |
*AppApi* | [**AppGetCertificates**](docs/AppApi.md#appgetcertificates) | **Get** /1.24/apps/{app}/certificate |
*AppApi* | [**AppList**](docs/AppApi.md#applist) | **Get** /1.0/apps |
*AppApi* | [**AppQuotaChange**](docs/AppApi.md#appquotachange) | **Put** /1.0/apps/{app}/quota |
*AppApi* | [**AppQuotaGet**](docs/AppApi.md#appquotaget) | **Get** /1.0/apps/{app}/quota |
Expand Down Expand Up @@ -187,6 +188,9 @@ Class | Method | HTTP request | Description

- [App](docs/App.md)
- [AppCName](docs/AppCName.md)
- [AppCertificates](docs/AppCertificates.md)
- [AppCertificatesCnames](docs/AppCertificatesCnames.md)
- [AppCertificatesRouters](docs/AppCertificatesRouters.md)
- [AppCreateResponse](docs/AppCreateResponse.md)
- [AppId](docs/AppId.md)
- [AppInternalAddresses](docs/AppInternalAddresses.md)
Expand Down
75 changes: 75 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,40 @@ paths:
- Bearer: []
tags:
- app
/1.24/apps/{app}/certificate:
get:
description: Get the certificate for the app.
operationId: AppGetCertificates
parameters:
- description: Application name
in: path
name: app
required: true
schema:
type: string
responses:
200:
content:
application/json:
schema:
$ref: '#/components/schemas/AppCertificates'
description: Certificate found
401:
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Unauthorized
404:
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: App not found
security:
- Bearer: []
tags:
- app
/1.24/apps/{app}/certissuer:
delete:
description: Unset the certificate issuer for the app.
Expand Down Expand Up @@ -6665,6 +6699,22 @@ components:
description: Percentage threshold for scaling down
type: integer
x-go-custom-type: '*int32'
AppCertificates:
example:
routers:
key:
cnames:
key:
certificate: certificate
issuer: issuer
properties:
routers:
additionalProperties:
$ref: '#/components/schemas/AppCertificates_routers'
type: object
required:
- routers
type: object
CertIssuerSetData:
example:
cname: cname
Expand Down Expand Up @@ -6983,6 +7033,19 @@ components:
ip:
type: string
type: object
AppCertificates_routers:
example:
cnames:
key:
certificate: certificate
issuer: issuer
properties:
cnames:
additionalProperties:
$ref: '#/components/schemas/AppCertificates_cnames'
type: object
required:
- cnames
AppRouterList:
description: Application Router
items:
Expand Down Expand Up @@ -9432,6 +9495,18 @@ components:
type: string
type: object
type: object
AppCertificates_cnames:
example:
certificate: certificate
issuer: issuer
properties:
certificate:
type: string
issuer:
type: string
required:
- certificate
- issuer
Service:
properties:
id:
Expand Down
29 changes: 29 additions & 0 deletions docs/AppApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Method | HTTP request | Description
[**AppDelete**](AppApi.md#AppDelete) | **Delete** /1.0/apps/{app} |
[**AppDeploy**](AppApi.md#AppDeploy) | **Post** /1.0/apps/{app}/deploy |
[**AppGet**](AppApi.md#AppGet) | **Get** /1.0/apps/{app} |
[**AppGetCertificates**](AppApi.md#AppGetCertificates) | **Get** /1.24/apps/{app}/certificate |
[**AppList**](AppApi.md#AppList) | **Get** /1.0/apps |
[**AppQuotaChange**](AppApi.md#AppQuotaChange) | **Put** /1.0/apps/{app}/quota |
[**AppQuotaGet**](AppApi.md#AppQuotaGet) | **Get** /1.0/apps/{app}/quota |
Expand Down Expand Up @@ -268,6 +269,34 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **AppGetCertificates**
> AppCertificates AppGetCertificates(ctx, app)

Get the certificate for the app.

### Required Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**app** | **string**| Application name |

### Return type

[**AppCertificates**](AppCertificates.md)

### Authorization

[Bearer](../README.md#Bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **AppList**
> []MiniApp AppList(ctx, optional)
Expand Down
10 changes: 10 additions & 0 deletions docs/AppCertificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# AppCertificates

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Routers** | [**map[string]AppCertificatesRouters**](AppCertificates_routers.md) | |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


11 changes: 11 additions & 0 deletions docs/AppCertificatesCnames.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# AppCertificatesCnames

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Certificate** | **string** | |
**Issuer** | **string** | |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


10 changes: 10 additions & 0 deletions docs/AppCertificatesRouters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# AppCertificatesRouters

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cnames** | [**map[string]AppCertificatesCnames**](AppCertificates_cnames.md) | |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


125 changes: 125 additions & 0 deletions pkg/tsuru/api_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,131 @@ func (a *AppApiService) AppGet(ctx context.Context, app string) (App, *http.Resp
return localVarReturnValue, localVarHttpResponse, nil
}

/*
AppApiService
Get the certificate for the app.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app Application name
@return AppCertificates
*/
func (a *AppApiService) AppGetCertificates(ctx context.Context, app string) (AppCertificates, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue AppCertificates
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/1.24/apps/{app}/certificate"
localVarPath = strings.Replace(localVarPath, "{"+"app"+"}", fmt.Sprintf("%v", app), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

// 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["Authorization"] = key
}
}

r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
statusCode: localVarHttpResponse.StatusCode,
}

if localVarHttpResponse.StatusCode == 200 {
var v AppCertificates
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 == 401 {
var v string
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 == 404 {
var v string
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
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
statusCode: localVarHttpResponse.StatusCode,
}
return localVarReturnValue, localVarHttpResponse, newErr
}

return localVarReturnValue, localVarHttpResponse, nil
}

/*
AppApiService
List apps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package tsuru

type AppSetCertIssuer struct {
Cname string `json:"cname,omitempty"`
Issuer string `json:"issuer,omitempty"`
type AppCertificates struct {
Routers map[string]AppCertificatesRouters `json:"routers"`
}
15 changes: 15 additions & 0 deletions pkg/tsuru/model_app_certificates_cnames.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Tsuru
*
* Open source, extensible and Docker-based Platform as a Service (PaaS)
*
* API version: 1.24
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package tsuru

type AppCertificatesCnames struct {
Certificate string `json:"certificate"`
Issuer string `json:"issuer"`
}
14 changes: 14 additions & 0 deletions pkg/tsuru/model_app_certificates_routers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Tsuru
*
* Open source, extensible and Docker-based Platform as a Service (PaaS)
*
* API version: 1.24
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package tsuru

type AppCertificatesRouters struct {
Cnames map[string]AppCertificatesCnames `json:"cnames"`
}

0 comments on commit b97d66b

Please sign in to comment.