Skip to content

Commit

Permalink
Fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Jan 20, 2024
1 parent c3e9452 commit 470af24
Show file tree
Hide file tree
Showing 76 changed files with 1,903 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.1.10 (unreleased)

- Retry on 400 and 500 HTTP errors when creating or updating objects
- Fix import operation of resources

## 0.1.9

Expand Down
1 change: 1 addition & 0 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ description: |-
## 0.1.10 (unreleased)

- Retry on 400 and 500 HTTP errors when creating or updating objects
- Fix import operation of resources

## 0.1.9

Expand Down
67 changes: 67 additions & 0 deletions gen/gen_definition.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
// All rights reserved.
//
// Licensed under the Mozilla Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://mozilla.org/MPL/2.0/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: MPL-2.0

//go:build ignore

package main

import (
"fmt"
"os"

"github.com/pb33f/libopenapi"
)

const (
modelFile = "./gen/models/ise_320p4_ers.json"
outputFile = "./gen/definition/active_directory.yaml"
endpoint = "/activedirectory/"
schemaElement = "ERSActiveDirectory"
)

func main() {
modelBytes, err := os.ReadFile(modelFile)
if err != nil {
panic(fmt.Sprintf("Error reading file: %v", err))
}

document, err := libopenapi.NewDocument(modelBytes)
if err != nil {
panic(fmt.Sprintf("Cannot create new document: %e", err))
}

docModel, errors := document.BuildV3Model()
if len(errors) > 0 {
for i := range errors {
fmt.Printf("error: %e\n", errors[i])
}
panic(fmt.Sprintf("Cannot create v3 model from document: %d errors reported", len(errors)))
}

schema, _ := docModel.Model.Components.Schemas.Get(schemaElement)

prop, _ := schema.Schema().Properties.Get("domain")

println(prop)

// write to output file
// f, err := os.Create(outputFile)
// if err != nil {
// log.Fatalf("Error creating output file: %v", err)
// }
// f.Write(output.Bytes())
}
19 changes: 19 additions & 0 deletions gen/templates/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion gen/templates/resource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

238 changes: 238 additions & 0 deletions internal/provider/model_ise_allowed_protocols.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions internal/provider/model_ise_allowed_protocols_tacacs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 470af24

Please sign in to comment.