Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PTOCP-947: Client generated code for upgrade policy #43

Merged
merged 5 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The following Bloxone APIs are supported:
- [DNS Configuration](dns_config/README.md)
- [DNS Data](dns_data/README.md)
- [Keys](keys/README.md)
- [Upgrade Policy](upgradePolicy/README.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this to be under ## Bloxone Cloud

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


# Installation

Expand Down
4 changes: 4 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/infobloxopen/bloxone-go-client/keys"
"github.com/infobloxopen/bloxone-go-client/option"
"github.com/infobloxopen/bloxone-go-client/redirect"
"github.com/infobloxopen/bloxone-go-client/upgradepolicy"
)

// APIClient is an aggregation of different BloxOne API clients.
Expand All @@ -26,6 +27,7 @@ type APIClient struct {
FWAPI *fw.APIClient
AnycastAPI *anycast.APIClient
RedirectAPI *redirect.APIClient
UpgradePolicyClientAPI *upgradepolicy.APIClient
}

// NewAPIClient creates a new BloxOne API Client.
Expand All @@ -40,6 +42,7 @@ type APIClient struct {
// - DNSForwardingProxyAPI
// - FWAPI
// - AnycastAPI
// - UpgradePolicyClientAPI
//
// The client can be configured with a variadic option. The following options are available:
// - WithClientName(string) sets the name of the client using the SDK.
Expand All @@ -60,5 +63,6 @@ func NewAPIClient(options ...option.ClientOption) *APIClient {
FWAPI: fw.NewAPIClient(options...),
AnycastAPI: anycast.NewAPIClient(options...),
RedirectAPI: redirect.NewAPIClient(options...),
UpgradePolicyClientAPI: upgradepolicy.NewAPIClient(options...),
}
}
23 changes: 23 additions & 0 deletions upgradepolicy/.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
52 changes: 52 additions & 0 deletions upgradepolicy/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.openapi-generator-ignore
README.md
api/openapi.yaml
api_upgrade_policy_v2.go
client.go
docs/ApplyConfigNowRequest.md
docs/ApplyConfigNowResponse.md
docs/ApplyConfigNowStatus.md
docs/BatchMaintenanceWindow.md
docs/BatchMaintenanceWindowRequest.md
docs/BatchMaintenanceWindowResponse.md
docs/BatchMaintenanceWindowResult.md
docs/CreateMaintenanceWindow.md
docs/CreateMaintenanceWindowRequest.md
docs/CreateMaintenanceWindowResponse.md
docs/DeferredWindow.md
docs/DeleteMaintenanceWindowResponse.md
docs/GetMaintenanceWindowResponse.md
docs/ListMaintenanceWindowResponse.md
docs/MaintenanceWindow.md
docs/OnpremDetails.md
docs/ScheduledWindow.md
docs/StatusCode.md
docs/UpdateBatchMaintenanceWindow.md
docs/UpdateMaintenanceWindow.md
docs/UpdateMaintenanceWindowRequest.md
docs/UpdateMaintenanceWindowResponse.md
docs/UpgradePolicyV2API.md
model_apply_config_now_request.go
model_apply_config_now_response.go
model_apply_config_now_status.go
model_batch_maintenance_window.go
model_batch_maintenance_window_request.go
model_batch_maintenance_window_response.go
model_batch_maintenance_window_result.go
model_create_maintenance_window.go
model_create_maintenance_window_request.go
model_create_maintenance_window_response.go
model_deferred_window.go
model_delete_maintenance_window_response.go
model_get_maintenance_window_response.go
model_list_maintenance_window_response.go
model_maintenance_window.go
model_onprem_details.go
model_scheduled_window.go
model_status_code.go
model_update_batch_maintenance_window.go
model_update_maintenance_window.go
model_update_maintenance_window_request.go
model_update_maintenance_window_response.go
test/api_upgrade_policy_v2_test.go
utils.go
1 change: 1 addition & 0 deletions upgradepolicy/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.5.0
137 changes: 137 additions & 0 deletions upgradepolicy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Go API client for Schedule Software/Config Updates

