-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: support cloud api key name and secret
- Loading branch information
Showing
16 changed files
with
196 additions
and
23 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,6 +7,10 @@ info: | |
altText: ApeCloud logo | ||
description: | | ||
The Admin API is used to manage the ApeCloud platform. | ||
contact: | ||
email: [email protected] | ||
name: ApeCloud Support | ||
url: https://www.apecloud.com | ||
servers: | ||
- url: http://127.0.0.1:8080 | ||
description: local | ||
|
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 |
---|---|---|
|
@@ -15,6 +15,10 @@ info: | |
We use standard HTTP authentication and provide API keys to identify who you are. Your API keys carry many privileges, so be sure to keep them secret! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. | ||
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. | ||
contact: | ||
email: [email protected] | ||
name: ApeCloud Support | ||
url: https://www.apecloud.com | ||
servers: | ||
- url: http://127.0.0.1:8080 | ||
description: local | ||
|
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
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 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch test function", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "test", | ||
"program": "${workspaceFolder}/tests/api/api_organization_test.go", | ||
"args": [ | ||
"-test.run", | ||
"TestListOrgs" | ||
], | ||
"envFile": "${workspaceFolder}/.env", | ||
"showLog": false, | ||
} | ||
] | ||
} |
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
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,70 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. | ||
// This product includes software developed at ApeCloud (https://www.apecloud.com/). | ||
// Copyright 2022-Present ApeCloud Co., Ltd | ||
|
||
package kbcloud | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/apecloud/kb-cloud-client-go/api/common" | ||
) | ||
|
||
// LoadBalancerAvailableType Whether the loadbalancer is available in the environment. | ||
type LoadBalancerAvailableType string | ||
|
||
// List of LoadBalancerAvailableType. | ||
const ( | ||
LoadBalancerAvailableTypeAvailable LoadBalancerAvailableType = "Available" | ||
LoadBalancerAvailableTypeUnavailable LoadBalancerAvailableType = "Unavailable" | ||
LoadBalancerAvailableTypeChecking LoadBalancerAvailableType = "Checking" | ||
LoadBalancerAvailableTypeUnknown LoadBalancerAvailableType = "Unknown" | ||
) | ||
|
||
var allowedLoadBalancerAvailableTypeEnumValues = []LoadBalancerAvailableType{ | ||
LoadBalancerAvailableTypeAvailable, | ||
LoadBalancerAvailableTypeUnavailable, | ||
LoadBalancerAvailableTypeChecking, | ||
LoadBalancerAvailableTypeUnknown, | ||
} | ||
|
||
// GetAllowedValues returns the list of possible values. | ||
func (v *LoadBalancerAvailableType) GetAllowedValues() []LoadBalancerAvailableType { | ||
return allowedLoadBalancerAvailableTypeEnumValues | ||
} | ||
|
||
// UnmarshalJSON deserializes the given payload. | ||
func (v *LoadBalancerAvailableType) UnmarshalJSON(src []byte) error { | ||
var value string | ||
err := common.Unmarshal(src, &value) | ||
if err != nil { | ||
return err | ||
} | ||
*v = LoadBalancerAvailableType(value) | ||
return nil | ||
} | ||
|
||
// NewLoadBalancerAvailableTypeFromValue returns a pointer to a valid LoadBalancerAvailableType | ||
// for the value passed as argument, or an error if the value passed is not allowed by the enum. | ||
func NewLoadBalancerAvailableTypeFromValue(v string) (*LoadBalancerAvailableType, error) { | ||
ev := LoadBalancerAvailableType(v) | ||
if ev.IsValid() { | ||
return &ev, nil | ||
} | ||
return nil, fmt.Errorf("invalid value '%v' for LoadBalancerAvailableType: valid values are %v", v, allowedLoadBalancerAvailableTypeEnumValues) | ||
} | ||
|
||
// IsValid return true if the value is valid for the enum, false otherwise. | ||
func (v LoadBalancerAvailableType) IsValid() bool { | ||
for _, existing := range allowedLoadBalancerAvailableTypeEnumValues { | ||
if existing == v { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// Ptr returns reference to LoadBalancerAvailableType value. | ||
func (v LoadBalancerAvailableType) Ptr() *LoadBalancerAvailableType { | ||
return &v | ||
} |
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,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
cd .generator | ||
poetry install | ||
poetry run python -m generator ./schemas/* -o ../api | ||
|
||
cd ../api | ||
goimports -w . |
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
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,22 @@ | ||
package test | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/apecloud/kb-cloud-client-go/api/kbcloud" | ||
"github.com/apecloud/kb-cloud-client-go/tests" | ||
) | ||
|
||
func TestListOrgs(t *testing.T) { | ||
ctx := WithClient(WithTestAuth(NewDefaultContext(context.Background()))) | ||
assert := tests.Assert(ctx, t) | ||
client := Client(ctx) | ||
api := kbcloud.NewOrganizationApi(client) | ||
|
||
orgs, resp, err := api.ListOrg(ctx) | ||
assert.NoError(err) | ||
assert.Equal(http.StatusOK, resp.StatusCode) | ||
assert.NotNil(orgs) | ||
} |
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
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