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 21, 2023
1 parent ba56ac2 commit 5c1b576
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
25 changes: 19 additions & 6 deletions pkg/daprrp/processors/pubsubbrokers/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ 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.
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 +119,16 @@ 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.
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
25 changes: 19 additions & 6 deletions pkg/daprrp/processors/secretstores/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ 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.
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 +116,16 @@ 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.
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
25 changes: 19 additions & 6 deletions pkg/daprrp/processors/statestores/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ 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.
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 +119,16 @@ 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.
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 5c1b576

Please sign in to comment.