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

2515 Adding import and export #2571

Merged
merged 19 commits into from
Jan 9, 2025
Merged

2515 Adding import and export #2571

merged 19 commits into from
Jan 9, 2025

Conversation

jensalm
Copy link
Contributor

@jensalm jensalm commented Dec 3, 2024

Support in the cli to import entities into a network and exporting entities from a network. Supports both json and yaml.

closes #2515

@jensalm jensalm requested review from a team as code owners December 3, 2024 20:55
go.mod Show resolved Hide resolved
zititest/go.sum Outdated Show resolved Hide resolved
ziti/cmd/cmd.go Outdated Show resolved Hide resolved
}
cas, err := d.GetCertificateAuthorities()
if err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

does this mean it stops at the first error? that could be .... annoying if it takes a while for this to run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it stops at errors but the command can be rerun as many times as needed because it checks if the entity exists and skip it


// convert to a map of values
m := d.ToMap(item)
d.Filter(m, []string{"id", "_links", "createdAt", "updatedAt"})
Copy link
Member

Choose a reason for hiding this comment

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

d.Filter(m, []string{"id", "_links", "createdAt", "updatedAt"}) seems like a good candidate to refactor imo


// filter unwanted properties
d.Filter(m, []string{"id", "_links", "createdAt", "updatedAt",
"edgeRouterRolesDisplay", "identityRolesDisplay", "isSystem"})
Copy link
Member

Choose a reason for hiding this comment

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

"isSystem" is really something we would want to filter? should any "system" entities be exported/imported at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought was that anything marked as isSystem shouldn't be included and it's filtered out because it's not a "valuable" property in that it's not settable.

m := d.ToMap(item)

// filter unwanted properties
d.Filter(m, []string{"id", "_links", "createdAt", "updatedAt"})
Copy link
Member

Choose a reason for hiding this comment

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

CAs should probably come along with a warning, indicating the user is going to need to re-verify the CA on import. it might be there, but if not, that should be added to avoid the confusion when they import and the ca is not "verified"

zititest/go.sum Outdated Show resolved Hide resolved
Copy link
Member

@dovholuknf dovholuknf left a comment

Choose a reason for hiding this comment

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

seems like a good start. let's merge it and iterate through any issues

@dovholuknf dovholuknf merged commit ee0ea19 into main Jan 9, 2025
38 checks passed
@dovholuknf dovholuknf deleted the 2515-import-export branch January 9, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for exporting and importing all entities
3 participants