id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
162,000 | argoproj/argo-cd | util/settings/settings.go | Subscribe | func (mgr *SettingsManager) Subscribe(subCh chan<- *ArgoCDSettings) {
mgr.mutex.Lock()
defer mgr.mutex.Unlock()
mgr.subscribers = append(mgr.subscribers, subCh)
log.Infof("%v subscribed to settings updates", subCh)
} | go | func (mgr *SettingsManager) Subscribe(subCh chan<- *ArgoCDSettings) {
mgr.mutex.Lock()
defer mgr.mutex.Unlock()
mgr.subscribers = append(mgr.subscribers, subCh)
log.Infof("%v subscribed to settings updates", subCh)
} | [
"func",
"(",
"mgr",
"*",
"SettingsManager",
")",
"Subscribe",
"(",
"subCh",
"chan",
"<-",
"*",
"ArgoCDSettings",
")",
"{",
"mgr",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mgr",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"mgr",
".",
"s... | // Subscribe registers a channel in which to subscribe to settings updates | [
"Subscribe",
"registers",
"a",
"channel",
"in",
"which",
"to",
"subscribe",
"to",
"settings",
"updates"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L756-L761 |
162,001 | argoproj/argo-cd | util/settings/settings.go | Unsubscribe | func (mgr *SettingsManager) Unsubscribe(subCh chan<- *ArgoCDSettings) {
mgr.mutex.Lock()
defer mgr.mutex.Unlock()
for i, ch := range mgr.subscribers {
if ch == subCh {
mgr.subscribers = append(mgr.subscribers[:i], mgr.subscribers[i+1:]...)
log.Infof("%v unsubscribed from settings updates", subCh)
return
... | go | func (mgr *SettingsManager) Unsubscribe(subCh chan<- *ArgoCDSettings) {
mgr.mutex.Lock()
defer mgr.mutex.Unlock()
for i, ch := range mgr.subscribers {
if ch == subCh {
mgr.subscribers = append(mgr.subscribers[:i], mgr.subscribers[i+1:]...)
log.Infof("%v unsubscribed from settings updates", subCh)
return
... | [
"func",
"(",
"mgr",
"*",
"SettingsManager",
")",
"Unsubscribe",
"(",
"subCh",
"chan",
"<-",
"*",
"ArgoCDSettings",
")",
"{",
"mgr",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mgr",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"for",
"i",
... | // Unsubscribe unregisters a channel from receiving of settings updates | [
"Unsubscribe",
"unregisters",
"a",
"channel",
"from",
"receiving",
"of",
"settings",
"updates"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L764-L774 |
162,002 | argoproj/argo-cd | util/settings/settings.go | InitializeSettings | func (mgr *SettingsManager) InitializeSettings() (*ArgoCDSettings, error) {
cdSettings, err := mgr.GetSettings()
if err != nil && !isIncompleteSettingsError(err) {
return nil, err
}
if cdSettings == nil {
cdSettings = &ArgoCDSettings{}
}
if cdSettings.ServerSignature == nil {
// set JWT signature
signatur... | go | func (mgr *SettingsManager) InitializeSettings() (*ArgoCDSettings, error) {
cdSettings, err := mgr.GetSettings()
if err != nil && !isIncompleteSettingsError(err) {
return nil, err
}
if cdSettings == nil {
cdSettings = &ArgoCDSettings{}
}
if cdSettings.ServerSignature == nil {
// set JWT signature
signatur... | [
"func",
"(",
"mgr",
"*",
"SettingsManager",
")",
"InitializeSettings",
"(",
")",
"(",
"*",
"ArgoCDSettings",
",",
"error",
")",
"{",
"cdSettings",
",",
"err",
":=",
"mgr",
".",
"GetSettings",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"isInco... | // InitializeSettings is used to initialize empty admin password, signature, certificate etc if missing | [
"InitializeSettings",
"is",
"used",
"to",
"initialize",
"empty",
"admin",
"password",
"signature",
"certificate",
"etc",
"if",
"missing"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L793-L864 |
162,003 | argoproj/argo-cd | server/project/project.go | NewServer | func NewServer(ns string, kubeclientset kubernetes.Interface, appclientset appclientset.Interface, enf *rbac.Enforcer, projectLock *util.KeyLock, sessionMgr *session.SessionManager) *Server {
auditLogger := argo.NewAuditLogger(ns, kubeclientset, "argocd-server")
return &Server{enf: enf, appclientset: appclientset, ku... | go | func NewServer(ns string, kubeclientset kubernetes.Interface, appclientset appclientset.Interface, enf *rbac.Enforcer, projectLock *util.KeyLock, sessionMgr *session.SessionManager) *Server {
auditLogger := argo.NewAuditLogger(ns, kubeclientset, "argocd-server")
return &Server{enf: enf, appclientset: appclientset, ku... | [
"func",
"NewServer",
"(",
"ns",
"string",
",",
"kubeclientset",
"kubernetes",
".",
"Interface",
",",
"appclientset",
"appclientset",
".",
"Interface",
",",
"enf",
"*",
"rbac",
".",
"Enforcer",
",",
"projectLock",
"*",
"util",
".",
"KeyLock",
",",
"sessionMgr",... | // NewServer returns a new instance of the Project service | [
"NewServer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"Project",
"service"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.go#L45-L48 |
162,004 | argoproj/argo-cd | server/project/project.go | CreateToken | func (s *Server) CreateToken(ctx context.Context, q *ProjectTokenCreateRequest) (*ProjectTokenResponse, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionUpdate, q.Project); err != nil {
return nil, err
}
project, err := s.appclientset.ArgoprojV1alpha1().AppProj... | go | func (s *Server) CreateToken(ctx context.Context, q *ProjectTokenCreateRequest) (*ProjectTokenResponse, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionUpdate, q.Project); err != nil {
return nil, err
}
project, err := s.appclientset.ArgoprojV1alpha1().AppProj... | [
"func",
"(",
"s",
"*",
"Server",
")",
"CreateToken",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ProjectTokenCreateRequest",
")",
"(",
"*",
"ProjectTokenResponse",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr",
... | // CreateToken creates a new token to access a project | [
"CreateToken",
"creates",
"a",
"new",
"token",
"to",
"access",
"a",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.go#L51-L96 |
162,005 | argoproj/argo-cd | server/project/project.go | DeleteToken | func (s *Server) DeleteToken(ctx context.Context, q *ProjectTokenDeleteRequest) (*EmptyResponse, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionDelete, q.Project); err != nil {
return nil, err
}
project, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.... | go | func (s *Server) DeleteToken(ctx context.Context, q *ProjectTokenDeleteRequest) (*EmptyResponse, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionDelete, q.Project); err != nil {
return nil, err
}
project, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.... | [
"func",
"(",
"s",
"*",
"Server",
")",
"DeleteToken",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ProjectTokenDeleteRequest",
")",
"(",
"*",
"EmptyResponse",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr",
"(",
... | // DeleteToken deletes a token in a project | [
"DeleteToken",
"deletes",
"a",
"token",
"in",
"a",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.go#L99-L131 |
162,006 | argoproj/argo-cd | server/project/project.go | List | func (s *Server) List(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProjectList, error) {
list, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(metav1.ListOptions{})
if list != nil {
newItems := make([]v1alpha1.AppProject, 0)
for i := range list.Items {
project := list.Items[i]
if s.en... | go | func (s *Server) List(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProjectList, error) {
list, err := s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).List(metav1.ListOptions{})
if list != nil {
newItems := make([]v1alpha1.AppProject, 0)
for i := range list.Items {
project := list.Items[i]
if s.en... | [
"func",
"(",
"s",
"*",
"Server",
")",
"List",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ProjectQuery",
")",
"(",
"*",
"v1alpha1",
".",
"AppProjectList",
",",
"error",
")",
"{",
"list",
",",
"err",
":=",
"s",
".",
"appclientset",
".",
"... | // List returns list of projects | [
"List",
"returns",
"list",
"of",
"projects"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.go#L151-L164 |
162,007 | argoproj/argo-cd | server/project/project.go | Get | func (s *Server) Get(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProject, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionGet, q.Name); err != nil {
return nil, err
}
return s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).Get(q.Name, metav1.GetOpti... | go | func (s *Server) Get(ctx context.Context, q *ProjectQuery) (*v1alpha1.AppProject, error) {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionGet, q.Name); err != nil {
return nil, err
}
return s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).Get(q.Name, metav1.GetOpti... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Get",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ProjectQuery",
")",
"(",
"*",
"v1alpha1",
".",
"AppProject",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"enf",
".",
"EnforceErr",
"(",
"... | // Get returns a project by name | [
"Get",
"returns",
"a",
"project",
"by",
"name"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.go#L167-L172 |
162,008 | argoproj/argo-cd | server/project/project.go | Delete | func (s *Server) Delete(ctx context.Context, q *ProjectQuery) (*EmptyResponse, error) {
if q.Name == common.DefaultAppProjectName {
return nil, status.Errorf(codes.InvalidArgument, "name '%s' is reserved and cannot be deleted", q.Name)
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, ... | go | func (s *Server) Delete(ctx context.Context, q *ProjectQuery) (*EmptyResponse, error) {
if q.Name == common.DefaultAppProjectName {
return nil, status.Errorf(codes.InvalidArgument, "name '%s' is reserved and cannot be deleted", q.Name)
}
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceProjects, ... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ProjectQuery",
")",
"(",
"*",
"EmptyResponse",
",",
"error",
")",
"{",
"if",
"q",
".",
"Name",
"==",
"common",
".",
"DefaultAppProjectName",
"{",
"... | // Delete deletes a project | [
"Delete",
"deletes",
"a",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/project/project.go#L294-L323 |
162,009 | argoproj/argo-cd | util/swagger/swagger.go | ServeSwaggerUI | func ServeSwaggerUI(mux *http.ServeMux, swaggerJSON string, uiPath string) {
prefix := path.Dir(uiPath)
specURL := path.Join(prefix, "swagger.json")
mux.HandleFunc(specURL, func(w http.ResponseWriter, r *http.Request) {
_, _ = fmt.Fprint(w, swaggerJSON)
})
mux.Handle(uiPath, middleware.Redoc(middleware.RedocOp... | go | func ServeSwaggerUI(mux *http.ServeMux, swaggerJSON string, uiPath string) {
prefix := path.Dir(uiPath)
specURL := path.Join(prefix, "swagger.json")
mux.HandleFunc(specURL, func(w http.ResponseWriter, r *http.Request) {
_, _ = fmt.Fprint(w, swaggerJSON)
})
mux.Handle(uiPath, middleware.Redoc(middleware.RedocOp... | [
"func",
"ServeSwaggerUI",
"(",
"mux",
"*",
"http",
".",
"ServeMux",
",",
"swaggerJSON",
"string",
",",
"uiPath",
"string",
")",
"{",
"prefix",
":=",
"path",
".",
"Dir",
"(",
"uiPath",
")",
"\n",
"specURL",
":=",
"path",
".",
"Join",
"(",
"prefix",
",",... | // ServeSwaggerUI serves the Swagger UI and JSON spec. | [
"ServeSwaggerUI",
"serves",
"the",
"Swagger",
"UI",
"and",
"JSON",
"spec",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/swagger/swagger.go#L12-L25 |
162,010 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/appproject.go | newAppProjects | func newAppProjects(c *ArgoprojV1alpha1Client, namespace string) *appProjects {
return &appProjects{
client: c.RESTClient(),
ns: namespace,
}
} | go | func newAppProjects(c *ArgoprojV1alpha1Client, namespace string) *appProjects {
return &appProjects{
client: c.RESTClient(),
ns: namespace,
}
} | [
"func",
"newAppProjects",
"(",
"c",
"*",
"ArgoprojV1alpha1Client",
",",
"namespace",
"string",
")",
"*",
"appProjects",
"{",
"return",
"&",
"appProjects",
"{",
"client",
":",
"c",
".",
"RESTClient",
"(",
")",
",",
"ns",
":",
"namespace",
",",
"}",
"\n",
... | // newAppProjects returns a AppProjects | [
"newAppProjects",
"returns",
"a",
"AppProjects"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/appproject.go#L40-L45 |
162,011 | argoproj/argo-cd | cmd/argocd/commands/app_actions.go | NewApplicationResourceActionsCommand | func NewApplicationResourceActionsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "actions",
Short: "Manage Resource actions",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewApplicationResour... | go | func NewApplicationResourceActionsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "actions",
Short: "Manage Resource actions",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewApplicationResour... | [
"func",
"NewApplicationResourceActionsCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
... | // NewApplicationResourceActionsCommand returns a new instance of an `argocd app actions` command | [
"NewApplicationResourceActionsCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"app",
"actions",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/app_actions.go#L20-L32 |
162,012 | argoproj/argo-cd | cmd/argocd/commands/app_actions.go | NewApplicationResourceActionsListCommand | func NewApplicationResourceActionsListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var namespace string
var kind string
var group string
var resourceName string
var all bool
var command = &cobra.Command{
Use: "list APPNAME",
Short: "Lists available actions on a resource",
}
command.Run... | go | func NewApplicationResourceActionsListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var namespace string
var kind string
var group string
var resourceName string
var all bool
var command = &cobra.Command{
Use: "list APPNAME",
Short: "Lists available actions on a resource",
}
command.Run... | [
"func",
"NewApplicationResourceActionsListCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"namespace",
"string",
"\n",
"var",
"kind",
"string",
"\n",
"var",
"group",
"string",
"\n",
"var",
"r... | // NewApplicationResourceActionsListCommand returns a new instance of an `argocd app actions list` command | [
"NewApplicationResourceActionsListCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"app",
"actions",
"list",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/app_actions.go#L35-L99 |
162,013 | argoproj/argo-cd | cmd/argocd/commands/app_actions.go | NewApplicationResourceActionsRunCommand | func NewApplicationResourceActionsRunCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var namespace string
var kind string
var group string
var resourceName string
var all bool
var command = &cobra.Command{
Use: "run APPNAME ACTION",
Short: "Runs an available action on resource(s)",
}
com... | go | func NewApplicationResourceActionsRunCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var namespace string
var kind string
var group string
var resourceName string
var all bool
var command = &cobra.Command{
Use: "run APPNAME ACTION",
Short: "Runs an available action on resource(s)",
}
com... | [
"func",
"NewApplicationResourceActionsRunCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"namespace",
"string",
"\n",
"var",
"kind",
"string",
"\n",
"var",
"group",
"string",
"\n",
"var",
"re... | // NewApplicationResourceActionsRunCommand returns a new instance of an `argocd app actions run` command | [
"NewApplicationResourceActionsRunCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"app",
"actions",
"run",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/app_actions.go#L102-L150 |
162,014 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | HasIdentity | func (r SyncOperationResource) HasIdentity(name string, gvk schema.GroupVersionKind) bool {
if name == r.Name && gvk.Kind == r.Kind && gvk.Group == r.Group {
return true
}
return false
} | go | func (r SyncOperationResource) HasIdentity(name string, gvk schema.GroupVersionKind) bool {
if name == r.Name && gvk.Kind == r.Kind && gvk.Group == r.Group {
return true
}
return false
} | [
"func",
"(",
"r",
"SyncOperationResource",
")",
"HasIdentity",
"(",
"name",
"string",
",",
"gvk",
"schema",
".",
"GroupVersionKind",
")",
"bool",
"{",
"if",
"name",
"==",
"r",
".",
"Name",
"&&",
"gvk",
".",
"Kind",
"==",
"r",
".",
"Kind",
"&&",
"gvk",
... | // HasIdentity determines whether a sync operation is identified by a manifest. | [
"HasIdentity",
"determines",
"whether",
"a",
"sync",
"operation",
"is",
"identified",
"by",
"a",
"manifest",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L245-L250 |
162,015 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | ProjectPoliciesString | func (proj *AppProject) ProjectPoliciesString() string {
var policies []string
for _, role := range proj.Spec.Roles {
projectPolicy := fmt.Sprintf("p, proj:%s:%s, projects, get, %s, allow", proj.ObjectMeta.Name, role.Name, proj.ObjectMeta.Name)
policies = append(policies, projectPolicy)
policies = append(polici... | go | func (proj *AppProject) ProjectPoliciesString() string {
var policies []string
for _, role := range proj.Spec.Roles {
projectPolicy := fmt.Sprintf("p, proj:%s:%s, projects, get, %s, allow", proj.ObjectMeta.Name, role.Name, proj.ObjectMeta.Name)
policies = append(policies, projectPolicy)
policies = append(polici... | [
"func",
"(",
"proj",
"*",
"AppProject",
")",
"ProjectPoliciesString",
"(",
")",
"string",
"{",
"var",
"policies",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"role",
":=",
"range",
"proj",
".",
"Spec",
".",
"Roles",
"{",
"projectPolicy",
":=",
"fmt",
".... | // ProjectPoliciesString returns Casbin formated string of a project's policies for each role | [
"ProjectPoliciesString",
"returns",
"Casbin",
"formated",
"string",
"of",
"a",
"project",
"s",
"policies",
"for",
"each",
"role"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L859-L870 |
162,016 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | SetCascadedDeletion | func (app *Application) SetCascadedDeletion(prune bool) {
index := app.getFinalizerIndex(common.ResourcesFinalizerName)
if prune != (index > -1) {
if index > -1 {
app.Finalizers[index] = app.Finalizers[len(app.Finalizers)-1]
app.Finalizers = app.Finalizers[:len(app.Finalizers)-1]
} else {
app.Finalizers ... | go | func (app *Application) SetCascadedDeletion(prune bool) {
index := app.getFinalizerIndex(common.ResourcesFinalizerName)
if prune != (index > -1) {
if index > -1 {
app.Finalizers[index] = app.Finalizers[len(app.Finalizers)-1]
app.Finalizers = app.Finalizers[:len(app.Finalizers)-1]
} else {
app.Finalizers ... | [
"func",
"(",
"app",
"*",
"Application",
")",
"SetCascadedDeletion",
"(",
"prune",
"bool",
")",
"{",
"index",
":=",
"app",
".",
"getFinalizerIndex",
"(",
"common",
".",
"ResourcesFinalizerName",
")",
"\n",
"if",
"prune",
"!=",
"(",
"index",
">",
"-",
"1",
... | // SetCascadedDeletion sets or remove resources finalizer | [
"SetCascadedDeletion",
"sets",
"or",
"remove",
"resources",
"finalizer"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L906-L916 |
162,017 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | GetErrorConditions | func (status *ApplicationStatus) GetErrorConditions() []ApplicationCondition {
result := make([]ApplicationCondition, 0)
for i := range status.Conditions {
condition := status.Conditions[i]
if condition.IsError() {
result = append(result, condition)
}
}
return result
} | go | func (status *ApplicationStatus) GetErrorConditions() []ApplicationCondition {
result := make([]ApplicationCondition, 0)
for i := range status.Conditions {
condition := status.Conditions[i]
if condition.IsError() {
result = append(result, condition)
}
}
return result
} | [
"func",
"(",
"status",
"*",
"ApplicationStatus",
")",
"GetErrorConditions",
"(",
")",
"[",
"]",
"ApplicationCondition",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"ApplicationCondition",
",",
"0",
")",
"\n",
"for",
"i",
":=",
"range",
"status",
".",
"Cond... | // GetErrorConditions returns list of application error conditions | [
"GetErrorConditions",
"returns",
"list",
"of",
"application",
"error",
"conditions"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L919-L928 |
162,018 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | Equals | func (source *ApplicationSource) Equals(other ApplicationSource) bool {
return reflect.DeepEqual(*source, other)
} | go | func (source *ApplicationSource) Equals(other ApplicationSource) bool {
return reflect.DeepEqual(*source, other)
} | [
"func",
"(",
"source",
"*",
"ApplicationSource",
")",
"Equals",
"(",
"other",
"ApplicationSource",
")",
"bool",
"{",
"return",
"reflect",
".",
"DeepEqual",
"(",
"*",
"source",
",",
"other",
")",
"\n",
"}"
] | // Equals compares two instances of ApplicationSource and return true if instances are equal. | [
"Equals",
"compares",
"two",
"instances",
"of",
"ApplicationSource",
"and",
"return",
"true",
"if",
"instances",
"are",
"equal",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L936-L938 |
162,019 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | Equals | func (dest ApplicationDestination) Equals(other ApplicationDestination) bool {
return reflect.DeepEqual(dest, other)
} | go | func (dest ApplicationDestination) Equals(other ApplicationDestination) bool {
return reflect.DeepEqual(dest, other)
} | [
"func",
"(",
"dest",
"ApplicationDestination",
")",
"Equals",
"(",
"other",
"ApplicationDestination",
")",
"bool",
"{",
"return",
"reflect",
".",
"DeepEqual",
"(",
"dest",
",",
"other",
")",
"\n",
"}"
] | // Equals compares two instances of ApplicationDestination and return true if instances are equal. | [
"Equals",
"compares",
"two",
"instances",
"of",
"ApplicationDestination",
"and",
"return",
"true",
"if",
"instances",
"are",
"equal",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L972-L974 |
162,020 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | GetProject | func (spec ApplicationSpec) GetProject() string {
if spec.Project == "" {
return common.DefaultAppProjectName
}
return spec.Project
} | go | func (spec ApplicationSpec) GetProject() string {
if spec.Project == "" {
return common.DefaultAppProjectName
}
return spec.Project
} | [
"func",
"(",
"spec",
"ApplicationSpec",
")",
"GetProject",
"(",
")",
"string",
"{",
"if",
"spec",
".",
"Project",
"==",
"\"",
"\"",
"{",
"return",
"common",
".",
"DefaultAppProjectName",
"\n",
"}",
"\n",
"return",
"spec",
".",
"Project",
"\n",
"}"
] | // GetProject returns the application's project. This is preferred over spec.Project which may be empty | [
"GetProject",
"returns",
"the",
"application",
"s",
"project",
".",
"This",
"is",
"preferred",
"over",
"spec",
".",
"Project",
"which",
"may",
"be",
"empty"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L977-L982 |
162,021 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | IsSourcePermitted | func (proj AppProject) IsSourcePermitted(src ApplicationSource) bool {
srcNormalized := git.NormalizeGitURL(src.RepoURL)
for _, repoURL := range proj.Spec.SourceRepos {
normalized := git.NormalizeGitURL(repoURL)
if globMatch(normalized, srcNormalized) {
return true
}
}
return false
} | go | func (proj AppProject) IsSourcePermitted(src ApplicationSource) bool {
srcNormalized := git.NormalizeGitURL(src.RepoURL)
for _, repoURL := range proj.Spec.SourceRepos {
normalized := git.NormalizeGitURL(repoURL)
if globMatch(normalized, srcNormalized) {
return true
}
}
return false
} | [
"func",
"(",
"proj",
"AppProject",
")",
"IsSourcePermitted",
"(",
"src",
"ApplicationSource",
")",
"bool",
"{",
"srcNormalized",
":=",
"git",
".",
"NormalizeGitURL",
"(",
"src",
".",
"RepoURL",
")",
"\n",
"for",
"_",
",",
"repoURL",
":=",
"range",
"proj",
... | // IsSourcePermitted validates if the provided application's source is a one of the allowed sources for the project. | [
"IsSourcePermitted",
"validates",
"if",
"the",
"provided",
"application",
"s",
"source",
"is",
"a",
"one",
"of",
"the",
"allowed",
"sources",
"for",
"the",
"project",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L1017-L1026 |
162,022 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | IsDestinationPermitted | func (proj AppProject) IsDestinationPermitted(dst ApplicationDestination) bool {
for _, item := range proj.Spec.Destinations {
if globMatch(item.Server, dst.Server) && globMatch(item.Namespace, dst.Namespace) {
return true
}
}
return false
} | go | func (proj AppProject) IsDestinationPermitted(dst ApplicationDestination) bool {
for _, item := range proj.Spec.Destinations {
if globMatch(item.Server, dst.Server) && globMatch(item.Namespace, dst.Namespace) {
return true
}
}
return false
} | [
"func",
"(",
"proj",
"AppProject",
")",
"IsDestinationPermitted",
"(",
"dst",
"ApplicationDestination",
")",
"bool",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"proj",
".",
"Spec",
".",
"Destinations",
"{",
"if",
"globMatch",
"(",
"item",
".",
"Server",
... | // IsDestinationPermitted validates if the provided application's destination is one of the allowed destinations for the project | [
"IsDestinationPermitted",
"validates",
"if",
"the",
"provided",
"application",
"s",
"destination",
"is",
"one",
"of",
"the",
"allowed",
"destinations",
"for",
"the",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L1029-L1036 |
162,023 | argoproj/argo-cd | pkg/apis/application/v1alpha1/types.go | RESTConfig | func (c *Cluster) RESTConfig() *rest.Config {
var config *rest.Config
var err error
if c.Server == common.KubernetesInternalAPIServerAddr && os.Getenv(common.EnvVarFakeInClusterConfig) == "true" {
config, err = clientcmd.BuildConfigFromFlags("", filepath.Join(os.Getenv("HOME"), ".kube", "config"))
} else if c.Ser... | go | func (c *Cluster) RESTConfig() *rest.Config {
var config *rest.Config
var err error
if c.Server == common.KubernetesInternalAPIServerAddr && os.Getenv(common.EnvVarFakeInClusterConfig) == "true" {
config, err = clientcmd.BuildConfigFromFlags("", filepath.Join(os.Getenv("HOME"), ".kube", "config"))
} else if c.Ser... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"RESTConfig",
"(",
")",
"*",
"rest",
".",
"Config",
"{",
"var",
"config",
"*",
"rest",
".",
"Config",
"\n",
"var",
"err",
"error",
"\n",
"if",
"c",
".",
"Server",
"==",
"common",
".",
"KubernetesInternalAPIServerA... | // RESTConfig returns a go-client REST config from cluster | [
"RESTConfig",
"returns",
"a",
"go",
"-",
"client",
"REST",
"config",
"from",
"cluster"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/types.go#L1039-L1084 |
162,024 | argoproj/argo-cd | util/session/sessionmanager.go | NewSessionManager | func NewSessionManager(settingsMgr *settings.SettingsManager, dexServerAddr string) *SessionManager {
s := SessionManager{
settingsMgr: settingsMgr,
}
settings, err := settingsMgr.GetSettings()
if err != nil {
panic(err)
}
tlsConfig := settings.TLSConfig()
if tlsConfig != nil {
tlsConfig.InsecureSkipVerify... | go | func NewSessionManager(settingsMgr *settings.SettingsManager, dexServerAddr string) *SessionManager {
s := SessionManager{
settingsMgr: settingsMgr,
}
settings, err := settingsMgr.GetSettings()
if err != nil {
panic(err)
}
tlsConfig := settings.TLSConfig()
if tlsConfig != nil {
tlsConfig.InsecureSkipVerify... | [
"func",
"NewSessionManager",
"(",
"settingsMgr",
"*",
"settings",
".",
"SettingsManager",
",",
"dexServerAddr",
"string",
")",
"*",
"SessionManager",
"{",
"s",
":=",
"SessionManager",
"{",
"settingsMgr",
":",
"settingsMgr",
",",
"}",
"\n",
"settings",
",",
"err"... | // NewSessionManager creates a new session manager from Argo CD settings | [
"NewSessionManager",
"creates",
"a",
"new",
"session",
"manager",
"from",
"Argo",
"CD",
"settings"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/session/sessionmanager.go#L43-L74 |
162,025 | argoproj/argo-cd | util/session/sessionmanager.go | Parse | func (mgr *SessionManager) Parse(tokenString string) (jwt.Claims, error) {
// Parse takes the token string and a function for looking up the key. The latter is especially
// useful if you use multiple keys for your application. The standard is to use 'kid' in the
// head of the token to identify which key to use, b... | go | func (mgr *SessionManager) Parse(tokenString string) (jwt.Claims, error) {
// Parse takes the token string and a function for looking up the key. The latter is especially
// useful if you use multiple keys for your application. The standard is to use 'kid' in the
// head of the token to identify which key to use, b... | [
"func",
"(",
"mgr",
"*",
"SessionManager",
")",
"Parse",
"(",
"tokenString",
"string",
")",
"(",
"jwt",
".",
"Claims",
",",
"error",
")",
"{",
"// Parse takes the token string and a function for looking up the key. The latter is especially",
"// useful if you use multiple key... | // Parse tries to parse the provided string and returns the token claims for local superuser login. | [
"Parse",
"tries",
"to",
"parse",
"the",
"provided",
"string",
"and",
"returns",
"the",
"token",
"claims",
"for",
"local",
"superuser",
"login",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/session/sessionmanager.go#L107-L133 |
162,026 | argoproj/argo-cd | util/session/sessionmanager.go | VerifyToken | func (mgr *SessionManager) VerifyToken(tokenString string) (jwt.Claims, error) {
parser := &jwt.Parser{
SkipClaimsValidation: true,
}
var claims jwt.StandardClaims
_, _, err := parser.ParseUnverified(tokenString, &claims)
if err != nil {
return nil, err
}
switch claims.Issuer {
case SessionManagerClaimsIssu... | go | func (mgr *SessionManager) VerifyToken(tokenString string) (jwt.Claims, error) {
parser := &jwt.Parser{
SkipClaimsValidation: true,
}
var claims jwt.StandardClaims
_, _, err := parser.ParseUnverified(tokenString, &claims)
if err != nil {
return nil, err
}
switch claims.Issuer {
case SessionManagerClaimsIssu... | [
"func",
"(",
"mgr",
"*",
"SessionManager",
")",
"VerifyToken",
"(",
"tokenString",
"string",
")",
"(",
"jwt",
".",
"Claims",
",",
"error",
")",
"{",
"parser",
":=",
"&",
"jwt",
".",
"Parser",
"{",
"SkipClaimsValidation",
":",
"true",
",",
"}",
"\n",
"v... | // VerifyToken verifies if a token is correct. Tokens can be issued either from us or by an IDP.
// We choose how to verify based on the issuer. | [
"VerifyToken",
"verifies",
"if",
"a",
"token",
"is",
"correct",
".",
"Tokens",
"can",
"be",
"issued",
"either",
"from",
"us",
"or",
"by",
"an",
"IDP",
".",
"We",
"choose",
"how",
"to",
"verify",
"based",
"on",
"the",
"issuer",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/session/sessionmanager.go#L156-L183 |
162,027 | argoproj/argo-cd | util/session/sessionmanager.go | Username | func Username(ctx context.Context) string {
claims, ok := ctx.Value("claims").(jwt.Claims)
if !ok {
return ""
}
mapClaims, err := jwtutil.MapClaims(claims)
if err != nil {
return ""
}
switch jwtutil.GetField(mapClaims, "iss") {
case SessionManagerClaimsIssuer:
return jwtutil.GetField(mapClaims, "sub")
de... | go | func Username(ctx context.Context) string {
claims, ok := ctx.Value("claims").(jwt.Claims)
if !ok {
return ""
}
mapClaims, err := jwtutil.MapClaims(claims)
if err != nil {
return ""
}
switch jwtutil.GetField(mapClaims, "iss") {
case SessionManagerClaimsIssuer:
return jwtutil.GetField(mapClaims, "sub")
de... | [
"func",
"Username",
"(",
"ctx",
"context",
".",
"Context",
")",
"string",
"{",
"claims",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"\"",
"\"",
")",
".",
"(",
"jwt",
".",
"Claims",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}... | // Username is a helper to extract a human readable username from a context | [
"Username",
"is",
"a",
"helper",
"to",
"extract",
"a",
"human",
"readable",
"username",
"from",
"a",
"context"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/session/sessionmanager.go#L201-L216 |
162,028 | argoproj/argo-cd | util/grpc/grpc.go | PanicLoggerUnaryServerInterceptor | func PanicLoggerUnaryServerInterceptor(log *logrus.Entry) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error) {
defer func() {
if r := recover(); r != nil {
log.Errorf("Recovered from panic: %+v\n%s",... | go | func PanicLoggerUnaryServerInterceptor(log *logrus.Entry) grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error) {
defer func() {
if r := recover(); r != nil {
log.Errorf("Recovered from panic: %+v\n%s",... | [
"func",
"PanicLoggerUnaryServerInterceptor",
"(",
"log",
"*",
"logrus",
".",
"Entry",
")",
"grpc",
".",
"UnaryServerInterceptor",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"interface",
"{",
"}",
",",
"info",
"*",
"grpc",
".",
... | // PanicLoggerUnaryServerInterceptor returns a new unary server interceptor for recovering from panics and returning error | [
"PanicLoggerUnaryServerInterceptor",
"returns",
"a",
"new",
"unary",
"server",
"interceptor",
"for",
"recovering",
"from",
"panics",
"and",
"returning",
"error"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/grpc/grpc.go#L19-L29 |
162,029 | argoproj/argo-cd | util/grpc/grpc.go | PanicLoggerStreamServerInterceptor | func PanicLoggerStreamServerInterceptor(log *logrus.Entry) grpc.StreamServerInterceptor {
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error) {
defer func() {
if r := recover(); r != nil {
log.Errorf("Recovered from panic: %+v\n%s", r, de... | go | func PanicLoggerStreamServerInterceptor(log *logrus.Entry) grpc.StreamServerInterceptor {
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error) {
defer func() {
if r := recover(); r != nil {
log.Errorf("Recovered from panic: %+v\n%s", r, de... | [
"func",
"PanicLoggerStreamServerInterceptor",
"(",
"log",
"*",
"logrus",
".",
"Entry",
")",
"grpc",
".",
"StreamServerInterceptor",
"{",
"return",
"func",
"(",
"srv",
"interface",
"{",
"}",
",",
"stream",
"grpc",
".",
"ServerStream",
",",
"info",
"*",
"grpc",
... | // PanicLoggerStreamServerInterceptor returns a new streaming server interceptor for recovering from panics and returning error | [
"PanicLoggerStreamServerInterceptor",
"returns",
"a",
"new",
"streaming",
"server",
"interceptor",
"for",
"recovering",
"from",
"panics",
"and",
"returning",
"error"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/grpc/grpc.go#L32-L42 |
162,030 | argoproj/argo-cd | util/grpc/useragent.go | UserAgentUnaryServerInterceptor | func UserAgentUnaryServerInterceptor(clientName, constraintStr string) grpc.UnaryServerInterceptor {
userAgentEnforcer := newUserAgentEnforcer(clientName, constraintStr)
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
if err := userAgen... | go | func UserAgentUnaryServerInterceptor(clientName, constraintStr string) grpc.UnaryServerInterceptor {
userAgentEnforcer := newUserAgentEnforcer(clientName, constraintStr)
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
if err := userAgen... | [
"func",
"UserAgentUnaryServerInterceptor",
"(",
"clientName",
",",
"constraintStr",
"string",
")",
"grpc",
".",
"UnaryServerInterceptor",
"{",
"userAgentEnforcer",
":=",
"newUserAgentEnforcer",
"(",
"clientName",
",",
"constraintStr",
")",
"\n",
"return",
"func",
"(",
... | // UserAgentUnaryServerInterceptor returns a UnaryServerInterceptor which enforces a minimum client
// version in the user agent | [
"UserAgentUnaryServerInterceptor",
"returns",
"a",
"UnaryServerInterceptor",
"which",
"enforces",
"a",
"minimum",
"client",
"version",
"in",
"the",
"user",
"agent"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/grpc/useragent.go#L16-L24 |
162,031 | argoproj/argo-cd | util/grpc/useragent.go | UserAgentStreamServerInterceptor | func UserAgentStreamServerInterceptor(clientName, constraintStr string) grpc.StreamServerInterceptor {
userAgentEnforcer := newUserAgentEnforcer(clientName, constraintStr)
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
if err := userAgentEnfor... | go | func UserAgentStreamServerInterceptor(clientName, constraintStr string) grpc.StreamServerInterceptor {
userAgentEnforcer := newUserAgentEnforcer(clientName, constraintStr)
return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
if err := userAgentEnfor... | [
"func",
"UserAgentStreamServerInterceptor",
"(",
"clientName",
",",
"constraintStr",
"string",
")",
"grpc",
".",
"StreamServerInterceptor",
"{",
"userAgentEnforcer",
":=",
"newUserAgentEnforcer",
"(",
"clientName",
",",
"constraintStr",
")",
"\n",
"return",
"func",
"(",... | // UserAgentStreamServerInterceptor returns a StreamServerInterceptor which enforces a minimum client
// version in the user agent | [
"UserAgentStreamServerInterceptor",
"returns",
"a",
"StreamServerInterceptor",
"which",
"enforces",
"a",
"minimum",
"client",
"version",
"in",
"the",
"user",
"agent"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/grpc/useragent.go#L28-L36 |
162,032 | argoproj/argo-cd | controller/sync_hooks.go | verifyPermittedHooks | func (sc *syncContext) verifyPermittedHooks(hooks []*unstructured.Unstructured) bool {
for _, hook := range hooks {
gvk := hook.GroupVersionKind()
serverRes, err := kube.ServerResourceForGroupVersionKind(sc.disco, gvk)
if err != nil {
sc.setOperationPhase(appv1.OperationError, fmt.Sprintf("unable to identify ... | go | func (sc *syncContext) verifyPermittedHooks(hooks []*unstructured.Unstructured) bool {
for _, hook := range hooks {
gvk := hook.GroupVersionKind()
serverRes, err := kube.ServerResourceForGroupVersionKind(sc.disco, gvk)
if err != nil {
sc.setOperationPhase(appv1.OperationError, fmt.Sprintf("unable to identify ... | [
"func",
"(",
"sc",
"*",
"syncContext",
")",
"verifyPermittedHooks",
"(",
"hooks",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
")",
"bool",
"{",
"for",
"_",
",",
"hook",
":=",
"range",
"hooks",
"{",
"gvk",
":=",
"hook",
".",
"GroupVersionKind",
"(... | // verifyPermittedHooks verifies all hooks are permitted in the project | [
"verifyPermittedHooks",
"verifies",
"all",
"hooks",
"are",
"permitted",
"in",
"the",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L76-L104 |
162,033 | argoproj/argo-cd | controller/sync_hooks.go | runHooks | func (sc *syncContext) runHooks(hooks []*unstructured.Unstructured, hookType appv1.HookType) bool {
shouldContinue := true
for _, hook := range hooks {
if hookType == appv1.HookTypeSync && isHookType(hook, appv1.HookTypeSkip) {
// If we get here, we are invoking all sync hooks and reached a resource that is
/... | go | func (sc *syncContext) runHooks(hooks []*unstructured.Unstructured, hookType appv1.HookType) bool {
shouldContinue := true
for _, hook := range hooks {
if hookType == appv1.HookTypeSync && isHookType(hook, appv1.HookTypeSkip) {
// If we get here, we are invoking all sync hooks and reached a resource that is
/... | [
"func",
"(",
"sc",
"*",
"syncContext",
")",
"runHooks",
"(",
"hooks",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
",",
"hookType",
"appv1",
".",
"HookType",
")",
"bool",
"{",
"shouldContinue",
":=",
"true",
"\n",
"for",
"_",
",",
"hook",
":=",
... | // runHooks iterates & filters the target manifests for resources of the specified hook type, then
// creates the resource. Updates the sc.opRes.hooks with the current status. Returns whether or not
// we should continue to the next hook phase. | [
"runHooks",
"iterates",
"&",
"filters",
"the",
"target",
"manifests",
"for",
"resources",
"of",
"the",
"specified",
"hook",
"type",
"then",
"creates",
"the",
"resource",
".",
"Updates",
"the",
"sc",
".",
"opRes",
".",
"hooks",
"with",
"the",
"current",
"stat... | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L138-L188 |
162,034 | argoproj/argo-cd | controller/sync_hooks.go | syncNonHookTasks | func (sc *syncContext) syncNonHookTasks(syncTasks []syncTask) bool {
var nonHookTasks []syncTask
for _, task := range syncTasks {
if task.targetObj == nil {
nonHookTasks = append(nonHookTasks, task)
} else {
annotations := task.targetObj.GetAnnotations()
if annotations != nil && annotations[common.Annota... | go | func (sc *syncContext) syncNonHookTasks(syncTasks []syncTask) bool {
var nonHookTasks []syncTask
for _, task := range syncTasks {
if task.targetObj == nil {
nonHookTasks = append(nonHookTasks, task)
} else {
annotations := task.targetObj.GetAnnotations()
if annotations != nil && annotations[common.Annota... | [
"func",
"(",
"sc",
"*",
"syncContext",
")",
"syncNonHookTasks",
"(",
"syncTasks",
"[",
"]",
"syncTask",
")",
"bool",
"{",
"var",
"nonHookTasks",
"[",
"]",
"syncTask",
"\n",
"for",
"_",
",",
"task",
":=",
"range",
"syncTasks",
"{",
"if",
"task",
".",
"t... | // syncNonHookTasks syncs or prunes the objects that are not handled by hooks using an apply sync.
// returns true if the sync was successful | [
"syncNonHookTasks",
"syncs",
"or",
"prunes",
"the",
"objects",
"that",
"are",
"not",
"handled",
"by",
"hooks",
"using",
"an",
"apply",
"sync",
".",
"returns",
"true",
"if",
"the",
"sync",
"was",
"successful"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L192-L209 |
162,035 | argoproj/argo-cd | controller/sync_hooks.go | enforceHookDeletePolicy | func enforceHookDeletePolicy(hook *unstructured.Unstructured, phase appv1.OperationPhase) bool {
annotations := hook.GetAnnotations()
if annotations == nil {
return false
}
deletePolicies := strings.Split(annotations[common.AnnotationKeyHookDeletePolicy], ",")
for _, dp := range deletePolicies {
policy := appv... | go | func enforceHookDeletePolicy(hook *unstructured.Unstructured, phase appv1.OperationPhase) bool {
annotations := hook.GetAnnotations()
if annotations == nil {
return false
}
deletePolicies := strings.Split(annotations[common.AnnotationKeyHookDeletePolicy], ",")
for _, dp := range deletePolicies {
policy := appv... | [
"func",
"enforceHookDeletePolicy",
"(",
"hook",
"*",
"unstructured",
".",
"Unstructured",
",",
"phase",
"appv1",
".",
"OperationPhase",
")",
"bool",
"{",
"annotations",
":=",
"hook",
".",
"GetAnnotations",
"(",
")",
"\n",
"if",
"annotations",
"==",
"nil",
"{",... | // enforceHookDeletePolicy examines the hook deletion policy of a object and deletes it based on the status | [
"enforceHookDeletePolicy",
"examines",
"the",
"hook",
"deletion",
"policy",
"of",
"a",
"object",
"and",
"deletes",
"it",
"based",
"on",
"the",
"status"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L272-L288 |
162,036 | argoproj/argo-cd | controller/sync_hooks.go | isHookType | func isHookType(hook *unstructured.Unstructured, hookType appv1.HookType) bool {
annotations := hook.GetAnnotations()
if annotations == nil {
return false
}
resHookTypes := strings.Split(annotations[common.AnnotationKeyHook], ",")
for _, ht := range resHookTypes {
if string(hookType) == strings.TrimSpace(ht) {... | go | func isHookType(hook *unstructured.Unstructured, hookType appv1.HookType) bool {
annotations := hook.GetAnnotations()
if annotations == nil {
return false
}
resHookTypes := strings.Split(annotations[common.AnnotationKeyHook], ",")
for _, ht := range resHookTypes {
if string(hookType) == strings.TrimSpace(ht) {... | [
"func",
"isHookType",
"(",
"hook",
"*",
"unstructured",
".",
"Unstructured",
",",
"hookType",
"appv1",
".",
"HookType",
")",
"bool",
"{",
"annotations",
":=",
"hook",
".",
"GetAnnotations",
"(",
")",
"\n",
"if",
"annotations",
"==",
"nil",
"{",
"return",
"... | // isHookType tells whether or not the supplied object is a hook of the specified type | [
"isHookType",
"tells",
"whether",
"or",
"not",
"the",
"supplied",
"object",
"is",
"a",
"hook",
"of",
"the",
"specified",
"type"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L291-L303 |
162,037 | argoproj/argo-cd | controller/sync_hooks.go | newHookStatus | func newHookStatus(hook *unstructured.Unstructured, hookType appv1.HookType) appv1.ResourceResult {
gvk := hook.GroupVersionKind()
hookStatus := appv1.ResourceResult{
Name: hook.GetName(),
Kind: hook.GetKind(),
Group: gvk.Group,
Version: gvk.Version,
HookType: hookType,
HookPhase: appv1.O... | go | func newHookStatus(hook *unstructured.Unstructured, hookType appv1.HookType) appv1.ResourceResult {
gvk := hook.GroupVersionKind()
hookStatus := appv1.ResourceResult{
Name: hook.GetName(),
Kind: hook.GetKind(),
Group: gvk.Group,
Version: gvk.Version,
HookType: hookType,
HookPhase: appv1.O... | [
"func",
"newHookStatus",
"(",
"hook",
"*",
"unstructured",
".",
"Unstructured",
",",
"hookType",
"appv1",
".",
"HookType",
")",
"appv1",
".",
"ResourceResult",
"{",
"gvk",
":=",
"hook",
".",
"GroupVersionKind",
"(",
")",
"\n",
"hookStatus",
":=",
"appv1",
".... | // newHookStatus returns a hook status from an _live_ unstructured object | [
"newHookStatus",
"returns",
"a",
"hook",
"status",
"from",
"an",
"_live_",
"unstructured",
"object"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L306-L328 |
162,038 | argoproj/argo-cd | controller/sync_hooks.go | isRunnable | func isRunnable(res *appv1.ResourceResult) bool {
gvk := res.GroupVersionKind()
return isBatchJob(gvk) || isArgoWorkflow(gvk) || isPod(gvk)
} | go | func isRunnable(res *appv1.ResourceResult) bool {
gvk := res.GroupVersionKind()
return isBatchJob(gvk) || isArgoWorkflow(gvk) || isPod(gvk)
} | [
"func",
"isRunnable",
"(",
"res",
"*",
"appv1",
".",
"ResourceResult",
")",
"bool",
"{",
"gvk",
":=",
"res",
".",
"GroupVersionKind",
"(",
")",
"\n",
"return",
"isBatchJob",
"(",
"gvk",
")",
"||",
"isArgoWorkflow",
"(",
"gvk",
")",
"||",
"isPod",
"(",
... | // isRunnable returns if the resource object is a runnable type which needs to be terminated | [
"isRunnable",
"returns",
"if",
"the",
"resource",
"object",
"is",
"a",
"runnable",
"type",
"which",
"needs",
"to",
"be",
"terminated"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L331-L334 |
162,039 | argoproj/argo-cd | controller/sync_hooks.go | updateHookStatus | func (sc *syncContext) updateHookStatus(hookStatus appv1.ResourceResult) bool {
sc.lock.Lock()
defer sc.lock.Unlock()
for i, prev := range sc.syncRes.Resources {
if !prev.IsHook() {
continue
}
if hookEqual(prev, hookStatus.Group, hookStatus.Kind, hookStatus.Namespace, hookStatus.Name, hookStatus.HookType) {... | go | func (sc *syncContext) updateHookStatus(hookStatus appv1.ResourceResult) bool {
sc.lock.Lock()
defer sc.lock.Unlock()
for i, prev := range sc.syncRes.Resources {
if !prev.IsHook() {
continue
}
if hookEqual(prev, hookStatus.Group, hookStatus.Kind, hookStatus.Namespace, hookStatus.Name, hookStatus.HookType) {... | [
"func",
"(",
"sc",
"*",
"syncContext",
")",
"updateHookStatus",
"(",
"hookStatus",
"appv1",
".",
"ResourceResult",
")",
"bool",
"{",
"sc",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"sc",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"for",
"i"... | // updateHookStatus updates the status of a hook. Returns true if the hook was modified | [
"updateHookStatus",
"updates",
"the",
"status",
"of",
"a",
"hook",
".",
"Returns",
"true",
"if",
"the",
"hook",
"was",
"modified"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L473-L500 |
162,040 | argoproj/argo-cd | controller/sync_hooks.go | areHooksCompletedSuccessful | func areHooksCompletedSuccessful(hookType appv1.HookType, hookStatuses []*appv1.ResourceResult) (bool, bool) {
isSuccessful := true
for _, hookStatus := range hookStatuses {
if !hookStatus.IsHook() {
continue
}
if hookStatus.HookType != hookType {
continue
}
if !hookStatus.HookPhase.Completed() {
r... | go | func areHooksCompletedSuccessful(hookType appv1.HookType, hookStatuses []*appv1.ResourceResult) (bool, bool) {
isSuccessful := true
for _, hookStatus := range hookStatuses {
if !hookStatus.IsHook() {
continue
}
if hookStatus.HookType != hookType {
continue
}
if !hookStatus.HookPhase.Completed() {
r... | [
"func",
"areHooksCompletedSuccessful",
"(",
"hookType",
"appv1",
".",
"HookType",
",",
"hookStatuses",
"[",
"]",
"*",
"appv1",
".",
"ResourceResult",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"isSuccessful",
":=",
"true",
"\n",
"for",
"_",
",",
"hookStatus",
... | // areHooksCompletedSuccessful checks if all the hooks of the specified type are completed and successful | [
"areHooksCompletedSuccessful",
"checks",
"if",
"all",
"the",
"hooks",
"of",
"the",
"specified",
"type",
"are",
"completed",
"and",
"successful"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/controller/sync_hooks.go#L503-L520 |
162,041 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go | Get | func (c *FakeApplications) Get(name string, options v1.GetOptions) (result *v1alpha1.Application, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(applicationsResource, c.ns, name), &v1alpha1.Application{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Application), err
} | go | func (c *FakeApplications) Get(name string, options v1.GetOptions) (result *v1alpha1.Application, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(applicationsResource, c.ns, name), &v1alpha1.Application{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Application), err
} | [
"func",
"(",
"c",
"*",
"FakeApplications",
")",
"Get",
"(",
"name",
"string",
",",
"options",
"v1",
".",
"GetOptions",
")",
"(",
"result",
"*",
"v1alpha1",
".",
"Application",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
... | // Get takes name of the application, and returns the corresponding application object, and an error if there is any. | [
"Get",
"takes",
"name",
"of",
"the",
"application",
"and",
"returns",
"the",
"corresponding",
"application",
"object",
"and",
"an",
"error",
"if",
"there",
"is",
"any",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go#L26-L34 |
162,042 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go | List | func (c *FakeApplications) List(opts v1.ListOptions) (result *v1alpha1.ApplicationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(applicationsResource, applicationsKind, c.ns, opts), &v1alpha1.ApplicationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptio... | go | func (c *FakeApplications) List(opts v1.ListOptions) (result *v1alpha1.ApplicationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(applicationsResource, applicationsKind, c.ns, opts), &v1alpha1.ApplicationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptio... | [
"func",
"(",
"c",
"*",
"FakeApplications",
")",
"List",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"result",
"*",
"v1alpha1",
".",
"ApplicationList",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",... | // List takes label and field selectors, and returns the list of Applications that match those selectors. | [
"List",
"takes",
"label",
"and",
"field",
"selectors",
"and",
"returns",
"the",
"list",
"of",
"Applications",
"that",
"match",
"those",
"selectors",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go#L37-L56 |
162,043 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go | Watch | func (c *FakeApplications) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(applicationsResource, c.ns, opts))
} | go | func (c *FakeApplications) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(applicationsResource, c.ns, opts))
} | [
"func",
"(",
"c",
"*",
"FakeApplications",
")",
"Watch",
"(",
"opts",
"v1",
".",
"ListOptions",
")",
"(",
"watch",
".",
"Interface",
",",
"error",
")",
"{",
"return",
"c",
".",
"Fake",
".",
"InvokesWatch",
"(",
"testing",
".",
"NewWatchAction",
"(",
"a... | // Watch returns a watch.Interface that watches the requested applications. | [
"Watch",
"returns",
"a",
"watch",
".",
"Interface",
"that",
"watches",
"the",
"requested",
"applications",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go#L59-L63 |
162,044 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go | Delete | func (c *FakeApplications) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(applicationsResource, c.ns, name), &v1alpha1.Application{})
return err
} | go | func (c *FakeApplications) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(applicationsResource, c.ns, name), &v1alpha1.Application{})
return err
} | [
"func",
"(",
"c",
"*",
"FakeApplications",
")",
"Delete",
"(",
"name",
"string",
",",
"options",
"*",
"v1",
".",
"DeleteOptions",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewDeleteAction",
"(",
... | // Delete takes name of the application and deletes it. Returns an error if one occurs. | [
"Delete",
"takes",
"name",
"of",
"the",
"application",
"and",
"deletes",
"it",
".",
"Returns",
"an",
"error",
"if",
"one",
"occurs",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go#L88-L93 |
162,045 | argoproj/argo-cd | pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go | Patch | func (c *FakeApplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Application, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(applicationsResource, c.ns, name, data, subresources...), &v1alpha1.Application{})
if obj == nil {
retur... | go | func (c *FakeApplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Application, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(applicationsResource, c.ns, name, data, subresources...), &v1alpha1.Application{})
if obj == nil {
retur... | [
"func",
"(",
"c",
"*",
"FakeApplications",
")",
"Patch",
"(",
"name",
"string",
",",
"pt",
"types",
".",
"PatchType",
",",
"data",
"[",
"]",
"byte",
",",
"subresources",
"...",
"string",
")",
"(",
"result",
"*",
"v1alpha1",
".",
"Application",
",",
"er... | // Patch applies the patch and returns the patched application. | [
"Patch",
"applies",
"the",
"patch",
"and",
"returns",
"the",
"patched",
"application",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/clientset/versioned/typed/application/v1alpha1/fake/fake_application.go#L104-L112 |
162,046 | argoproj/argo-cd | pkg/client/listers/application/v1alpha1/application.go | List | func (s *applicationLister) List(selector labels.Selector) (ret []*v1alpha1.Application, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Application))
})
return ret, err
} | go | func (s *applicationLister) List(selector labels.Selector) (ret []*v1alpha1.Application, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Application))
})
return ret, err
} | [
"func",
"(",
"s",
"*",
"applicationLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1alpha1",
".",
"Application",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAll",
"(",
"s",
".",
... | // List lists all Applications in the indexer. | [
"List",
"lists",
"all",
"Applications",
"in",
"the",
"indexer",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/listers/application/v1alpha1/application.go#L32-L37 |
162,047 | argoproj/argo-cd | pkg/client/listers/application/v1alpha1/application.go | Applications | func (s *applicationLister) Applications(namespace string) ApplicationNamespaceLister {
return applicationNamespaceLister{indexer: s.indexer, namespace: namespace}
} | go | func (s *applicationLister) Applications(namespace string) ApplicationNamespaceLister {
return applicationNamespaceLister{indexer: s.indexer, namespace: namespace}
} | [
"func",
"(",
"s",
"*",
"applicationLister",
")",
"Applications",
"(",
"namespace",
"string",
")",
"ApplicationNamespaceLister",
"{",
"return",
"applicationNamespaceLister",
"{",
"indexer",
":",
"s",
".",
"indexer",
",",
"namespace",
":",
"namespace",
"}",
"\n",
... | // Applications returns an object that can list and get Applications. | [
"Applications",
"returns",
"an",
"object",
"that",
"can",
"list",
"and",
"get",
"Applications",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/listers/application/v1alpha1/application.go#L40-L42 |
162,048 | argoproj/argo-cd | pkg/client/listers/application/v1alpha1/application.go | List | func (s applicationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Application, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Application))
})
return ret, err
} | go | func (s applicationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Application, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Application))
})
return ret, err
} | [
"func",
"(",
"s",
"applicationNamespaceLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1alpha1",
".",
"Application",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAllByNamespace",
"(",
"... | // List lists all Applications in the indexer for a given namespace. | [
"List",
"lists",
"all",
"Applications",
"in",
"the",
"indexer",
"for",
"a",
"given",
"namespace",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/listers/application/v1alpha1/application.go#L61-L66 |
162,049 | argoproj/argo-cd | pkg/apiclient/grpcproxy.go | useGRPCProxy | func (c *client) useGRPCProxy() (net.Addr, io.Closer, error) {
c.proxyMutex.Lock()
defer c.proxyMutex.Unlock()
if c.proxyListener == nil {
var err error
c.proxyServer, c.proxyListener, err = c.startGRPCProxy()
if err != nil {
return nil, nil, err
}
}
c.proxyUsersCount = c.proxyUsersCount + 1
return c... | go | func (c *client) useGRPCProxy() (net.Addr, io.Closer, error) {
c.proxyMutex.Lock()
defer c.proxyMutex.Unlock()
if c.proxyListener == nil {
var err error
c.proxyServer, c.proxyListener, err = c.startGRPCProxy()
if err != nil {
return nil, nil, err
}
}
c.proxyUsersCount = c.proxyUsersCount + 1
return c... | [
"func",
"(",
"c",
"*",
"client",
")",
"useGRPCProxy",
"(",
")",
"(",
"net",
".",
"Addr",
",",
"io",
".",
"Closer",
",",
"error",
")",
"{",
"c",
".",
"proxyMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"proxyMutex",
".",
"Unlock",
"(",
... | // useGRPCProxy ensures that grpc proxy server is started and return closer which stops server when no one uses it | [
"useGRPCProxy",
"ensures",
"that",
"grpc",
"proxy",
"server",
"is",
"started",
"and",
"return",
"closer",
"which",
"stops",
"server",
"when",
"no",
"one",
"uses",
"it"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apiclient/grpcproxy.go#L175-L200 |
162,050 | argoproj/argo-cd | server/settings/settings.pb.gw.go | RegisterSettingsServiceHandler | func RegisterSettingsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterSettingsServiceHandlerClient(ctx, mux, NewSettingsServiceClient(conn))
} | go | func RegisterSettingsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterSettingsServiceHandlerClient(ctx, mux, NewSettingsServiceClient(conn))
} | [
"func",
"RegisterSettingsServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterSettingsServiceHandlerClient",
"(",
"ctx",
",",
"mux"... | // RegisterSettingsServiceHandler registers the http handlers for service SettingsService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterSettingsServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"SettingsService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/settings/settings.pb.gw.go#L67-L69 |
162,051 | argoproj/argo-cd | util/grpc/errors.go | ErrorCodeUnaryServerInterceptor | func ErrorCodeUnaryServerInterceptor() grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
resp, err = handler(ctx, req)
return resp, kubeErrToGRPC(err)
}
} | go | func ErrorCodeUnaryServerInterceptor() grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
resp, err = handler(ctx, req)
return resp, kubeErrToGRPC(err)
}
} | [
"func",
"ErrorCodeUnaryServerInterceptor",
"(",
")",
"grpc",
".",
"UnaryServerInterceptor",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"interface",
"{",
"}",
",",
"info",
"*",
"grpc",
".",
"UnaryServerInfo",
",",
"handler",
"grpc... | // ErrorCodeUnaryServerInterceptor replaces Kubernetes errors with relevant gRPC equivalents, if any. | [
"ErrorCodeUnaryServerInterceptor",
"replaces",
"Kubernetes",
"errors",
"with",
"relevant",
"gRPC",
"equivalents",
"if",
"any",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/grpc/errors.go#L62-L67 |
162,052 | argoproj/argo-cd | util/grpc/errors.go | ErrorCodeStreamServerInterceptor | func ErrorCodeStreamServerInterceptor() grpc.StreamServerInterceptor {
return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
err := handler(srv, ss)
return kubeErrToGRPC(err)
}
} | go | func ErrorCodeStreamServerInterceptor() grpc.StreamServerInterceptor {
return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
err := handler(srv, ss)
return kubeErrToGRPC(err)
}
} | [
"func",
"ErrorCodeStreamServerInterceptor",
"(",
")",
"grpc",
".",
"StreamServerInterceptor",
"{",
"return",
"func",
"(",
"srv",
"interface",
"{",
"}",
",",
"ss",
"grpc",
".",
"ServerStream",
",",
"info",
"*",
"grpc",
".",
"StreamServerInfo",
",",
"handler",
"... | // ErrorCodeStreamServerInterceptor replaces Kubernetes errors with relevant gRPC equivalents, if any. | [
"ErrorCodeStreamServerInterceptor",
"replaces",
"Kubernetes",
"errors",
"with",
"relevant",
"gRPC",
"equivalents",
"if",
"any",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/grpc/errors.go#L70-L75 |
162,053 | argoproj/argo-cd | reposerver/repository/repository.go | NewService | func NewService(gitFactory git.ClientFactory, cache *cache.Cache, parallelismLimit int64) *Service {
var parallelismLimitSemaphore *semaphore.Weighted
if parallelismLimit > 0 {
parallelismLimitSemaphore = semaphore.NewWeighted(parallelismLimit)
}
return &Service{
parallelismLimitSemaphore: parallelismLimitSemap... | go | func NewService(gitFactory git.ClientFactory, cache *cache.Cache, parallelismLimit int64) *Service {
var parallelismLimitSemaphore *semaphore.Weighted
if parallelismLimit > 0 {
parallelismLimitSemaphore = semaphore.NewWeighted(parallelismLimit)
}
return &Service{
parallelismLimitSemaphore: parallelismLimitSemap... | [
"func",
"NewService",
"(",
"gitFactory",
"git",
".",
"ClientFactory",
",",
"cache",
"*",
"cache",
".",
"Cache",
",",
"parallelismLimit",
"int64",
")",
"*",
"Service",
"{",
"var",
"parallelismLimitSemaphore",
"*",
"semaphore",
".",
"Weighted",
"\n",
"if",
"para... | // NewService returns a new instance of the Manifest service | [
"NewService",
"returns",
"a",
"new",
"instance",
"of",
"the",
"Manifest",
"service"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L50-L62 |
162,054 | argoproj/argo-cd | reposerver/repository/repository.go | ListDir | func (s *Service) ListDir(ctx context.Context, q *ListDirRequest) (*FileList, error) {
gitClient, commitSHA, err := s.newClientResolveRevision(q.Repo, q.Revision)
if err != nil {
return nil, err
}
if files, err := s.cache.GetGitListDir(commitSHA, q.Path); err == nil {
log.Infof("listdir cache hit: %s/%s", commi... | go | func (s *Service) ListDir(ctx context.Context, q *ListDirRequest) (*FileList, error) {
gitClient, commitSHA, err := s.newClientResolveRevision(q.Repo, q.Revision)
if err != nil {
return nil, err
}
if files, err := s.cache.GetGitListDir(commitSHA, q.Path); err == nil {
log.Infof("listdir cache hit: %s/%s", commi... | [
"func",
"(",
"s",
"*",
"Service",
")",
"ListDir",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"ListDirRequest",
")",
"(",
"*",
"FileList",
",",
"error",
")",
"{",
"gitClient",
",",
"commitSHA",
",",
"err",
":=",
"s",
".",
"newClientResolveRev... | // ListDir lists the contents of a GitHub repo | [
"ListDir",
"lists",
"the",
"contents",
"of",
"a",
"GitHub",
"repo"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L65-L93 |
162,055 | argoproj/argo-cd | reposerver/repository/repository.go | tempRepoPath | func tempRepoPath(repo string) string {
return filepath.Join(os.TempDir(), strings.Replace(repo, "/", "_", -1))
} | go | func tempRepoPath(repo string) string {
return filepath.Join(os.TempDir(), strings.Replace(repo, "/", "_", -1))
} | [
"func",
"tempRepoPath",
"(",
"repo",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"os",
".",
"TempDir",
"(",
")",
",",
"strings",
".",
"Replace",
"(",
"repo",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
")",
"\n... | // tempRepoPath returns a formulated temporary directory location to clone a repository | [
"tempRepoPath",
"returns",
"a",
"formulated",
"temporary",
"directory",
"location",
"to",
"clone",
"a",
"repository"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L282-L284 |
162,056 | argoproj/argo-cd | reposerver/repository/repository.go | GetAppSourceType | func GetAppSourceType(source *v1alpha1.ApplicationSource, appDirPath string) (v1alpha1.ApplicationSourceType, error) {
appSourceType, err := source.ExplicitType()
if err != nil {
return "", err
}
if appSourceType != nil {
return *appSourceType, nil
}
if pathExists(appDirPath, "app.yaml") {
return v1alpha1.... | go | func GetAppSourceType(source *v1alpha1.ApplicationSource, appDirPath string) (v1alpha1.ApplicationSourceType, error) {
appSourceType, err := source.ExplicitType()
if err != nil {
return "", err
}
if appSourceType != nil {
return *appSourceType, nil
}
if pathExists(appDirPath, "app.yaml") {
return v1alpha1.... | [
"func",
"GetAppSourceType",
"(",
"source",
"*",
"v1alpha1",
".",
"ApplicationSource",
",",
"appDirPath",
"string",
")",
"(",
"v1alpha1",
".",
"ApplicationSourceType",
",",
"error",
")",
"{",
"appSourceType",
",",
"err",
":=",
"source",
".",
"ExplicitType",
"(",
... | // GetAppSourceType returns explicit application source type or examines a directory and determines its application source type | [
"GetAppSourceType",
"returns",
"explicit",
"application",
"source",
"type",
"or",
"examines",
"a",
"directory",
"and",
"determines",
"its",
"application",
"source",
"type"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L287-L308 |
162,057 | argoproj/argo-cd | reposerver/repository/repository.go | checkoutRevision | func checkoutRevision(gitClient git.Client, commitSHA string) (string, error) {
err := gitClient.Init()
if err != nil {
return "", status.Errorf(codes.Internal, "Failed to initialize git repo: %v", err)
}
err = gitClient.Fetch()
if err != nil {
return "", status.Errorf(codes.Internal, "Failed to fetch git repo... | go | func checkoutRevision(gitClient git.Client, commitSHA string) (string, error) {
err := gitClient.Init()
if err != nil {
return "", status.Errorf(codes.Internal, "Failed to initialize git repo: %v", err)
}
err = gitClient.Fetch()
if err != nil {
return "", status.Errorf(codes.Internal, "Failed to fetch git repo... | [
"func",
"checkoutRevision",
"(",
"gitClient",
"git",
".",
"Client",
",",
"commitSHA",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"err",
":=",
"gitClient",
".",
"Init",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",... | // checkoutRevision is a convenience function to initialize a repo, fetch, and checkout a revision
// Returns the 40 character commit SHA after the checkout has been performed | [
"checkoutRevision",
"is",
"a",
"convenience",
"function",
"to",
"initialize",
"a",
"repo",
"fetch",
"and",
"checkout",
"a",
"revision",
"Returns",
"the",
"40",
"character",
"commit",
"SHA",
"after",
"the",
"checkout",
"has",
"been",
"performed"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L332-L346 |
162,058 | argoproj/argo-cd | reposerver/repository/repository.go | ksShow | func ksShow(appLabelKey, appPath string, ksonnetOpts *v1alpha1.ApplicationSourceKsonnet) ([]*unstructured.Unstructured, *v1alpha1.ApplicationDestination, error) {
ksApp, err := ksonnet.NewKsonnetApp(appPath)
if err != nil {
return nil, nil, status.Errorf(codes.FailedPrecondition, "unable to load application from %s... | go | func ksShow(appLabelKey, appPath string, ksonnetOpts *v1alpha1.ApplicationSourceKsonnet) ([]*unstructured.Unstructured, *v1alpha1.ApplicationDestination, error) {
ksApp, err := ksonnet.NewKsonnetApp(appPath)
if err != nil {
return nil, nil, status.Errorf(codes.FailedPrecondition, "unable to load application from %s... | [
"func",
"ksShow",
"(",
"appLabelKey",
",",
"appPath",
"string",
",",
"ksonnetOpts",
"*",
"v1alpha1",
".",
"ApplicationSourceKsonnet",
")",
"(",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
",",
"*",
"v1alpha1",
".",
"ApplicationDestination",
",",
"error",... | // ksShow runs `ks show` in an app directory after setting any component parameter overrides | [
"ksShow",
"runs",
"ks",
"show",
"in",
"an",
"app",
"directory",
"after",
"setting",
"any",
"component",
"parameter",
"overrides"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L349-L378 |
162,059 | argoproj/argo-cd | reposerver/repository/repository.go | findManifests | func findManifests(appPath string, directory v1alpha1.ApplicationSourceDirectory) ([]*unstructured.Unstructured, error) {
var objs []*unstructured.Unstructured
err := filepath.Walk(appPath, func(path string, f os.FileInfo, err error) error {
if err != nil {
return err
}
if f.IsDir() {
if path != appPath &... | go | func findManifests(appPath string, directory v1alpha1.ApplicationSourceDirectory) ([]*unstructured.Unstructured, error) {
var objs []*unstructured.Unstructured
err := filepath.Walk(appPath, func(path string, f os.FileInfo, err error) error {
if err != nil {
return err
}
if f.IsDir() {
if path != appPath &... | [
"func",
"findManifests",
"(",
"appPath",
"string",
",",
"directory",
"v1alpha1",
".",
"ApplicationSourceDirectory",
")",
"(",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"var",
"objs",
"[",
"]",
"*",
"unstructured",
".",
"Unst... | // findManifests looks at all yaml files in a directory and unmarshals them into a list of unstructured objects | [
"findManifests",
"looks",
"at",
"all",
"yaml",
"files",
"in",
"a",
"directory",
"and",
"unmarshals",
"them",
"into",
"a",
"list",
"of",
"unstructured",
"objects"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L383-L454 |
162,060 | argoproj/argo-cd | reposerver/repository/repository.go | pathExists | func pathExists(ss ...string) bool {
name := filepath.Join(ss...)
if _, err := os.Stat(name); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
} | go | func pathExists(ss ...string) bool {
name := filepath.Join(ss...)
if _, err := os.Stat(name); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
} | [
"func",
"pathExists",
"(",
"ss",
"...",
"string",
")",
"bool",
"{",
"name",
":=",
"filepath",
".",
"Join",
"(",
"ss",
"...",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"os",
... | // pathExists reports whether the file or directory at the named concatenation of paths exists. | [
"pathExists",
"reports",
"whether",
"the",
"file",
"or",
"directory",
"at",
"the",
"named",
"concatenation",
"of",
"paths",
"exists",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L478-L486 |
162,061 | argoproj/argo-cd | reposerver/repository/repository.go | newClientResolveRevision | func (s *Service) newClientResolveRevision(repo *v1alpha1.Repository, revision string) (git.Client, string, error) {
repoURL := git.NormalizeGitURL(repo.Repo)
appRepoPath := tempRepoPath(repoURL)
gitClient, err := s.gitFactory.NewClient(repo.Repo, appRepoPath, repo.Username, repo.Password, repo.SSHPrivateKey, repo.I... | go | func (s *Service) newClientResolveRevision(repo *v1alpha1.Repository, revision string) (git.Client, string, error) {
repoURL := git.NormalizeGitURL(repo.Repo)
appRepoPath := tempRepoPath(repoURL)
gitClient, err := s.gitFactory.NewClient(repo.Repo, appRepoPath, repo.Username, repo.Password, repo.SSHPrivateKey, repo.I... | [
"func",
"(",
"s",
"*",
"Service",
")",
"newClientResolveRevision",
"(",
"repo",
"*",
"v1alpha1",
".",
"Repository",
",",
"revision",
"string",
")",
"(",
"git",
".",
"Client",
",",
"string",
",",
"error",
")",
"{",
"repoURL",
":=",
"git",
".",
"NormalizeG... | // newClientResolveRevision is a helper to perform the common task of instantiating a git client
// and resolving a revision to a commit SHA | [
"newClientResolveRevision",
"is",
"a",
"helper",
"to",
"perform",
"the",
"common",
"task",
"of",
"instantiating",
"a",
"git",
"client",
"and",
"resolving",
"a",
"revision",
"to",
"a",
"commit",
"SHA"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/repository/repository.go#L490-L502 |
162,062 | argoproj/argo-cd | util/webhook/webhook.go | HandleEvent | func (a *ArgoCDWebhookHandler) HandleEvent(payload interface{}, header webhooks.Header) {
webURL, revision, touchedHead := affectedRevisionInfo(payload)
// NOTE: the webURL does not include the .git extension
if webURL == "" {
log.Info("Ignoring webhook event")
return
}
log.Infof("Received push event repo: %s,... | go | func (a *ArgoCDWebhookHandler) HandleEvent(payload interface{}, header webhooks.Header) {
webURL, revision, touchedHead := affectedRevisionInfo(payload)
// NOTE: the webURL does not include the .git extension
if webURL == "" {
log.Info("Ignoring webhook event")
return
}
log.Infof("Received push event repo: %s,... | [
"func",
"(",
"a",
"*",
"ArgoCDWebhookHandler",
")",
"HandleEvent",
"(",
"payload",
"interface",
"{",
"}",
",",
"header",
"webhooks",
".",
"Header",
")",
"{",
"webURL",
",",
"revision",
",",
"touchedHead",
":=",
"affectedRevisionInfo",
"(",
"payload",
")",
"\... | // HandleEvent handles webhook events for repo push events | [
"HandleEvent",
"handles",
"webhook",
"events",
"for",
"repo",
"push",
"events"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/webhook/webhook.go#L98-L143 |
162,063 | argoproj/argo-cd | cmd/argocd/commands/relogin.go | NewReloginCommand | func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
password string
ssoPort int
)
var command = &cobra.Command{
Use: "relogin",
Short: "Refresh an expired authenticate token",
Long: "Refresh an expired authenticate token",
Run: func(c *cobra.Command, args []str... | go | func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
password string
ssoPort int
)
var command = &cobra.Command{
Use: "relogin",
Short: "Refresh an expired authenticate token",
Long: "Refresh an expired authenticate token",
Run: func(c *cobra.Command, args []str... | [
"func",
"NewReloginCommand",
"(",
"globalClientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"password",
"string",
"\n",
"ssoPort",
"int",
"\n",
")",
"\n",
"var",
"command",
"=",
"&",
"cobra",
".",
"C... | // NewReloginCommand returns a new instance of `argocd relogin` command | [
"NewReloginCommand",
"returns",
"a",
"new",
"instance",
"of",
"argocd",
"relogin",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/relogin.go#L21-L86 |
162,064 | argoproj/argo-cd | pkg/client/informers/externalversions/application/v1alpha1/interface.go | AppProjects | func (v *version) AppProjects() AppProjectInformer {
return &appProjectInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} | go | func (v *version) AppProjects() AppProjectInformer {
return &appProjectInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} | [
"func",
"(",
"v",
"*",
"version",
")",
"AppProjects",
"(",
")",
"AppProjectInformer",
"{",
"return",
"&",
"appProjectInformer",
"{",
"factory",
":",
"v",
".",
"factory",
",",
"namespace",
":",
"v",
".",
"namespace",
",",
"tweakListOptions",
":",
"v",
".",
... | // AppProjects returns a AppProjectInformer. | [
"AppProjects",
"returns",
"a",
"AppProjectInformer",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/informers/externalversions/application/v1alpha1/interface.go#L29-L31 |
162,065 | argoproj/argo-cd | pkg/client/informers/externalversions/application/v1alpha1/interface.go | Applications | func (v *version) Applications() ApplicationInformer {
return &applicationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} | go | func (v *version) Applications() ApplicationInformer {
return &applicationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
} | [
"func",
"(",
"v",
"*",
"version",
")",
"Applications",
"(",
")",
"ApplicationInformer",
"{",
"return",
"&",
"applicationInformer",
"{",
"factory",
":",
"v",
".",
"factory",
",",
"namespace",
":",
"v",
".",
"namespace",
",",
"tweakListOptions",
":",
"v",
".... | // Applications returns a ApplicationInformer. | [
"Applications",
"returns",
"a",
"ApplicationInformer",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/informers/externalversions/application/v1alpha1/interface.go#L34-L36 |
162,066 | argoproj/argo-cd | util/util.go | DeleteFile | func DeleteFile(path string) {
if _, err := os.Stat(path); os.IsNotExist(err) {
return
}
_ = os.Remove(path)
} | go | func DeleteFile(path string) {
if _, err := os.Stat(path); os.IsNotExist(err) {
return
}
_ = os.Remove(path)
} | [
"func",
"DeleteFile",
"(",
"path",
"string",
")",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
";",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"\n",
"}",
"\n",
"_",
"=",
"os",
".",
"Remove",
"(",
"path",
... | // DeleteFile is best effort deletion of a file | [
"DeleteFile",
"is",
"best",
"effort",
"deletion",
"of",
"a",
"file"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/util.go#L42-L47 |
162,067 | argoproj/argo-cd | util/util.go | MakeSignature | func MakeSignature(size int) ([]byte, error) {
b := make([]byte, size)
_, err := rand.Read(b)
if err != nil {
b = nil
}
// base64 encode it so signing key can be typed into validation utilities
b = []byte(base64.StdEncoding.EncodeToString(b))
return b, err
} | go | func MakeSignature(size int) ([]byte, error) {
b := make([]byte, size)
_, err := rand.Read(b)
if err != nil {
b = nil
}
// base64 encode it so signing key can be typed into validation utilities
b = []byte(base64.StdEncoding.EncodeToString(b))
return b, err
} | [
"func",
"MakeSignature",
"(",
"size",
"int",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"size",
")",
"\n",
"_",
",",
"err",
":=",
"rand",
".",
"Read",
"(",
"b",
")",
"\n",
"if",
"err",
... | // MakeSignature generates a cryptographically-secure pseudo-random token, based on a given number of random bytes, for signing purposes. | [
"MakeSignature",
"generates",
"a",
"cryptographically",
"-",
"secure",
"pseudo",
"-",
"random",
"token",
"based",
"on",
"a",
"given",
"number",
"of",
"random",
"bytes",
"for",
"signing",
"purposes",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/util.go#L74-L83 |
162,068 | argoproj/argo-cd | util/util.go | RetryUntilSucceed | func RetryUntilSucceed(action func() error, desc string, ctx context.Context, timeout time.Duration) {
ctxCompleted := false
stop := make(chan bool)
defer close(stop)
go func() {
select {
case <-ctx.Done():
ctxCompleted = true
case <-stop:
}
}()
for {
log.Debugf("Start %s", desc)
err := action()
... | go | func RetryUntilSucceed(action func() error, desc string, ctx context.Context, timeout time.Duration) {
ctxCompleted := false
stop := make(chan bool)
defer close(stop)
go func() {
select {
case <-ctx.Done():
ctxCompleted = true
case <-stop:
}
}()
for {
log.Debugf("Start %s", desc)
err := action()
... | [
"func",
"RetryUntilSucceed",
"(",
"action",
"func",
"(",
")",
"error",
",",
"desc",
"string",
",",
"ctx",
"context",
".",
"Context",
",",
"timeout",
"time",
".",
"Duration",
")",
"{",
"ctxCompleted",
":=",
"false",
"\n",
"stop",
":=",
"make",
"(",
"chan"... | // RetryUntilSucceed keep retrying given action with specified timeout until action succeed or specified context is done. | [
"RetryUntilSucceed",
"keep",
"retrying",
"given",
"action",
"with",
"specified",
"timeout",
"until",
"action",
"succeed",
"or",
"specified",
"context",
"is",
"done",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/util.go#L86-L112 |
162,069 | argoproj/argo-cd | util/lua/lua.go | ExecuteHealthLua | func (vm VM) ExecuteHealthLua(obj *unstructured.Unstructured, script string) (*appv1.HealthStatus, error) {
l, err := vm.runLua(obj, script)
if err != nil {
return nil, err
}
returnValue := l.Get(-1)
if returnValue.Type() == lua.LTTable {
jsonBytes, err := luajson.Encode(returnValue)
if err != nil {
retur... | go | func (vm VM) ExecuteHealthLua(obj *unstructured.Unstructured, script string) (*appv1.HealthStatus, error) {
l, err := vm.runLua(obj, script)
if err != nil {
return nil, err
}
returnValue := l.Get(-1)
if returnValue.Type() == lua.LTTable {
jsonBytes, err := luajson.Encode(returnValue)
if err != nil {
retur... | [
"func",
"(",
"vm",
"VM",
")",
"ExecuteHealthLua",
"(",
"obj",
"*",
"unstructured",
".",
"Unstructured",
",",
"script",
"string",
")",
"(",
"*",
"appv1",
".",
"HealthStatus",
",",
"error",
")",
"{",
"l",
",",
"err",
":=",
"vm",
".",
"runLua",
"(",
"ob... | // ExecuteHealthLua runs the lua script to generate the health status of a resource | [
"ExecuteHealthLua",
"runs",
"the",
"lua",
"script",
"to",
"generate",
"the",
"health",
"status",
"of",
"a",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/lua/lua.go#L76-L102 |
162,070 | argoproj/argo-cd | util/lua/lua.go | GetHealthScript | func (vm VM) GetHealthScript(obj *unstructured.Unstructured) (string, error) {
key := getConfigMapKey(obj)
if script, ok := vm.ResourceOverrides[key]; ok && script.HealthLua != "" {
return script.HealthLua, nil
}
return vm.getPredefinedLuaScripts(key, healthScriptFile)
} | go | func (vm VM) GetHealthScript(obj *unstructured.Unstructured) (string, error) {
key := getConfigMapKey(obj)
if script, ok := vm.ResourceOverrides[key]; ok && script.HealthLua != "" {
return script.HealthLua, nil
}
return vm.getPredefinedLuaScripts(key, healthScriptFile)
} | [
"func",
"(",
"vm",
"VM",
")",
"GetHealthScript",
"(",
"obj",
"*",
"unstructured",
".",
"Unstructured",
")",
"(",
"string",
",",
"error",
")",
"{",
"key",
":=",
"getConfigMapKey",
"(",
"obj",
")",
"\n",
"if",
"script",
",",
"ok",
":=",
"vm",
".",
"Res... | // GetHealthScript attempts to read lua script from config and then filesystem for that resource | [
"GetHealthScript",
"attempts",
"to",
"read",
"lua",
"script",
"from",
"config",
"and",
"then",
"filesystem",
"for",
"that",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/lua/lua.go#L105-L111 |
162,071 | argoproj/argo-cd | util/lua/lua.go | cleanReturnedObj | func cleanReturnedObj(newObj, obj map[string]interface{}) map[string]interface{} {
mapToReturn := newObj
for key := range obj {
if newValueInterface, ok := newObj[key]; ok {
oldValueInterface, ok := obj[key]
if !ok {
continue
}
switch newValue := newValueInterface.(type) {
case map[string]interfa... | go | func cleanReturnedObj(newObj, obj map[string]interface{}) map[string]interface{} {
mapToReturn := newObj
for key := range obj {
if newValueInterface, ok := newObj[key]; ok {
oldValueInterface, ok := obj[key]
if !ok {
continue
}
switch newValue := newValueInterface.(type) {
case map[string]interfa... | [
"func",
"cleanReturnedObj",
"(",
"newObj",
",",
"obj",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"mapToReturn",
":=",
"newObj",
"\n",
"for",
"key",
":=",
"range",
"obj",
"{",
"if",
"... | // cleanReturnedObj Lua cannot distinguish an empty table as an array or map, and the library we are using choose to
// decoded an empty table into an empty array. This function prevents the lua scripts from unintentionally changing an
// empty struct into empty arrays | [
"cleanReturnedObj",
"Lua",
"cannot",
"distinguish",
"an",
"empty",
"table",
"as",
"an",
"array",
"or",
"map",
"and",
"the",
"library",
"we",
"are",
"using",
"choose",
"to",
"decoded",
"an",
"empty",
"table",
"into",
"an",
"empty",
"array",
".",
"This",
"fu... | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/lua/lua.go#L138-L167 |
162,072 | argoproj/argo-cd | util/lua/lua.go | cleanReturnedArray | func cleanReturnedArray(newObj, obj []interface{}) []interface{} {
arrayToReturn := newObj
for i := range newObj {
switch newValue := newObj[i].(type) {
case map[string]interface{}:
if oldValue, ok := obj[i].(map[string]interface{}); ok {
convertedMap := cleanReturnedObj(newValue, oldValue)
arrayToRetu... | go | func cleanReturnedArray(newObj, obj []interface{}) []interface{} {
arrayToReturn := newObj
for i := range newObj {
switch newValue := newObj[i].(type) {
case map[string]interface{}:
if oldValue, ok := obj[i].(map[string]interface{}); ok {
convertedMap := cleanReturnedObj(newValue, oldValue)
arrayToRetu... | [
"func",
"cleanReturnedArray",
"(",
"newObj",
",",
"obj",
"[",
"]",
"interface",
"{",
"}",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"arrayToReturn",
":=",
"newObj",
"\n",
"for",
"i",
":=",
"range",
"newObj",
"{",
"switch",
"newValue",
":=",
"newObj",
... | // cleanReturnedArray allows Argo CD to recurse into nested arrays when checking for unintentional empty struct to
// empty array conversions. | [
"cleanReturnedArray",
"allows",
"Argo",
"CD",
"to",
"recurse",
"into",
"nested",
"arrays",
"when",
"checking",
"for",
"unintentional",
"empty",
"struct",
"to",
"empty",
"array",
"conversions",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/lua/lua.go#L171-L188 |
162,073 | argoproj/argo-cd | util/lua/lua.go | GetResourceAction | func (vm VM) GetResourceAction(obj *unstructured.Unstructured, actionName string) (appv1.ResourceActionDefinition, error) {
key := getConfigMapKey(obj)
override, ok := vm.ResourceOverrides[key]
if ok && override.Actions != "" {
actions, err := override.GetActions()
if err != nil {
return appv1.ResourceActionD... | go | func (vm VM) GetResourceAction(obj *unstructured.Unstructured, actionName string) (appv1.ResourceActionDefinition, error) {
key := getConfigMapKey(obj)
override, ok := vm.ResourceOverrides[key]
if ok && override.Actions != "" {
actions, err := override.GetActions()
if err != nil {
return appv1.ResourceActionD... | [
"func",
"(",
"vm",
"VM",
")",
"GetResourceAction",
"(",
"obj",
"*",
"unstructured",
".",
"Unstructured",
",",
"actionName",
"string",
")",
"(",
"appv1",
".",
"ResourceActionDefinition",
",",
"error",
")",
"{",
"key",
":=",
"getConfigMapKey",
"(",
"obj",
")",... | // GetResourceAction attempts to read lua script from config and then filesystem for that resource | [
"GetResourceAction",
"attempts",
"to",
"read",
"lua",
"script",
"from",
"config",
"and",
"then",
"filesystem",
"for",
"that",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/lua/lua.go#L265-L290 |
162,074 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectCommand | func NewProjectCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "proj",
Short: "Manage projects",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewProjectRoleCommand(clientOpts))
command.AddCom... | go | func NewProjectCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "proj",
Short: "Manage projects",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewProjectRoleCommand(clientOpts))
command.AddCom... | [
"func",
"NewProjectCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Ru... | // NewProjectCommand returns a new instance of an `argocd proj` command | [
"NewProjectCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L58-L83 |
162,075 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectCreateCommand | func NewProjectCreateCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
opts projectOpts
)
var command = &cobra.Command{
Use: "create PROJECT",
Short: "Create a project",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
... | go | func NewProjectCreateCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
opts projectOpts
)
var command = &cobra.Command{
Use: "create PROJECT",
Short: "Create a project",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
... | [
"func",
"NewProjectCreateCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"opts",
"projectOpts",
"\n",
")",
"\n",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":... | // NewProjectCreateCommand returns a new instance of an `argocd proj create` command | [
"NewProjectCreateCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"create",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L104-L134 |
162,076 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectSetCommand | func NewProjectSetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
opts projectOpts
)
var command = &cobra.Command{
Use: "set PROJECT",
Short: "Set project parameters",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
... | go | func NewProjectSetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
opts projectOpts
)
var command = &cobra.Command{
Use: "set PROJECT",
Short: "Set project parameters",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
... | [
"func",
"NewProjectSetCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"opts",
"projectOpts",
"\n",
")",
"\n",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
... | // NewProjectSetCommand returns a new instance of an `argocd proj set` command | [
"NewProjectSetCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"set",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L137-L180 |
162,077 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectAddDestinationCommand | func NewProjectAddDestinationCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "add-destination PROJECT SERVER NAMESPACE",
Short: "Add project destination",
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exi... | go | func NewProjectAddDestinationCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "add-destination PROJECT SERVER NAMESPACE",
Short: "Add project destination",
Run: func(c *cobra.Command, args []string) {
if len(args) != 3 {
c.HelpFunc()(c, args)
os.Exi... | [
"func",
"NewProjectAddDestinationCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\""... | // NewProjectAddDestinationCommand returns a new instance of an `argocd proj add-destination` command | [
"NewProjectAddDestinationCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"add",
"-",
"destination",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L183-L212 |
162,078 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectAllowNamespaceResourceCommand | func NewProjectAllowNamespaceResourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
use := "allow-namespace-resource PROJECT GROUP KIND"
desc := "Removes a namespaced API resource from the blacklist"
return modifyProjectResourceCmd(use, desc, clientOpts, func(proj *v1alpha1.AppProject, group string... | go | func NewProjectAllowNamespaceResourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
use := "allow-namespace-resource PROJECT GROUP KIND"
desc := "Removes a namespaced API resource from the blacklist"
return modifyProjectResourceCmd(use, desc, clientOpts, func(proj *v1alpha1.AppProject, group string... | [
"func",
"NewProjectAllowNamespaceResourceCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"use",
":=",
"\"",
"\"",
"\n",
"desc",
":=",
"\"",
"\"",
"\n",
"return",
"modifyProjectResourceCmd",
"(",
"us... | // NewProjectAllowNamespaceResourceCommand returns a new instance of an `deny-cluster-resources` command | [
"NewProjectAllowNamespaceResourceCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"deny",
"-",
"cluster",
"-",
"resources",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L314-L332 |
162,079 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectDenyNamespaceResourceCommand | func NewProjectDenyNamespaceResourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
use := "deny-namespace-resource PROJECT GROUP KIND"
desc := "Adds a namespaced API resource to the blacklist"
return modifyProjectResourceCmd(use, desc, clientOpts, func(proj *v1alpha1.AppProject, group string, kind ... | go | func NewProjectDenyNamespaceResourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
use := "deny-namespace-resource PROJECT GROUP KIND"
desc := "Adds a namespaced API resource to the blacklist"
return modifyProjectResourceCmd(use, desc, clientOpts, func(proj *v1alpha1.AppProject, group string, kind ... | [
"func",
"NewProjectDenyNamespaceResourceCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"use",
":=",
"\"",
"\"",
"\n",
"desc",
":=",
"\"",
"\"",
"\n",
"return",
"modifyProjectResourceCmd",
"(",
"use... | // NewProjectDenyNamespaceResourceCommand returns a new instance of an `argocd proj deny-namespace-resource` command | [
"NewProjectDenyNamespaceResourceCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"deny",
"-",
"namespace",
"-",
"resource",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L335-L348 |
162,080 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectRemoveSourceCommand | func NewProjectRemoveSourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "remove-source PROJECT URL",
Short: "Remove project source repository",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
... | go | func NewProjectRemoveSourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "remove-source PROJECT URL",
Short: "Remove project source repository",
Run: func(c *cobra.Command, args []string) {
if len(args) != 2 {
c.HelpFunc()(c, args)
os.Exit(1)
... | [
"func",
"NewProjectRemoveSourceCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
... | // NewProjectRemoveSourceCommand returns a new instance of an `argocd proj remove-src` command | [
"NewProjectRemoveSourceCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"remove",
"-",
"src",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L388-L423 |
162,081 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectDeleteCommand | func NewProjectDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "delete PROJECT",
Short: "Delete project",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, projIf := argocdclient.N... | go | func NewProjectDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "delete PROJECT",
Short: "Delete project",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, projIf := argocdclient.N... | [
"func",
"NewProjectDeleteCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",... | // NewProjectDeleteCommand returns a new instance of an `argocd proj delete` command | [
"NewProjectDeleteCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"delete",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L426-L444 |
162,082 | argoproj/argo-cd | cmd/argocd/commands/project.go | NewProjectListCommand | func NewProjectListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "list",
Short: "List projects",
Run: func(c *cobra.Command, args []string) {
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer util.Close(conn)
pro... | go | func NewProjectListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "list",
Short: "List projects",
Run: func(c *cobra.Command, args []string) {
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer util.Close(conn)
pro... | [
"func",
"NewProjectListCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
... | // NewProjectListCommand returns a new instance of an `argocd proj list` command | [
"NewProjectListCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"proj",
"list",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/project.go#L447-L465 |
162,083 | argoproj/argo-cd | util/argo/diff_normalizer.go | NewDiffNormalizer | func NewDiffNormalizer(ignore []v1alpha1.ResourceIgnoreDifferences, overrides map[string]v1alpha1.ResourceOverride) (diff.Normalizer, error) {
for key, override := range overrides {
parts := strings.Split(key, "/")
if len(parts) < 2 {
continue
}
group := parts[0]
kind := parts[1]
if override.IgnoreDiffe... | go | func NewDiffNormalizer(ignore []v1alpha1.ResourceIgnoreDifferences, overrides map[string]v1alpha1.ResourceOverride) (diff.Normalizer, error) {
for key, override := range overrides {
parts := strings.Split(key, "/")
if len(parts) < 2 {
continue
}
group := parts[0]
kind := parts[1]
if override.IgnoreDiffe... | [
"func",
"NewDiffNormalizer",
"(",
"ignore",
"[",
"]",
"v1alpha1",
".",
"ResourceIgnoreDifferences",
",",
"overrides",
"map",
"[",
"string",
"]",
"v1alpha1",
".",
"ResourceOverride",
")",
"(",
"diff",
".",
"Normalizer",
",",
"error",
")",
"{",
"for",
"key",
"... | // NewDiffNormalizer creates diff normalizer which removes ignored fields according to given application spec and resource overrides | [
"NewDiffNormalizer",
"creates",
"diff",
"normalizer",
"which",
"removes",
"ignored",
"fields",
"according",
"to",
"given",
"application",
"spec",
"and",
"resource",
"overrides"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/diff_normalizer.go#L33-L76 |
162,084 | argoproj/argo-cd | util/argo/diff_normalizer.go | Normalize | func (n *normalizer) Normalize(un *unstructured.Unstructured) error {
matched := make([]normalizerPatch, 0)
for _, patch := range n.patches {
groupKind := un.GroupVersionKind().GroupKind()
if groupKind == patch.groupKind &&
(patch.name == "" || patch.name == un.GetName()) &&
(patch.namespace == "" || patch.... | go | func (n *normalizer) Normalize(un *unstructured.Unstructured) error {
matched := make([]normalizerPatch, 0)
for _, patch := range n.patches {
groupKind := un.GroupVersionKind().GroupKind()
if groupKind == patch.groupKind &&
(patch.name == "" || patch.name == un.GetName()) &&
(patch.namespace == "" || patch.... | [
"func",
"(",
"n",
"*",
"normalizer",
")",
"Normalize",
"(",
"un",
"*",
"unstructured",
".",
"Unstructured",
")",
"error",
"{",
"matched",
":=",
"make",
"(",
"[",
"]",
"normalizerPatch",
",",
"0",
")",
"\n",
"for",
"_",
",",
"patch",
":=",
"range",
"n... | // Normalize removes fields from supplied resource using json paths from matching items of specified resources ignored differences list | [
"Normalize",
"removes",
"fields",
"from",
"supplied",
"resource",
"using",
"json",
"paths",
"from",
"matching",
"items",
"of",
"specified",
"resources",
"ignored",
"differences",
"list"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/argo/diff_normalizer.go#L79-L116 |
162,085 | blevesearch/bleve | index/scorch/snapshot_index.go | subtractStrings | func subtractStrings(a, b []string) []string {
if len(b) == 0 {
return a
}
rv := make([]string, 0, len(a))
OUTER:
for _, as := range a {
for _, bs := range b {
if as == bs {
continue OUTER
}
}
rv = append(rv, as)
}
return rv
} | go | func subtractStrings(a, b []string) []string {
if len(b) == 0 {
return a
}
rv := make([]string, 0, len(a))
OUTER:
for _, as := range a {
for _, bs := range b {
if as == bs {
continue OUTER
}
}
rv = append(rv, as)
}
return rv
} | [
"func",
"subtractStrings",
"(",
"a",
",",
"b",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"a",
"\n",
"}",
"\n\n",
"rv",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
... | // subtractStrings returns set a minus elements of set b. | [
"subtractStrings",
"returns",
"set",
"a",
"minus",
"elements",
"of",
"set",
"b",
"."
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/index/scorch/snapshot_index.go#L679-L695 |
162,086 | blevesearch/bleve | index/scorch/segment/zap/build.go | PersistSegmentBase | func PersistSegmentBase(sb *SegmentBase, path string) error {
flag := os.O_RDWR | os.O_CREATE
f, err := os.OpenFile(path, flag, 0600)
if err != nil {
return err
}
cleanup := func() {
_ = f.Close()
_ = os.Remove(path)
}
br := bufio.NewWriter(f)
_, err = br.Write(sb.mem)
if err != nil {
cleanup()
r... | go | func PersistSegmentBase(sb *SegmentBase, path string) error {
flag := os.O_RDWR | os.O_CREATE
f, err := os.OpenFile(path, flag, 0600)
if err != nil {
return err
}
cleanup := func() {
_ = f.Close()
_ = os.Remove(path)
}
br := bufio.NewWriter(f)
_, err = br.Write(sb.mem)
if err != nil {
cleanup()
r... | [
"func",
"PersistSegmentBase",
"(",
"sb",
"*",
"SegmentBase",
",",
"path",
"string",
")",
"error",
"{",
"flag",
":=",
"os",
".",
"O_RDWR",
"|",
"os",
".",
"O_CREATE",
"\n\n",
"f",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"path",
",",
"flag",
",",... | // PersistSegmentBase persists SegmentBase in the zap file format. | [
"PersistSegmentBase",
"persists",
"SegmentBase",
"in",
"the",
"zap",
"file",
"format",
"."
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/index/scorch/segment/zap/build.go#L31-L78 |
162,087 | blevesearch/bleve | search/query/term_range.go | NewTermRangeQuery | func NewTermRangeQuery(min, max string) *TermRangeQuery {
return NewTermRangeInclusiveQuery(min, max, nil, nil)
} | go | func NewTermRangeQuery(min, max string) *TermRangeQuery {
return NewTermRangeInclusiveQuery(min, max, nil, nil)
} | [
"func",
"NewTermRangeQuery",
"(",
"min",
",",
"max",
"string",
")",
"*",
"TermRangeQuery",
"{",
"return",
"NewTermRangeInclusiveQuery",
"(",
"min",
",",
"max",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] | // NewTermRangeQuery creates a new Query for ranges
// of text term values.
// Either, but not both endpoints can be nil.
// The minimum value is inclusive.
// The maximum value is exclusive. | [
"NewTermRangeQuery",
"creates",
"a",
"new",
"Query",
"for",
"ranges",
"of",
"text",
"term",
"values",
".",
"Either",
"but",
"not",
"both",
"endpoints",
"can",
"be",
"nil",
".",
"The",
"minimum",
"value",
"is",
"inclusive",
".",
"The",
"maximum",
"value",
"... | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/query/term_range.go#L40-L42 |
162,088 | blevesearch/bleve | search/query/term_range.go | NewTermRangeInclusiveQuery | func NewTermRangeInclusiveQuery(min, max string, minInclusive, maxInclusive *bool) *TermRangeQuery {
return &TermRangeQuery{
Min: min,
Max: max,
InclusiveMin: minInclusive,
InclusiveMax: maxInclusive,
}
} | go | func NewTermRangeInclusiveQuery(min, max string, minInclusive, maxInclusive *bool) *TermRangeQuery {
return &TermRangeQuery{
Min: min,
Max: max,
InclusiveMin: minInclusive,
InclusiveMax: maxInclusive,
}
} | [
"func",
"NewTermRangeInclusiveQuery",
"(",
"min",
",",
"max",
"string",
",",
"minInclusive",
",",
"maxInclusive",
"*",
"bool",
")",
"*",
"TermRangeQuery",
"{",
"return",
"&",
"TermRangeQuery",
"{",
"Min",
":",
"min",
",",
"Max",
":",
"max",
",",
"InclusiveMi... | // NewTermRangeInclusiveQuery creates a new Query for ranges
// of numeric values.
// Either, but not both endpoints can be nil.
// Control endpoint inclusion with inclusiveMin, inclusiveMax. | [
"NewTermRangeInclusiveQuery",
"creates",
"a",
"new",
"Query",
"for",
"ranges",
"of",
"numeric",
"values",
".",
"Either",
"but",
"not",
"both",
"endpoints",
"can",
"be",
"nil",
".",
"Control",
"endpoint",
"inclusion",
"with",
"inclusiveMin",
"inclusiveMax",
"."
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/query/term_range.go#L48-L55 |
162,089 | blevesearch/bleve | search/levenshtein.go | LevenshteinDistanceMax | func LevenshteinDistanceMax(a, b string, max int) (int, bool) {
v, wasMax, _ := LevenshteinDistanceMaxReuseSlice(a, b, max, nil)
return v, wasMax
} | go | func LevenshteinDistanceMax(a, b string, max int) (int, bool) {
v, wasMax, _ := LevenshteinDistanceMaxReuseSlice(a, b, max, nil)
return v, wasMax
} | [
"func",
"LevenshteinDistanceMax",
"(",
"a",
",",
"b",
"string",
",",
"max",
"int",
")",
"(",
"int",
",",
"bool",
")",
"{",
"v",
",",
"wasMax",
",",
"_",
":=",
"LevenshteinDistanceMaxReuseSlice",
"(",
"a",
",",
"b",
",",
"max",
",",
"nil",
")",
"\n",
... | // LevenshteinDistanceMax same as LevenshteinDistance but
// attempts to bail early once we know the distance
// will be greater than max
// in which case the first return val will be the max
// and the second will be true, indicating max was exceeded | [
"LevenshteinDistanceMax",
"same",
"as",
"LevenshteinDistance",
"but",
"attempts",
"to",
"bail",
"early",
"once",
"we",
"know",
"the",
"distance",
"will",
"be",
"greater",
"than",
"max",
"in",
"which",
"case",
"the",
"first",
"return",
"val",
"will",
"be",
"the... | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/levenshtein.go#L59-L62 |
162,090 | blevesearch/bleve | search/sort.go | Compare | func (so SortOrder) Compare(cachedScoring, cachedDesc []bool, i, j *DocumentMatch) int {
// compare the documents on all search sorts until a differences is found
for x := range so {
c := 0
if cachedScoring[x] {
if i.Score < j.Score {
c = -1
} else if i.Score > j.Score {
c = 1
}
} else {
iVa... | go | func (so SortOrder) Compare(cachedScoring, cachedDesc []bool, i, j *DocumentMatch) int {
// compare the documents on all search sorts until a differences is found
for x := range so {
c := 0
if cachedScoring[x] {
if i.Score < j.Score {
c = -1
} else if i.Score > j.Score {
c = 1
}
} else {
iVa... | [
"func",
"(",
"so",
"SortOrder",
")",
"Compare",
"(",
"cachedScoring",
",",
"cachedDesc",
"[",
"]",
"bool",
",",
"i",
",",
"j",
"*",
"DocumentMatch",
")",
"int",
"{",
"// compare the documents on all search sorts until a differences is found",
"for",
"x",
":=",
"ra... | // Compare will compare two document matches using the specified sort order
// if both are numbers, we avoid converting back to term | [
"Compare",
"will",
"compare",
"two",
"document",
"matches",
"using",
"the",
"specified",
"sort",
"order",
"if",
"both",
"are",
"numbers",
"we",
"avoid",
"converting",
"back",
"to",
"term"
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/sort.go#L221-L252 |
162,091 | blevesearch/bleve | search/sort.go | UpdateVisitor | func (s *SortField) UpdateVisitor(field string, term []byte) {
if field == s.Field {
s.values = append(s.values, term)
}
} | go | func (s *SortField) UpdateVisitor(field string, term []byte) {
if field == s.Field {
s.values = append(s.values, term)
}
} | [
"func",
"(",
"s",
"*",
"SortField",
")",
"UpdateVisitor",
"(",
"field",
"string",
",",
"term",
"[",
"]",
"byte",
")",
"{",
"if",
"field",
"==",
"s",
".",
"Field",
"{",
"s",
".",
"values",
"=",
"append",
"(",
"s",
".",
"values",
",",
"term",
")",
... | // UpdateVisitor notifies this sort field that in this document
// this field has the specified term | [
"UpdateVisitor",
"notifies",
"this",
"sort",
"field",
"that",
"in",
"this",
"document",
"this",
"field",
"has",
"the",
"specified",
"term"
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/sort.go#L352-L356 |
162,092 | blevesearch/bleve | search/sort.go | filterTermsByType | func (s *SortField) filterTermsByType(terms [][]byte) [][]byte {
stype := s.Type
if stype == SortFieldAuto {
allTermsPrefixCoded := true
termsWithShiftZero := s.tmp[:0]
for _, term := range terms {
valid, shift := numeric.ValidPrefixCodedTermBytes(term)
if valid && shift == 0 {
termsWithShiftZero = ap... | go | func (s *SortField) filterTermsByType(terms [][]byte) [][]byte {
stype := s.Type
if stype == SortFieldAuto {
allTermsPrefixCoded := true
termsWithShiftZero := s.tmp[:0]
for _, term := range terms {
valid, shift := numeric.ValidPrefixCodedTermBytes(term)
if valid && shift == 0 {
termsWithShiftZero = ap... | [
"func",
"(",
"s",
"*",
"SortField",
")",
"filterTermsByType",
"(",
"terms",
"[",
"]",
"[",
"]",
"byte",
")",
"[",
"]",
"[",
"]",
"byte",
"{",
"stype",
":=",
"s",
".",
"Type",
"\n",
"if",
"stype",
"==",
"SortFieldAuto",
"{",
"allTermsPrefixCoded",
":=... | // filterTermsByType attempts to make one pass on the terms
// if we are in auto-mode AND all the terms look like prefix-coded numbers
// return only the terms which had shift of 0
// if we are in explicit number or date mode, return only valid
// prefix coded numbers with shift of 0 | [
"filterTermsByType",
"attempts",
"to",
"make",
"one",
"pass",
"on",
"the",
"terms",
"if",
"we",
"are",
"in",
"auto",
"-",
"mode",
"AND",
"all",
"the",
"terms",
"look",
"like",
"prefix",
"-",
"coded",
"numbers",
"return",
"only",
"the",
"terms",
"which",
... | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/sort.go#L405-L434 |
162,093 | blevesearch/bleve | search/sort.go | NewSortGeoDistance | func NewSortGeoDistance(field, unit string, lon, lat float64, desc bool) (
*SortGeoDistance, error) {
rv := &SortGeoDistance{
Field: field,
Desc: desc,
Unit: unit,
Lon: lon,
Lat: lat,
}
var err error
rv.unitMult, err = geo.ParseDistanceUnit(unit)
if err != nil {
return nil, err
}
return rv, ni... | go | func NewSortGeoDistance(field, unit string, lon, lat float64, desc bool) (
*SortGeoDistance, error) {
rv := &SortGeoDistance{
Field: field,
Desc: desc,
Unit: unit,
Lon: lon,
Lat: lat,
}
var err error
rv.unitMult, err = geo.ParseDistanceUnit(unit)
if err != nil {
return nil, err
}
return rv, ni... | [
"func",
"NewSortGeoDistance",
"(",
"field",
",",
"unit",
"string",
",",
"lon",
",",
"lat",
"float64",
",",
"desc",
"bool",
")",
"(",
"*",
"SortGeoDistance",
",",
"error",
")",
"{",
"rv",
":=",
"&",
"SortGeoDistance",
"{",
"Field",
":",
"field",
",",
"D... | // NewSortGeoDistance creates SearchSort instance for sorting documents by
// their distance from the specified point. | [
"NewSortGeoDistance",
"creates",
"SearchSort",
"instance",
"for",
"sorting",
"documents",
"by",
"their",
"distance",
"from",
"the",
"specified",
"point",
"."
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/sort.go#L581-L596 |
162,094 | blevesearch/bleve | search/sort.go | filterTermsByType | func (s *SortGeoDistance) filterTermsByType(terms []string) []string {
var termsWithShiftZero []string
for _, term := range terms {
valid, shift := numeric.ValidPrefixCodedTerm(term)
if valid && shift == 0 {
termsWithShiftZero = append(termsWithShiftZero, term)
}
}
return termsWithShiftZero
} | go | func (s *SortGeoDistance) filterTermsByType(terms []string) []string {
var termsWithShiftZero []string
for _, term := range terms {
valid, shift := numeric.ValidPrefixCodedTerm(term)
if valid && shift == 0 {
termsWithShiftZero = append(termsWithShiftZero, term)
}
}
return termsWithShiftZero
} | [
"func",
"(",
"s",
"*",
"SortGeoDistance",
")",
"filterTermsByType",
"(",
"terms",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"termsWithShiftZero",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"term",
":=",
"range",
"terms",
"{",
"valid",
",... | // filterTermsByType attempts to make one pass on the terms
// return only valid prefix coded numbers with shift of 0 | [
"filterTermsByType",
"attempts",
"to",
"make",
"one",
"pass",
"on",
"the",
"terms",
"return",
"only",
"valid",
"prefix",
"coded",
"numbers",
"with",
"shift",
"of",
"0"
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/search/sort.go#L664-L673 |
162,095 | blevesearch/bleve | numeric/bin.go | Deinterleave | func Deinterleave(b uint64) uint64 {
b &= interleaveMagic[0]
b = (b ^ (b >> interleaveShift[0])) & interleaveMagic[1]
b = (b ^ (b >> interleaveShift[1])) & interleaveMagic[2]
b = (b ^ (b >> interleaveShift[2])) & interleaveMagic[3]
b = (b ^ (b >> interleaveShift[3])) & interleaveMagic[4]
b = (b ^ (b >> interleave... | go | func Deinterleave(b uint64) uint64 {
b &= interleaveMagic[0]
b = (b ^ (b >> interleaveShift[0])) & interleaveMagic[1]
b = (b ^ (b >> interleaveShift[1])) & interleaveMagic[2]
b = (b ^ (b >> interleaveShift[2])) & interleaveMagic[3]
b = (b ^ (b >> interleaveShift[3])) & interleaveMagic[4]
b = (b ^ (b >> interleave... | [
"func",
"Deinterleave",
"(",
"b",
"uint64",
")",
"uint64",
"{",
"b",
"&=",
"interleaveMagic",
"[",
"0",
"]",
"\n",
"b",
"=",
"(",
"b",
"^",
"(",
"b",
">>",
"interleaveShift",
"[",
"0",
"]",
")",
")",
"&",
"interleaveMagic",
"[",
"1",
"]",
"\n",
"... | // Deinterleave the 32-bit value starting at position 0
// to get the other 32-bit value, shift it by 1 first | [
"Deinterleave",
"the",
"32",
"-",
"bit",
"value",
"starting",
"at",
"position",
"0",
"to",
"get",
"the",
"other",
"32",
"-",
"bit",
"value",
"shift",
"it",
"by",
"1",
"first"
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/numeric/bin.go#L35-L43 |
162,096 | blevesearch/bleve | mapping/document.go | analyzerNameForPath | func (dm *DocumentMapping) analyzerNameForPath(path string) string {
field := dm.fieldDescribedByPath(path)
if field != nil {
return field.Analyzer
}
return ""
} | go | func (dm *DocumentMapping) analyzerNameForPath(path string) string {
field := dm.fieldDescribedByPath(path)
if field != nil {
return field.Analyzer
}
return ""
} | [
"func",
"(",
"dm",
"*",
"DocumentMapping",
")",
"analyzerNameForPath",
"(",
"path",
"string",
")",
"string",
"{",
"field",
":=",
"dm",
".",
"fieldDescribedByPath",
"(",
"path",
")",
"\n",
"if",
"field",
"!=",
"nil",
"{",
"return",
"field",
".",
"Analyzer",... | // analyzerNameForPath attempts to first find the field
// described by this path, then returns the analyzer
// configured for that field | [
"analyzerNameForPath",
"attempts",
"to",
"first",
"find",
"the",
"field",
"described",
"by",
"this",
"path",
"then",
"returns",
"the",
"analyzer",
"configured",
"for",
"that",
"field"
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/mapping/document.go#L90-L96 |
162,097 | blevesearch/bleve | mapping/document.go | documentMappingForPath | func (dm *DocumentMapping) documentMappingForPath(path string) *DocumentMapping {
pathElements := decodePath(path)
current := dm
OUTER:
for i, pathElement := range pathElements {
for name, subDocMapping := range current.Properties {
if name == pathElement {
current = subDocMapping
continue OUTER
}
... | go | func (dm *DocumentMapping) documentMappingForPath(path string) *DocumentMapping {
pathElements := decodePath(path)
current := dm
OUTER:
for i, pathElement := range pathElements {
for name, subDocMapping := range current.Properties {
if name == pathElement {
current = subDocMapping
continue OUTER
}
... | [
"func",
"(",
"dm",
"*",
"DocumentMapping",
")",
"documentMappingForPath",
"(",
"path",
"string",
")",
"*",
"DocumentMapping",
"{",
"pathElements",
":=",
"decodePath",
"(",
"path",
")",
"\n",
"current",
":=",
"dm",
"\n",
"OUTER",
":",
"for",
"i",
",",
"path... | // documentMappingForPath only returns EXACT matches for a sub document
// or for an explicitly mapped field, if you want to find the
// closest document mapping to a field not explicitly mapped
// use closestDocMapping | [
"documentMappingForPath",
"only",
"returns",
"EXACT",
"matches",
"for",
"a",
"sub",
"document",
"or",
"for",
"an",
"explicitly",
"mapped",
"field",
"if",
"you",
"want",
"to",
"find",
"the",
"closest",
"document",
"mapping",
"to",
"a",
"field",
"not",
"explicit... | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/mapping/document.go#L143-L167 |
162,098 | blevesearch/bleve | mapping/document.go | closestDocMapping | func (dm *DocumentMapping) closestDocMapping(path string) *DocumentMapping {
pathElements := decodePath(path)
current := dm
OUTER:
for _, pathElement := range pathElements {
for name, subDocMapping := range current.Properties {
if name == pathElement {
current = subDocMapping
continue OUTER
}
}
b... | go | func (dm *DocumentMapping) closestDocMapping(path string) *DocumentMapping {
pathElements := decodePath(path)
current := dm
OUTER:
for _, pathElement := range pathElements {
for name, subDocMapping := range current.Properties {
if name == pathElement {
current = subDocMapping
continue OUTER
}
}
b... | [
"func",
"(",
"dm",
"*",
"DocumentMapping",
")",
"closestDocMapping",
"(",
"path",
"string",
")",
"*",
"DocumentMapping",
"{",
"pathElements",
":=",
"decodePath",
"(",
"path",
")",
"\n",
"current",
":=",
"dm",
"\n",
"OUTER",
":",
"for",
"_",
",",
"pathEleme... | // closestDocMapping findest the most specific document mapping that matches
// part of the provided path | [
"closestDocMapping",
"findest",
"the",
"most",
"specific",
"document",
"mapping",
"that",
"matches",
"part",
"of",
"the",
"provided",
"path"
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/mapping/document.go#L171-L185 |
162,099 | blevesearch/bleve | mapping/document.go | AddSubDocumentMapping | func (dm *DocumentMapping) AddSubDocumentMapping(property string, sdm *DocumentMapping) {
if dm.Properties == nil {
dm.Properties = make(map[string]*DocumentMapping)
}
dm.Properties[property] = sdm
} | go | func (dm *DocumentMapping) AddSubDocumentMapping(property string, sdm *DocumentMapping) {
if dm.Properties == nil {
dm.Properties = make(map[string]*DocumentMapping)
}
dm.Properties[property] = sdm
} | [
"func",
"(",
"dm",
"*",
"DocumentMapping",
")",
"AddSubDocumentMapping",
"(",
"property",
"string",
",",
"sdm",
"*",
"DocumentMapping",
")",
"{",
"if",
"dm",
".",
"Properties",
"==",
"nil",
"{",
"dm",
".",
"Properties",
"=",
"make",
"(",
"map",
"[",
"str... | // AddSubDocumentMapping adds the provided DocumentMapping as a sub-mapping
// for the specified named subsection. | [
"AddSubDocumentMapping",
"adds",
"the",
"provided",
"DocumentMapping",
"as",
"a",
"sub",
"-",
"mapping",
"for",
"the",
"specified",
"named",
"subsection",
"."
] | 7f3a218ae72960bb4841254833a52a5f088a9928 | https://github.com/blevesearch/bleve/blob/7f3a218ae72960bb4841254833a52a5f088a9928/mapping/document.go#L213-L218 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.