Skip to content

Commit

Permalink
updating per comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshmimsft committed Sep 22, 2023
1 parent 05e98c4 commit 3553b73
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 18 deletions.
27 changes: 21 additions & 6 deletions pkg/daprrp/processors/pubsubbrokers/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ func (p *Processor) Process(ctx context.Context, resource *datamodel.DaprPubSubB
// If the resource is being provisioned manually then *we* are responsible for creating the Dapr Component.
// Let's do this now.

applicationID, err := resources.ParseResource(resource.Properties.Application)
if err != nil && resource.Properties.Application != "" {
return err // This should already be validated by this point.
// DaprPubSubBroker resources may or may not be application scoped.
// Some Dapr Components can be specific to a single application, they would be application scoped and have
// resource.Properties.Application populated, while others could be shared across multiple applications and
// would not have resource.Properties.Application populated.
var applicationID resources.ID
if resource.Properties.Application != "" {
applicationID, err = resources.ParseResource(resource.Properties.Application)
if err != nil {
return err // This should already be validated by this point.
}
}

component, err := dapr.ConstructDaprGeneric(
Expand Down Expand Up @@ -113,9 +120,17 @@ func (p *Processor) Delete(ctx context.Context, resource *datamodel.DaprPubSubBr
return nil
}

applicationID, err := resources.ParseResource(resource.Properties.Application)
if err != nil && resource.Properties.Application != "" {
return err // This should already be validated by this point.
// DaprPubSubBroker resources may or may not be application scoped.
// Some Dapr Components can be specific to a single application, they would be application scoped and have
// resource.Properties.Application populated, while others could be shared across multiple applications and
// would not have resource.Properties.Application populated.
var err error
var applicationID resources.ID
if resource.Properties.Application != "" {
applicationID, err = resources.ParseResource(resource.Properties.Application)
if err != nil {
return err
}
}

component := unstructured.Unstructured{
Expand Down
27 changes: 21 additions & 6 deletions pkg/daprrp/processors/secretstores/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@ func (p *Processor) Process(ctx context.Context, resource *datamodel.DaprSecretS
// If the resource is being provisioned manually then *we* are responsible for creating the Dapr Component.
// Let's do this now.

applicationID, err := resources.ParseResource(resource.Properties.Application)
if err != nil && resource.Properties.Application != "" {
return err // This should already be validated by this point.
// DaprSecretStore resources may or may not be application scoped.
// Some Dapr Components can be specific to a single application, they would be application scoped and have
// resource.Properties.Application populated, while others could be shared across multiple applications and
// would not have resource.Properties.Application populated.
var applicationID resources.ID
if resource.Properties.Application != "" {
applicationID, err = resources.ParseResource(resource.Properties.Application)
if err != nil {
return err // This should already be validated by this point.
}
}

component, err := dapr.ConstructDaprGeneric(
Expand Down Expand Up @@ -110,9 +117,17 @@ func (p *Processor) Delete(ctx context.Context, resource *datamodel.DaprSecretSt
return nil
}

applicationID, err := resources.ParseResource(resource.Properties.Application)
if err != nil && resource.Properties.Application != "" {
return err // This should already be validated by this point.
// DaprSecretStore resources may or may not be application scoped.
// Some Dapr Components can be specific to a single application, they would be application scoped and have
// resource.Properties.Application populated, while others could be shared across multiple applications and
// would not have resource.Properties.Application populated.
var err error
var applicationID resources.ID
if resource.Properties.Application != "" {
applicationID, err = resources.ParseResource(resource.Properties.Application)
if err != nil {
return err
}
}

component := unstructured.Unstructured{
Expand Down
27 changes: 21 additions & 6 deletions pkg/daprrp/processors/statestores/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ func (p *Processor) Process(ctx context.Context, resource *datamodel.DaprStateSt
// If the resource is being provisioned manually then *we* are responsible for creating the Dapr Component.
// Let's do this now.

applicationID, err := resources.ParseResource(resource.Properties.Application)
if err != nil && resource.Properties.Application != "" {
return err // This should already be validated by this point.
// DaprStateStore resources may or may not be application scoped.
// Some Dapr Components can be specific to a single application, they would be application scoped and have
// resource.Properties.Application populated, while others could be shared across multiple applications and
// would not have resource.Properties.Application populated.
var applicationID resources.ID
if resource.Properties.Application != "" {
applicationID, err = resources.ParseResource(resource.Properties.Application)
if err != nil {
return err // This should already be validated by this point.
}
}

component, err := dapr.ConstructDaprGeneric(
Expand Down Expand Up @@ -113,9 +120,17 @@ func (p *Processor) Delete(ctx context.Context, resource *datamodel.DaprStateSto
return nil
}

applicationID, err := resources.ParseResource(resource.Properties.Application)
if err != nil && resource.Properties.Application != "" {
return err // This should already be validated by this point.
// DaprStateStore resources may or may not be application scoped.
// Some Dapr Components can be specific to a single application, they would be application scoped and have
// resource.Properties.Application populated, while others could be shared across multiple applications and
// would not have resource.Properties.Application populated.
var err error
var applicationID resources.ID
if resource.Properties.Application != "" {
applicationID, err = resources.ParseResource(resource.Properties.Application)
if err != nil {
return err
}
}

component := unstructured.Unstructured{
Expand Down

0 comments on commit 3553b73

Please sign in to comment.