ocket8888 commented on a change in pull request #3930: Rewrite profile import 
to Go
URL: https://github.com/apache/trafficcontrol/pull/3930#discussion_r331145072
 
 

 ##########
 File path: lib/go-tc/profiles.go
 ##########
 @@ -89,30 +101,127 @@ type ProfileTrimmed struct {
        Name string `json:"name"`
 }
 
-type ProfileExportedNullable struct {
-       // The Profile name
-       //
-       Name *string `json:"name"`
-
-       // The Profile Description
-       //
+// ProfileExportImportNullable is an object of the form used by Traffic Ops
+// to represent exported and imported profiles.
+type ProfileExportImportNullable struct {
+       Name        *string `json:"name"`
        Description *string `json:"description"`
+       CDNName     *string `json:"cdn"`
+       Type        *string `json:"type"`
+}
 
-       // The CDN name associated with the Profile
+// ProfileExportResponse is an object of the form used by Traffic Ops
+// to represent exported profile response
+type ProfileExportResponse struct {
+       // Parameters associated to the profile
        //
-       CDNName *string `json:"cdn"`
+       Profile ProfileExportImportNullable `json:"profile"`
 
-       // The Type name associated with the Profile
+       // Parameters associated to the profile
        //
-       Type *string `json:"type"`
+       Parameters []ProfileExportImportParameterNullable `json:"parameters"`
 }
 
-type ProfileExportedResponse struct {
+// ProfileImportRequest is an object of the form used by Traffic Ops
+// to represent a request to import a profile
+type ProfileImportRequest struct {
        // Parameters associated to the profile
        //
-       Profile ProfileExportedNullable `json:"profile"`
+       Profile ProfileExportImportNullable `json:"profile"`
 
        // Parameters associated to the profile
        //
-       Parameters []ProfileExportedParameterNullable `json:"parameters"`
+       Parameters []ProfileExportImportParameterNullable `json:"parameters"`
+}
+
+// ProfileImportResponse is an object of the form used by Traffic Ops
+// to represent a response from importing a profile
+type ProfileImportResponse struct {
+       Response ProfileImportResponseObj `json:"response"`
+       Alerts
+}
+
+type ProfileImportResponseObj struct {
+       ProfileExportImportNullable
+       ID *int64 `json:"id"`
 
 Review comment:
   Currently, most of our objects are using just `int` for their ID's types (or 
`*int` for nullables). I don't think it's necessarily a bad idea to not follow 
that precedent, but since the IDs are serial why not use `*uint64`? A negative 
ID is an invalid ID (and actually so is zero in all cases, I believe).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to