Skip to content

Commit

Permalink
Support distribute release bundle v2 command
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNino committed Aug 27, 2023
1 parent 5d7e745 commit 6bf4a0b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1614,9 +1614,9 @@ summary, err := distManager.SignReleaseBundle(params)
#### Async Distributing a Release Bundle v1

```go
params := services.NewDistributeReleaseBundleParams("bundle-name", "1")
distributionRules := utils.DistributionCommonParams{SiteName: "Swamp-1", "CityName": "Tel-Aviv", "CountryCodes": []string{"123"}}}
params.DistributionRules = []*utils.DistributionCommonParams{distributionRules}
params := distribution.NewDistributeReleaseBundleParams("bundle-name", "1")
distributionRules := distribution.DistributionCommonParams{SiteName: "Swamp-1", "CityName": "Tel-Aviv", "CountryCodes": []string{"123"}}}
params.DistributionRules = []*distribution.DistributionCommonParams{distributionRules}
// Auto-creating repository if it does not exist
autoCreateRepo := true
err := distManager.DistributeReleaseBundle(params, autoCreateRepo)
Expand All @@ -1625,9 +1625,9 @@ err := distManager.DistributeReleaseBundle(params, autoCreateRepo)
#### Sync Distributing a Release Bundle v1

```go
params := services.NewDistributeReleaseBundleParams("bundle-name", "1")
distributionRules := utils.DistributionCommonParams{SiteName: "Swamp-1", "CityName": "Tel-Aviv", "CountryCodes": []string{"123"}}}
params.DistributionRules = []*utils.DistributionCommonParams{distributionRules}
params := distribution.NewDistributeReleaseBundleParams("bundle-name", "1")
distributionRules := distribution.DistributionCommonParams{SiteName: "Swamp-1", "CityName": "Tel-Aviv", "CountryCodes": []string{"123"}}}
params.DistributionRules = []*distribution.DistributionCommonParams{distributionRules}
// Auto-creating repository if it does not exist
autoCreateRepo := true
// Wait up to 120 minutes for the release bundle v1 distribution
Expand All @@ -1654,8 +1654,8 @@ status, err := distributeBundleService.GetStatus(params)
```go
params := services.NewDeleteReleaseBundleParams("bundle-name", "1")
params.DeleteFromDistribution = true
distributionRules := utils.DistributionCommonParams{SiteName: "Swamp-1", "CityName": "Tel-Aviv", "CountryCodes": []string{"123"}}}
params.DistributionRules = []*utils.DistributionCommonParams{distributionRules}
distributionRules := distribution.DistributionCommonParams{SiteName: "Swamp-1", "CityName": "Tel-Aviv", "CountryCodes": []string{"123"}}}
params.DistributionRules = []*distribution.DistributionCommonParams{distributionRules}
// Set to true to enable sync deletion (the command execution will end when the deletion process ends).
param.Sync = true
// Max minutes to wait for sync deletion.
Expand Down
2 changes: 1 addition & 1 deletion distribution/services/utils/releasebundlebody.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type BundleSpec struct {

type BundleQuery struct {
QueryName string `json:"query_name,omitempty"`
Aql string `json:"aql"`
Aql string `json:"aql,omitempty"`
PathMappings []distribution.PathMapping `json:"mappings,omitempty"`
AddedProps []AddedProps `json:"added_props,omitempty"`
}
Expand Down
4 changes: 2 additions & 2 deletions lifecycle/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ func (lcs *LifecycleServicesManager) DeleteReleaseBundle(rbDetails lifecycle.Rel
return rbService.DeleteReleaseBundle(rbDetails, params)
}

func (lcs *LifecycleServicesManager) DistributeReleaseBundle(params distribution.DistributionParams, autoCreateRepo bool, optionalPathMapping lifecycle.OptionalPathMapping) error {
func (lcs *LifecycleServicesManager) DistributeReleaseBundle(params distribution.DistributionParams, autoCreateRepo bool, pathMapping lifecycle.PathMapping) error {
distributeBundleService := lifecycle.NewDistributeReleaseBundleService(lcs.client)
distributeBundleService.LcDetails = lcs.config.GetServiceDetails()
distributeBundleService.DryRun = lcs.config.IsDryRun()
distributeBundleService.AutoCreateRepo = autoCreateRepo
distributeBundleService.DistributeParams = params
distributeBundleService.OptionalPathMapping = optionalPathMapping
distributeBundleService.PathMapping = pathMapping
return distributeBundleService.Distribute()
}
6 changes: 3 additions & 3 deletions lifecycle/services/distribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type DistributeReleaseBundleService struct {
DryRun bool
AutoCreateRepo bool
DistributeParams distribution.DistributionParams
OptionalPathMapping
PathMapping
}

func (dr *DistributeReleaseBundleService) GetHttpClient() *jfroghttpclient.JfrogHttpClient {
Expand Down Expand Up @@ -56,7 +56,7 @@ func (dr *DistributeReleaseBundleService) createDistributeBody() ReleaseBundleDi
return ReleaseBundleDistributeBody{
ReleaseBundleDistributeV1Body: distribution.CreateDistributeV1Body(dr.DistributeParams, dr.DryRun, dr.AutoCreateRepo),
Modifications: Modifications{
PathMappings: distribution.CreatePathMappings(dr.OptionalPathMapping.Pattern, dr.OptionalPathMapping.Target),
PathMappings: distribution.CreatePathMappings(dr.Pattern, dr.Target),
},
}
}
Expand All @@ -70,7 +70,7 @@ type Modifications struct {
PathMappings []distribution.PathMapping `json:"mappings"`
}

type OptionalPathMapping struct {
type PathMapping struct {
Pattern string
Target string
}

0 comments on commit 6bf4a0b

Please sign in to comment.