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
sequencelengths 21
1.41k
| docstring
stringlengths 6
2.61k
| docstring_tokens
sequencelengths 3
215
| sha
stringlengths 40
40
| url
stringlengths 85
252
|
---|---|---|---|---|---|---|---|---|---|---|---|
161,900 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ApplicationTree) DeepCopy() *ApplicationTree {
if in == nil {
return nil
}
out := new(ApplicationTree)
in.DeepCopyInto(out)
return out
} | go | func (in *ApplicationTree) DeepCopy() *ApplicationTree {
if in == nil {
return nil
}
out := new(ApplicationTree)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ApplicationTree",
")",
"DeepCopy",
"(",
")",
"*",
"ApplicationTree",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ApplicationTree",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTree. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ApplicationTree",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L496-L503 |
161,901 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ApplicationWatchEvent) DeepCopy() *ApplicationWatchEvent {
if in == nil {
return nil
}
out := new(ApplicationWatchEvent)
in.DeepCopyInto(out)
return out
} | go | func (in *ApplicationWatchEvent) DeepCopy() *ApplicationWatchEvent {
if in == nil {
return nil
}
out := new(ApplicationWatchEvent)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ApplicationWatchEvent",
")",
"DeepCopy",
"(",
")",
"*",
"ApplicationWatchEvent",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ApplicationWatchEvent",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationWatchEvent. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ApplicationWatchEvent",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L513-L520 |
161,902 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ClusterConfig) DeepCopy() *ClusterConfig {
if in == nil {
return nil
}
out := new(ClusterConfig)
in.DeepCopyInto(out)
return out
} | go | func (in *ClusterConfig) DeepCopy() *ClusterConfig {
if in == nil {
return nil
}
out := new(ClusterConfig)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ClusterConfig",
")",
"DeepCopy",
"(",
")",
"*",
"ClusterConfig",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ClusterConfig",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConfig. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ClusterConfig",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L553-L560 |
161,903 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *Command) DeepCopy() *Command {
if in == nil {
return nil
}
out := new(Command)
in.DeepCopyInto(out)
return out
} | go | func (in *Command) DeepCopy() *Command {
if in == nil {
return nil
}
out := new(Command)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Command",
")",
"DeepCopy",
"(",
")",
"*",
"Command",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Command",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Command. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Command",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L603-L610 |
161,904 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ComparedTo) DeepCopy() *ComparedTo {
if in == nil {
return nil
}
out := new(ComparedTo)
in.DeepCopyInto(out)
return out
} | go | func (in *ComparedTo) DeepCopy() *ComparedTo {
if in == nil {
return nil
}
out := new(ComparedTo)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ComparedTo",
")",
"DeepCopy",
"(",
")",
"*",
"ComparedTo",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ComparedTo",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComparedTo. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ComparedTo",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L621-L628 |
161,905 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ComponentParameter) DeepCopy() *ComponentParameter {
if in == nil {
return nil
}
out := new(ComponentParameter)
in.DeepCopyInto(out)
return out
} | go | func (in *ComponentParameter) DeepCopy() *ComponentParameter {
if in == nil {
return nil
}
out := new(ComponentParameter)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ComponentParameter",
")",
"DeepCopy",
"(",
")",
"*",
"ComponentParameter",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ComponentParameter",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentParameter. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ComponentParameter",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L637-L644 |
161,906 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ConfigManagementPlugin) DeepCopy() *ConfigManagementPlugin {
if in == nil {
return nil
}
out := new(ConfigManagementPlugin)
in.DeepCopyInto(out)
return out
} | go | func (in *ConfigManagementPlugin) DeepCopy() *ConfigManagementPlugin {
if in == nil {
return nil
}
out := new(ConfigManagementPlugin)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ConfigManagementPlugin",
")",
"DeepCopy",
"(",
")",
"*",
"ConfigManagementPlugin",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ConfigManagementPlugin",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigManagementPlugin. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ConfigManagementPlugin",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L659-L666 |
161,907 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ConnectionState) DeepCopy() *ConnectionState {
if in == nil {
return nil
}
out := new(ConnectionState)
in.DeepCopyInto(out)
return out
} | go | func (in *ConnectionState) DeepCopy() *ConnectionState {
if in == nil {
return nil
}
out := new(ConnectionState)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ConnectionState",
")",
"DeepCopy",
"(",
")",
"*",
"ConnectionState",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ConnectionState",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectionState. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ConnectionState",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L679-L686 |
161,908 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *HealthStatus) DeepCopy() *HealthStatus {
if in == nil {
return nil
}
out := new(HealthStatus)
in.DeepCopyInto(out)
return out
} | go | func (in *HealthStatus) DeepCopy() *HealthStatus {
if in == nil {
return nil
}
out := new(HealthStatus)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"HealthStatus",
")",
"DeepCopy",
"(",
")",
"*",
"HealthStatus",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"HealthStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthStatus. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"HealthStatus",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L695-L702 |
161,909 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *HelmParameter) DeepCopy() *HelmParameter {
if in == nil {
return nil
}
out := new(HelmParameter)
in.DeepCopyInto(out)
return out
} | go | func (in *HelmParameter) DeepCopy() *HelmParameter {
if in == nil {
return nil
}
out := new(HelmParameter)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"HelmParameter",
")",
"DeepCopy",
"(",
")",
"*",
"HelmParameter",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"HelmParameter",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmParameter. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"HelmParameter",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L711-L718 |
161,910 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *HelmRepository) DeepCopy() *HelmRepository {
if in == nil {
return nil
}
out := new(HelmRepository)
in.DeepCopyInto(out)
return out
} | go | func (in *HelmRepository) DeepCopy() *HelmRepository {
if in == nil {
return nil
}
out := new(HelmRepository)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"HelmRepository",
")",
"DeepCopy",
"(",
")",
"*",
"HelmRepository",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"HelmRepository",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepository. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"HelmRepository",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L742-L749 |
161,911 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *InfoItem) DeepCopy() *InfoItem {
if in == nil {
return nil
}
out := new(InfoItem)
in.DeepCopyInto(out)
return out
} | go | func (in *InfoItem) DeepCopy() *InfoItem {
if in == nil {
return nil
}
out := new(InfoItem)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"InfoItem",
")",
"DeepCopy",
"(",
")",
"*",
"InfoItem",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"InfoItem",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfoItem. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"InfoItem",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L758-L765 |
161,912 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *JWTToken) DeepCopy() *JWTToken {
if in == nil {
return nil
}
out := new(JWTToken)
in.DeepCopyInto(out)
return out
} | go | func (in *JWTToken) DeepCopy() *JWTToken {
if in == nil {
return nil
}
out := new(JWTToken)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"JWTToken",
")",
"DeepCopy",
"(",
")",
"*",
"JWTToken",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"JWTToken",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTToken. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"JWTToken",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L774-L781 |
161,913 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *JsonnetVar) DeepCopy() *JsonnetVar {
if in == nil {
return nil
}
out := new(JsonnetVar)
in.DeepCopyInto(out)
return out
} | go | func (in *JsonnetVar) DeepCopy() *JsonnetVar {
if in == nil {
return nil
}
out := new(JsonnetVar)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"JsonnetVar",
")",
"DeepCopy",
"(",
")",
"*",
"JsonnetVar",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"JsonnetVar",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JsonnetVar. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"JsonnetVar",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L790-L797 |
161,914 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *KsonnetParameter) DeepCopy() *KsonnetParameter {
if in == nil {
return nil
}
out := new(KsonnetParameter)
in.DeepCopyInto(out)
return out
} | go | func (in *KsonnetParameter) DeepCopy() *KsonnetParameter {
if in == nil {
return nil
}
out := new(KsonnetParameter)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"KsonnetParameter",
")",
"DeepCopy",
"(",
")",
"*",
"KsonnetParameter",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"KsonnetParameter",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KsonnetParameter. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"KsonnetParameter",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L806-L813 |
161,915 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *KustomizeImageTag) DeepCopy() *KustomizeImageTag {
if in == nil {
return nil
}
out := new(KustomizeImageTag)
in.DeepCopyInto(out)
return out
} | go | func (in *KustomizeImageTag) DeepCopy() *KustomizeImageTag {
if in == nil {
return nil
}
out := new(KustomizeImageTag)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"KustomizeImageTag",
")",
"DeepCopy",
"(",
")",
"*",
"KustomizeImageTag",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"KustomizeImageTag",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KustomizeImageTag. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"KustomizeImageTag",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L822-L829 |
161,916 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *Operation) DeepCopy() *Operation {
if in == nil {
return nil
}
out := new(Operation)
in.DeepCopyInto(out)
return out
} | go | func (in *Operation) DeepCopy() *Operation {
if in == nil {
return nil
}
out := new(Operation)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Operation",
")",
"DeepCopy",
"(",
")",
"*",
"Operation",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Operation",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Operation. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Operation",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L843-L850 |
161,917 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *OperationState) DeepCopy() *OperationState {
if in == nil {
return nil
}
out := new(OperationState)
in.DeepCopyInto(out)
return out
} | go | func (in *OperationState) DeepCopy() *OperationState {
if in == nil {
return nil
}
out := new(OperationState)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"OperationState",
")",
"DeepCopy",
"(",
")",
"*",
"OperationState",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"OperationState",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperationState. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"OperationState",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L870-L877 |
161,918 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ProjectRole) DeepCopy() *ProjectRole {
if in == nil {
return nil
}
out := new(ProjectRole)
in.DeepCopyInto(out)
return out
} | go | func (in *ProjectRole) DeepCopy() *ProjectRole {
if in == nil {
return nil
}
out := new(ProjectRole)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ProjectRole",
")",
"DeepCopy",
"(",
")",
"*",
"ProjectRole",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ProjectRole",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectRole. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ProjectRole",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L901-L908 |
161,919 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *Repository) DeepCopy() *Repository {
if in == nil {
return nil
}
out := new(Repository)
in.DeepCopyInto(out)
return out
} | go | func (in *Repository) DeepCopy() *Repository {
if in == nil {
return nil
}
out := new(Repository)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Repository",
")",
"DeepCopy",
"(",
")",
"*",
"Repository",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Repository",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Repository. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Repository",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L918-L925 |
161,920 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *RepositoryList) DeepCopy() *RepositoryList {
if in == nil {
return nil
}
out := new(RepositoryList)
in.DeepCopyInto(out)
return out
} | go | func (in *RepositoryList) DeepCopy() *RepositoryList {
if in == nil {
return nil
}
out := new(RepositoryList)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"RepositoryList",
")",
"DeepCopy",
"(",
")",
"*",
"RepositoryList",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"RepositoryList",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryList. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"RepositoryList",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L942-L949 |
161,921 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceAction) DeepCopy() *ResourceAction {
if in == nil {
return nil
}
out := new(ResourceAction)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceAction) DeepCopy() *ResourceAction {
if in == nil {
return nil
}
out := new(ResourceAction)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceAction",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceAction",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceAction",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceAction. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceAction",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L963-L970 |
161,922 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceActionDefinition) DeepCopy() *ResourceActionDefinition {
if in == nil {
return nil
}
out := new(ResourceActionDefinition)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceActionDefinition) DeepCopy() *ResourceActionDefinition {
if in == nil {
return nil
}
out := new(ResourceActionDefinition)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceActionDefinition",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceActionDefinition",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceActionDefinition",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceActionDefinition. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceActionDefinition",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L979-L986 |
161,923 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceActionParam) DeepCopy() *ResourceActionParam {
if in == nil {
return nil
}
out := new(ResourceActionParam)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceActionParam) DeepCopy() *ResourceActionParam {
if in == nil {
return nil
}
out := new(ResourceActionParam)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceActionParam",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceActionParam",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceActionParam",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceActionParam. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceActionParam",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L995-L1002 |
161,924 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceActions) DeepCopy() *ResourceActions {
if in == nil {
return nil
}
out := new(ResourceActions)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceActions) DeepCopy() *ResourceActions {
if in == nil {
return nil
}
out := new(ResourceActions)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceActions",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceActions",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceActions",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceActions. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceActions",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1016-L1023 |
161,925 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceDiff) DeepCopy() *ResourceDiff {
if in == nil {
return nil
}
out := new(ResourceDiff)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceDiff) DeepCopy() *ResourceDiff {
if in == nil {
return nil
}
out := new(ResourceDiff)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceDiff",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceDiff",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceDiff",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDiff. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceDiff",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1032-L1039 |
161,926 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceIgnoreDifferences) DeepCopy() *ResourceIgnoreDifferences {
if in == nil {
return nil
}
out := new(ResourceIgnoreDifferences)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceIgnoreDifferences) DeepCopy() *ResourceIgnoreDifferences {
if in == nil {
return nil
}
out := new(ResourceIgnoreDifferences)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceIgnoreDifferences",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceIgnoreDifferences",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceIgnoreDifferences",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceIgnoreDifferences. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceIgnoreDifferences",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1053-L1060 |
161,927 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceNetworkingInfo) DeepCopy() *ResourceNetworkingInfo {
if in == nil {
return nil
}
out := new(ResourceNetworkingInfo)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceNetworkingInfo) DeepCopy() *ResourceNetworkingInfo {
if in == nil {
return nil
}
out := new(ResourceNetworkingInfo)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceNetworkingInfo",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceNetworkingInfo",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceNetworkingInfo",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceNetworkingInfo. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceNetworkingInfo",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1098-L1105 |
161,928 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceNode) DeepCopy() *ResourceNode {
if in == nil {
return nil
}
out := new(ResourceNode)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceNode) DeepCopy() *ResourceNode {
if in == nil {
return nil
}
out := new(ResourceNode)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceNode",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceNode",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceNode",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceNode. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceNode",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1140-L1147 |
161,929 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceOverride) DeepCopy() *ResourceOverride {
if in == nil {
return nil
}
out := new(ResourceOverride)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceOverride) DeepCopy() *ResourceOverride {
if in == nil {
return nil
}
out := new(ResourceOverride)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceOverride",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceOverride",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceOverride",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceOverride. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceOverride",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1156-L1163 |
161,930 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceRef) DeepCopy() *ResourceRef {
if in == nil {
return nil
}
out := new(ResourceRef)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceRef) DeepCopy() *ResourceRef {
if in == nil {
return nil
}
out := new(ResourceRef)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceRef",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceRef",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceRef",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRef. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceRef",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1172-L1179 |
161,931 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceResult) DeepCopy() *ResourceResult {
if in == nil {
return nil
}
out := new(ResourceResult)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceResult) DeepCopy() *ResourceResult {
if in == nil {
return nil
}
out := new(ResourceResult)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceResult",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceResult",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceResult",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceResult. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceResult",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1188-L1195 |
161,932 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *ResourceStatus) DeepCopy() *ResourceStatus {
if in == nil {
return nil
}
out := new(ResourceStatus)
in.DeepCopyInto(out)
return out
} | go | func (in *ResourceStatus) DeepCopy() *ResourceStatus {
if in == nil {
return nil
}
out := new(ResourceStatus)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ResourceStatus",
")",
"DeepCopy",
"(",
")",
"*",
"ResourceStatus",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ResourceStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStatus. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ResourceStatus",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1209-L1216 |
161,933 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *RevisionHistory) DeepCopy() *RevisionHistory {
if in == nil {
return nil
}
out := new(RevisionHistory)
in.DeepCopyInto(out)
return out
} | go | func (in *RevisionHistory) DeepCopy() *RevisionHistory {
if in == nil {
return nil
}
out := new(RevisionHistory)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"RevisionHistory",
")",
"DeepCopy",
"(",
")",
"*",
"RevisionHistory",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"RevisionHistory",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RevisionHistory. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"RevisionHistory",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1227-L1234 |
161,934 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncOperation) DeepCopy() *SyncOperation {
if in == nil {
return nil
}
out := new(SyncOperation)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncOperation) DeepCopy() *SyncOperation {
if in == nil {
return nil
}
out := new(SyncOperation)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncOperation",
")",
"DeepCopy",
"(",
")",
"*",
"SyncOperation",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncOperation",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncOperation. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncOperation",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1258-L1265 |
161,935 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncOperationResource) DeepCopy() *SyncOperationResource {
if in == nil {
return nil
}
out := new(SyncOperationResource)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncOperationResource) DeepCopy() *SyncOperationResource {
if in == nil {
return nil
}
out := new(SyncOperationResource)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncOperationResource",
")",
"DeepCopy",
"(",
")",
"*",
"SyncOperationResource",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncOperationResource",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncOperationResource. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncOperationResource",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1274-L1281 |
161,936 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncOperationResult) DeepCopy() *SyncOperationResult {
if in == nil {
return nil
}
out := new(SyncOperationResult)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncOperationResult) DeepCopy() *SyncOperationResult {
if in == nil {
return nil
}
out := new(SyncOperationResult)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncOperationResult",
")",
"DeepCopy",
"(",
")",
"*",
"SyncOperationResult",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncOperationResult",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncOperationResult. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncOperationResult",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1302-L1309 |
161,937 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncPolicy) DeepCopy() *SyncPolicy {
if in == nil {
return nil
}
out := new(SyncPolicy)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncPolicy) DeepCopy() *SyncPolicy {
if in == nil {
return nil
}
out := new(SyncPolicy)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncPolicy",
")",
"DeepCopy",
"(",
")",
"*",
"SyncPolicy",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncPolicy",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncPolicy. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncPolicy",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1323-L1330 |
161,938 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncPolicyAutomated) DeepCopy() *SyncPolicyAutomated {
if in == nil {
return nil
}
out := new(SyncPolicyAutomated)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncPolicyAutomated) DeepCopy() *SyncPolicyAutomated {
if in == nil {
return nil
}
out := new(SyncPolicyAutomated)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncPolicyAutomated",
")",
"DeepCopy",
"(",
")",
"*",
"SyncPolicyAutomated",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncPolicyAutomated",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncPolicyAutomated. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncPolicyAutomated",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1339-L1346 |
161,939 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncStatus) DeepCopy() *SyncStatus {
if in == nil {
return nil
}
out := new(SyncStatus)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncStatus) DeepCopy() *SyncStatus {
if in == nil {
return nil
}
out := new(SyncStatus)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncStatus",
")",
"DeepCopy",
"(",
")",
"*",
"SyncStatus",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncStatus. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncStatus",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1356-L1363 |
161,940 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncStrategy) DeepCopy() *SyncStrategy {
if in == nil {
return nil
}
out := new(SyncStrategy)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncStrategy) DeepCopy() *SyncStrategy {
if in == nil {
return nil
}
out := new(SyncStrategy)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncStrategy",
")",
"DeepCopy",
"(",
")",
"*",
"SyncStrategy",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncStrategy",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncStrategy. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncStrategy",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1382-L1389 |
161,941 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncStrategyApply) DeepCopy() *SyncStrategyApply {
if in == nil {
return nil
}
out := new(SyncStrategyApply)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncStrategyApply) DeepCopy() *SyncStrategyApply {
if in == nil {
return nil
}
out := new(SyncStrategyApply)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncStrategyApply",
")",
"DeepCopy",
"(",
")",
"*",
"SyncStrategyApply",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncStrategyApply",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncStrategyApply. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncStrategyApply",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1398-L1405 |
161,942 | argoproj/argo-cd | pkg/apis/application/v1alpha1/zz_generated.deepcopy.go | DeepCopy | func (in *SyncStrategyHook) DeepCopy() *SyncStrategyHook {
if in == nil {
return nil
}
out := new(SyncStrategyHook)
in.DeepCopyInto(out)
return out
} | go | func (in *SyncStrategyHook) DeepCopy() *SyncStrategyHook {
if in == nil {
return nil
}
out := new(SyncStrategyHook)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"SyncStrategyHook",
")",
"DeepCopy",
"(",
")",
"*",
"SyncStrategyHook",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"SyncStrategyHook",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncStrategyHook. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"SyncStrategyHook",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/apis/application/v1alpha1/zz_generated.deepcopy.go#L1415-L1422 |
161,943 | argoproj/argo-cd | cmd/argocd/commands/context.go | NewContextCommand | func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "context",
Aliases: []string{"ctx"},
Short: "Switch between contexts",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
printArgoCDContexts(clientOpts.ConfigPath)
return
}
ctxName := args[0]
argoCDDir, err := localconfig.DefaultConfigDir()
errors.CheckError(err)
prevCtxFile := path.Join(argoCDDir, ".prev-ctx")
if ctxName == "-" {
prevCtxBytes, err := ioutil.ReadFile(prevCtxFile)
errors.CheckError(err)
ctxName = string(prevCtxBytes)
}
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errors.CheckError(err)
if localCfg.CurrentContext == ctxName {
fmt.Printf("Already at context '%s'\n", localCfg.CurrentContext)
return
}
if _, err = localCfg.ResolveContext(ctxName); err != nil {
log.Fatal(err)
}
prevCtx := localCfg.CurrentContext
localCfg.CurrentContext = ctxName
err = localconfig.WriteLocalConfig(*localCfg, clientOpts.ConfigPath)
errors.CheckError(err)
err = ioutil.WriteFile(prevCtxFile, []byte(prevCtx), 0644)
errors.CheckError(err)
fmt.Printf("Switched to context '%s'\n", localCfg.CurrentContext)
},
}
return command
} | go | func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "context",
Aliases: []string{"ctx"},
Short: "Switch between contexts",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
printArgoCDContexts(clientOpts.ConfigPath)
return
}
ctxName := args[0]
argoCDDir, err := localconfig.DefaultConfigDir()
errors.CheckError(err)
prevCtxFile := path.Join(argoCDDir, ".prev-ctx")
if ctxName == "-" {
prevCtxBytes, err := ioutil.ReadFile(prevCtxFile)
errors.CheckError(err)
ctxName = string(prevCtxBytes)
}
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errors.CheckError(err)
if localCfg.CurrentContext == ctxName {
fmt.Printf("Already at context '%s'\n", localCfg.CurrentContext)
return
}
if _, err = localCfg.ResolveContext(ctxName); err != nil {
log.Fatal(err)
}
prevCtx := localCfg.CurrentContext
localCfg.CurrentContext = ctxName
err = localconfig.WriteLocalConfig(*localCfg, clientOpts.ConfigPath)
errors.CheckError(err)
err = ioutil.WriteFile(prevCtxFile, []byte(prevCtx), 0644)
errors.CheckError(err)
fmt.Printf("Switched to context '%s'\n", localCfg.CurrentContext)
},
}
return command
} | [
"func",
"NewContextCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Aliases",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"c",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"printArgoCDContexts",
"(",
"clientOpts",
".",
"ConfigPath",
")",
"\n",
"return",
"\n",
"}",
"\n",
"ctxName",
":=",
"args",
"[",
"0",
"]",
"\n",
"argoCDDir",
",",
"err",
":=",
"localconfig",
".",
"DefaultConfigDir",
"(",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"prevCtxFile",
":=",
"path",
".",
"Join",
"(",
"argoCDDir",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"ctxName",
"==",
"\"",
"\"",
"{",
"prevCtxBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"prevCtxFile",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"ctxName",
"=",
"string",
"(",
"prevCtxBytes",
")",
"\n",
"}",
"\n",
"localCfg",
",",
"err",
":=",
"localconfig",
".",
"ReadLocalConfig",
"(",
"clientOpts",
".",
"ConfigPath",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"if",
"localCfg",
".",
"CurrentContext",
"==",
"ctxName",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"localCfg",
".",
"CurrentContext",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
"=",
"localCfg",
".",
"ResolveContext",
"(",
"ctxName",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"prevCtx",
":=",
"localCfg",
".",
"CurrentContext",
"\n",
"localCfg",
".",
"CurrentContext",
"=",
"ctxName",
"\n",
"err",
"=",
"localconfig",
".",
"WriteLocalConfig",
"(",
"*",
"localCfg",
",",
"clientOpts",
".",
"ConfigPath",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"err",
"=",
"ioutil",
".",
"WriteFile",
"(",
"prevCtxFile",
",",
"[",
"]",
"byte",
"(",
"prevCtx",
")",
",",
"0644",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"localCfg",
".",
"CurrentContext",
")",
"\n",
"}",
",",
"}",
"\n",
"return",
"command",
"\n",
"}"
] | // NewContextCommand returns a new instance of an `argocd ctx` command | [
"NewContextCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"ctx",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/context.go#L20-L59 |
161,944 | argoproj/argo-cd | reposerver/clientset.go | NewRepoServerClientset | func NewRepoServerClientset(address string, timeoutSeconds int) Clientset {
return &clientSet{address: address, timeoutSeconds: timeoutSeconds}
} | go | func NewRepoServerClientset(address string, timeoutSeconds int) Clientset {
return &clientSet{address: address, timeoutSeconds: timeoutSeconds}
} | [
"func",
"NewRepoServerClientset",
"(",
"address",
"string",
",",
"timeoutSeconds",
"int",
")",
"Clientset",
"{",
"return",
"&",
"clientSet",
"{",
"address",
":",
"address",
",",
"timeoutSeconds",
":",
"timeoutSeconds",
"}",
"\n",
"}"
] | // NewRepoServerClientset creates new instance of repo server Clientset | [
"NewRepoServerClientset",
"creates",
"new",
"instance",
"of",
"repo",
"server",
"Clientset"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/clientset.go#L48-L50 |
161,945 | argoproj/argo-cd | util/project/util.go | GetRoleByName | func GetRoleByName(proj *v1alpha1.AppProject, name string) (*v1alpha1.ProjectRole, int, error) {
for i, role := range proj.Spec.Roles {
if name == role.Name {
return &role, i, nil
}
}
return nil, -1, fmt.Errorf("role '%s' does not exist in project '%s'", name, proj.Name)
} | go | func GetRoleByName(proj *v1alpha1.AppProject, name string) (*v1alpha1.ProjectRole, int, error) {
for i, role := range proj.Spec.Roles {
if name == role.Name {
return &role, i, nil
}
}
return nil, -1, fmt.Errorf("role '%s' does not exist in project '%s'", name, proj.Name)
} | [
"func",
"GetRoleByName",
"(",
"proj",
"*",
"v1alpha1",
".",
"AppProject",
",",
"name",
"string",
")",
"(",
"*",
"v1alpha1",
".",
"ProjectRole",
",",
"int",
",",
"error",
")",
"{",
"for",
"i",
",",
"role",
":=",
"range",
"proj",
".",
"Spec",
".",
"Roles",
"{",
"if",
"name",
"==",
"role",
".",
"Name",
"{",
"return",
"&",
"role",
",",
"i",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"proj",
".",
"Name",
")",
"\n",
"}"
] | // GetRoleByName returns the role in a project by the name with its index | [
"GetRoleByName",
"returns",
"the",
"role",
"in",
"a",
"project",
"by",
"the",
"name",
"with",
"its",
"index"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/project/util.go#L16-L23 |
161,946 | argoproj/argo-cd | util/project/util.go | GetJWTToken | func GetJWTToken(proj *v1alpha1.AppProject, roleName string, issuedAt int64) (*v1alpha1.JWTToken, int, error) {
role, _, err := GetRoleByName(proj, roleName)
if err != nil {
return nil, -1, err
}
for i, token := range role.JWTTokens {
if issuedAt == token.IssuedAt {
return &token, i, nil
}
}
return nil, -1, fmt.Errorf("JWT token for role '%s' issued at '%d' does not exist in project '%s'", role.Name, issuedAt, proj.Name)
} | go | func GetJWTToken(proj *v1alpha1.AppProject, roleName string, issuedAt int64) (*v1alpha1.JWTToken, int, error) {
role, _, err := GetRoleByName(proj, roleName)
if err != nil {
return nil, -1, err
}
for i, token := range role.JWTTokens {
if issuedAt == token.IssuedAt {
return &token, i, nil
}
}
return nil, -1, fmt.Errorf("JWT token for role '%s' issued at '%d' does not exist in project '%s'", role.Name, issuedAt, proj.Name)
} | [
"func",
"GetJWTToken",
"(",
"proj",
"*",
"v1alpha1",
".",
"AppProject",
",",
"roleName",
"string",
",",
"issuedAt",
"int64",
")",
"(",
"*",
"v1alpha1",
".",
"JWTToken",
",",
"int",
",",
"error",
")",
"{",
"role",
",",
"_",
",",
"err",
":=",
"GetRoleByName",
"(",
"proj",
",",
"roleName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"for",
"i",
",",
"token",
":=",
"range",
"role",
".",
"JWTTokens",
"{",
"if",
"issuedAt",
"==",
"token",
".",
"IssuedAt",
"{",
"return",
"&",
"token",
",",
"i",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"role",
".",
"Name",
",",
"issuedAt",
",",
"proj",
".",
"Name",
")",
"\n",
"}"
] | // GetJWTToken looks up the index of a JWTToken in a project by the issue at time | [
"GetJWTToken",
"looks",
"up",
"the",
"index",
"of",
"a",
"JWTToken",
"in",
"a",
"project",
"by",
"the",
"issue",
"at",
"time"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/project/util.go#L26-L37 |
161,947 | argoproj/argo-cd | util/project/util.go | validatePolicySyntax | func validatePolicySyntax(p *v1alpha1.AppProject) error {
err := rbac.ValidatePolicy(p.ProjectPoliciesString())
if err != nil {
return status.Errorf(codes.InvalidArgument, "policy syntax error: %s", err.Error())
}
return nil
} | go | func validatePolicySyntax(p *v1alpha1.AppProject) error {
err := rbac.ValidatePolicy(p.ProjectPoliciesString())
if err != nil {
return status.Errorf(codes.InvalidArgument, "policy syntax error: %s", err.Error())
}
return nil
} | [
"func",
"validatePolicySyntax",
"(",
"p",
"*",
"v1alpha1",
".",
"AppProject",
")",
"error",
"{",
"err",
":=",
"rbac",
".",
"ValidatePolicy",
"(",
"p",
".",
"ProjectPoliciesString",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"status",
".",
"Errorf",
"(",
"codes",
".",
"InvalidArgument",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // validatePolicySyntax verifies policy syntax is accepted by casbin | [
"validatePolicySyntax",
"verifies",
"policy",
"syntax",
"is",
"accepted",
"by",
"casbin"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/project/util.go#L163-L169 |
161,948 | argoproj/argo-cd | util/project/util.go | AddGroupToRole | func AddGroupToRole(p *v1alpha1.AppProject, roleName, group string) (bool, error) {
role, roleIndex, err := GetRoleByName(p, roleName)
if err != nil {
return false, err
}
for _, roleGroup := range role.Groups {
if group == roleGroup {
return false, nil
}
}
role.Groups = append(role.Groups, group)
p.Spec.Roles[roleIndex] = *role
return true, nil
} | go | func AddGroupToRole(p *v1alpha1.AppProject, roleName, group string) (bool, error) {
role, roleIndex, err := GetRoleByName(p, roleName)
if err != nil {
return false, err
}
for _, roleGroup := range role.Groups {
if group == roleGroup {
return false, nil
}
}
role.Groups = append(role.Groups, group)
p.Spec.Roles[roleIndex] = *role
return true, nil
} | [
"func",
"AddGroupToRole",
"(",
"p",
"*",
"v1alpha1",
".",
"AppProject",
",",
"roleName",
",",
"group",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"role",
",",
"roleIndex",
",",
"err",
":=",
"GetRoleByName",
"(",
"p",
",",
"roleName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"roleGroup",
":=",
"range",
"role",
".",
"Groups",
"{",
"if",
"group",
"==",
"roleGroup",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"role",
".",
"Groups",
"=",
"append",
"(",
"role",
".",
"Groups",
",",
"group",
")",
"\n",
"p",
".",
"Spec",
".",
"Roles",
"[",
"roleIndex",
"]",
"=",
"*",
"role",
"\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] | // AddGroupToRole adds an OIDC group to a role | [
"AddGroupToRole",
"adds",
"an",
"OIDC",
"group",
"to",
"a",
"role"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/project/util.go#L172-L185 |
161,949 | argoproj/argo-cd | util/project/util.go | NormalizePolicies | func NormalizePolicies(p *v1alpha1.AppProject) {
for i, role := range p.Spec.Roles {
var normalizedPolicies []string
for _, policy := range role.Policies {
normalizedPolicies = append(normalizedPolicies, normalizePolicy(policy))
}
p.Spec.Roles[i].Policies = normalizedPolicies
}
} | go | func NormalizePolicies(p *v1alpha1.AppProject) {
for i, role := range p.Spec.Roles {
var normalizedPolicies []string
for _, policy := range role.Policies {
normalizedPolicies = append(normalizedPolicies, normalizePolicy(policy))
}
p.Spec.Roles[i].Policies = normalizedPolicies
}
} | [
"func",
"NormalizePolicies",
"(",
"p",
"*",
"v1alpha1",
".",
"AppProject",
")",
"{",
"for",
"i",
",",
"role",
":=",
"range",
"p",
".",
"Spec",
".",
"Roles",
"{",
"var",
"normalizedPolicies",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"policy",
":=",
"range",
"role",
".",
"Policies",
"{",
"normalizedPolicies",
"=",
"append",
"(",
"normalizedPolicies",
",",
"normalizePolicy",
"(",
"policy",
")",
")",
"\n",
"}",
"\n",
"p",
".",
"Spec",
".",
"Roles",
"[",
"i",
"]",
".",
"Policies",
"=",
"normalizedPolicies",
"\n",
"}",
"\n",
"}"
] | // NormalizePolicies normalizes the policies in the project | [
"NormalizePolicies",
"normalizes",
"the",
"policies",
"in",
"the",
"project"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/project/util.go#L204-L212 |
161,950 | argoproj/argo-cd | util/cli/cli.go | ReadAndConfirmPassword | func ReadAndConfirmPassword() (string, error) {
for {
fmt.Print("*** Enter new password: ")
password, err := terminal.ReadPassword(syscall.Stdin)
if err != nil {
return "", err
}
fmt.Print("\n")
fmt.Print("*** Confirm new password: ")
confirmPassword, err := terminal.ReadPassword(syscall.Stdin)
if err != nil {
return "", err
}
fmt.Print("\n")
if string(password) == string(confirmPassword) {
return string(password), nil
}
log.Error("Passwords do not match")
}
} | go | func ReadAndConfirmPassword() (string, error) {
for {
fmt.Print("*** Enter new password: ")
password, err := terminal.ReadPassword(syscall.Stdin)
if err != nil {
return "", err
}
fmt.Print("\n")
fmt.Print("*** Confirm new password: ")
confirmPassword, err := terminal.ReadPassword(syscall.Stdin)
if err != nil {
return "", err
}
fmt.Print("\n")
if string(password) == string(confirmPassword) {
return string(password), nil
}
log.Error("Passwords do not match")
}
} | [
"func",
"ReadAndConfirmPassword",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"for",
"{",
"fmt",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"password",
",",
"err",
":=",
"terminal",
".",
"ReadPassword",
"(",
"syscall",
".",
"Stdin",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"fmt",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"confirmPassword",
",",
"err",
":=",
"terminal",
".",
"ReadPassword",
"(",
"syscall",
".",
"Stdin",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"if",
"string",
"(",
"password",
")",
"==",
"string",
"(",
"confirmPassword",
")",
"{",
"return",
"string",
"(",
"password",
")",
",",
"nil",
"\n",
"}",
"\n",
"log",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] | // ReadAndConfirmPassword is a helper to read and confirm a password from stdin | [
"ReadAndConfirmPassword",
"is",
"a",
"helper",
"to",
"read",
"and",
"confirm",
"a",
"password",
"from",
"stdin"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/cli/cli.go#L119-L138 |
161,951 | argoproj/argo-cd | util/cli/cli.go | SetLogLevel | func SetLogLevel(logLevel string) {
level, err := log.ParseLevel(logLevel)
errors.CheckError(err)
log.SetLevel(level)
if os.Getenv("FORCE_LOG_COLORS") == "1" {
log.SetFormatter(&log.TextFormatter{ForceColors: true})
}
} | go | func SetLogLevel(logLevel string) {
level, err := log.ParseLevel(logLevel)
errors.CheckError(err)
log.SetLevel(level)
if os.Getenv("FORCE_LOG_COLORS") == "1" {
log.SetFormatter(&log.TextFormatter{ForceColors: true})
}
} | [
"func",
"SetLogLevel",
"(",
"logLevel",
"string",
")",
"{",
"level",
",",
"err",
":=",
"log",
".",
"ParseLevel",
"(",
"logLevel",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"log",
".",
"SetLevel",
"(",
"level",
")",
"\n",
"if",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"{",
"log",
".",
"SetFormatter",
"(",
"&",
"log",
".",
"TextFormatter",
"{",
"ForceColors",
":",
"true",
"}",
")",
"\n",
"}",
"\n",
"}"
] | // SetLogLevel parses and sets a logrus log level | [
"SetLogLevel",
"parses",
"and",
"sets",
"a",
"logrus",
"log",
"level"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/cli/cli.go#L141-L148 |
161,952 | argoproj/argo-cd | util/cli/cli.go | SetGLogLevel | func SetGLogLevel(glogLevel int) {
_ = flag.CommandLine.Parse([]string{})
_ = flag.Lookup("logtostderr").Value.Set("true")
_ = flag.Lookup("v").Value.Set(strconv.Itoa(glogLevel))
} | go | func SetGLogLevel(glogLevel int) {
_ = flag.CommandLine.Parse([]string{})
_ = flag.Lookup("logtostderr").Value.Set("true")
_ = flag.Lookup("v").Value.Set(strconv.Itoa(glogLevel))
} | [
"func",
"SetGLogLevel",
"(",
"glogLevel",
"int",
")",
"{",
"_",
"=",
"flag",
".",
"CommandLine",
".",
"Parse",
"(",
"[",
"]",
"string",
"{",
"}",
")",
"\n",
"_",
"=",
"flag",
".",
"Lookup",
"(",
"\"",
"\"",
")",
".",
"Value",
".",
"Set",
"(",
"\"",
"\"",
")",
"\n",
"_",
"=",
"flag",
".",
"Lookup",
"(",
"\"",
"\"",
")",
".",
"Value",
".",
"Set",
"(",
"strconv",
".",
"Itoa",
"(",
"glogLevel",
")",
")",
"\n",
"}"
] | // SetGLogLevel set the glog level for the k8s go-client | [
"SetGLogLevel",
"set",
"the",
"glog",
"level",
"for",
"the",
"k8s",
"go",
"-",
"client"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/cli/cli.go#L151-L155 |
161,953 | argoproj/argo-cd | server/repository/repository.pb.gw.go | RegisterRepositoryServiceHandler | func RegisterRepositoryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterRepositoryServiceHandlerClient(ctx, mux, NewRepositoryServiceClient(conn))
} | go | func RegisterRepositoryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterRepositoryServiceHandlerClient(ctx, mux, NewRepositoryServiceClient(conn))
} | [
"func",
"RegisterRepositoryServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterRepositoryServiceHandlerClient",
"(",
"ctx",
",",
"mux",
",",
"NewRepositoryServiceClient",
"(",
"conn",
")",
")",
"\n",
"}"
] | // RegisterRepositoryServiceHandler registers the http handlers for service RepositoryService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterRepositoryServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"RepositoryService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/repository/repository.pb.gw.go#L235-L237 |
161,954 | argoproj/argo-cd | server/session/session.pb.gw.go | RegisterSessionServiceHandler | func RegisterSessionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterSessionServiceHandlerClient(ctx, mux, NewSessionServiceClient(conn))
} | go | func RegisterSessionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterSessionServiceHandlerClient(ctx, mux, NewSessionServiceClient(conn))
} | [
"func",
"RegisterSessionServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterSessionServiceHandlerClient",
"(",
"ctx",
",",
"mux",
",",
"NewSessionServiceClient",
"(",
"conn",
")",
")",
"\n",
"}"
] | // RegisterSessionServiceHandler registers the http handlers for service SessionService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterSessionServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"SessionService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/session/session.pb.gw.go#L80-L82 |
161,955 | argoproj/argo-cd | util/cache/cache.go | AddCacheFlagsToCmd | func AddCacheFlagsToCmd(cmd *cobra.Command) func() (*Cache, error) {
redisAddress := ""
sentinelAddresses := make([]string, 0)
sentinelMaster := ""
redisDB := 0
cmd.Flags().StringVar(&redisAddress, "redis", "", "Redis server hostname and port (e.g. argocd-redis:6379). ")
cmd.Flags().IntVar(&redisDB, "redisdb", 0, "Redis database.")
cmd.Flags().StringArrayVar(&sentinelAddresses, "sentinel", []string{}, "Redis sentinel hostname and port (e.g. argocd-redis-ha-announce-0:6379). ")
cmd.Flags().StringVar(&sentinelMaster, "sentinelmaster", "master", "Redis sentinel master group name.")
return func() (*Cache, error) {
password := os.Getenv(envRedisPassword)
if len(sentinelAddresses) > 0 {
client := redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: sentinelMaster,
SentinelAddrs: sentinelAddresses,
DB: redisDB,
Password: password,
})
return NewCache(NewRedisCache(client, defaultCacheExpiration)), nil
}
if redisAddress == "" {
redisAddress = common.DefaultRedisAddr
}
client := redis.NewClient(&redis.Options{
Addr: redisAddress,
Password: password,
DB: redisDB,
})
return NewCache(NewRedisCache(client, defaultCacheExpiration)), nil
}
} | go | func AddCacheFlagsToCmd(cmd *cobra.Command) func() (*Cache, error) {
redisAddress := ""
sentinelAddresses := make([]string, 0)
sentinelMaster := ""
redisDB := 0
cmd.Flags().StringVar(&redisAddress, "redis", "", "Redis server hostname and port (e.g. argocd-redis:6379). ")
cmd.Flags().IntVar(&redisDB, "redisdb", 0, "Redis database.")
cmd.Flags().StringArrayVar(&sentinelAddresses, "sentinel", []string{}, "Redis sentinel hostname and port (e.g. argocd-redis-ha-announce-0:6379). ")
cmd.Flags().StringVar(&sentinelMaster, "sentinelmaster", "master", "Redis sentinel master group name.")
return func() (*Cache, error) {
password := os.Getenv(envRedisPassword)
if len(sentinelAddresses) > 0 {
client := redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: sentinelMaster,
SentinelAddrs: sentinelAddresses,
DB: redisDB,
Password: password,
})
return NewCache(NewRedisCache(client, defaultCacheExpiration)), nil
}
if redisAddress == "" {
redisAddress = common.DefaultRedisAddr
}
client := redis.NewClient(&redis.Options{
Addr: redisAddress,
Password: password,
DB: redisDB,
})
return NewCache(NewRedisCache(client, defaultCacheExpiration)), nil
}
} | [
"func",
"AddCacheFlagsToCmd",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"func",
"(",
")",
"(",
"*",
"Cache",
",",
"error",
")",
"{",
"redisAddress",
":=",
"\"",
"\"",
"\n",
"sentinelAddresses",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"sentinelMaster",
":=",
"\"",
"\"",
"\n",
"redisDB",
":=",
"0",
"\n\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"redisAddress",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"IntVar",
"(",
"&",
"redisDB",
",",
"\"",
"\"",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringArrayVar",
"(",
"&",
"sentinelAddresses",
",",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"}",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"sentinelMaster",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"func",
"(",
")",
"(",
"*",
"Cache",
",",
"error",
")",
"{",
"password",
":=",
"os",
".",
"Getenv",
"(",
"envRedisPassword",
")",
"\n",
"if",
"len",
"(",
"sentinelAddresses",
")",
">",
"0",
"{",
"client",
":=",
"redis",
".",
"NewFailoverClient",
"(",
"&",
"redis",
".",
"FailoverOptions",
"{",
"MasterName",
":",
"sentinelMaster",
",",
"SentinelAddrs",
":",
"sentinelAddresses",
",",
"DB",
":",
"redisDB",
",",
"Password",
":",
"password",
",",
"}",
")",
"\n",
"return",
"NewCache",
"(",
"NewRedisCache",
"(",
"client",
",",
"defaultCacheExpiration",
")",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"redisAddress",
"==",
"\"",
"\"",
"{",
"redisAddress",
"=",
"common",
".",
"DefaultRedisAddr",
"\n",
"}",
"\n",
"client",
":=",
"redis",
".",
"NewClient",
"(",
"&",
"redis",
".",
"Options",
"{",
"Addr",
":",
"redisAddress",
",",
"Password",
":",
"password",
",",
"DB",
":",
"redisDB",
",",
"}",
")",
"\n",
"return",
"NewCache",
"(",
"NewRedisCache",
"(",
"client",
",",
"defaultCacheExpiration",
")",
")",
",",
"nil",
"\n",
"}",
"\n",
"}"
] | // AddCacheFlagsToCmd adds flags which control caching to the specified command | [
"AddCacheFlagsToCmd",
"adds",
"flags",
"which",
"control",
"caching",
"to",
"the",
"specified",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/cache/cache.go#L40-L72 |
161,956 | argoproj/argo-cd | server/session/session.go | Delete | func (s *Server) Delete(ctx context.Context, q *SessionDeleteRequest) (*SessionResponse, error) {
return &SessionResponse{Token: ""}, nil
} | go | func (s *Server) Delete(ctx context.Context, q *SessionDeleteRequest) (*SessionResponse, error) {
return &SessionResponse{Token: ""}, nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"q",
"*",
"SessionDeleteRequest",
")",
"(",
"*",
"SessionResponse",
",",
"error",
")",
"{",
"return",
"&",
"SessionResponse",
"{",
"Token",
":",
"\"",
"\"",
"}",
",",
"nil",
"\n",
"}"
] | // Delete an authentication cookie from the client. This makes sense only for the Web client. | [
"Delete",
"an",
"authentication",
"cookie",
"from",
"the",
"client",
".",
"This",
"makes",
"sense",
"only",
"for",
"the",
"Web",
"client",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/session/session.go#L45-L47 |
161,957 | argoproj/argo-cd | server/cluster/cluster.pb.gw.go | RegisterClusterServiceHandler | func RegisterClusterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterClusterServiceHandlerClient(ctx, mux, NewClusterServiceClient(conn))
} | go | func RegisterClusterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterClusterServiceHandlerClient(ctx, mux, NewClusterServiceClient(conn))
} | [
"func",
"RegisterClusterServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterClusterServiceHandlerClient",
"(",
"ctx",
",",
"mux",
",",
"NewClusterServiceClient",
"(",
"conn",
")",
")",
"\n",
"}"
] | // RegisterClusterServiceHandler registers the http handlers for service ClusterService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterClusterServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"ClusterService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/cluster/cluster.pb.gw.go#L194-L196 |
161,958 | argoproj/argo-cd | pkg/client/listers/application/v1alpha1/appproject.go | List | func (s *appProjectLister) List(selector labels.Selector) (ret []*v1alpha1.AppProject, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.AppProject))
})
return ret, err
} | go | func (s *appProjectLister) List(selector labels.Selector) (ret []*v1alpha1.AppProject, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.AppProject))
})
return ret, err
} | [
"func",
"(",
"s",
"*",
"appProjectLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1alpha1",
".",
"AppProject",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAll",
"(",
"s",
".",
"indexer",
",",
"selector",
",",
"func",
"(",
"m",
"interface",
"{",
"}",
")",
"{",
"ret",
"=",
"append",
"(",
"ret",
",",
"m",
".",
"(",
"*",
"v1alpha1",
".",
"AppProject",
")",
")",
"\n",
"}",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] | // List lists all AppProjects in the indexer. | [
"List",
"lists",
"all",
"AppProjects",
"in",
"the",
"indexer",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/listers/application/v1alpha1/appproject.go#L32-L37 |
161,959 | argoproj/argo-cd | pkg/client/listers/application/v1alpha1/appproject.go | AppProjects | func (s *appProjectLister) AppProjects(namespace string) AppProjectNamespaceLister {
return appProjectNamespaceLister{indexer: s.indexer, namespace: namespace}
} | go | func (s *appProjectLister) AppProjects(namespace string) AppProjectNamespaceLister {
return appProjectNamespaceLister{indexer: s.indexer, namespace: namespace}
} | [
"func",
"(",
"s",
"*",
"appProjectLister",
")",
"AppProjects",
"(",
"namespace",
"string",
")",
"AppProjectNamespaceLister",
"{",
"return",
"appProjectNamespaceLister",
"{",
"indexer",
":",
"s",
".",
"indexer",
",",
"namespace",
":",
"namespace",
"}",
"\n",
"}"
] | // AppProjects returns an object that can list and get AppProjects. | [
"AppProjects",
"returns",
"an",
"object",
"that",
"can",
"list",
"and",
"get",
"AppProjects",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/listers/application/v1alpha1/appproject.go#L40-L42 |
161,960 | argoproj/argo-cd | pkg/client/listers/application/v1alpha1/appproject.go | List | func (s appProjectNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AppProject, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.AppProject))
})
return ret, err
} | go | func (s appProjectNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AppProject, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.AppProject))
})
return ret, err
} | [
"func",
"(",
"s",
"appProjectNamespaceLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1alpha1",
".",
"AppProject",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAllByNamespace",
"(",
"s",
".",
"indexer",
",",
"s",
".",
"namespace",
",",
"selector",
",",
"func",
"(",
"m",
"interface",
"{",
"}",
")",
"{",
"ret",
"=",
"append",
"(",
"ret",
",",
"m",
".",
"(",
"*",
"v1alpha1",
".",
"AppProject",
")",
")",
"\n",
"}",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] | // List lists all AppProjects in the indexer for a given namespace. | [
"List",
"lists",
"all",
"AppProjects",
"in",
"the",
"indexer",
"for",
"a",
"given",
"namespace",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/pkg/client/listers/application/v1alpha1/appproject.go#L61-L66 |
161,961 | argoproj/argo-cd | util/diff/diff.go | TwoWayDiff | func TwoWayDiff(config, live *unstructured.Unstructured) *DiffResult {
var configObj, liveObj map[string]interface{}
if config != nil {
config = removeNamespaceAnnotation(config)
configObj = config.Object
}
if live != nil {
liveObj = jsonutil.RemoveMapFields(configObj, live.Object)
}
gjDiff := gojsondiff.New().CompareObjects(liveObj, configObj)
dr := DiffResult{
Diff: gjDiff,
Modified: gjDiff.Modified(),
}
return &dr
} | go | func TwoWayDiff(config, live *unstructured.Unstructured) *DiffResult {
var configObj, liveObj map[string]interface{}
if config != nil {
config = removeNamespaceAnnotation(config)
configObj = config.Object
}
if live != nil {
liveObj = jsonutil.RemoveMapFields(configObj, live.Object)
}
gjDiff := gojsondiff.New().CompareObjects(liveObj, configObj)
dr := DiffResult{
Diff: gjDiff,
Modified: gjDiff.Modified(),
}
return &dr
} | [
"func",
"TwoWayDiff",
"(",
"config",
",",
"live",
"*",
"unstructured",
".",
"Unstructured",
")",
"*",
"DiffResult",
"{",
"var",
"configObj",
",",
"liveObj",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"if",
"config",
"!=",
"nil",
"{",
"config",
"=",
"removeNamespaceAnnotation",
"(",
"config",
")",
"\n",
"configObj",
"=",
"config",
".",
"Object",
"\n",
"}",
"\n",
"if",
"live",
"!=",
"nil",
"{",
"liveObj",
"=",
"jsonutil",
".",
"RemoveMapFields",
"(",
"configObj",
",",
"live",
".",
"Object",
")",
"\n",
"}",
"\n",
"gjDiff",
":=",
"gojsondiff",
".",
"New",
"(",
")",
".",
"CompareObjects",
"(",
"liveObj",
",",
"configObj",
")",
"\n",
"dr",
":=",
"DiffResult",
"{",
"Diff",
":",
"gjDiff",
",",
"Modified",
":",
"gjDiff",
".",
"Modified",
"(",
")",
",",
"}",
"\n",
"return",
"&",
"dr",
"\n",
"}"
] | // TwoWayDiff performs a normal two-way diff between two unstructured objects. Ignores extra fields
// in the live object.
// Inputs are assumed to be stripped of type information | [
"TwoWayDiff",
"performs",
"a",
"normal",
"two",
"-",
"way",
"diff",
"between",
"two",
"unstructured",
"objects",
".",
"Ignores",
"extra",
"fields",
"in",
"the",
"live",
"object",
".",
"Inputs",
"are",
"assumed",
"to",
"be",
"stripped",
"of",
"type",
"information"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L61-L76 |
161,962 | argoproj/argo-cd | util/diff/diff.go | ThreeWayDiff | func ThreeWayDiff(orig, config, live *unstructured.Unstructured) (*DiffResult, error) {
orig = removeNamespaceAnnotation(orig)
config = removeNamespaceAnnotation(config)
// Remove defaulted fields from the live object.
// This subtracts any extra fields in the live object which are not present in last-applied-configuration.
// This is needed to perform a fair comparison when we send the objects to gojsondiff
live = &unstructured.Unstructured{Object: jsonutil.RemoveMapFields(orig.Object, live.Object)}
// 1. calculate a 3-way merge patch
patchBytes, err := threeWayMergePatch(orig, config, live)
if err != nil {
return nil, err
}
// 2. apply the patch against the live object
liveBytes, err := json.Marshal(live)
if err != nil {
return nil, err
}
versionedObject, err := scheme.Scheme.New(orig.GroupVersionKind())
if err != nil {
return nil, err
}
patchedLiveBytes, err := strategicpatch.StrategicMergePatch(liveBytes, patchBytes, versionedObject)
if err != nil {
return nil, err
}
var patchedLive unstructured.Unstructured
err = json.Unmarshal(patchedLiveBytes, &patchedLive)
if err != nil {
return nil, err
}
// 3. diff the live object vs. the patched live object
gjDiff := gojsondiff.New().CompareObjects(live.Object, patchedLive.Object)
dr := DiffResult{
Diff: gjDiff,
Modified: gjDiff.Modified(),
}
return &dr, nil
} | go | func ThreeWayDiff(orig, config, live *unstructured.Unstructured) (*DiffResult, error) {
orig = removeNamespaceAnnotation(orig)
config = removeNamespaceAnnotation(config)
// Remove defaulted fields from the live object.
// This subtracts any extra fields in the live object which are not present in last-applied-configuration.
// This is needed to perform a fair comparison when we send the objects to gojsondiff
live = &unstructured.Unstructured{Object: jsonutil.RemoveMapFields(orig.Object, live.Object)}
// 1. calculate a 3-way merge patch
patchBytes, err := threeWayMergePatch(orig, config, live)
if err != nil {
return nil, err
}
// 2. apply the patch against the live object
liveBytes, err := json.Marshal(live)
if err != nil {
return nil, err
}
versionedObject, err := scheme.Scheme.New(orig.GroupVersionKind())
if err != nil {
return nil, err
}
patchedLiveBytes, err := strategicpatch.StrategicMergePatch(liveBytes, patchBytes, versionedObject)
if err != nil {
return nil, err
}
var patchedLive unstructured.Unstructured
err = json.Unmarshal(patchedLiveBytes, &patchedLive)
if err != nil {
return nil, err
}
// 3. diff the live object vs. the patched live object
gjDiff := gojsondiff.New().CompareObjects(live.Object, patchedLive.Object)
dr := DiffResult{
Diff: gjDiff,
Modified: gjDiff.Modified(),
}
return &dr, nil
} | [
"func",
"ThreeWayDiff",
"(",
"orig",
",",
"config",
",",
"live",
"*",
"unstructured",
".",
"Unstructured",
")",
"(",
"*",
"DiffResult",
",",
"error",
")",
"{",
"orig",
"=",
"removeNamespaceAnnotation",
"(",
"orig",
")",
"\n",
"config",
"=",
"removeNamespaceAnnotation",
"(",
"config",
")",
"\n",
"// Remove defaulted fields from the live object.",
"// This subtracts any extra fields in the live object which are not present in last-applied-configuration.",
"// This is needed to perform a fair comparison when we send the objects to gojsondiff",
"live",
"=",
"&",
"unstructured",
".",
"Unstructured",
"{",
"Object",
":",
"jsonutil",
".",
"RemoveMapFields",
"(",
"orig",
".",
"Object",
",",
"live",
".",
"Object",
")",
"}",
"\n\n",
"// 1. calculate a 3-way merge patch",
"patchBytes",
",",
"err",
":=",
"threeWayMergePatch",
"(",
"orig",
",",
"config",
",",
"live",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// 2. apply the patch against the live object",
"liveBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"live",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"versionedObject",
",",
"err",
":=",
"scheme",
".",
"Scheme",
".",
"New",
"(",
"orig",
".",
"GroupVersionKind",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"patchedLiveBytes",
",",
"err",
":=",
"strategicpatch",
".",
"StrategicMergePatch",
"(",
"liveBytes",
",",
"patchBytes",
",",
"versionedObject",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"patchedLive",
"unstructured",
".",
"Unstructured",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"patchedLiveBytes",
",",
"&",
"patchedLive",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// 3. diff the live object vs. the patched live object",
"gjDiff",
":=",
"gojsondiff",
".",
"New",
"(",
")",
".",
"CompareObjects",
"(",
"live",
".",
"Object",
",",
"patchedLive",
".",
"Object",
")",
"\n",
"dr",
":=",
"DiffResult",
"{",
"Diff",
":",
"gjDiff",
",",
"Modified",
":",
"gjDiff",
".",
"Modified",
"(",
")",
",",
"}",
"\n",
"return",
"&",
"dr",
",",
"nil",
"\n",
"}"
] | // ThreeWayDiff performs a diff with the understanding of how to incorporate the
// last-applied-configuration annotation in the diff.
// Inputs are assumed to be stripped of type information | [
"ThreeWayDiff",
"performs",
"a",
"diff",
"with",
"the",
"understanding",
"of",
"how",
"to",
"incorporate",
"the",
"last",
"-",
"applied",
"-",
"configuration",
"annotation",
"in",
"the",
"diff",
".",
"Inputs",
"are",
"assumed",
"to",
"be",
"stripped",
"of",
"type",
"information"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L81-L121 |
161,963 | argoproj/argo-cd | util/diff/diff.go | DiffArray | func DiffArray(configArray, liveArray []*unstructured.Unstructured, normalizer Normalizer) (*DiffResultList, error) {
numItems := len(configArray)
if len(liveArray) != numItems {
return nil, fmt.Errorf("left and right arrays have mismatched lengths")
}
diffResultList := DiffResultList{
Diffs: make([]DiffResult, numItems),
}
for i := 0; i < numItems; i++ {
config := configArray[i]
live := liveArray[i]
diffRes := Diff(config, live, normalizer)
diffResultList.Diffs[i] = *diffRes
if diffRes.Modified {
diffResultList.Modified = true
}
}
return &diffResultList, nil
} | go | func DiffArray(configArray, liveArray []*unstructured.Unstructured, normalizer Normalizer) (*DiffResultList, error) {
numItems := len(configArray)
if len(liveArray) != numItems {
return nil, fmt.Errorf("left and right arrays have mismatched lengths")
}
diffResultList := DiffResultList{
Diffs: make([]DiffResult, numItems),
}
for i := 0; i < numItems; i++ {
config := configArray[i]
live := liveArray[i]
diffRes := Diff(config, live, normalizer)
diffResultList.Diffs[i] = *diffRes
if diffRes.Modified {
diffResultList.Modified = true
}
}
return &diffResultList, nil
} | [
"func",
"DiffArray",
"(",
"configArray",
",",
"liveArray",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
",",
"normalizer",
"Normalizer",
")",
"(",
"*",
"DiffResultList",
",",
"error",
")",
"{",
"numItems",
":=",
"len",
"(",
"configArray",
")",
"\n",
"if",
"len",
"(",
"liveArray",
")",
"!=",
"numItems",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"diffResultList",
":=",
"DiffResultList",
"{",
"Diffs",
":",
"make",
"(",
"[",
"]",
"DiffResult",
",",
"numItems",
")",
",",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"numItems",
";",
"i",
"++",
"{",
"config",
":=",
"configArray",
"[",
"i",
"]",
"\n",
"live",
":=",
"liveArray",
"[",
"i",
"]",
"\n",
"diffRes",
":=",
"Diff",
"(",
"config",
",",
"live",
",",
"normalizer",
")",
"\n",
"diffResultList",
".",
"Diffs",
"[",
"i",
"]",
"=",
"*",
"diffRes",
"\n",
"if",
"diffRes",
".",
"Modified",
"{",
"diffResultList",
".",
"Modified",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"diffResultList",
",",
"nil",
"\n",
"}"
] | // DiffArray performs a diff on a list of unstructured objects. Objects are expected to match
// environments | [
"DiffArray",
"performs",
"a",
"diff",
"on",
"a",
"list",
"of",
"unstructured",
"objects",
".",
"Objects",
"are",
"expected",
"to",
"match",
"environments"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L214-L233 |
161,964 | argoproj/argo-cd | util/diff/diff.go | ASCIIFormat | func (d *DiffResult) ASCIIFormat(left *unstructured.Unstructured, formatOpts formatter.AsciiFormatterConfig) (string, error) {
if !d.Diff.Modified() {
return "", nil
}
if left == nil {
return "", errors.New("Supplied nil left object")
}
asciiFmt := formatter.NewAsciiFormatter(left.Object, formatOpts)
return asciiFmt.Format(d.Diff)
} | go | func (d *DiffResult) ASCIIFormat(left *unstructured.Unstructured, formatOpts formatter.AsciiFormatterConfig) (string, error) {
if !d.Diff.Modified() {
return "", nil
}
if left == nil {
return "", errors.New("Supplied nil left object")
}
asciiFmt := formatter.NewAsciiFormatter(left.Object, formatOpts)
return asciiFmt.Format(d.Diff)
} | [
"func",
"(",
"d",
"*",
"DiffResult",
")",
"ASCIIFormat",
"(",
"left",
"*",
"unstructured",
".",
"Unstructured",
",",
"formatOpts",
"formatter",
".",
"AsciiFormatterConfig",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"!",
"d",
".",
"Diff",
".",
"Modified",
"(",
")",
"{",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"if",
"left",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"asciiFmt",
":=",
"formatter",
".",
"NewAsciiFormatter",
"(",
"left",
".",
"Object",
",",
"formatOpts",
")",
"\n",
"return",
"asciiFmt",
".",
"Format",
"(",
"d",
".",
"Diff",
")",
"\n",
"}"
] | // ASCIIFormat returns the ASCII format of the diff | [
"ASCIIFormat",
"returns",
"the",
"ASCII",
"format",
"of",
"the",
"diff"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L236-L245 |
161,965 | argoproj/argo-cd | util/diff/diff.go | NormalizeSecret | func NormalizeSecret(un *unstructured.Unstructured) {
if un == nil {
return
}
gvk := un.GroupVersionKind()
if gvk.Group != "" || gvk.Kind != "Secret" {
return
}
var secret corev1.Secret
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &secret)
if err != nil {
return
}
// We normalize nils to empty string to handle: https://github.com/argoproj/argo-cd/issues/943
for k, v := range secret.Data {
if len(v) == 0 {
secret.Data[k] = []byte("")
}
}
if len(secret.StringData) > 0 {
if secret.Data == nil {
secret.Data = make(map[string][]byte)
}
for k, v := range secret.StringData {
secret.Data[k] = []byte(v)
}
delete(un.Object, "stringData")
}
newObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&secret)
if err != nil {
log.Warnf("object unable to convert from secret: %v", err)
return
}
if secret.Data != nil {
err = unstructured.SetNestedField(un.Object, newObj["data"], "data")
if err != nil {
log.Warnf("failed to set secret.data: %v", err)
return
}
}
} | go | func NormalizeSecret(un *unstructured.Unstructured) {
if un == nil {
return
}
gvk := un.GroupVersionKind()
if gvk.Group != "" || gvk.Kind != "Secret" {
return
}
var secret corev1.Secret
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &secret)
if err != nil {
return
}
// We normalize nils to empty string to handle: https://github.com/argoproj/argo-cd/issues/943
for k, v := range secret.Data {
if len(v) == 0 {
secret.Data[k] = []byte("")
}
}
if len(secret.StringData) > 0 {
if secret.Data == nil {
secret.Data = make(map[string][]byte)
}
for k, v := range secret.StringData {
secret.Data[k] = []byte(v)
}
delete(un.Object, "stringData")
}
newObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&secret)
if err != nil {
log.Warnf("object unable to convert from secret: %v", err)
return
}
if secret.Data != nil {
err = unstructured.SetNestedField(un.Object, newObj["data"], "data")
if err != nil {
log.Warnf("failed to set secret.data: %v", err)
return
}
}
} | [
"func",
"NormalizeSecret",
"(",
"un",
"*",
"unstructured",
".",
"Unstructured",
")",
"{",
"if",
"un",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"gvk",
":=",
"un",
".",
"GroupVersionKind",
"(",
")",
"\n",
"if",
"gvk",
".",
"Group",
"!=",
"\"",
"\"",
"||",
"gvk",
".",
"Kind",
"!=",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n",
"var",
"secret",
"corev1",
".",
"Secret",
"\n",
"err",
":=",
"runtime",
".",
"DefaultUnstructuredConverter",
".",
"FromUnstructured",
"(",
"un",
".",
"Object",
",",
"&",
"secret",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"// We normalize nils to empty string to handle: https://github.com/argoproj/argo-cd/issues/943",
"for",
"k",
",",
"v",
":=",
"range",
"secret",
".",
"Data",
"{",
"if",
"len",
"(",
"v",
")",
"==",
"0",
"{",
"secret",
".",
"Data",
"[",
"k",
"]",
"=",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"secret",
".",
"StringData",
")",
">",
"0",
"{",
"if",
"secret",
".",
"Data",
"==",
"nil",
"{",
"secret",
".",
"Data",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
")",
"\n",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"secret",
".",
"StringData",
"{",
"secret",
".",
"Data",
"[",
"k",
"]",
"=",
"[",
"]",
"byte",
"(",
"v",
")",
"\n",
"}",
"\n",
"delete",
"(",
"un",
".",
"Object",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"newObj",
",",
"err",
":=",
"runtime",
".",
"DefaultUnstructuredConverter",
".",
"ToUnstructured",
"(",
"&",
"secret",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"secret",
".",
"Data",
"!=",
"nil",
"{",
"err",
"=",
"unstructured",
".",
"SetNestedField",
"(",
"un",
".",
"Object",
",",
"newObj",
"[",
"\"",
"\"",
"]",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] | // NormalizeSecret mutates the supplied object and encodes stringData to data, and converts nils to
// empty strings. If the object is not a secret, or is an invalid secret, then returns the same object. | [
"NormalizeSecret",
"mutates",
"the",
"supplied",
"object",
"and",
"encodes",
"stringData",
"to",
"data",
"and",
"converts",
"nils",
"to",
"empty",
"strings",
".",
"If",
"the",
"object",
"is",
"not",
"a",
"secret",
"or",
"is",
"an",
"invalid",
"secret",
"then",
"returns",
"the",
"same",
"object",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L272-L312 |
161,966 | argoproj/argo-cd | util/diff/diff.go | JSONFormat | func (d *DiffResult) JSONFormat() (string, error) {
if !d.Diff.Modified() {
return "", nil
}
jsonFmt := formatter.NewDeltaFormatter()
return jsonFmt.Format(d.Diff)
} | go | func (d *DiffResult) JSONFormat() (string, error) {
if !d.Diff.Modified() {
return "", nil
}
jsonFmt := formatter.NewDeltaFormatter()
return jsonFmt.Format(d.Diff)
} | [
"func",
"(",
"d",
"*",
"DiffResult",
")",
"JSONFormat",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"!",
"d",
".",
"Diff",
".",
"Modified",
"(",
")",
"{",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"jsonFmt",
":=",
"formatter",
".",
"NewDeltaFormatter",
"(",
")",
"\n",
"return",
"jsonFmt",
".",
"Format",
"(",
"d",
".",
"Diff",
")",
"\n",
"}"
] | // JSONFormat returns the diff as a JSON string | [
"JSONFormat",
"returns",
"the",
"diff",
"as",
"a",
"JSON",
"string"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L337-L343 |
161,967 | argoproj/argo-cd | util/diff/diff.go | HideSecretData | func HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstructured) (*unstructured.Unstructured, *unstructured.Unstructured, error) {
var orig *unstructured.Unstructured
if live != nil {
orig = GetLastAppliedConfigAnnotation(live)
live = live.DeepCopy()
}
if target != nil {
target = target.DeepCopy()
}
keys := map[string]bool{}
for _, obj := range []*unstructured.Unstructured{target, live, orig} {
if obj == nil {
continue
}
NormalizeSecret(obj)
if data, found, err := unstructured.NestedMap(obj.Object, "data"); found && err == nil {
for k := range data {
keys[k] = true
}
}
}
for k := range keys {
nextReplacement := "*********"
valToReplacement := make(map[string]string)
for _, obj := range []*unstructured.Unstructured{target, live, orig} {
var data map[string]interface{}
if obj != nil {
var err error
data, _, err = unstructured.NestedMap(obj.Object, "data")
if err != nil {
return nil, nil, err
}
}
if data == nil {
data = make(map[string]interface{})
}
valData, ok := data[k]
if !ok {
continue
}
val := toString(valData)
replacement, ok := valToReplacement[val]
if !ok {
replacement = nextReplacement
nextReplacement = nextReplacement + "*"
valToReplacement[val] = replacement
}
data[k] = replacement
err := unstructured.SetNestedField(obj.Object, data, "data")
if err != nil {
return nil, nil, err
}
}
}
if live != nil && orig != nil {
annotations := live.GetAnnotations()
if annotations == nil {
annotations = make(map[string]string)
}
lastAppliedData, err := json.Marshal(orig)
if err != nil {
return nil, nil, err
}
annotations[core.LastAppliedConfigAnnotation] = string(lastAppliedData)
live.SetAnnotations(annotations)
}
return target, live, nil
} | go | func HideSecretData(target *unstructured.Unstructured, live *unstructured.Unstructured) (*unstructured.Unstructured, *unstructured.Unstructured, error) {
var orig *unstructured.Unstructured
if live != nil {
orig = GetLastAppliedConfigAnnotation(live)
live = live.DeepCopy()
}
if target != nil {
target = target.DeepCopy()
}
keys := map[string]bool{}
for _, obj := range []*unstructured.Unstructured{target, live, orig} {
if obj == nil {
continue
}
NormalizeSecret(obj)
if data, found, err := unstructured.NestedMap(obj.Object, "data"); found && err == nil {
for k := range data {
keys[k] = true
}
}
}
for k := range keys {
nextReplacement := "*********"
valToReplacement := make(map[string]string)
for _, obj := range []*unstructured.Unstructured{target, live, orig} {
var data map[string]interface{}
if obj != nil {
var err error
data, _, err = unstructured.NestedMap(obj.Object, "data")
if err != nil {
return nil, nil, err
}
}
if data == nil {
data = make(map[string]interface{})
}
valData, ok := data[k]
if !ok {
continue
}
val := toString(valData)
replacement, ok := valToReplacement[val]
if !ok {
replacement = nextReplacement
nextReplacement = nextReplacement + "*"
valToReplacement[val] = replacement
}
data[k] = replacement
err := unstructured.SetNestedField(obj.Object, data, "data")
if err != nil {
return nil, nil, err
}
}
}
if live != nil && orig != nil {
annotations := live.GetAnnotations()
if annotations == nil {
annotations = make(map[string]string)
}
lastAppliedData, err := json.Marshal(orig)
if err != nil {
return nil, nil, err
}
annotations[core.LastAppliedConfigAnnotation] = string(lastAppliedData)
live.SetAnnotations(annotations)
}
return target, live, nil
} | [
"func",
"HideSecretData",
"(",
"target",
"*",
"unstructured",
".",
"Unstructured",
",",
"live",
"*",
"unstructured",
".",
"Unstructured",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
",",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"var",
"orig",
"*",
"unstructured",
".",
"Unstructured",
"\n",
"if",
"live",
"!=",
"nil",
"{",
"orig",
"=",
"GetLastAppliedConfigAnnotation",
"(",
"live",
")",
"\n",
"live",
"=",
"live",
".",
"DeepCopy",
"(",
")",
"\n",
"}",
"\n",
"if",
"target",
"!=",
"nil",
"{",
"target",
"=",
"target",
".",
"DeepCopy",
"(",
")",
"\n",
"}",
"\n\n",
"keys",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"obj",
":=",
"range",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
"{",
"target",
",",
"live",
",",
"orig",
"}",
"{",
"if",
"obj",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"NormalizeSecret",
"(",
"obj",
")",
"\n",
"if",
"data",
",",
"found",
",",
"err",
":=",
"unstructured",
".",
"NestedMap",
"(",
"obj",
".",
"Object",
",",
"\"",
"\"",
")",
";",
"found",
"&&",
"err",
"==",
"nil",
"{",
"for",
"k",
":=",
"range",
"data",
"{",
"keys",
"[",
"k",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"k",
":=",
"range",
"keys",
"{",
"nextReplacement",
":=",
"\"",
"\"",
"\n",
"valToReplacement",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"obj",
":=",
"range",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
"{",
"target",
",",
"live",
",",
"orig",
"}",
"{",
"var",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"if",
"obj",
"!=",
"nil",
"{",
"var",
"err",
"error",
"\n",
"data",
",",
"_",
",",
"err",
"=",
"unstructured",
".",
"NestedMap",
"(",
"obj",
".",
"Object",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"data",
"==",
"nil",
"{",
"data",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"valData",
",",
"ok",
":=",
"data",
"[",
"k",
"]",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"val",
":=",
"toString",
"(",
"valData",
")",
"\n",
"replacement",
",",
"ok",
":=",
"valToReplacement",
"[",
"val",
"]",
"\n",
"if",
"!",
"ok",
"{",
"replacement",
"=",
"nextReplacement",
"\n",
"nextReplacement",
"=",
"nextReplacement",
"+",
"\"",
"\"",
"\n",
"valToReplacement",
"[",
"val",
"]",
"=",
"replacement",
"\n",
"}",
"\n",
"data",
"[",
"k",
"]",
"=",
"replacement",
"\n",
"err",
":=",
"unstructured",
".",
"SetNestedField",
"(",
"obj",
".",
"Object",
",",
"data",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"live",
"!=",
"nil",
"&&",
"orig",
"!=",
"nil",
"{",
"annotations",
":=",
"live",
".",
"GetAnnotations",
"(",
")",
"\n",
"if",
"annotations",
"==",
"nil",
"{",
"annotations",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"lastAppliedData",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"orig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"annotations",
"[",
"core",
".",
"LastAppliedConfigAnnotation",
"]",
"=",
"string",
"(",
"lastAppliedData",
")",
"\n",
"live",
".",
"SetAnnotations",
"(",
"annotations",
")",
"\n",
"}",
"\n",
"return",
"target",
",",
"live",
",",
"nil",
"\n",
"}"
] | // HideSecretData replaces secret data values in specified target, live secrets and in last applied configuration of live secret with stars. Also preserves differences between
// target, live and last applied config values. E.g. if all three are equal the values would be replaced with same number of stars. If all the are different then number of stars
// in replacement should be different. | [
"HideSecretData",
"replaces",
"secret",
"data",
"values",
"in",
"specified",
"target",
"live",
"secrets",
"and",
"in",
"last",
"applied",
"configuration",
"of",
"live",
"secret",
"with",
"stars",
".",
"Also",
"preserves",
"differences",
"between",
"target",
"live",
"and",
"last",
"applied",
"config",
"values",
".",
"E",
".",
"g",
".",
"if",
"all",
"three",
"are",
"equal",
"the",
"values",
"would",
"be",
"replaced",
"with",
"same",
"number",
"of",
"stars",
".",
"If",
"all",
"the",
"are",
"different",
"then",
"number",
"of",
"stars",
"in",
"replacement",
"should",
"be",
"different",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/diff/diff.go#L365-L434 |
161,968 | argoproj/argo-cd | util/health/health.go | SetApplicationHealth | func SetApplicationHealth(resStatuses []appv1.ResourceStatus, liveObjs []*unstructured.Unstructured, resourceOverrides map[string]appv1.ResourceOverride, filter func(obj *unstructured.Unstructured) bool) (*appv1.HealthStatus, error) {
var savedErr error
appHealth := appv1.HealthStatus{Status: appv1.HealthStatusHealthy}
for i, liveObj := range liveObjs {
var resHealth *appv1.HealthStatus
var err error
if liveObj == nil {
resHealth = &appv1.HealthStatus{Status: appv1.HealthStatusMissing}
} else {
if filter(liveObj) {
resHealth, err = GetResourceHealth(liveObj, resourceOverrides)
if err != nil && savedErr == nil {
savedErr = err
}
}
}
if resHealth != nil {
resStatuses[i].Health = resHealth
// Don't allow resource hooks to affect health status
isHook := liveObj != nil && hookutil.IsHook(liveObj)
if !isHook && IsWorse(appHealth.Status, resHealth.Status) {
appHealth.Status = resHealth.Status
}
}
}
return &appHealth, savedErr
} | go | func SetApplicationHealth(resStatuses []appv1.ResourceStatus, liveObjs []*unstructured.Unstructured, resourceOverrides map[string]appv1.ResourceOverride, filter func(obj *unstructured.Unstructured) bool) (*appv1.HealthStatus, error) {
var savedErr error
appHealth := appv1.HealthStatus{Status: appv1.HealthStatusHealthy}
for i, liveObj := range liveObjs {
var resHealth *appv1.HealthStatus
var err error
if liveObj == nil {
resHealth = &appv1.HealthStatus{Status: appv1.HealthStatusMissing}
} else {
if filter(liveObj) {
resHealth, err = GetResourceHealth(liveObj, resourceOverrides)
if err != nil && savedErr == nil {
savedErr = err
}
}
}
if resHealth != nil {
resStatuses[i].Health = resHealth
// Don't allow resource hooks to affect health status
isHook := liveObj != nil && hookutil.IsHook(liveObj)
if !isHook && IsWorse(appHealth.Status, resHealth.Status) {
appHealth.Status = resHealth.Status
}
}
}
return &appHealth, savedErr
} | [
"func",
"SetApplicationHealth",
"(",
"resStatuses",
"[",
"]",
"appv1",
".",
"ResourceStatus",
",",
"liveObjs",
"[",
"]",
"*",
"unstructured",
".",
"Unstructured",
",",
"resourceOverrides",
"map",
"[",
"string",
"]",
"appv1",
".",
"ResourceOverride",
",",
"filter",
"func",
"(",
"obj",
"*",
"unstructured",
".",
"Unstructured",
")",
"bool",
")",
"(",
"*",
"appv1",
".",
"HealthStatus",
",",
"error",
")",
"{",
"var",
"savedErr",
"error",
"\n",
"appHealth",
":=",
"appv1",
".",
"HealthStatus",
"{",
"Status",
":",
"appv1",
".",
"HealthStatusHealthy",
"}",
"\n",
"for",
"i",
",",
"liveObj",
":=",
"range",
"liveObjs",
"{",
"var",
"resHealth",
"*",
"appv1",
".",
"HealthStatus",
"\n",
"var",
"err",
"error",
"\n",
"if",
"liveObj",
"==",
"nil",
"{",
"resHealth",
"=",
"&",
"appv1",
".",
"HealthStatus",
"{",
"Status",
":",
"appv1",
".",
"HealthStatusMissing",
"}",
"\n",
"}",
"else",
"{",
"if",
"filter",
"(",
"liveObj",
")",
"{",
"resHealth",
",",
"err",
"=",
"GetResourceHealth",
"(",
"liveObj",
",",
"resourceOverrides",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"savedErr",
"==",
"nil",
"{",
"savedErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"resHealth",
"!=",
"nil",
"{",
"resStatuses",
"[",
"i",
"]",
".",
"Health",
"=",
"resHealth",
"\n",
"// Don't allow resource hooks to affect health status",
"isHook",
":=",
"liveObj",
"!=",
"nil",
"&&",
"hookutil",
".",
"IsHook",
"(",
"liveObj",
")",
"\n",
"if",
"!",
"isHook",
"&&",
"IsWorse",
"(",
"appHealth",
".",
"Status",
",",
"resHealth",
".",
"Status",
")",
"{",
"appHealth",
".",
"Status",
"=",
"resHealth",
".",
"Status",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"appHealth",
",",
"savedErr",
"\n",
"}"
] | // SetApplicationHealth updates the health statuses of all resources performed in the comparison | [
"SetApplicationHealth",
"updates",
"the",
"health",
"statuses",
"of",
"all",
"resources",
"performed",
"in",
"the",
"comparison"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/health/health.go#L24-L50 |
161,969 | argoproj/argo-cd | util/health/health.go | GetResourceHealth | func GetResourceHealth(obj *unstructured.Unstructured, resourceOverrides map[string]appv1.ResourceOverride) (*appv1.HealthStatus, error) {
if obj.GetDeletionTimestamp() != nil {
return &appv1.HealthStatus{
Status: appv1.HealthStatusProgressing,
Message: "Pending deletion",
}, nil
}
health, err := getResourceHealthFromLuaScript(obj, resourceOverrides)
if err != nil {
health = &appv1.HealthStatus{
Status: appv1.HealthStatusUnknown,
Message: err.Error(),
}
return health, err
}
if health != nil {
return health, nil
}
gvk := obj.GroupVersionKind()
switch gvk.Group {
case "apps", "extensions":
switch gvk.Kind {
case kube.DeploymentKind:
health, err = getDeploymentHealth(obj)
case kube.IngressKind:
health, err = getIngressHealth(obj)
case kube.StatefulSetKind:
health, err = getStatefulSetHealth(obj)
case kube.ReplicaSetKind:
health, err = getReplicaSetHealth(obj)
case kube.DaemonSetKind:
health, err = getDaemonSetHealth(obj)
}
case "argoproj.io":
switch gvk.Kind {
case "Application":
health, err = getApplicationHealth(obj)
}
case "":
switch gvk.Kind {
case kube.ServiceKind:
health, err = getServiceHealth(obj)
case kube.PersistentVolumeClaimKind:
health, err = getPVCHealth(obj)
case kube.PodKind:
health, err = getPodHealth(obj)
}
case "batch":
switch gvk.Kind {
case kube.JobKind:
health, err = getJobHealth(obj)
}
}
if err != nil {
health = &appv1.HealthStatus{
Status: appv1.HealthStatusUnknown,
Message: err.Error(),
}
}
return health, err
} | go | func GetResourceHealth(obj *unstructured.Unstructured, resourceOverrides map[string]appv1.ResourceOverride) (*appv1.HealthStatus, error) {
if obj.GetDeletionTimestamp() != nil {
return &appv1.HealthStatus{
Status: appv1.HealthStatusProgressing,
Message: "Pending deletion",
}, nil
}
health, err := getResourceHealthFromLuaScript(obj, resourceOverrides)
if err != nil {
health = &appv1.HealthStatus{
Status: appv1.HealthStatusUnknown,
Message: err.Error(),
}
return health, err
}
if health != nil {
return health, nil
}
gvk := obj.GroupVersionKind()
switch gvk.Group {
case "apps", "extensions":
switch gvk.Kind {
case kube.DeploymentKind:
health, err = getDeploymentHealth(obj)
case kube.IngressKind:
health, err = getIngressHealth(obj)
case kube.StatefulSetKind:
health, err = getStatefulSetHealth(obj)
case kube.ReplicaSetKind:
health, err = getReplicaSetHealth(obj)
case kube.DaemonSetKind:
health, err = getDaemonSetHealth(obj)
}
case "argoproj.io":
switch gvk.Kind {
case "Application":
health, err = getApplicationHealth(obj)
}
case "":
switch gvk.Kind {
case kube.ServiceKind:
health, err = getServiceHealth(obj)
case kube.PersistentVolumeClaimKind:
health, err = getPVCHealth(obj)
case kube.PodKind:
health, err = getPodHealth(obj)
}
case "batch":
switch gvk.Kind {
case kube.JobKind:
health, err = getJobHealth(obj)
}
}
if err != nil {
health = &appv1.HealthStatus{
Status: appv1.HealthStatusUnknown,
Message: err.Error(),
}
}
return health, err
} | [
"func",
"GetResourceHealth",
"(",
"obj",
"*",
"unstructured",
".",
"Unstructured",
",",
"resourceOverrides",
"map",
"[",
"string",
"]",
"appv1",
".",
"ResourceOverride",
")",
"(",
"*",
"appv1",
".",
"HealthStatus",
",",
"error",
")",
"{",
"if",
"obj",
".",
"GetDeletionTimestamp",
"(",
")",
"!=",
"nil",
"{",
"return",
"&",
"appv1",
".",
"HealthStatus",
"{",
"Status",
":",
"appv1",
".",
"HealthStatusProgressing",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"health",
",",
"err",
":=",
"getResourceHealthFromLuaScript",
"(",
"obj",
",",
"resourceOverrides",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"health",
"=",
"&",
"appv1",
".",
"HealthStatus",
"{",
"Status",
":",
"appv1",
".",
"HealthStatusUnknown",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"return",
"health",
",",
"err",
"\n",
"}",
"\n",
"if",
"health",
"!=",
"nil",
"{",
"return",
"health",
",",
"nil",
"\n",
"}",
"\n\n",
"gvk",
":=",
"obj",
".",
"GroupVersionKind",
"(",
")",
"\n",
"switch",
"gvk",
".",
"Group",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"switch",
"gvk",
".",
"Kind",
"{",
"case",
"kube",
".",
"DeploymentKind",
":",
"health",
",",
"err",
"=",
"getDeploymentHealth",
"(",
"obj",
")",
"\n",
"case",
"kube",
".",
"IngressKind",
":",
"health",
",",
"err",
"=",
"getIngressHealth",
"(",
"obj",
")",
"\n",
"case",
"kube",
".",
"StatefulSetKind",
":",
"health",
",",
"err",
"=",
"getStatefulSetHealth",
"(",
"obj",
")",
"\n",
"case",
"kube",
".",
"ReplicaSetKind",
":",
"health",
",",
"err",
"=",
"getReplicaSetHealth",
"(",
"obj",
")",
"\n",
"case",
"kube",
".",
"DaemonSetKind",
":",
"health",
",",
"err",
"=",
"getDaemonSetHealth",
"(",
"obj",
")",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"switch",
"gvk",
".",
"Kind",
"{",
"case",
"\"",
"\"",
":",
"health",
",",
"err",
"=",
"getApplicationHealth",
"(",
"obj",
")",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"switch",
"gvk",
".",
"Kind",
"{",
"case",
"kube",
".",
"ServiceKind",
":",
"health",
",",
"err",
"=",
"getServiceHealth",
"(",
"obj",
")",
"\n",
"case",
"kube",
".",
"PersistentVolumeClaimKind",
":",
"health",
",",
"err",
"=",
"getPVCHealth",
"(",
"obj",
")",
"\n",
"case",
"kube",
".",
"PodKind",
":",
"health",
",",
"err",
"=",
"getPodHealth",
"(",
"obj",
")",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"switch",
"gvk",
".",
"Kind",
"{",
"case",
"kube",
".",
"JobKind",
":",
"health",
",",
"err",
"=",
"getJobHealth",
"(",
"obj",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"health",
"=",
"&",
"appv1",
".",
"HealthStatus",
"{",
"Status",
":",
"appv1",
".",
"HealthStatusUnknown",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"health",
",",
"err",
"\n",
"}"
] | // GetResourceHealth returns the health of a k8s resource | [
"GetResourceHealth",
"returns",
"the",
"health",
"of",
"a",
"k8s",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/health/health.go#L53-L116 |
161,970 | argoproj/argo-cd | util/health/health.go | IsWorse | func IsWorse(current, new appv1.HealthStatusCode) bool {
currentIndex := 0
newIndex := 0
for i, code := range healthOrder {
if current == code {
currentIndex = i
}
if new == code {
newIndex = i
}
}
return newIndex > currentIndex
} | go | func IsWorse(current, new appv1.HealthStatusCode) bool {
currentIndex := 0
newIndex := 0
for i, code := range healthOrder {
if current == code {
currentIndex = i
}
if new == code {
newIndex = i
}
}
return newIndex > currentIndex
} | [
"func",
"IsWorse",
"(",
"current",
",",
"new",
"appv1",
".",
"HealthStatusCode",
")",
"bool",
"{",
"currentIndex",
":=",
"0",
"\n",
"newIndex",
":=",
"0",
"\n",
"for",
"i",
",",
"code",
":=",
"range",
"healthOrder",
"{",
"if",
"current",
"==",
"code",
"{",
"currentIndex",
"=",
"i",
"\n",
"}",
"\n",
"if",
"new",
"==",
"code",
"{",
"newIndex",
"=",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"newIndex",
">",
"currentIndex",
"\n",
"}"
] | // IsWorse returns whether or not the new health status code is a worser condition than the current | [
"IsWorse",
"returns",
"whether",
"or",
"not",
"the",
"new",
"health",
"status",
"code",
"is",
"a",
"worser",
"condition",
"than",
"the",
"current"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/health/health.go#L129-L141 |
161,971 | argoproj/argo-cd | util/healthz/healthz.go | ServeHealthCheck | func ServeHealthCheck(mux *http.ServeMux, f func() error) {
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
if err := f(); err != nil {
w.WriteHeader(http.StatusServiceUnavailable)
log.Errorln(w, err)
} else {
fmt.Fprintln(w, "ok")
}
})
} | go | func ServeHealthCheck(mux *http.ServeMux, f func() error) {
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
if err := f(); err != nil {
w.WriteHeader(http.StatusServiceUnavailable)
log.Errorln(w, err)
} else {
fmt.Fprintln(w, "ok")
}
})
} | [
"func",
"ServeHealthCheck",
"(",
"mux",
"*",
"http",
".",
"ServeMux",
",",
"f",
"func",
"(",
")",
"error",
")",
"{",
"mux",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"err",
":=",
"f",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"log",
".",
"Errorln",
"(",
"w",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintln",
"(",
"w",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
] | // ServeHealthCheck serves the health check endpoint.
// ServeHealthCheck relies on the provided function to return an error if unhealthy and nil otherwise. | [
"ServeHealthCheck",
"serves",
"the",
"health",
"check",
"endpoint",
".",
"ServeHealthCheck",
"relies",
"on",
"the",
"provided",
"function",
"to",
"return",
"an",
"error",
"if",
"unhealthy",
"and",
"nil",
"otherwise",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/healthz/healthz.go#L12-L21 |
161,972 | argoproj/argo-cd | reposerver/server.go | NewServer | func NewServer(gitFactory git.ClientFactory, cache *cache.Cache, tlsConfCustomizer tlsutil.ConfigCustomizer, parallelismLimit int64) (*ArgoCDRepoServer, error) {
// generate TLS cert
hosts := []string{
"localhost",
"argocd-repo-server",
}
cert, err := tlsutil.GenerateX509KeyPair(tlsutil.CertOptions{
Hosts: hosts,
Organization: "Argo CD",
IsCA: true,
})
if err != nil {
return nil, err
}
tlsConfig := &tls.Config{Certificates: []tls.Certificate{*cert}}
tlsConfCustomizer(tlsConfig)
serverLog := log.NewEntry(log.StandardLogger())
streamInterceptors := []grpc.StreamServerInterceptor{grpc_logrus.StreamServerInterceptor(serverLog), grpc_util.PanicLoggerStreamServerInterceptor(serverLog)}
unaryInterceptors := []grpc.UnaryServerInterceptor{grpc_logrus.UnaryServerInterceptor(serverLog), grpc_util.PanicLoggerUnaryServerInterceptor(serverLog)}
return &ArgoCDRepoServer{
log: serverLog,
gitFactory: gitFactory,
cache: cache,
parallelismLimit: parallelismLimit,
opts: []grpc.ServerOption{
grpc.Creds(credentials.NewTLS(tlsConfig)),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryInterceptors...)),
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(streamInterceptors...)),
},
}, nil
} | go | func NewServer(gitFactory git.ClientFactory, cache *cache.Cache, tlsConfCustomizer tlsutil.ConfigCustomizer, parallelismLimit int64) (*ArgoCDRepoServer, error) {
// generate TLS cert
hosts := []string{
"localhost",
"argocd-repo-server",
}
cert, err := tlsutil.GenerateX509KeyPair(tlsutil.CertOptions{
Hosts: hosts,
Organization: "Argo CD",
IsCA: true,
})
if err != nil {
return nil, err
}
tlsConfig := &tls.Config{Certificates: []tls.Certificate{*cert}}
tlsConfCustomizer(tlsConfig)
serverLog := log.NewEntry(log.StandardLogger())
streamInterceptors := []grpc.StreamServerInterceptor{grpc_logrus.StreamServerInterceptor(serverLog), grpc_util.PanicLoggerStreamServerInterceptor(serverLog)}
unaryInterceptors := []grpc.UnaryServerInterceptor{grpc_logrus.UnaryServerInterceptor(serverLog), grpc_util.PanicLoggerUnaryServerInterceptor(serverLog)}
return &ArgoCDRepoServer{
log: serverLog,
gitFactory: gitFactory,
cache: cache,
parallelismLimit: parallelismLimit,
opts: []grpc.ServerOption{
grpc.Creds(credentials.NewTLS(tlsConfig)),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryInterceptors...)),
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(streamInterceptors...)),
},
}, nil
} | [
"func",
"NewServer",
"(",
"gitFactory",
"git",
".",
"ClientFactory",
",",
"cache",
"*",
"cache",
".",
"Cache",
",",
"tlsConfCustomizer",
"tlsutil",
".",
"ConfigCustomizer",
",",
"parallelismLimit",
"int64",
")",
"(",
"*",
"ArgoCDRepoServer",
",",
"error",
")",
"{",
"// generate TLS cert",
"hosts",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"}",
"\n",
"cert",
",",
"err",
":=",
"tlsutil",
".",
"GenerateX509KeyPair",
"(",
"tlsutil",
".",
"CertOptions",
"{",
"Hosts",
":",
"hosts",
",",
"Organization",
":",
"\"",
"\"",
",",
"IsCA",
":",
"true",
",",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"tlsConfig",
":=",
"&",
"tls",
".",
"Config",
"{",
"Certificates",
":",
"[",
"]",
"tls",
".",
"Certificate",
"{",
"*",
"cert",
"}",
"}",
"\n",
"tlsConfCustomizer",
"(",
"tlsConfig",
")",
"\n\n",
"serverLog",
":=",
"log",
".",
"NewEntry",
"(",
"log",
".",
"StandardLogger",
"(",
")",
")",
"\n",
"streamInterceptors",
":=",
"[",
"]",
"grpc",
".",
"StreamServerInterceptor",
"{",
"grpc_logrus",
".",
"StreamServerInterceptor",
"(",
"serverLog",
")",
",",
"grpc_util",
".",
"PanicLoggerStreamServerInterceptor",
"(",
"serverLog",
")",
"}",
"\n",
"unaryInterceptors",
":=",
"[",
"]",
"grpc",
".",
"UnaryServerInterceptor",
"{",
"grpc_logrus",
".",
"UnaryServerInterceptor",
"(",
"serverLog",
")",
",",
"grpc_util",
".",
"PanicLoggerUnaryServerInterceptor",
"(",
"serverLog",
")",
"}",
"\n\n",
"return",
"&",
"ArgoCDRepoServer",
"{",
"log",
":",
"serverLog",
",",
"gitFactory",
":",
"gitFactory",
",",
"cache",
":",
"cache",
",",
"parallelismLimit",
":",
"parallelismLimit",
",",
"opts",
":",
"[",
"]",
"grpc",
".",
"ServerOption",
"{",
"grpc",
".",
"Creds",
"(",
"credentials",
".",
"NewTLS",
"(",
"tlsConfig",
")",
")",
",",
"grpc",
".",
"UnaryInterceptor",
"(",
"grpc_middleware",
".",
"ChainUnaryServer",
"(",
"unaryInterceptors",
"...",
")",
")",
",",
"grpc",
".",
"StreamInterceptor",
"(",
"grpc_middleware",
".",
"ChainStreamServer",
"(",
"streamInterceptors",
"...",
")",
")",
",",
"}",
",",
"}",
",",
"nil",
"\n",
"}"
] | // NewServer returns a new instance of the Argo CD Repo server | [
"NewServer",
"returns",
"a",
"new",
"instance",
"of",
"the",
"Argo",
"CD",
"Repo",
"server"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/server.go#L31-L65 |
161,973 | argoproj/argo-cd | reposerver/server.go | CreateGRPC | func (a *ArgoCDRepoServer) CreateGRPC() *grpc.Server {
server := grpc.NewServer(a.opts...)
version.RegisterVersionServiceServer(server, &version.Server{})
manifestService := repository.NewService(a.gitFactory, a.cache, a.parallelismLimit)
repository.RegisterRepoServerServiceServer(server, manifestService)
// Register reflection service on gRPC server.
reflection.Register(server)
return server
} | go | func (a *ArgoCDRepoServer) CreateGRPC() *grpc.Server {
server := grpc.NewServer(a.opts...)
version.RegisterVersionServiceServer(server, &version.Server{})
manifestService := repository.NewService(a.gitFactory, a.cache, a.parallelismLimit)
repository.RegisterRepoServerServiceServer(server, manifestService)
// Register reflection service on gRPC server.
reflection.Register(server)
return server
} | [
"func",
"(",
"a",
"*",
"ArgoCDRepoServer",
")",
"CreateGRPC",
"(",
")",
"*",
"grpc",
".",
"Server",
"{",
"server",
":=",
"grpc",
".",
"NewServer",
"(",
"a",
".",
"opts",
"...",
")",
"\n",
"version",
".",
"RegisterVersionServiceServer",
"(",
"server",
",",
"&",
"version",
".",
"Server",
"{",
"}",
")",
"\n",
"manifestService",
":=",
"repository",
".",
"NewService",
"(",
"a",
".",
"gitFactory",
",",
"a",
".",
"cache",
",",
"a",
".",
"parallelismLimit",
")",
"\n",
"repository",
".",
"RegisterRepoServerServiceServer",
"(",
"server",
",",
"manifestService",
")",
"\n\n",
"// Register reflection service on gRPC server.",
"reflection",
".",
"Register",
"(",
"server",
")",
"\n\n",
"return",
"server",
"\n",
"}"
] | // CreateGRPC creates new configured grpc server | [
"CreateGRPC",
"creates",
"new",
"configured",
"grpc",
"server"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/reposerver/server.go#L68-L78 |
161,974 | argoproj/argo-cd | server/account/account.pb.gw.go | RegisterAccountServiceHandler | func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterAccountServiceHandlerClient(ctx, mux, NewAccountServiceClient(conn))
} | go | func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterAccountServiceHandlerClient(ctx, mux, NewAccountServiceClient(conn))
} | [
"func",
"RegisterAccountServiceHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterAccountServiceHandlerClient",
"(",
"ctx",
",",
"mux",
",",
"NewAccountServiceClient",
"(",
"conn",
")",
")",
"\n",
"}"
] | // RegisterAccountServiceHandler registers the http handlers for service AccountService to "mux".
// The handlers forward requests to the grpc endpoint over "conn". | [
"RegisterAccountServiceHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"AccountService",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/server/account/account.pb.gw.go#L71-L73 |
161,975 | argoproj/argo-cd | util/db/repository.go | ListRepoURLs | func (db *db) ListRepoURLs(ctx context.Context) ([]string, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
urls := make([]string, len(s.Repositories))
for i := range s.Repositories {
urls[i] = s.Repositories[i].URL
}
return urls, nil
} | go | func (db *db) ListRepoURLs(ctx context.Context) ([]string, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
urls := make([]string, len(s.Repositories))
for i := range s.Repositories {
urls[i] = s.Repositories[i].URL
}
return urls, nil
} | [
"func",
"(",
"db",
"*",
"db",
")",
"ListRepoURLs",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"db",
".",
"settingsMgr",
".",
"GetSettings",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"urls",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"s",
".",
"Repositories",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"s",
".",
"Repositories",
"{",
"urls",
"[",
"i",
"]",
"=",
"s",
".",
"Repositories",
"[",
"i",
"]",
".",
"URL",
"\n",
"}",
"\n",
"return",
"urls",
",",
"nil",
"\n",
"}"
] | // ListRepoURLs returns list of repositories | [
"ListRepoURLs",
"returns",
"list",
"of",
"repositories"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/db/repository.go#L29-L40 |
161,976 | argoproj/argo-cd | util/db/repository.go | CreateRepository | func (db *db) CreateRepository(ctx context.Context, r *appsv1.Repository) (*appsv1.Repository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
index := getRepositoryIndex(s, r.Repo)
if index > -1 {
return nil, status.Errorf(codes.AlreadyExists, "repository '%s' already exists", r.Repo)
}
data := make(map[string][]byte)
if r.Username != "" {
data[username] = []byte(r.Username)
}
if r.Password != "" {
data[password] = []byte(r.Password)
}
if r.SSHPrivateKey != "" {
data[sshPrivateKey] = []byte(r.SSHPrivateKey)
}
repoInfo := settings.RepoCredentials{
URL: r.Repo,
InsecureIgnoreHostKey: r.InsecureIgnoreHostKey,
}
err = db.updateSecrets(&repoInfo, r)
if err != nil {
return nil, err
}
s.Repositories = append(s.Repositories, repoInfo)
err = db.settingsMgr.SaveSettings(s)
if err != nil {
return nil, err
}
return r, nil
} | go | func (db *db) CreateRepository(ctx context.Context, r *appsv1.Repository) (*appsv1.Repository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
index := getRepositoryIndex(s, r.Repo)
if index > -1 {
return nil, status.Errorf(codes.AlreadyExists, "repository '%s' already exists", r.Repo)
}
data := make(map[string][]byte)
if r.Username != "" {
data[username] = []byte(r.Username)
}
if r.Password != "" {
data[password] = []byte(r.Password)
}
if r.SSHPrivateKey != "" {
data[sshPrivateKey] = []byte(r.SSHPrivateKey)
}
repoInfo := settings.RepoCredentials{
URL: r.Repo,
InsecureIgnoreHostKey: r.InsecureIgnoreHostKey,
}
err = db.updateSecrets(&repoInfo, r)
if err != nil {
return nil, err
}
s.Repositories = append(s.Repositories, repoInfo)
err = db.settingsMgr.SaveSettings(s)
if err != nil {
return nil, err
}
return r, nil
} | [
"func",
"(",
"db",
"*",
"db",
")",
"CreateRepository",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"*",
"appsv1",
".",
"Repository",
")",
"(",
"*",
"appsv1",
".",
"Repository",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"db",
".",
"settingsMgr",
".",
"GetSettings",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"index",
":=",
"getRepositoryIndex",
"(",
"s",
",",
"r",
".",
"Repo",
")",
"\n",
"if",
"index",
">",
"-",
"1",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"AlreadyExists",
",",
"\"",
"\"",
",",
"r",
".",
"Repo",
")",
"\n",
"}",
"\n\n",
"data",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
")",
"\n",
"if",
"r",
".",
"Username",
"!=",
"\"",
"\"",
"{",
"data",
"[",
"username",
"]",
"=",
"[",
"]",
"byte",
"(",
"r",
".",
"Username",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"Password",
"!=",
"\"",
"\"",
"{",
"data",
"[",
"password",
"]",
"=",
"[",
"]",
"byte",
"(",
"r",
".",
"Password",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"SSHPrivateKey",
"!=",
"\"",
"\"",
"{",
"data",
"[",
"sshPrivateKey",
"]",
"=",
"[",
"]",
"byte",
"(",
"r",
".",
"SSHPrivateKey",
")",
"\n",
"}",
"\n\n",
"repoInfo",
":=",
"settings",
".",
"RepoCredentials",
"{",
"URL",
":",
"r",
".",
"Repo",
",",
"InsecureIgnoreHostKey",
":",
"r",
".",
"InsecureIgnoreHostKey",
",",
"}",
"\n",
"err",
"=",
"db",
".",
"updateSecrets",
"(",
"&",
"repoInfo",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"s",
".",
"Repositories",
"=",
"append",
"(",
"s",
".",
"Repositories",
",",
"repoInfo",
")",
"\n",
"err",
"=",
"db",
".",
"settingsMgr",
".",
"SaveSettings",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] | // CreateRepository creates a repository | [
"CreateRepository",
"creates",
"a",
"repository"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/db/repository.go#L43-L80 |
161,977 | argoproj/argo-cd | util/db/repository.go | GetRepository | func (db *db) GetRepository(ctx context.Context, repoURL string) (*appsv1.Repository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
index := getRepositoryIndex(s, repoURL)
if index < 0 {
return nil, status.Errorf(codes.NotFound, "repo '%s' not found", repoURL)
}
repo, err := db.credentialsToRepository(s.Repositories[index])
if err != nil {
return nil, err
}
if !repo.HasCredentials() {
index := getRepositoryCredentialIndex(s, repoURL)
if index >= 0 {
credential, err := db.credentialsToRepository(s.RepositoryCredentials[index])
if err != nil {
return nil, err
} else {
log.WithFields(log.Fields{"repoURL": repo.Repo, "credUrl": credential.Repo}).Info("copying credentials")
repo.CopyCredentialsFrom(*credential)
}
}
}
return repo, err
} | go | func (db *db) GetRepository(ctx context.Context, repoURL string) (*appsv1.Repository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
index := getRepositoryIndex(s, repoURL)
if index < 0 {
return nil, status.Errorf(codes.NotFound, "repo '%s' not found", repoURL)
}
repo, err := db.credentialsToRepository(s.Repositories[index])
if err != nil {
return nil, err
}
if !repo.HasCredentials() {
index := getRepositoryCredentialIndex(s, repoURL)
if index >= 0 {
credential, err := db.credentialsToRepository(s.RepositoryCredentials[index])
if err != nil {
return nil, err
} else {
log.WithFields(log.Fields{"repoURL": repo.Repo, "credUrl": credential.Repo}).Info("copying credentials")
repo.CopyCredentialsFrom(*credential)
}
}
}
return repo, err
} | [
"func",
"(",
"db",
"*",
"db",
")",
"GetRepository",
"(",
"ctx",
"context",
".",
"Context",
",",
"repoURL",
"string",
")",
"(",
"*",
"appsv1",
".",
"Repository",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"db",
".",
"settingsMgr",
".",
"GetSettings",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"index",
":=",
"getRepositoryIndex",
"(",
"s",
",",
"repoURL",
")",
"\n",
"if",
"index",
"<",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"NotFound",
",",
"\"",
"\"",
",",
"repoURL",
")",
"\n",
"}",
"\n\n",
"repo",
",",
"err",
":=",
"db",
".",
"credentialsToRepository",
"(",
"s",
".",
"Repositories",
"[",
"index",
"]",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"repo",
".",
"HasCredentials",
"(",
")",
"{",
"index",
":=",
"getRepositoryCredentialIndex",
"(",
"s",
",",
"repoURL",
")",
"\n",
"if",
"index",
">=",
"0",
"{",
"credential",
",",
"err",
":=",
"db",
".",
"credentialsToRepository",
"(",
"s",
".",
"RepositoryCredentials",
"[",
"index",
"]",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"repo",
".",
"Repo",
",",
"\"",
"\"",
":",
"credential",
".",
"Repo",
"}",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"repo",
".",
"CopyCredentialsFrom",
"(",
"*",
"credential",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"repo",
",",
"err",
"\n",
"}"
] | // GetRepository returns a repository by URL | [
"GetRepository",
"returns",
"a",
"repository",
"by",
"URL"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/db/repository.go#L83-L116 |
161,978 | argoproj/argo-cd | util/db/repository.go | UpdateRepository | func (db *db) UpdateRepository(ctx context.Context, r *appsv1.Repository) (*appsv1.Repository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
index := getRepositoryIndex(s, r.Repo)
if index < 0 {
return nil, status.Errorf(codes.NotFound, "repo '%s' not found", r.Repo)
}
repoInfo := s.Repositories[index]
err = db.updateSecrets(&repoInfo, r)
if err != nil {
return nil, err
}
s.Repositories[index] = repoInfo
err = db.settingsMgr.SaveSettings(s)
if err != nil {
return nil, err
}
return r, nil
} | go | func (db *db) UpdateRepository(ctx context.Context, r *appsv1.Repository) (*appsv1.Repository, error) {
s, err := db.settingsMgr.GetSettings()
if err != nil {
return nil, err
}
index := getRepositoryIndex(s, r.Repo)
if index < 0 {
return nil, status.Errorf(codes.NotFound, "repo '%s' not found", r.Repo)
}
repoInfo := s.Repositories[index]
err = db.updateSecrets(&repoInfo, r)
if err != nil {
return nil, err
}
s.Repositories[index] = repoInfo
err = db.settingsMgr.SaveSettings(s)
if err != nil {
return nil, err
}
return r, nil
} | [
"func",
"(",
"db",
"*",
"db",
")",
"UpdateRepository",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"*",
"appsv1",
".",
"Repository",
")",
"(",
"*",
"appsv1",
".",
"Repository",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"db",
".",
"settingsMgr",
".",
"GetSettings",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"index",
":=",
"getRepositoryIndex",
"(",
"s",
",",
"r",
".",
"Repo",
")",
"\n",
"if",
"index",
"<",
"0",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"NotFound",
",",
"\"",
"\"",
",",
"r",
".",
"Repo",
")",
"\n",
"}",
"\n\n",
"repoInfo",
":=",
"s",
".",
"Repositories",
"[",
"index",
"]",
"\n",
"err",
"=",
"db",
".",
"updateSecrets",
"(",
"&",
"repoInfo",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"s",
".",
"Repositories",
"[",
"index",
"]",
"=",
"repoInfo",
"\n",
"err",
"=",
"db",
".",
"settingsMgr",
".",
"SaveSettings",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] | // UpdateRepository updates a repository | [
"UpdateRepository",
"updates",
"a",
"repository"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/db/repository.go#L133-L155 |
161,979 | argoproj/argo-cd | util/keylock.go | NewKeyLock | func NewKeyLock() *KeyLock {
return &KeyLock{
giantLock: sync.RWMutex{},
locks: map[string]*sync.Mutex{},
}
} | go | func NewKeyLock() *KeyLock {
return &KeyLock{
giantLock: sync.RWMutex{},
locks: map[string]*sync.Mutex{},
}
} | [
"func",
"NewKeyLock",
"(",
")",
"*",
"KeyLock",
"{",
"return",
"&",
"KeyLock",
"{",
"giantLock",
":",
"sync",
".",
"RWMutex",
"{",
"}",
",",
"locks",
":",
"map",
"[",
"string",
"]",
"*",
"sync",
".",
"Mutex",
"{",
"}",
",",
"}",
"\n",
"}"
] | // NewKeyLock creates new instance of KeyLock | [
"NewKeyLock",
"creates",
"new",
"instance",
"of",
"KeyLock"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/keylock.go#L12-L17 |
161,980 | argoproj/argo-cd | util/helm/helm.go | NewHelmApp | func NewHelmApp(path string, helmRepos []*argoappv1.HelmRepository) Helm {
return &helm{path: path, helmRepos: helmRepos}
} | go | func NewHelmApp(path string, helmRepos []*argoappv1.HelmRepository) Helm {
return &helm{path: path, helmRepos: helmRepos}
} | [
"func",
"NewHelmApp",
"(",
"path",
"string",
",",
"helmRepos",
"[",
"]",
"*",
"argoappv1",
".",
"HelmRepository",
")",
"Helm",
"{",
"return",
"&",
"helm",
"{",
"path",
":",
"path",
",",
"helmRepos",
":",
"helmRepos",
"}",
"\n",
"}"
] | // NewHelmApp create a new wrapper to run commands on the `helm` command-line tool. | [
"NewHelmApp",
"create",
"a",
"new",
"wrapper",
"to",
"run",
"commands",
"on",
"the",
"helm",
"command",
"-",
"line",
"tool",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/helm/helm.go#L40-L42 |
161,981 | argoproj/argo-cd | util/jwt/jwt.go | MapClaims | func MapClaims(claims jwtgo.Claims) (jwtgo.MapClaims, error) {
claimsBytes, err := json.Marshal(claims)
if err != nil {
return nil, err
}
var mapClaims jwtgo.MapClaims
err = json.Unmarshal(claimsBytes, &mapClaims)
if err != nil {
return nil, err
}
return mapClaims, nil
} | go | func MapClaims(claims jwtgo.Claims) (jwtgo.MapClaims, error) {
claimsBytes, err := json.Marshal(claims)
if err != nil {
return nil, err
}
var mapClaims jwtgo.MapClaims
err = json.Unmarshal(claimsBytes, &mapClaims)
if err != nil {
return nil, err
}
return mapClaims, nil
} | [
"func",
"MapClaims",
"(",
"claims",
"jwtgo",
".",
"Claims",
")",
"(",
"jwtgo",
".",
"MapClaims",
",",
"error",
")",
"{",
"claimsBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"claims",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"mapClaims",
"jwtgo",
".",
"MapClaims",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"claimsBytes",
",",
"&",
"mapClaims",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"mapClaims",
",",
"nil",
"\n",
"}"
] | // MapClaims converts a jwt.Claims to a MapClaims | [
"MapClaims",
"converts",
"a",
"jwt",
".",
"Claims",
"to",
"a",
"MapClaims"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/jwt/jwt.go#L11-L22 |
161,982 | argoproj/argo-cd | util/jwt/jwt.go | GetField | func GetField(claims jwtgo.MapClaims, fieldName string) string {
if fieldIf, ok := claims[fieldName]; ok {
if field, ok := fieldIf.(string); ok {
return field
}
}
return ""
} | go | func GetField(claims jwtgo.MapClaims, fieldName string) string {
if fieldIf, ok := claims[fieldName]; ok {
if field, ok := fieldIf.(string); ok {
return field
}
}
return ""
} | [
"func",
"GetField",
"(",
"claims",
"jwtgo",
".",
"MapClaims",
",",
"fieldName",
"string",
")",
"string",
"{",
"if",
"fieldIf",
",",
"ok",
":=",
"claims",
"[",
"fieldName",
"]",
";",
"ok",
"{",
"if",
"field",
",",
"ok",
":=",
"fieldIf",
".",
"(",
"string",
")",
";",
"ok",
"{",
"return",
"field",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] | // GetField extracts a field from the claims as a string | [
"GetField",
"extracts",
"a",
"field",
"from",
"the",
"claims",
"as",
"a",
"string"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/jwt/jwt.go#L25-L32 |
161,983 | argoproj/argo-cd | util/jwt/jwt.go | GetGroups | func GetGroups(claims jwtgo.MapClaims) []string {
groups := make([]string, 0)
groupsIf, ok := claims["groups"]
if !ok {
return groups
}
groupIfList, ok := groupsIf.([]interface{})
if !ok {
return groups
}
for _, groupIf := range groupIfList {
group, ok := groupIf.(string)
if ok {
groups = append(groups, group)
}
}
return groups
} | go | func GetGroups(claims jwtgo.MapClaims) []string {
groups := make([]string, 0)
groupsIf, ok := claims["groups"]
if !ok {
return groups
}
groupIfList, ok := groupsIf.([]interface{})
if !ok {
return groups
}
for _, groupIf := range groupIfList {
group, ok := groupIf.(string)
if ok {
groups = append(groups, group)
}
}
return groups
} | [
"func",
"GetGroups",
"(",
"claims",
"jwtgo",
".",
"MapClaims",
")",
"[",
"]",
"string",
"{",
"groups",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"groupsIf",
",",
"ok",
":=",
"claims",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"groups",
"\n",
"}",
"\n",
"groupIfList",
",",
"ok",
":=",
"groupsIf",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"groups",
"\n",
"}",
"\n",
"for",
"_",
",",
"groupIf",
":=",
"range",
"groupIfList",
"{",
"group",
",",
"ok",
":=",
"groupIf",
".",
"(",
"string",
")",
"\n",
"if",
"ok",
"{",
"groups",
"=",
"append",
"(",
"groups",
",",
"group",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"groups",
"\n",
"}"
] | // GetGroups extracts the groups from a claims | [
"GetGroups",
"extracts",
"the",
"groups",
"from",
"a",
"claims"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/jwt/jwt.go#L35-L52 |
161,984 | argoproj/argo-cd | util/jwt/jwt.go | GetIssuedAt | func GetIssuedAt(m jwtgo.MapClaims) (int64, error) {
switch iat := m["iat"].(type) {
case float64:
return int64(iat), nil
case json.Number:
return iat.Int64()
case int64:
return iat, nil
default:
return 0, fmt.Errorf("iat '%v' is not a number", iat)
}
} | go | func GetIssuedAt(m jwtgo.MapClaims) (int64, error) {
switch iat := m["iat"].(type) {
case float64:
return int64(iat), nil
case json.Number:
return iat.Int64()
case int64:
return iat, nil
default:
return 0, fmt.Errorf("iat '%v' is not a number", iat)
}
} | [
"func",
"GetIssuedAt",
"(",
"m",
"jwtgo",
".",
"MapClaims",
")",
"(",
"int64",
",",
"error",
")",
"{",
"switch",
"iat",
":=",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"type",
")",
"{",
"case",
"float64",
":",
"return",
"int64",
"(",
"iat",
")",
",",
"nil",
"\n",
"case",
"json",
".",
"Number",
":",
"return",
"iat",
".",
"Int64",
"(",
")",
"\n",
"case",
"int64",
":",
"return",
"iat",
",",
"nil",
"\n",
"default",
":",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"iat",
")",
"\n",
"}",
"\n",
"}"
] | // GetIssuedAt returns the issued at as an int64 | [
"GetIssuedAt",
"returns",
"the",
"issued",
"at",
"as",
"an",
"int64"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/jwt/jwt.go#L55-L66 |
161,985 | argoproj/argo-cd | cmd/argocd/commands/repo.go | NewRepoCommand | func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "repo",
Short: "Manage git repository credentials",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewRepoAddCommand(clientOpts))
command.AddCommand(NewRepoListCommand(clientOpts))
command.AddCommand(NewRepoRemoveCommand(clientOpts))
return command
} | go | func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "repo",
Short: "Manage git repository credentials",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
},
}
command.AddCommand(NewRepoAddCommand(clientOpts))
command.AddCommand(NewRepoListCommand(clientOpts))
command.AddCommand(NewRepoRemoveCommand(clientOpts))
return command
} | [
"func",
"NewRepoCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"c",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"c",
".",
"HelpFunc",
"(",
")",
"(",
"c",
",",
"args",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
",",
"}",
"\n\n",
"command",
".",
"AddCommand",
"(",
"NewRepoAddCommand",
"(",
"clientOpts",
")",
")",
"\n",
"command",
".",
"AddCommand",
"(",
"NewRepoListCommand",
"(",
"clientOpts",
")",
")",
"\n",
"command",
".",
"AddCommand",
"(",
"NewRepoRemoveCommand",
"(",
"clientOpts",
")",
")",
"\n",
"return",
"command",
"\n",
"}"
] | // NewRepoCommand returns a new instance of an `argocd repo` command | [
"NewRepoCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"repo",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/repo.go#L23-L37 |
161,986 | argoproj/argo-cd | cmd/argocd/commands/repo.go | NewRepoAddCommand | func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
repo appsv1.Repository
upsert bool
sshPrivateKeyPath string
insecureIgnoreHostKey bool
)
var command = &cobra.Command{
Use: "add REPO",
Short: "Add git repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
repo.Repo = args[0]
if sshPrivateKeyPath != "" {
keyData, err := ioutil.ReadFile(sshPrivateKeyPath)
if err != nil {
log.Fatal(err)
}
repo.SSHPrivateKey = string(keyData)
}
repo.InsecureIgnoreHostKey = insecureIgnoreHostKey
// First test the repo *without* username/password. This gives us a hint on whether this
// is a private repo.
// NOTE: it is important not to run git commands to test git credentials on the user's
// system since it may mess with their git credential store (e.g. osx keychain).
// See issue #315
err := git.TestRepo(repo.Repo, "", "", repo.SSHPrivateKey, repo.InsecureIgnoreHostKey)
if err != nil {
if git.IsSSHURL(repo.Repo) {
// If we failed using git SSH credentials, then the repo is automatically bad
log.Fatal(err)
}
// If we can't test the repo, it's probably private. Prompt for credentials and
// let the server test it.
repo.Username, repo.Password = cli.PromptCredentials(repo.Username, repo.Password)
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
repoCreateReq := repository.RepoCreateRequest{
Repo: &repo,
Upsert: upsert,
}
createdRepo, err := repoIf.Create(context.Background(), &repoCreateReq)
errors.CheckError(err)
fmt.Printf("repository '%s' added\n", createdRepo.Repo)
},
}
command.Flags().StringVar(&repo.Username, "username", "", "username to the repository")
command.Flags().StringVar(&repo.Password, "password", "", "password to the repository")
command.Flags().StringVar(&sshPrivateKeyPath, "ssh-private-key-path", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
command.Flags().BoolVar(&insecureIgnoreHostKey, "insecure-ignore-host-key", false, "disables SSH strict host key checking")
command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
return command
} | go | func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
repo appsv1.Repository
upsert bool
sshPrivateKeyPath string
insecureIgnoreHostKey bool
)
var command = &cobra.Command{
Use: "add REPO",
Short: "Add git repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) != 1 {
c.HelpFunc()(c, args)
os.Exit(1)
}
repo.Repo = args[0]
if sshPrivateKeyPath != "" {
keyData, err := ioutil.ReadFile(sshPrivateKeyPath)
if err != nil {
log.Fatal(err)
}
repo.SSHPrivateKey = string(keyData)
}
repo.InsecureIgnoreHostKey = insecureIgnoreHostKey
// First test the repo *without* username/password. This gives us a hint on whether this
// is a private repo.
// NOTE: it is important not to run git commands to test git credentials on the user's
// system since it may mess with their git credential store (e.g. osx keychain).
// See issue #315
err := git.TestRepo(repo.Repo, "", "", repo.SSHPrivateKey, repo.InsecureIgnoreHostKey)
if err != nil {
if git.IsSSHURL(repo.Repo) {
// If we failed using git SSH credentials, then the repo is automatically bad
log.Fatal(err)
}
// If we can't test the repo, it's probably private. Prompt for credentials and
// let the server test it.
repo.Username, repo.Password = cli.PromptCredentials(repo.Username, repo.Password)
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
repoCreateReq := repository.RepoCreateRequest{
Repo: &repo,
Upsert: upsert,
}
createdRepo, err := repoIf.Create(context.Background(), &repoCreateReq)
errors.CheckError(err)
fmt.Printf("repository '%s' added\n", createdRepo.Repo)
},
}
command.Flags().StringVar(&repo.Username, "username", "", "username to the repository")
command.Flags().StringVar(&repo.Password, "password", "", "password to the repository")
command.Flags().StringVar(&sshPrivateKeyPath, "ssh-private-key-path", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
command.Flags().BoolVar(&insecureIgnoreHostKey, "insecure-ignore-host-key", false, "disables SSH strict host key checking")
command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
return command
} | [
"func",
"NewRepoAddCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"repo",
"appsv1",
".",
"Repository",
"\n",
"upsert",
"bool",
"\n",
"sshPrivateKeyPath",
"string",
"\n",
"insecureIgnoreHostKey",
"bool",
"\n",
")",
"\n",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"c",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"c",
".",
"HelpFunc",
"(",
")",
"(",
"c",
",",
"args",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"repo",
".",
"Repo",
"=",
"args",
"[",
"0",
"]",
"\n",
"if",
"sshPrivateKeyPath",
"!=",
"\"",
"\"",
"{",
"keyData",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"sshPrivateKeyPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"repo",
".",
"SSHPrivateKey",
"=",
"string",
"(",
"keyData",
")",
"\n",
"}",
"\n",
"repo",
".",
"InsecureIgnoreHostKey",
"=",
"insecureIgnoreHostKey",
"\n",
"// First test the repo *without* username/password. This gives us a hint on whether this",
"// is a private repo.",
"// NOTE: it is important not to run git commands to test git credentials on the user's",
"// system since it may mess with their git credential store (e.g. osx keychain).",
"// See issue #315",
"err",
":=",
"git",
".",
"TestRepo",
"(",
"repo",
".",
"Repo",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"repo",
".",
"SSHPrivateKey",
",",
"repo",
".",
"InsecureIgnoreHostKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"git",
".",
"IsSSHURL",
"(",
"repo",
".",
"Repo",
")",
"{",
"// If we failed using git SSH credentials, then the repo is automatically bad",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"// If we can't test the repo, it's probably private. Prompt for credentials and",
"// let the server test it.",
"repo",
".",
"Username",
",",
"repo",
".",
"Password",
"=",
"cli",
".",
"PromptCredentials",
"(",
"repo",
".",
"Username",
",",
"repo",
".",
"Password",
")",
"\n",
"}",
"\n",
"conn",
",",
"repoIf",
":=",
"argocdclient",
".",
"NewClientOrDie",
"(",
"clientOpts",
")",
".",
"NewRepoClientOrDie",
"(",
")",
"\n",
"defer",
"util",
".",
"Close",
"(",
"conn",
")",
"\n",
"repoCreateReq",
":=",
"repository",
".",
"RepoCreateRequest",
"{",
"Repo",
":",
"&",
"repo",
",",
"Upsert",
":",
"upsert",
",",
"}",
"\n",
"createdRepo",
",",
"err",
":=",
"repoIf",
".",
"Create",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"repoCreateReq",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"createdRepo",
".",
"Repo",
")",
"\n",
"}",
",",
"}",
"\n",
"command",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"repo",
".",
"Username",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"command",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"repo",
".",
"Password",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"command",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"sshPrivateKeyPath",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"command",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"insecureIgnoreHostKey",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"command",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"upsert",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"return",
"command",
"\n",
"}"
] | // NewRepoAddCommand returns a new instance of an `argocd repo add` command | [
"NewRepoAddCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"repo",
"add",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/repo.go#L40-L96 |
161,987 | argoproj/argo-cd | cmd/argocd/commands/repo.go | NewRepoRemoveCommand | func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm REPO",
Short: "Remove git repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
for _, repoURL := range args {
_, err := repoIf.Delete(context.Background(), &repository.RepoQuery{Repo: repoURL})
errors.CheckError(err)
}
},
}
return command
} | go | func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm REPO",
Short: "Remove git repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
for _, repoURL := range args {
_, err := repoIf.Delete(context.Background(), &repository.RepoQuery{Repo: repoURL})
errors.CheckError(err)
}
},
}
return command
} | [
"func",
"NewRepoRemoveCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"c",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"c",
".",
"HelpFunc",
"(",
")",
"(",
"c",
",",
"args",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"conn",
",",
"repoIf",
":=",
"argocdclient",
".",
"NewClientOrDie",
"(",
"clientOpts",
")",
".",
"NewRepoClientOrDie",
"(",
")",
"\n",
"defer",
"util",
".",
"Close",
"(",
"conn",
")",
"\n",
"for",
"_",
",",
"repoURL",
":=",
"range",
"args",
"{",
"_",
",",
"err",
":=",
"repoIf",
".",
"Delete",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"repository",
".",
"RepoQuery",
"{",
"Repo",
":",
"repoURL",
"}",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
",",
"}",
"\n",
"return",
"command",
"\n",
"}"
] | // NewRepoRemoveCommand returns a new instance of an `argocd repo list` command | [
"NewRepoRemoveCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"repo",
"list",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/repo.go#L99-L117 |
161,988 | argoproj/argo-cd | cmd/argocd/commands/repo.go | NewRepoListCommand | func NewRepoListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "list",
Short: "List configured repositories",
Run: func(c *cobra.Command, args []string) {
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
repos, err := repoIf.List(context.Background(), &repository.RepoQuery{})
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "REPO\tUSER\tSTATUS\tMESSAGE\n")
for _, r := range repos.Items {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", r.Repo, r.Username, r.ConnectionState.Status, r.ConnectionState.Message)
}
_ = w.Flush()
},
}
return command
} | go | func NewRepoListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "list",
Short: "List configured repositories",
Run: func(c *cobra.Command, args []string) {
conn, repoIf := argocdclient.NewClientOrDie(clientOpts).NewRepoClientOrDie()
defer util.Close(conn)
repos, err := repoIf.List(context.Background(), &repository.RepoQuery{})
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "REPO\tUSER\tSTATUS\tMESSAGE\n")
for _, r := range repos.Items {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", r.Repo, r.Username, r.ConnectionState.Status, r.ConnectionState.Message)
}
_ = w.Flush()
},
}
return command
} | [
"func",
"NewRepoListCommand",
"(",
"clientOpts",
"*",
"argocdclient",
".",
"ClientOptions",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"c",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"conn",
",",
"repoIf",
":=",
"argocdclient",
".",
"NewClientOrDie",
"(",
"clientOpts",
")",
".",
"NewRepoClientOrDie",
"(",
")",
"\n",
"defer",
"util",
".",
"Close",
"(",
"conn",
")",
"\n",
"repos",
",",
"err",
":=",
"repoIf",
".",
"List",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"repository",
".",
"RepoQuery",
"{",
"}",
")",
"\n",
"errors",
".",
"CheckError",
"(",
"err",
")",
"\n",
"w",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"os",
".",
"Stdout",
",",
"0",
",",
"0",
",",
"2",
",",
"' '",
",",
"0",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\\n",
"\"",
")",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"repos",
".",
"Items",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\\n",
"\"",
",",
"r",
".",
"Repo",
",",
"r",
".",
"Username",
",",
"r",
".",
"ConnectionState",
".",
"Status",
",",
"r",
".",
"ConnectionState",
".",
"Message",
")",
"\n",
"}",
"\n",
"_",
"=",
"w",
".",
"Flush",
"(",
")",
"\n",
"}",
",",
"}",
"\n",
"return",
"command",
"\n",
"}"
] | // NewRepoListCommand returns a new instance of an `argocd repo rm` command | [
"NewRepoListCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argocd",
"repo",
"rm",
"command"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/cmd/argocd/commands/repo.go#L120-L138 |
161,989 | argoproj/argo-cd | util/kube/ctl.go | isSupportedVerb | func isSupportedVerb(apiResource *metav1.APIResource, verb string) bool {
for _, v := range apiResource.Verbs {
if v == verb {
return true
}
}
return false
} | go | func isSupportedVerb(apiResource *metav1.APIResource, verb string) bool {
for _, v := range apiResource.Verbs {
if v == verb {
return true
}
}
return false
} | [
"func",
"isSupportedVerb",
"(",
"apiResource",
"*",
"metav1",
".",
"APIResource",
",",
"verb",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"apiResource",
".",
"Verbs",
"{",
"if",
"v",
"==",
"verb",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // isSupportedVerb returns whether or not a APIResource supports a specific verb | [
"isSupportedVerb",
"returns",
"whether",
"or",
"not",
"a",
"APIResource",
"supports",
"a",
"specific",
"verb"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kube/ctl.go#L113-L120 |
161,990 | argoproj/argo-cd | util/kube/ctl.go | GetResource | func (k KubectlCmd) GetResource(config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string) (*unstructured.Unstructured, error) {
dynamicIf, err := dynamic.NewForConfig(config)
if err != nil {
return nil, err
}
disco, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return nil, err
}
apiResource, err := ServerResourceForGroupVersionKind(disco, gvk)
if err != nil {
return nil, err
}
resource := gvk.GroupVersion().WithResource(apiResource.Name)
resourceIf := ToResourceInterface(dynamicIf, apiResource, resource, namespace)
return resourceIf.Get(name, metav1.GetOptions{})
} | go | func (k KubectlCmd) GetResource(config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string) (*unstructured.Unstructured, error) {
dynamicIf, err := dynamic.NewForConfig(config)
if err != nil {
return nil, err
}
disco, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return nil, err
}
apiResource, err := ServerResourceForGroupVersionKind(disco, gvk)
if err != nil {
return nil, err
}
resource := gvk.GroupVersion().WithResource(apiResource.Name)
resourceIf := ToResourceInterface(dynamicIf, apiResource, resource, namespace)
return resourceIf.Get(name, metav1.GetOptions{})
} | [
"func",
"(",
"k",
"KubectlCmd",
")",
"GetResource",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"name",
"string",
",",
"namespace",
"string",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"dynamicIf",
",",
"err",
":=",
"dynamic",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"disco",
",",
"err",
":=",
"discovery",
".",
"NewDiscoveryClientForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"apiResource",
",",
"err",
":=",
"ServerResourceForGroupVersionKind",
"(",
"disco",
",",
"gvk",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"resource",
":=",
"gvk",
".",
"GroupVersion",
"(",
")",
".",
"WithResource",
"(",
"apiResource",
".",
"Name",
")",
"\n",
"resourceIf",
":=",
"ToResourceInterface",
"(",
"dynamicIf",
",",
"apiResource",
",",
"resource",
",",
"namespace",
")",
"\n",
"return",
"resourceIf",
".",
"Get",
"(",
"name",
",",
"metav1",
".",
"GetOptions",
"{",
"}",
")",
"\n",
"}"
] | // GetResource returns resource | [
"GetResource",
"returns",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kube/ctl.go#L133-L149 |
161,991 | argoproj/argo-cd | util/kube/ctl.go | PatchResource | func (k KubectlCmd) PatchResource(config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, patchType types.PatchType, patchBytes []byte) (*unstructured.Unstructured, error) {
dynamicIf, err := dynamic.NewForConfig(config)
if err != nil {
return nil, err
}
disco, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return nil, err
}
apiResource, err := ServerResourceForGroupVersionKind(disco, gvk)
if err != nil {
return nil, err
}
resource := gvk.GroupVersion().WithResource(apiResource.Name)
resourceIf := ToResourceInterface(dynamicIf, apiResource, resource, namespace)
return resourceIf.Patch(name, patchType, patchBytes, metav1.UpdateOptions{})
} | go | func (k KubectlCmd) PatchResource(config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, patchType types.PatchType, patchBytes []byte) (*unstructured.Unstructured, error) {
dynamicIf, err := dynamic.NewForConfig(config)
if err != nil {
return nil, err
}
disco, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return nil, err
}
apiResource, err := ServerResourceForGroupVersionKind(disco, gvk)
if err != nil {
return nil, err
}
resource := gvk.GroupVersion().WithResource(apiResource.Name)
resourceIf := ToResourceInterface(dynamicIf, apiResource, resource, namespace)
return resourceIf.Patch(name, patchType, patchBytes, metav1.UpdateOptions{})
} | [
"func",
"(",
"k",
"KubectlCmd",
")",
"PatchResource",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"name",
"string",
",",
"namespace",
"string",
",",
"patchType",
"types",
".",
"PatchType",
",",
"patchBytes",
"[",
"]",
"byte",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"dynamicIf",
",",
"err",
":=",
"dynamic",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"disco",
",",
"err",
":=",
"discovery",
".",
"NewDiscoveryClientForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"apiResource",
",",
"err",
":=",
"ServerResourceForGroupVersionKind",
"(",
"disco",
",",
"gvk",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"resource",
":=",
"gvk",
".",
"GroupVersion",
"(",
")",
".",
"WithResource",
"(",
"apiResource",
".",
"Name",
")",
"\n",
"resourceIf",
":=",
"ToResourceInterface",
"(",
"dynamicIf",
",",
"apiResource",
",",
"resource",
",",
"namespace",
")",
"\n",
"return",
"resourceIf",
".",
"Patch",
"(",
"name",
",",
"patchType",
",",
"patchBytes",
",",
"metav1",
".",
"UpdateOptions",
"{",
"}",
")",
"\n",
"}"
] | // PatchResource patches resource | [
"PatchResource",
"patches",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kube/ctl.go#L152-L168 |
161,992 | argoproj/argo-cd | util/kube/ctl.go | DeleteResource | func (k KubectlCmd) DeleteResource(config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, forceDelete bool) error {
dynamicIf, err := dynamic.NewForConfig(config)
if err != nil {
return err
}
disco, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return err
}
apiResource, err := ServerResourceForGroupVersionKind(disco, gvk)
if err != nil {
return err
}
resource := gvk.GroupVersion().WithResource(apiResource.Name)
resourceIf := ToResourceInterface(dynamicIf, apiResource, resource, namespace)
propagationPolicy := metav1.DeletePropagationForeground
deleteOptions := &metav1.DeleteOptions{PropagationPolicy: &propagationPolicy}
if forceDelete {
propagationPolicy = metav1.DeletePropagationBackground
zeroGracePeriod := int64(0)
deleteOptions.GracePeriodSeconds = &zeroGracePeriod
}
return resourceIf.Delete(name, deleteOptions)
} | go | func (k KubectlCmd) DeleteResource(config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, forceDelete bool) error {
dynamicIf, err := dynamic.NewForConfig(config)
if err != nil {
return err
}
disco, err := discovery.NewDiscoveryClientForConfig(config)
if err != nil {
return err
}
apiResource, err := ServerResourceForGroupVersionKind(disco, gvk)
if err != nil {
return err
}
resource := gvk.GroupVersion().WithResource(apiResource.Name)
resourceIf := ToResourceInterface(dynamicIf, apiResource, resource, namespace)
propagationPolicy := metav1.DeletePropagationForeground
deleteOptions := &metav1.DeleteOptions{PropagationPolicy: &propagationPolicy}
if forceDelete {
propagationPolicy = metav1.DeletePropagationBackground
zeroGracePeriod := int64(0)
deleteOptions.GracePeriodSeconds = &zeroGracePeriod
}
return resourceIf.Delete(name, deleteOptions)
} | [
"func",
"(",
"k",
"KubectlCmd",
")",
"DeleteResource",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"gvk",
"schema",
".",
"GroupVersionKind",
",",
"name",
"string",
",",
"namespace",
"string",
",",
"forceDelete",
"bool",
")",
"error",
"{",
"dynamicIf",
",",
"err",
":=",
"dynamic",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"disco",
",",
"err",
":=",
"discovery",
".",
"NewDiscoveryClientForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"apiResource",
",",
"err",
":=",
"ServerResourceForGroupVersionKind",
"(",
"disco",
",",
"gvk",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resource",
":=",
"gvk",
".",
"GroupVersion",
"(",
")",
".",
"WithResource",
"(",
"apiResource",
".",
"Name",
")",
"\n",
"resourceIf",
":=",
"ToResourceInterface",
"(",
"dynamicIf",
",",
"apiResource",
",",
"resource",
",",
"namespace",
")",
"\n",
"propagationPolicy",
":=",
"metav1",
".",
"DeletePropagationForeground",
"\n",
"deleteOptions",
":=",
"&",
"metav1",
".",
"DeleteOptions",
"{",
"PropagationPolicy",
":",
"&",
"propagationPolicy",
"}",
"\n",
"if",
"forceDelete",
"{",
"propagationPolicy",
"=",
"metav1",
".",
"DeletePropagationBackground",
"\n",
"zeroGracePeriod",
":=",
"int64",
"(",
"0",
")",
"\n",
"deleteOptions",
".",
"GracePeriodSeconds",
"=",
"&",
"zeroGracePeriod",
"\n",
"}",
"\n\n",
"return",
"resourceIf",
".",
"Delete",
"(",
"name",
",",
"deleteOptions",
")",
"\n",
"}"
] | // DeleteResource deletes resource | [
"DeleteResource",
"deletes",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kube/ctl.go#L171-L195 |
161,993 | argoproj/argo-cd | util/kube/ctl.go | ApplyResource | func (k KubectlCmd) ApplyResource(config *rest.Config, obj *unstructured.Unstructured, namespace string, dryRun, force bool) (string, error) {
log.Infof("Applying resource %s/%s in cluster: %s, namespace: %s", obj.GetKind(), obj.GetName(), config.Host, namespace)
f, err := ioutil.TempFile(util.TempDir, "")
if err != nil {
return "", fmt.Errorf("Failed to generate temp file for kubeconfig: %v", err)
}
_ = f.Close()
err = WriteKubeConfig(config, namespace, f.Name())
if err != nil {
return "", fmt.Errorf("Failed to write kubeconfig: %v", err)
}
defer util.DeleteFile(f.Name())
manifestBytes, err := json.Marshal(obj)
if err != nil {
return "", err
}
var out []string
// If it is an RBAC resource, run `kubectl auth reconcile`. This is preferred over
// `kubectl apply`, which cannot tolerate changes in roleRef, which is an immutable field.
// See: https://github.com/kubernetes/kubernetes/issues/66353
// `auth reconcile` will delete and recreate the resource if necessary
if obj.GetAPIVersion() == "rbac.authorization.k8s.io/v1" {
// `kubectl auth reconcile` has a side effect of auto-creating namespaces if it doesn't exist.
// See: https://github.com/kubernetes/kubernetes/issues/71185. This is behavior which we do
// not want. We need to check if the namespace exists, before know if it is safe to run this
// command. Skip this for dryRuns.
if !dryRun && namespace != "" {
kubeClient, err := kubernetes.NewForConfig(config)
if err != nil {
return "", err
}
_, err = kubeClient.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
if err != nil {
return "", err
}
}
outReconcile, err := runKubectl(f.Name(), namespace, []string{"auth", "reconcile"}, manifestBytes, dryRun)
if err != nil {
return "", err
}
out = append(out, outReconcile)
// We still want to fallthrough and run `kubectl apply` in order set the
// last-applied-configuration annotation in the object.
}
// Run kubectl apply
applyArgs := []string{"apply"}
if force {
applyArgs = append(applyArgs, "--force")
}
outApply, err := runKubectl(f.Name(), namespace, applyArgs, manifestBytes, dryRun)
if err != nil {
return "", err
}
out = append(out, outApply)
return strings.Join(out, ". "), nil
} | go | func (k KubectlCmd) ApplyResource(config *rest.Config, obj *unstructured.Unstructured, namespace string, dryRun, force bool) (string, error) {
log.Infof("Applying resource %s/%s in cluster: %s, namespace: %s", obj.GetKind(), obj.GetName(), config.Host, namespace)
f, err := ioutil.TempFile(util.TempDir, "")
if err != nil {
return "", fmt.Errorf("Failed to generate temp file for kubeconfig: %v", err)
}
_ = f.Close()
err = WriteKubeConfig(config, namespace, f.Name())
if err != nil {
return "", fmt.Errorf("Failed to write kubeconfig: %v", err)
}
defer util.DeleteFile(f.Name())
manifestBytes, err := json.Marshal(obj)
if err != nil {
return "", err
}
var out []string
// If it is an RBAC resource, run `kubectl auth reconcile`. This is preferred over
// `kubectl apply`, which cannot tolerate changes in roleRef, which is an immutable field.
// See: https://github.com/kubernetes/kubernetes/issues/66353
// `auth reconcile` will delete and recreate the resource if necessary
if obj.GetAPIVersion() == "rbac.authorization.k8s.io/v1" {
// `kubectl auth reconcile` has a side effect of auto-creating namespaces if it doesn't exist.
// See: https://github.com/kubernetes/kubernetes/issues/71185. This is behavior which we do
// not want. We need to check if the namespace exists, before know if it is safe to run this
// command. Skip this for dryRuns.
if !dryRun && namespace != "" {
kubeClient, err := kubernetes.NewForConfig(config)
if err != nil {
return "", err
}
_, err = kubeClient.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
if err != nil {
return "", err
}
}
outReconcile, err := runKubectl(f.Name(), namespace, []string{"auth", "reconcile"}, manifestBytes, dryRun)
if err != nil {
return "", err
}
out = append(out, outReconcile)
// We still want to fallthrough and run `kubectl apply` in order set the
// last-applied-configuration annotation in the object.
}
// Run kubectl apply
applyArgs := []string{"apply"}
if force {
applyArgs = append(applyArgs, "--force")
}
outApply, err := runKubectl(f.Name(), namespace, applyArgs, manifestBytes, dryRun)
if err != nil {
return "", err
}
out = append(out, outApply)
return strings.Join(out, ". "), nil
} | [
"func",
"(",
"k",
"KubectlCmd",
")",
"ApplyResource",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"obj",
"*",
"unstructured",
".",
"Unstructured",
",",
"namespace",
"string",
",",
"dryRun",
",",
"force",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"obj",
".",
"GetKind",
"(",
")",
",",
"obj",
".",
"GetName",
"(",
")",
",",
"config",
".",
"Host",
",",
"namespace",
")",
"\n",
"f",
",",
"err",
":=",
"ioutil",
".",
"TempFile",
"(",
"util",
".",
"TempDir",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"_",
"=",
"f",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"WriteKubeConfig",
"(",
"config",
",",
"namespace",
",",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"util",
".",
"DeleteFile",
"(",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"manifestBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"var",
"out",
"[",
"]",
"string",
"\n",
"// If it is an RBAC resource, run `kubectl auth reconcile`. This is preferred over",
"// `kubectl apply`, which cannot tolerate changes in roleRef, which is an immutable field.",
"// See: https://github.com/kubernetes/kubernetes/issues/66353",
"// `auth reconcile` will delete and recreate the resource if necessary",
"if",
"obj",
".",
"GetAPIVersion",
"(",
")",
"==",
"\"",
"\"",
"{",
"// `kubectl auth reconcile` has a side effect of auto-creating namespaces if it doesn't exist.",
"// See: https://github.com/kubernetes/kubernetes/issues/71185. This is behavior which we do",
"// not want. We need to check if the namespace exists, before know if it is safe to run this",
"// command. Skip this for dryRuns.",
"if",
"!",
"dryRun",
"&&",
"namespace",
"!=",
"\"",
"\"",
"{",
"kubeClient",
",",
"err",
":=",
"kubernetes",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"kubeClient",
".",
"CoreV1",
"(",
")",
".",
"Namespaces",
"(",
")",
".",
"Get",
"(",
"namespace",
",",
"metav1",
".",
"GetOptions",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"outReconcile",
",",
"err",
":=",
"runKubectl",
"(",
"f",
".",
"Name",
"(",
")",
",",
"namespace",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"manifestBytes",
",",
"dryRun",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"out",
"=",
"append",
"(",
"out",
",",
"outReconcile",
")",
"\n",
"// We still want to fallthrough and run `kubectl apply` in order set the",
"// last-applied-configuration annotation in the object.",
"}",
"\n\n",
"// Run kubectl apply",
"applyArgs",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"if",
"force",
"{",
"applyArgs",
"=",
"append",
"(",
"applyArgs",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"outApply",
",",
"err",
":=",
"runKubectl",
"(",
"f",
".",
"Name",
"(",
")",
",",
"namespace",
",",
"applyArgs",
",",
"manifestBytes",
",",
"dryRun",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"out",
"=",
"append",
"(",
"out",
",",
"outApply",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"out",
",",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}"
] | // ApplyResource performs an apply of a unstructured resource | [
"ApplyResource",
"performs",
"an",
"apply",
"of",
"a",
"unstructured",
"resource"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/kube/ctl.go#L198-L254 |
161,994 | argoproj/argo-cd | util/settings/settings.go | GetResourceOverrides | func (mgr *SettingsManager) GetResourceOverrides() (map[string]v1alpha1.ResourceOverride, error) {
argoCDCM, err := mgr.configmaps.ConfigMaps(mgr.namespace).Get(common.ArgoCDConfigMapName)
if err != nil {
return nil, err
}
resourceOverrides, err := getResourceOverridesFromConfigMap(argoCDCM)
if err != nil {
return nil, err
}
return resourceOverrides, nil
} | go | func (mgr *SettingsManager) GetResourceOverrides() (map[string]v1alpha1.ResourceOverride, error) {
argoCDCM, err := mgr.configmaps.ConfigMaps(mgr.namespace).Get(common.ArgoCDConfigMapName)
if err != nil {
return nil, err
}
resourceOverrides, err := getResourceOverridesFromConfigMap(argoCDCM)
if err != nil {
return nil, err
}
return resourceOverrides, nil
} | [
"func",
"(",
"mgr",
"*",
"SettingsManager",
")",
"GetResourceOverrides",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"v1alpha1",
".",
"ResourceOverride",
",",
"error",
")",
"{",
"argoCDCM",
",",
"err",
":=",
"mgr",
".",
"configmaps",
".",
"ConfigMaps",
"(",
"mgr",
".",
"namespace",
")",
".",
"Get",
"(",
"common",
".",
"ArgoCDConfigMapName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"resourceOverrides",
",",
"err",
":=",
"getResourceOverridesFromConfigMap",
"(",
"argoCDCM",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"resourceOverrides",
",",
"nil",
"\n",
"}"
] | // GetResouceOverrides loads Resource Overrides from argocd-cm ConfigMap | [
"GetResouceOverrides",
"loads",
"Resource",
"Overrides",
"from",
"argocd",
"-",
"cm",
"ConfigMap"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L178-L189 |
161,995 | argoproj/argo-cd | util/settings/settings.go | GetSettings | func (mgr *SettingsManager) GetSettings() (*ArgoCDSettings, error) {
err := mgr.ensureSynced(false)
if err != nil {
return nil, err
}
argoCDCM, err := mgr.configmaps.ConfigMaps(mgr.namespace).Get(common.ArgoCDConfigMapName)
if err != nil {
return nil, err
}
argoCDSecret, err := mgr.secrets.Secrets(mgr.namespace).Get(common.ArgoCDSecretName)
if err != nil {
return nil, err
}
var settings ArgoCDSettings
var errs []error
if err := updateSettingsFromConfigMap(&settings, argoCDCM); err != nil {
errs = append(errs, err)
}
if err := updateSettingsFromSecret(&settings, argoCDSecret); err != nil {
errs = append(errs, err)
}
if len(errs) > 0 {
return &settings, errs[0]
}
return &settings, nil
} | go | func (mgr *SettingsManager) GetSettings() (*ArgoCDSettings, error) {
err := mgr.ensureSynced(false)
if err != nil {
return nil, err
}
argoCDCM, err := mgr.configmaps.ConfigMaps(mgr.namespace).Get(common.ArgoCDConfigMapName)
if err != nil {
return nil, err
}
argoCDSecret, err := mgr.secrets.Secrets(mgr.namespace).Get(common.ArgoCDSecretName)
if err != nil {
return nil, err
}
var settings ArgoCDSettings
var errs []error
if err := updateSettingsFromConfigMap(&settings, argoCDCM); err != nil {
errs = append(errs, err)
}
if err := updateSettingsFromSecret(&settings, argoCDSecret); err != nil {
errs = append(errs, err)
}
if len(errs) > 0 {
return &settings, errs[0]
}
return &settings, nil
} | [
"func",
"(",
"mgr",
"*",
"SettingsManager",
")",
"GetSettings",
"(",
")",
"(",
"*",
"ArgoCDSettings",
",",
"error",
")",
"{",
"err",
":=",
"mgr",
".",
"ensureSynced",
"(",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"argoCDCM",
",",
"err",
":=",
"mgr",
".",
"configmaps",
".",
"ConfigMaps",
"(",
"mgr",
".",
"namespace",
")",
".",
"Get",
"(",
"common",
".",
"ArgoCDConfigMapName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"argoCDSecret",
",",
"err",
":=",
"mgr",
".",
"secrets",
".",
"Secrets",
"(",
"mgr",
".",
"namespace",
")",
".",
"Get",
"(",
"common",
".",
"ArgoCDSecretName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"settings",
"ArgoCDSettings",
"\n",
"var",
"errs",
"[",
"]",
"error",
"\n",
"if",
"err",
":=",
"updateSettingsFromConfigMap",
"(",
"&",
"settings",
",",
"argoCDCM",
")",
";",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"updateSettingsFromSecret",
"(",
"&",
"settings",
",",
"argoCDSecret",
")",
";",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"errs",
")",
">",
"0",
"{",
"return",
"&",
"settings",
",",
"errs",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"&",
"settings",
",",
"nil",
"\n",
"}"
] | // GetSettings retrieves settings from the ArgoCDConfigMap and secret. | [
"GetSettings",
"retrieves",
"settings",
"from",
"the",
"ArgoCDConfigMap",
"and",
"secret",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L192-L217 |
161,996 | argoproj/argo-cd | util/settings/settings.go | updateSettingsFromSecret | func updateSettingsFromSecret(settings *ArgoCDSettings, argoCDSecret *apiv1.Secret) error {
var errs []error
adminPasswordHash, ok := argoCDSecret.Data[settingAdminPasswordHashKey]
if ok {
settings.AdminPasswordHash = string(adminPasswordHash)
} else {
errs = append(errs, &incompleteSettingsError{message: "admin.password is missing"})
}
adminPasswordMtimeBytes, ok := argoCDSecret.Data[settingAdminPasswordMtimeKey]
if ok {
if adminPasswordMtime, err := time.Parse(time.RFC3339, string(adminPasswordMtimeBytes)); err == nil {
settings.AdminPasswordMtime = adminPasswordMtime
}
}
secretKey, ok := argoCDSecret.Data[settingServerSignatureKey]
if ok {
settings.ServerSignature = secretKey
} else {
errs = append(errs, &incompleteSettingsError{message: "server.secretkey is missing"})
}
if githubWebhookSecret := argoCDSecret.Data[settingsWebhookGitHubSecretKey]; len(githubWebhookSecret) > 0 {
settings.WebhookGitHubSecret = string(githubWebhookSecret)
}
if gitlabWebhookSecret := argoCDSecret.Data[settingsWebhookGitLabSecretKey]; len(gitlabWebhookSecret) > 0 {
settings.WebhookGitLabSecret = string(gitlabWebhookSecret)
}
if bitbucketWebhookUUID := argoCDSecret.Data[settingsWebhookBitbucketUUIDKey]; len(bitbucketWebhookUUID) > 0 {
settings.WebhookBitbucketUUID = string(bitbucketWebhookUUID)
}
serverCert, certOk := argoCDSecret.Data[settingServerCertificate]
serverKey, keyOk := argoCDSecret.Data[settingServerPrivateKey]
if certOk && keyOk {
cert, err := tls.X509KeyPair(serverCert, serverKey)
if err != nil {
errs = append(errs, &incompleteSettingsError{message: fmt.Sprintf("invalid x509 key pair %s/%s in secret: %s", settingServerCertificate, settingServerPrivateKey, err)})
} else {
settings.Certificate = &cert
}
}
secretValues := make(map[string]string, len(argoCDSecret.Data))
for k, v := range argoCDSecret.Data {
secretValues[k] = string(v)
}
settings.Secrets = secretValues
if len(errs) > 0 {
return errs[0]
}
return nil
} | go | func updateSettingsFromSecret(settings *ArgoCDSettings, argoCDSecret *apiv1.Secret) error {
var errs []error
adminPasswordHash, ok := argoCDSecret.Data[settingAdminPasswordHashKey]
if ok {
settings.AdminPasswordHash = string(adminPasswordHash)
} else {
errs = append(errs, &incompleteSettingsError{message: "admin.password is missing"})
}
adminPasswordMtimeBytes, ok := argoCDSecret.Data[settingAdminPasswordMtimeKey]
if ok {
if adminPasswordMtime, err := time.Parse(time.RFC3339, string(adminPasswordMtimeBytes)); err == nil {
settings.AdminPasswordMtime = adminPasswordMtime
}
}
secretKey, ok := argoCDSecret.Data[settingServerSignatureKey]
if ok {
settings.ServerSignature = secretKey
} else {
errs = append(errs, &incompleteSettingsError{message: "server.secretkey is missing"})
}
if githubWebhookSecret := argoCDSecret.Data[settingsWebhookGitHubSecretKey]; len(githubWebhookSecret) > 0 {
settings.WebhookGitHubSecret = string(githubWebhookSecret)
}
if gitlabWebhookSecret := argoCDSecret.Data[settingsWebhookGitLabSecretKey]; len(gitlabWebhookSecret) > 0 {
settings.WebhookGitLabSecret = string(gitlabWebhookSecret)
}
if bitbucketWebhookUUID := argoCDSecret.Data[settingsWebhookBitbucketUUIDKey]; len(bitbucketWebhookUUID) > 0 {
settings.WebhookBitbucketUUID = string(bitbucketWebhookUUID)
}
serverCert, certOk := argoCDSecret.Data[settingServerCertificate]
serverKey, keyOk := argoCDSecret.Data[settingServerPrivateKey]
if certOk && keyOk {
cert, err := tls.X509KeyPair(serverCert, serverKey)
if err != nil {
errs = append(errs, &incompleteSettingsError{message: fmt.Sprintf("invalid x509 key pair %s/%s in secret: %s", settingServerCertificate, settingServerPrivateKey, err)})
} else {
settings.Certificate = &cert
}
}
secretValues := make(map[string]string, len(argoCDSecret.Data))
for k, v := range argoCDSecret.Data {
secretValues[k] = string(v)
}
settings.Secrets = secretValues
if len(errs) > 0 {
return errs[0]
}
return nil
} | [
"func",
"updateSettingsFromSecret",
"(",
"settings",
"*",
"ArgoCDSettings",
",",
"argoCDSecret",
"*",
"apiv1",
".",
"Secret",
")",
"error",
"{",
"var",
"errs",
"[",
"]",
"error",
"\n",
"adminPasswordHash",
",",
"ok",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingAdminPasswordHashKey",
"]",
"\n",
"if",
"ok",
"{",
"settings",
".",
"AdminPasswordHash",
"=",
"string",
"(",
"adminPasswordHash",
")",
"\n",
"}",
"else",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"&",
"incompleteSettingsError",
"{",
"message",
":",
"\"",
"\"",
"}",
")",
"\n",
"}",
"\n",
"adminPasswordMtimeBytes",
",",
"ok",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingAdminPasswordMtimeKey",
"]",
"\n",
"if",
"ok",
"{",
"if",
"adminPasswordMtime",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"time",
".",
"RFC3339",
",",
"string",
"(",
"adminPasswordMtimeBytes",
")",
")",
";",
"err",
"==",
"nil",
"{",
"settings",
".",
"AdminPasswordMtime",
"=",
"adminPasswordMtime",
"\n",
"}",
"\n",
"}",
"\n",
"secretKey",
",",
"ok",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingServerSignatureKey",
"]",
"\n",
"if",
"ok",
"{",
"settings",
".",
"ServerSignature",
"=",
"secretKey",
"\n",
"}",
"else",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"&",
"incompleteSettingsError",
"{",
"message",
":",
"\"",
"\"",
"}",
")",
"\n",
"}",
"\n",
"if",
"githubWebhookSecret",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingsWebhookGitHubSecretKey",
"]",
";",
"len",
"(",
"githubWebhookSecret",
")",
">",
"0",
"{",
"settings",
".",
"WebhookGitHubSecret",
"=",
"string",
"(",
"githubWebhookSecret",
")",
"\n",
"}",
"\n",
"if",
"gitlabWebhookSecret",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingsWebhookGitLabSecretKey",
"]",
";",
"len",
"(",
"gitlabWebhookSecret",
")",
">",
"0",
"{",
"settings",
".",
"WebhookGitLabSecret",
"=",
"string",
"(",
"gitlabWebhookSecret",
")",
"\n",
"}",
"\n",
"if",
"bitbucketWebhookUUID",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingsWebhookBitbucketUUIDKey",
"]",
";",
"len",
"(",
"bitbucketWebhookUUID",
")",
">",
"0",
"{",
"settings",
".",
"WebhookBitbucketUUID",
"=",
"string",
"(",
"bitbucketWebhookUUID",
")",
"\n",
"}",
"\n\n",
"serverCert",
",",
"certOk",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingServerCertificate",
"]",
"\n",
"serverKey",
",",
"keyOk",
":=",
"argoCDSecret",
".",
"Data",
"[",
"settingServerPrivateKey",
"]",
"\n",
"if",
"certOk",
"&&",
"keyOk",
"{",
"cert",
",",
"err",
":=",
"tls",
".",
"X509KeyPair",
"(",
"serverCert",
",",
"serverKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"&",
"incompleteSettingsError",
"{",
"message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"settingServerCertificate",
",",
"settingServerPrivateKey",
",",
"err",
")",
"}",
")",
"\n",
"}",
"else",
"{",
"settings",
".",
"Certificate",
"=",
"&",
"cert",
"\n",
"}",
"\n",
"}",
"\n",
"secretValues",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"argoCDSecret",
".",
"Data",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"argoCDSecret",
".",
"Data",
"{",
"secretValues",
"[",
"k",
"]",
"=",
"string",
"(",
"v",
")",
"\n",
"}",
"\n",
"settings",
".",
"Secrets",
"=",
"secretValues",
"\n",
"if",
"len",
"(",
"errs",
")",
">",
"0",
"{",
"return",
"errs",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // updateSettingsFromSecret transfers settings from a Kubernetes secret into an ArgoCDSettings struct. | [
"updateSettingsFromSecret",
"transfers",
"settings",
"from",
"a",
"Kubernetes",
"secret",
"into",
"an",
"ArgoCDSettings",
"struct",
"."
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L433-L482 |
161,997 | argoproj/argo-cd | util/settings/settings.go | NewSettingsManager | func NewSettingsManager(ctx context.Context, clientset kubernetes.Interface, namespace string) *SettingsManager {
mgr := &SettingsManager{
ctx: ctx,
clientset: clientset,
namespace: namespace,
mutex: &sync.Mutex{},
}
return mgr
} | go | func NewSettingsManager(ctx context.Context, clientset kubernetes.Interface, namespace string) *SettingsManager {
mgr := &SettingsManager{
ctx: ctx,
clientset: clientset,
namespace: namespace,
mutex: &sync.Mutex{},
}
return mgr
} | [
"func",
"NewSettingsManager",
"(",
"ctx",
"context",
".",
"Context",
",",
"clientset",
"kubernetes",
".",
"Interface",
",",
"namespace",
"string",
")",
"*",
"SettingsManager",
"{",
"mgr",
":=",
"&",
"SettingsManager",
"{",
"ctx",
":",
"ctx",
",",
"clientset",
":",
"clientset",
",",
"namespace",
":",
"namespace",
",",
"mutex",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"}",
"\n\n",
"return",
"mgr",
"\n",
"}"
] | // NewSettingsManager generates a new SettingsManager pointer and returns it | [
"NewSettingsManager",
"generates",
"a",
"new",
"SettingsManager",
"pointer",
"and",
"returns",
"it"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L637-L647 |
161,998 | argoproj/argo-cd | util/settings/settings.go | IsSSOConfigured | func (a *ArgoCDSettings) IsSSOConfigured() bool {
if a.IsDexConfigured() {
return true
}
if a.OIDCConfig() != nil {
return true
}
return false
} | go | func (a *ArgoCDSettings) IsSSOConfigured() bool {
if a.IsDexConfigured() {
return true
}
if a.OIDCConfig() != nil {
return true
}
return false
} | [
"func",
"(",
"a",
"*",
"ArgoCDSettings",
")",
"IsSSOConfigured",
"(",
")",
"bool",
"{",
"if",
"a",
".",
"IsDexConfigured",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"a",
".",
"OIDCConfig",
"(",
")",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IsSSOConfigured returns whether or not single-sign-on is configured | [
"IsSSOConfigured",
"returns",
"whether",
"or",
"not",
"single",
"-",
"sign",
"-",
"on",
"is",
"configured"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L654-L662 |
161,999 | argoproj/argo-cd | util/settings/settings.go | TLSConfig | func (a *ArgoCDSettings) TLSConfig() *tls.Config {
if a.Certificate == nil {
return nil
}
certPool := x509.NewCertPool()
pemCertBytes, _ := tlsutil.EncodeX509KeyPair(*a.Certificate)
ok := certPool.AppendCertsFromPEM(pemCertBytes)
if !ok {
panic("bad certs")
}
return &tls.Config{
RootCAs: certPool,
}
} | go | func (a *ArgoCDSettings) TLSConfig() *tls.Config {
if a.Certificate == nil {
return nil
}
certPool := x509.NewCertPool()
pemCertBytes, _ := tlsutil.EncodeX509KeyPair(*a.Certificate)
ok := certPool.AppendCertsFromPEM(pemCertBytes)
if !ok {
panic("bad certs")
}
return &tls.Config{
RootCAs: certPool,
}
} | [
"func",
"(",
"a",
"*",
"ArgoCDSettings",
")",
"TLSConfig",
"(",
")",
"*",
"tls",
".",
"Config",
"{",
"if",
"a",
".",
"Certificate",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"certPool",
":=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"pemCertBytes",
",",
"_",
":=",
"tlsutil",
".",
"EncodeX509KeyPair",
"(",
"*",
"a",
".",
"Certificate",
")",
"\n",
"ok",
":=",
"certPool",
".",
"AppendCertsFromPEM",
"(",
"pemCertBytes",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"tls",
".",
"Config",
"{",
"RootCAs",
":",
"certPool",
",",
"}",
"\n",
"}"
] | // TLSConfig returns a tls.Config with the configured certificates | [
"TLSConfig",
"returns",
"a",
"tls",
".",
"Config",
"with",
"the",
"configured",
"certificates"
] | 5c353a12f2c67d8ab0d5d9aa619c9059c5261640 | https://github.com/argoproj/argo-cd/blob/5c353a12f2c67d8ab0d5d9aa619c9059c5261640/util/settings/settings.go#L692-L705 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.