Infoblox by default does automatic software updates when they become available. Updates are applied to all on-prem hosts, physical or virtual. However, you can override and schedule the software updates. You can also defer the updates to a later date and time. You can configure up to a total of 50 deferrals (scheduled and deferred software updates), which means you have the flexibility to create up to 50 update groups across different on-prem hosts by mapping with appropriate tags. Tags are be used to associate deferrals (scheduled or deferred) with a specific or group of onprem-hosts. Apart from software update deferrals, config update deferrals also can be configured using these overrides.

## 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/upgradepolicy
```

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

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 := upgradepolicy.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 := upgradepolicy.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 := upgradepolicy.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 Schedule Software/Config Updates. 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 Schedule Software/Config Updates, you can use the `option.WithAPIKey` option. For example:

```go
client := upgradepolicy.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 := upgradepolicy.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/upgrade_policy*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*UpgradePolicyV2API* | [**ApplyConfigNow**](docs/UpgradePolicyV2API.md#applyconfignow) | **Post** /v2/config/apply_now | Immediately apply the config updates object to the list of hosts
*UpgradePolicyV2API* | [**Batch**](docs/UpgradePolicyV2API.md#batch) | **Post** /v2/maintenance_windows/batch | Create, update and/or delete multiple maintenance windows in a single request
*UpgradePolicyV2API* | [**Create**](docs/UpgradePolicyV2API.md#create) | **Post** /v2/maintenance_windows | Create a maintenance window
*UpgradePolicyV2API* | [**Delete**](docs/UpgradePolicyV2API.md#delete) | **Delete** /v2/maintenance_windows/{id} | Delete maintenance window
*UpgradePolicyV2API* | [**Get**](docs/UpgradePolicyV2API.md#get) | **Get** /v2/maintenance_windows/{id} | Read a maintenance window
*UpgradePolicyV2API* | [**List**](docs/UpgradePolicyV2API.md#list) | **Get** /v2/maintenance_windows | List all the maintenance windows
*UpgradePolicyV2API* | [**Update**](docs/UpgradePolicyV2API.md#update) | **Patch** /v2/maintenance_windows/{id} | Update an existing maintenance window


## Documentation For Models

- [ApplyConfigNowRequest](docs/ApplyConfigNowRequest.md)
- [ApplyConfigNowResponse](docs/ApplyConfigNowResponse.md)
- [ApplyConfigNowStatus](docs/ApplyConfigNowStatus.md)
- [BatchMaintenanceWindow](docs/BatchMaintenanceWindow.md)
- [BatchMaintenanceWindowRequest](docs/BatchMaintenanceWindowRequest.md)
- [BatchMaintenanceWindowResponse](docs/BatchMaintenanceWindowResponse.md)
- [BatchMaintenanceWindowResult](docs/BatchMaintenanceWindowResult.md)
- [CreateMaintenanceWindow](docs/CreateMaintenanceWindow.md)
- [CreateMaintenanceWindowRequest](docs/CreateMaintenanceWindowRequest.md)
- [CreateMaintenanceWindowResponse](docs/CreateMaintenanceWindowResponse.md)
- [DeferredWindow](docs/DeferredWindow.md)
- [DeleteMaintenanceWindowResponse](docs/DeleteMaintenanceWindowResponse.md)
- [GetMaintenanceWindowResponse](docs/GetMaintenanceWindowResponse.md)
- [ListMaintenanceWindowResponse](docs/ListMaintenanceWindowResponse.md)
- [MaintenanceWindow](docs/MaintenanceWindow.md)
- [OnpremDetails](docs/OnpremDetails.md)
- [ScheduledWindow](docs/ScheduledWindow.md)
- [StatusCode](docs/StatusCode.md)
- [UpdateBatchMaintenanceWindow](docs/UpdateBatchMaintenanceWindow.md)
- [UpdateMaintenanceWindow](docs/UpdateMaintenanceWindow.md)
- [UpdateMaintenanceWindowRequest](docs/UpdateMaintenanceWindowRequest.md)
- [UpdateMaintenanceWindowResponse](docs/UpdateMaintenanceWindowResponse.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
Loading