Skip to content

Commit

Permalink
Schema changes for Cloud Discovery ( Discovery Configuration V2) (#54)
Browse files Browse the repository at this point in the history
* Initial commit for discovery

* added changes to client file

* Modified Tests
  • Loading branch information
unasra authored Sep 9, 2024
1 parent 22eca81 commit b786391
Show file tree
Hide file tree
Showing 65 changed files with 14,640 additions and 24 deletions.
52 changes: 28 additions & 24 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
"github.com/infobloxopen/bloxone-go-client/anycast"
"github.com/infobloxopen/bloxone-go-client/clouddiscovery"
"github.com/infobloxopen/bloxone-go-client/dfp"
"github.com/infobloxopen/bloxone-go-client/dnsconfig"
"github.com/infobloxopen/bloxone-go-client/dnsdata"
Expand All @@ -18,25 +19,27 @@ import (

// APIClient is an aggregation of different BloxOne API clients.
type APIClient struct {
IPAddressManagementAPI *ipam.APIClient
IPAMFederationAPI *ipamfederation.APIClient
DNSConfigurationAPI *dnsconfig.APIClient
DNSDataAPI *dnsdata.APIClient
HostActivationAPI *infraprovision.APIClient
InfraManagementAPI *inframgmt.APIClient
KeysAPI *keys.APIClient
DNSForwardingProxyAPI *dfp.APIClient
FWAPI *fw.APIClient
AnycastAPI *anycast.APIClient
RedirectAPI *redirect.APIClient
UpgradePolicyClientAPI *upgradepolicy.APIClient
IPAddressManagementAPI *ipam.APIClient
IPAMFederationAPI *ipamfederation.APIClient
DiscoveryConfigurationAPIV2 *clouddiscovery.APIClient
DNSConfigurationAPI *dnsconfig.APIClient
DNSDataAPI *dnsdata.APIClient
HostActivationAPI *infraprovision.APIClient
InfraManagementAPI *inframgmt.APIClient
KeysAPI *keys.APIClient
DNSForwardingProxyAPI *dfp.APIClient
FWAPI *fw.APIClient
AnycastAPI *anycast.APIClient
RedirectAPI *redirect.APIClient
UpgradePolicyClientAPI *upgradepolicy.APIClient
}

// NewAPIClient creates a new BloxOne API Client.
// This is an aggregation of different BloxOne API clients.
// The following clients are available:
// - IPAddressManagementAPI
// - IPAMFederationAPI
// - DiscoveryConfigurationAPIV2
// - DNSConfigurationAPI
// - DNSDataAPI
// - HostActivationAPI
Expand All @@ -56,17 +59,18 @@ type APIClient struct {
// - WithDebug() sets the debug mode.
func NewAPIClient(options ...option.ClientOption) *APIClient {
return &APIClient{
IPAddressManagementAPI: ipam.NewAPIClient(options...),
IPAMFederationAPI: ipamfederation.NewAPIClient(options...),
DNSConfigurationAPI: dnsconfig.NewAPIClient(options...),
DNSDataAPI: dnsdata.NewAPIClient(options...),
HostActivationAPI: infraprovision.NewAPIClient(options...),
InfraManagementAPI: inframgmt.NewAPIClient(options...),
KeysAPI: keys.NewAPIClient(options...),
DNSForwardingProxyAPI: dfp.NewAPIClient(options...),
FWAPI: fw.NewAPIClient(options...),
AnycastAPI: anycast.NewAPIClient(options...),
RedirectAPI: redirect.NewAPIClient(options...),
UpgradePolicyClientAPI: upgradepolicy.NewAPIClient(options...),
IPAddressManagementAPI: ipam.NewAPIClient(options...),
IPAMFederationAPI: ipamfederation.NewAPIClient(options...),
DiscoveryConfigurationAPIV2: clouddiscovery.NewAPIClient(options...),
DNSConfigurationAPI: dnsconfig.NewAPIClient(options...),
DNSDataAPI: dnsdata.NewAPIClient(options...),
HostActivationAPI: infraprovision.NewAPIClient(options...),
InfraManagementAPI: inframgmt.NewAPIClient(options...),
KeysAPI: keys.NewAPIClient(options...),
DNSForwardingProxyAPI: dfp.NewAPIClient(options...),
FWAPI: fw.NewAPIClient(options...),
AnycastAPI: anycast.NewAPIClient(options...),
RedirectAPI: redirect.NewAPIClient(options...),
UpgradePolicyClientAPI: upgradepolicy.NewAPIClient(options...),
}
}
23 changes: 23 additions & 0 deletions clouddiscovery/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
58 changes: 58 additions & 0 deletions clouddiscovery/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
README.md
api/openapi.yaml
api_accounts.go
api_providers.go
api_sub_accounts.go
client.go
docs/Account.md
docs/AccountListResponse.md
docs/AccountsAPI.md
docs/AdditionalConfig.md
docs/ApiPageInfo.md
docs/Category.md
docs/CredentialConfig.md
docs/CredentialPreference.md
docs/DNSConfig.md
docs/Destination.md
docs/DestinationConfig.md
docs/DiscoveryConfig.md
docs/IPAMConfig.md
docs/Object.md
docs/ObjectType.md
docs/ProviderCreateResponse.md
docs/ProviderListResponse.md
docs/ProviderReadResponse.md
docs/ProviderUpdateResponse.md
docs/ProvidersAPI.md
docs/Resource.md
docs/SourceConfig.md
docs/SubAccountListRequestV2.md
docs/SubAccountListResponseV2.md
docs/SubAccountProvCredConfig.md
docs/SubAccountV2.md
docs/SubAccountsAPI.md
model_account.go
model_account_list_response.go
model_additional_config.go
model_api_page_info.go
model_category.go
model_credential_config.go
model_credential_preference.go
model_destination.go
model_destination_config.go
model_discovery_config.go
model_dns_config.go
model_ipam_config.go
model_object.go
model_object_type.go
model_provider_create_response.go
model_provider_list_response.go
model_provider_read_response.go
model_provider_update_response.go
model_resource.go
model_source_config.go
model_sub_account_list_request_v2.go
model_sub_account_list_response_v2.go
model_sub_account_prov_cred_config.go
model_sub_account_v2.go
utils.go
1 change: 1 addition & 0 deletions clouddiscovery/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.5.0
143 changes: 143 additions & 0 deletions clouddiscovery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Go API client for Discovery Configuration API V2

The Discovery configuration service is a BloxOne Service that provides configuration for accessing and syncing the Cloud assets

Base Paths:
1. provider: **_/api/cloud_discovery/v2/_**


## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: v2
- Generator version: 7.5.0
- Build package: com.infoblox.codegen.BloxoneGoClientCodegen

## Installation

Install the package using `go get`:
```bash
go get github.com/infobloxopen/bloxone-go-client/clouddiscovery
```

Import the package into your code:
```go
import "github.com/infobloxopen/bloxone-go-client/clouddiscovery"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

To create a new API client, you can use the `NewAPIClient` function as shown below
```go
client := clouddiscovery.NewAPIClient()
```

## Configuration

The `NewAPIClient` function accepts a variadic list of `option.ClientOption` functions that can be used to configure the client.
It requires the `option` package to be imported. You can import the package using:
```go
import "github.com/infobloxopen/bloxone-go-client/option"
```

### Client Name
The client name is used to identify the client in the logs. By default, the client name is set to `bloxone-go-client`. You can change this using the `option.WithClientName` option. For example:
```go
client := clouddiscovery.NewAPIClient(option.WithClientName("my-client"))
```

### Server URL

The default URL for the Cloud Services Portal is `https://csp.infoblox.com`. If you need to change this, you can use `option.WithCSPUrl` to set the URL. For example:

```go
client := clouddiscovery.NewAPIClient(option.WithCSPUrl("https://csp.eu.infoblox.com"))
```

You can also set the URL using the environment variable `BLOXONE_CSP_URL`

### Authorization

An API key is required to access Discovery Configuration API V2. You can obtain an API key by following the instructions in the guide for [Configuring User API Keys](https://docs.infoblox.com/space/BloxOneCloud/35430405/Configuring+User+API+Keys).

To use an API key with Discovery Configuration API V2, you can use the `option.WithAPIKey` option. For example:

```go
client := clouddiscovery.NewAPIClient(option.WithAPIKey("YOUR_API_KEY"))
```

You can also set the API key using the environment variable `BLOXONE_API_KEY`

Note: The API key is a secret and should be handled securely. Hardcoding the API key in your code is not recommended.

### Default Tags

You can set default tags for all API requests using the `option.WithDefaultTags` option. For example:

```go
client := clouddiscovery.NewAPIClient(option.WithDefaultTags(map[string]string{"tag1": "value1", "tag2": "value2"}))
```
This will add the tags `tag1=value1` and `tag2=value2` to all API requests that support tags in the request body.

## Documentation for API Endpoints

All URIs are relative to *http://csp.infoblox.com/api/cloud_discovery/v2*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountsAPI* | [**List**](docs/AccountsAPI.md#list) | **Get** /accounts | List Accounts
*ProvidersAPI* | [**Create**](docs/ProvidersAPI.md#create) | **Post** /providers | Create Provider
*ProvidersAPI* | [**Delete**](docs/ProvidersAPI.md#delete) | **Delete** /providers/{id} | Delete Provider
*ProvidersAPI* | [**List**](docs/ProvidersAPI.md#list) | **Get** /providers | List Provider
*ProvidersAPI* | [**Read**](docs/ProvidersAPI.md#read) | **Get** /providers/{id} | Read Provider
*ProvidersAPI* | [**Update**](docs/ProvidersAPI.md#update) | **Put** /providers/{id} | Update Provider
*SubAccountsAPI* | [**List**](docs/SubAccountsAPI.md#list) | **Post** /sub_accounts | List Sub-accounts


## Documentation For Models

- [Account](docs/Account.md)
- [AccountListResponse](docs/AccountListResponse.md)
- [AdditionalConfig](docs/AdditionalConfig.md)
- [ApiPageInfo](docs/ApiPageInfo.md)
- [Category](docs/Category.md)
- [CredentialConfig](docs/CredentialConfig.md)
- [CredentialPreference](docs/CredentialPreference.md)
- [DNSConfig](docs/DNSConfig.md)
- [Destination](docs/Destination.md)
- [DestinationConfig](docs/DestinationConfig.md)
- [DiscoveryConfig](docs/DiscoveryConfig.md)
- [IPAMConfig](docs/IPAMConfig.md)
- [Object](docs/Object.md)
- [ObjectType](docs/ObjectType.md)
- [ProviderCreateResponse](docs/ProviderCreateResponse.md)
- [ProviderListResponse](docs/ProviderListResponse.md)
- [ProviderReadResponse](docs/ProviderReadResponse.md)
- [ProviderUpdateResponse](docs/ProviderUpdateResponse.md)
- [Resource](docs/Resource.md)
- [SourceConfig](docs/SourceConfig.md)
- [SubAccountListRequestV2](docs/SubAccountListRequestV2.md)
- [SubAccountListResponseV2](docs/SubAccountListResponseV2.md)
- [SubAccountProvCredConfig](docs/SubAccountProvCredConfig.md)
- [SubAccountV2](docs/SubAccountV2.md)


## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:

* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`
Loading

0 comments on commit b786391

Please sign in to comment.