-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
461633c
commit 6d3358d
Showing
51 changed files
with
4,034 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/targets/adapter/jiratarget" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("jiratarget", jiratarget.EnvAccessorCtor, jiratarget.NewTarget) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
pkgadapter "knative.dev/eventing/pkg/adapter/v2" | ||
|
||
"github.com/zeiss/typhoon/pkg/targets/adapter/servicenowtarget" | ||
) | ||
|
||
func main() { | ||
pkgadapter.Main("servicenowtarget", servicenowtarget.EnvAccessorCtor, servicenowtarget.NewTarget) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
"knative.dev/pkg/apis" | ||
duckv1 "knative.dev/pkg/apis/duck/v1" | ||
|
||
"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1" | ||
) | ||
|
||
// Managed event types | ||
const ( | ||
EventTypeJiraIssueCreate = "com.zeiss.typhoon.jira.issue.create" | ||
EventTypeJiraIssueGet = "com.zeiss.typhoon.jira.issue.get" | ||
EventTypeJiraCustom = "com.zeiss.typhoon.jira.custom" | ||
|
||
EventTypeJiraIssue = "com.zeiss.typhoon.jira.issue" | ||
EventTypeJiraCustomResponse = "com.zeiss.typhoon.jira.custom.response" | ||
) | ||
|
||
// GetGroupVersionKind implements kmeta.OwnerRefable. | ||
func (*JiraTarget) GetGroupVersionKind() schema.GroupVersionKind { | ||
return SchemeGroupVersion.WithKind("JiraTarget") | ||
} | ||
|
||
// GetConditionSet implements duckv1.KRShaped. | ||
func (*JiraTarget) GetConditionSet() apis.ConditionSet { | ||
return v1alpha1.DefaultConditionSet | ||
} | ||
|
||
// GetStatus implements duckv1.KRShaped. | ||
func (t *JiraTarget) GetStatus() *duckv1.Status { | ||
return &t.Status.Status | ||
} | ||
|
||
// GetStatusManager implements Reconcilable. | ||
func (t *JiraTarget) GetStatusManager() *v1alpha1.StatusManager { | ||
return &v1alpha1.StatusManager{ | ||
ConditionSet: t.GetConditionSet(), | ||
Status: &t.Status, | ||
} | ||
} | ||
|
||
// AcceptedEventTypes implements IntegrationTarget. | ||
func (*JiraTarget) AcceptedEventTypes() []string { | ||
return []string{ | ||
EventTypeJiraIssueCreate, | ||
EventTypeJiraIssueGet, | ||
EventTypeJiraCustom, | ||
} | ||
} | ||
|
||
// GetEventTypes implements EventSource. | ||
func (*JiraTarget) GetEventTypes() []string { | ||
return []string{ | ||
EventTypeJiraIssue, | ||
EventTypeJiraCustomResponse, | ||
} | ||
} | ||
|
||
// AsEventSource implements EventSource. | ||
func (t *JiraTarget) AsEventSource() string { | ||
kind := strings.ToLower(t.GetGroupVersionKind().Kind) | ||
return "com.zeiss.typhoon." + kind + "." + t.Namespace + "." + t.Name | ||
} | ||
|
||
// GetAdapterOverrides implements AdapterConfigurable. | ||
func (t *JiraTarget) GetAdapterOverrides() *v1alpha1.AdapterOverrides { | ||
return t.Spec.AdapterOverrides | ||
} | ||
|
||
// SetDefaults implements apis.Defaultable | ||
func (t *JiraTarget) SetDefaults(ctx context.Context) { | ||
} | ||
|
||
// Validate implements apis.Validatable | ||
func (t *JiraTarget) Validate(ctx context.Context) *apis.FieldError { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1" | ||
) | ||
|
||
// +genclient | ||
// +genreconciler | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// JiraTarget is the Schema for the Jira Target. | ||
type JiraTarget struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec JiraTargetSpec `json:"spec"` | ||
Status v1alpha1.Status `json:"status,omitempty"` | ||
} | ||
|
||
// Check the interfaces the event target should be implementing. | ||
var ( | ||
_ v1alpha1.Reconcilable = (*JiraTarget)(nil) | ||
_ v1alpha1.AdapterConfigurable = (*JiraTarget)(nil) | ||
_ v1alpha1.EventSource = (*JiraTarget)(nil) | ||
) | ||
|
||
// JiraTargetSpec defines the desired state of the event target. | ||
type JiraTargetSpec struct { | ||
// Authentication to interact with the JIRA REST API. | ||
Auth JiraAuth `json:"auth"` | ||
|
||
// URL for Jira service. | ||
URL string `json:"url"` | ||
|
||
// Adapter spec overrides parameters. | ||
// +optional | ||
AdapterOverrides *v1alpha1.AdapterOverrides `json:"adapterOverrides,omitempty"` | ||
} | ||
|
||
// JiraAuth contains Jira credentials. | ||
type JiraAuth struct { | ||
// Jira username to connect to the instance as. | ||
User string `json:"user"` | ||
// Jira API token bound to the user. | ||
Token SecretValueFromSource `json:"token"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// JiraTargetList is a list of event target instances. | ||
type JiraTargetList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
Items []JiraTarget `json:"items"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"context" | ||
|
||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
"knative.dev/pkg/apis" | ||
duckv1 "knative.dev/pkg/apis/duck/v1" | ||
|
||
"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1" | ||
) | ||
|
||
// GetGroupVersionKind implements kmeta.OwnerRefable. | ||
func (*ServiceNowTarget) GetGroupVersionKind() schema.GroupVersionKind { | ||
return SchemeGroupVersion.WithKind("ServiceNowTarget") | ||
} | ||
|
||
// GetConditionSet implements duckv1.KRShaped. | ||
func (*ServiceNowTarget) GetConditionSet() apis.ConditionSet { | ||
return v1alpha1.DefaultConditionSet | ||
} | ||
|
||
// GetStatus implements duckv1.KRShaped. | ||
func (t *ServiceNowTarget) GetStatus() *duckv1.Status { | ||
return &t.Status.Status | ||
} | ||
|
||
// GetStatusManager implements Reconcilable. | ||
func (t *ServiceNowTarget) GetStatusManager() *v1alpha1.StatusManager { | ||
return &v1alpha1.StatusManager{ | ||
ConditionSet: t.GetConditionSet(), | ||
Status: &t.Status, | ||
} | ||
} | ||
|
||
// GetAdapterOverrides implements AdapterConfigurable. | ||
func (t *ServiceNowTarget) GetAdapterOverrides() *v1alpha1.AdapterOverrides { | ||
return t.Spec.AdapterOverrides | ||
} | ||
|
||
// SetDefaults implements apis.Defaultable | ||
func (t *ServiceNowTarget) SetDefaults(ctx context.Context) { | ||
} | ||
|
||
// Validate implements apis.Validatable | ||
func (t *ServiceNowTarget) Validate(ctx context.Context) *apis.FieldError { | ||
return nil | ||
} |
Oops, something went wrong.