Skip to content

Commit

Permalink
initial readme (failing)
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed Nov 27, 2021
1 parent 9fce971 commit 4b283eb
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,51 @@
A **k**ubernetes **op**enap**i** **u**n**m**angler.

Creates rust structs from a named crd by converting the live openapi schema.


## Installation

```sh
cargo install kopium
```

## Usage

```sh
kopium prometheusrules.monitoring.coreos.com > prometheusrule.rs
```

## Output

```rust
use kube::CustomResource;
use serde::{Serialize, Deserialize};
use std::collections::BTreeMap;

#[derive(CustomResource, Serialize, Deserialize, Clone, Debug)]
#[kube(group = "monitoring.coreos.com", version = "v1", kind = "PrometheusRule")]
#[kube(Namespaced)]
#[kube(schema = "disabled")]
pub struct PrometheusRuleSpec {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub groups: Vec<PrometheusRuleGroups>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct PrometheusRuleGroups {
pub interval: Option<String>,
pub name: String,
pub partial_response_strategy: Option<String>,
pub rules: Vec<PrometheusRuleRules>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct PrometheusRuleRules {
pub alert: Option<String>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub annotations: BTreeMap<String, String>,
pub expr: String,
pub for: Option<String>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub labels: BTreeMap<String, String>,
pub record: Option<String>,
}
```
8 changes: 8 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
overflow_delimited_expr = true
newline_style = "Unix"
imports_granularity = "Crate"
reorder_impl_items = true
blank_lines_upper_bound = 2
comment_width = 110
max_width = 110
inline_attribute_width = 80

0 comments on commit 4b283eb

Please sign in to comment.