query_docstring
stringlengths 24
20.8k
| positive_code
stringlengths 17
325k
| hard_negative_code
stringlengths 17
325k
| similarity_score
float64 0.3
1
| query_repo
stringclasses 407
values | query_path
stringlengths 5
170
| hn_repo
stringclasses 400
values | hn_path
stringlengths 5
170
| hn_license
stringclasses 4
values | language
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|
CreateDatasetRequest generates a "aws/request.Request" representing the
client's request for the CreateDataset operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See CreateDataset for more information on using the CreateDataset
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the CreateDatasetRequest method.
req, resp := client.CreateDatasetRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/finspace-2020-07-13/CreateDataset
Deprecated: This method will be discontinued. | func (c *FinSpaceData) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
if c.Client.Config.Logger != nil {
c.Client.Config.Logger.Log("This operation, CreateDataset, has been deprecated")
}
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/datasetsv2",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *LookoutForVision) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/2020-11-20/projects/{projectName}/datasets",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | 0.995466 | aws/aws-sdk-go | service/finspacedata/api.go | aws/aws-sdk-go | service/lookoutforvision/api.go | Apache-2.0 | go |
CreateDatasetRequest generates a "aws/request.Request" representing the
client's request for the CreateDataset operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See CreateDataset for more information on using the CreateDataset
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the CreateDatasetRequest method.
req, resp := client.CreateDatasetRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/finspace-2020-07-13/CreateDataset
Deprecated: This method will be discontinued. | func (c *FinSpaceData) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
if c.Client.Config.Logger != nil {
c.Client.Config.Logger.Log("This operation, CreateDataset, has been deprecated")
}
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/datasetsv2",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *Personalize) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | 0.992797 | aws/aws-sdk-go | service/finspacedata/api.go | aws/aws-sdk-go | service/personalize/api.go | Apache-2.0 | go |
CreateDatasetRequest generates a "aws/request.Request" representing the
client's request for the CreateDataset operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See CreateDataset for more information on using the CreateDataset
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the CreateDatasetRequest method.
req, resp := client.CreateDatasetRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/finspace-2020-07-13/CreateDataset
Deprecated: This method will be discontinued. | func (c *FinSpaceData) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
if c.Client.Config.Logger != nil {
c.Client.Config.Logger.Log("This operation, CreateDataset, has been deprecated")
}
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/datasetsv2",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *LookoutEquipment) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | 0.990412 | aws/aws-sdk-go | service/finspacedata/api.go | aws/aws-sdk-go | service/lookoutequipment/api.go | Apache-2.0 | go |
CreateDatasetRequest generates a "aws/request.Request" representing the
client's request for the CreateDataset operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See CreateDataset for more information on using the CreateDataset
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the CreateDatasetRequest method.
req, resp := client.CreateDatasetRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/finspace-2020-07-13/CreateDataset
Deprecated: This method will be discontinued. | func (c *FinSpaceData) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
if c.Client.Config.Logger != nil {
c.Client.Config.Logger.Log("This operation, CreateDataset, has been deprecated")
}
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/datasetsv2",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *GlueDataBrew) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/datasets",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | 0.988479 | aws/aws-sdk-go | service/finspacedata/api.go | aws/aws-sdk-go | service/gluedatabrew/api.go | Apache-2.0 | go |
CreateDatasetRequest generates a "aws/request.Request" representing the
client's request for the CreateDataset operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See CreateDataset for more information on using the CreateDataset
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the CreateDatasetRequest method.
req, resp := client.CreateDatasetRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/finspace-2020-07-13/CreateDataset
Deprecated: This method will be discontinued. | func (c *FinSpaceData) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
if c.Client.Config.Logger != nil {
c.Client.Config.Logger.Log("This operation, CreateDataset, has been deprecated")
}
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/datasetsv2",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *Rekognition) CreateDatasetRequest(input *CreateDatasetInput) (req *request.Request, output *CreateDatasetOutput) {
op := &request.Operation{
Name: opCreateDataset,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &CreateDatasetInput{}
}
output = &CreateDatasetOutput{}
req = c.newRequest(op, input, output)
return
} | 0.981814 | aws/aws-sdk-go | service/finspacedata/api.go | aws/aws-sdk-go | service/rekognition/api.go | Apache-2.0 | go |
AssertNoSubset asserts that the second parameter is not a subset of the list.
The order is irrelevant.
When using a custom message, the same formatting as with fmt.Sprintf() is used.
Example:
testza.AssertNoSubset(t, []int{1, 2, 3}, []int{1, 7})
testza.AssertNoSubset(t, []string{"Hello", "World", "Test"}, []string{"Test", "John"}) | func AssertNoSubset(t testRunner, list any, subset any, msg ...any) {
if test, ok := t.(helper); ok {
test.Helper()
}
if internal.IsSubset(t, list, subset) {
internal.Fail(t, "The second parameter !!is a subset of the list!!, but should not be.", internal.Objects{internal.NewObjectsSingleNamed("List", list)[0], internal.NewObjectsSingleNamed("Subset", subset)[0]}, msg...)
}
} | func AssertSubset(t testRunner, list any, subset any, msg ...any) {
if test, ok := t.(helper); ok {
test.Helper()
}
if !internal.IsSubset(t, list, subset) {
internal.Fail(t, "The second parameter !!is not a subset of the list!!, but should be.", internal.Objects{internal.NewObjectsSingleNamed("List", list)[0], internal.NewObjectsSingleNamed("Subset", subset)[0]}, msg...)
}
} | 0.951978 | MarvinJWendt/testza | assert.go | MarvinJWendt/testza | assert.go | MIT | go |
AssertNoSubset asserts that the second parameter is not a subset of the list.
The order is irrelevant.
When using a custom message, the same formatting as with fmt.Sprintf() is used.
Example:
testza.AssertNoSubset(t, []int{1, 2, 3}, []int{1, 7})
testza.AssertNoSubset(t, []string{"Hello", "World", "Test"}, []string{"Test", "John"}) | func AssertNoSubset(t testRunner, list any, subset any, msg ...any) {
if test, ok := t.(helper); ok {
test.Helper()
}
if internal.IsSubset(t, list, subset) {
internal.Fail(t, "The second parameter !!is a subset of the list!!, but should not be.", internal.Objects{internal.NewObjectsSingleNamed("List", list)[0], internal.NewObjectsSingleNamed("Subset", subset)[0]}, msg...)
}
} | func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
}
return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
} | 0.780437 | MarvinJWendt/testza | assert.go | umputun/tg-spam | vendor/github.com/stretchr/testify/assert/assertion_format.go | MIT | go |
AssertNoSubset asserts that the second parameter is not a subset of the list.
The order is irrelevant.
When using a custom message, the same formatting as with fmt.Sprintf() is used.
Example:
testza.AssertNoSubset(t, []int{1, 2, 3}, []int{1, 7})
testza.AssertNoSubset(t, []string{"Hello", "World", "Test"}, []string{"Test", "John"}) | func AssertNoSubset(t testRunner, list any, subset any, msg ...any) {
if test, ok := t.(helper); ok {
test.Helper()
}
if internal.IsSubset(t, list, subset) {
internal.Fail(t, "The second parameter !!is a subset of the list!!, but should not be.", internal.Objects{internal.NewObjectsSingleNamed("List", list)[0], internal.NewObjectsSingleNamed("Subset", subset)[0]}, msg...)
}
} | func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if subset == nil {
return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...)
}
defer func() {
if e := recover(); e != nil {
ok = false
}
}()
listKind := reflect.TypeOf(list).Kind()
subsetKind := reflect.TypeOf(subset).Kind()
if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
}
if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
}
subsetValue := reflect.ValueOf(subset)
if subsetKind == reflect.Map && listKind == reflect.Map {
listValue := reflect.ValueOf(list)
subsetKeys := subsetValue.MapKeys()
for i := 0; i < len(subsetKeys); i++ {
subsetKey := subsetKeys[i]
subsetElement := subsetValue.MapIndex(subsetKey).Interface()
listElement := listValue.MapIndex(subsetKey).Interface()
if !ObjectsAreEqual(subsetElement, listElement) {
return true
}
}
return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
}
for i := 0; i < subsetValue.Len(); i++ {
element := subsetValue.Index(i).Interface()
ok, found := containsElement(list, element)
if !ok {
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
}
if !found {
return true
}
}
return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
} | 0.774646 | MarvinJWendt/testza | assert.go | DavidDeSimone/OpenCloudSaves | vendor/github.com/stretchr/testify/assert/assertions.go | MIT | go |
AssertNoSubset asserts that the second parameter is not a subset of the list.
The order is irrelevant.
When using a custom message, the same formatting as with fmt.Sprintf() is used.
Example:
testza.AssertNoSubset(t, []int{1, 2, 3}, []int{1, 7})
testza.AssertNoSubset(t, []string{"Hello", "World", "Test"}, []string{"Test", "John"}) | func AssertNoSubset(t testRunner, list any, subset any, msg ...any) {
if test, ok := t.(helper); ok {
test.Helper()
}
if internal.IsSubset(t, list, subset) {
internal.Fail(t, "The second parameter !!is a subset of the list!!, but should not be.", internal.Objects{internal.NewObjectsSingleNamed("List", list)[0], internal.NewObjectsSingleNamed("Subset", subset)[0]}, msg...)
}
} | func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
}
NotSubset(a.t, list, subset, msgAndArgs...)
} | 0.77242 | MarvinJWendt/testza | assert.go | Shopify/ghostferry | vendor/github.com/stretchr/testify/require/require_forward.go | MIT | go |
AssertNoSubset asserts that the second parameter is not a subset of the list.
The order is irrelevant.
When using a custom message, the same formatting as with fmt.Sprintf() is used.
Example:
testza.AssertNoSubset(t, []int{1, 2, 3}, []int{1, 7})
testza.AssertNoSubset(t, []string{"Hello", "World", "Test"}, []string{"Test", "John"}) | func AssertNoSubset(t testRunner, list any, subset any, msg ...any) {
if test, ok := t.(helper); ok {
test.Helper()
}
if internal.IsSubset(t, list, subset) {
internal.Fail(t, "The second parameter !!is a subset of the list!!, but should not be.", internal.Objects{internal.NewObjectsSingleNamed("List", list)[0], internal.NewObjectsSingleNamed("Subset", subset)[0]}, msg...)
}
} | func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
if h, ok := t.(tHelper); ok {
h.Helper()
}
if subset == nil {
return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...)
}
listKind := reflect.TypeOf(list).Kind()
if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
}
subsetKind := reflect.TypeOf(subset).Kind()
if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map {
return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
}
if subsetKind == reflect.Map && listKind == reflect.Map {
subsetMap := reflect.ValueOf(subset)
actualMap := reflect.ValueOf(list)
for _, k := range subsetMap.MapKeys() {
ev := subsetMap.MapIndex(k)
av := actualMap.MapIndex(k)
if !av.IsValid() {
return true
}
if !ObjectsAreEqual(ev.Interface(), av.Interface()) {
return true
}
}
return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
}
subsetList := reflect.ValueOf(subset)
for i := 0; i < subsetList.Len(); i++ {
element := subsetList.Index(i).Interface()
ok, found := containsElement(list, element)
if !ok {
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
}
if !found {
return true
}
}
return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
} | 0.770979 | MarvinJWendt/testza | assert.go | umputun/tg-spam | vendor/github.com/stretchr/testify/assert/assertions.go | MIT | go |
String produces a single-line version info
This looks like:
```
u<version>-<git revision>-<build status>
``` | func (b BuildInfo) String() string {
return fmt.Sprintf("%v-%v-%v",
b.Version,
b.GitRevision,
b.BuildStatus)
} | func Version() string {
return sys.TheVersion
} | 0.691341 | istio/istio | pkg/version/version.go | mit-pdos/biscuit | src/runtime/extern.go | BSD-3-Clause | go |
String produces a single-line version info
This looks like:
```
u<version>-<git revision>-<build status>
``` | func (b BuildInfo) String() string {
return fmt.Sprintf("%v-%v-%v",
b.Version,
b.GitRevision,
b.BuildStatus)
} | func (v *Version) String() string {
var buf bytes.Buffer
fmtParts := make([]string, len(v.segments))
for i, s := range v.segments {
// We can ignore err here since we've pre-parsed the values in segments
str := strconv.FormatInt(s, 10)
fmtParts[i] = str
}
fmt.Fprintf(&buf, strings.Join(fmtParts, "."))
if v.pre != "" {
fmt.Fprintf(&buf, "-%s", v.pre)
}
if v.metadata != "" {
fmt.Fprintf(&buf, "+%s", v.metadata)
}
return buf.String()
} | 0.685228 | istio/istio | pkg/version/version.go | appscode/osm | vendor/gomodules.xyz/version/version.go | Apache-2.0 | go |
String produces a single-line version info
This looks like:
```
u<version>-<git revision>-<build status>
``` | func (b BuildInfo) String() string {
return fmt.Sprintf("%v-%v-%v",
b.Version,
b.GitRevision,
b.BuildStatus)
} | func GetVersion() string {
if version != "" {
return version
}
return "unknown"
} | 0.679366 | istio/istio | pkg/version/version.go | OdyseeTeam/chainquery | meta/meta.go | MIT | go |
String produces a single-line version info
This looks like:
```
u<version>-<git revision>-<build status>
``` | func (b BuildInfo) String() string {
return fmt.Sprintf("%v-%v-%v",
b.Version,
b.GitRevision,
b.BuildStatus)
} | func (c *Client) Version() (*Env, error) {
return c.VersionWithContext(context.TODO())
} | 0.645529 | istio/istio | pkg/version/version.go | fsouza/go-dockerclient | misc.go | BSD-2-Clause | go |
String produces a single-line version info
This looks like:
```
u<version>-<git revision>-<build status>
``` | func (b BuildInfo) String() string {
return fmt.Sprintf("%v-%v-%v",
b.Version,
b.GitRevision,
b.BuildStatus)
} | func longVersion() string {
buf := bytes.NewBuffer(nil)
fmt.Fprintln(buf, "Version:", _buildVersion)
fmt.Fprintln(buf, "Git SHA:", _buildGitRevision)
fmt.Fprintln(buf, "Go Version:", _buildGoVersion)
fmt.Fprintln(buf, "Building OS/Arch:", _buildOS)
fmt.Fprintln(buf, "Running OS/Arch:", _runningOS)
return buf.String()
} | 0.633231 | istio/istio | pkg/version/version.go | apache/apisix-go-plugin-runner | cmd/go-runner/version.go | Apache-2.0 | go |
TransferInputDevice API operation for AWS Elemental MediaLive.
Start an input device transfer to another AWS account. After you make the
request, the other account must accept or reject the transfer.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Elemental MediaLive's
API operation TransferInputDevice for usage and error information.
Returned Error Types:
- BadRequestException
- UnprocessableEntityException
- InternalServerErrorException
- ForbiddenException
- BadGatewayException
- NotFoundException
- GatewayTimeoutException
- TooManyRequestsException
- ConflictException
See also, https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/TransferInputDevice | func (c *MediaLive) TransferInputDevice(input *TransferInputDeviceInput) (*TransferInputDeviceOutput, error) {
req, out := c.TransferInputDeviceRequest(input)
return out, req.Send()
} | func (c *MediaLive) AcceptInputDeviceTransfer(input *AcceptInputDeviceTransferInput) (*AcceptInputDeviceTransferOutput, error) {
req, out := c.AcceptInputDeviceTransferRequest(input)
return out, req.Send()
} | 0.828099 | aws/aws-sdk-go | service/medialive/api.go | aws/aws-sdk-go | service/medialive/api.go | Apache-2.0 | go |
TransferInputDevice API operation for AWS Elemental MediaLive.
Start an input device transfer to another AWS account. After you make the
request, the other account must accept or reject the transfer.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Elemental MediaLive's
API operation TransferInputDevice for usage and error information.
Returned Error Types:
- BadRequestException
- UnprocessableEntityException
- InternalServerErrorException
- ForbiddenException
- BadGatewayException
- NotFoundException
- GatewayTimeoutException
- TooManyRequestsException
- ConflictException
See also, https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/TransferInputDevice | func (c *MediaLive) TransferInputDevice(input *TransferInputDeviceInput) (*TransferInputDeviceOutput, error) {
req, out := c.TransferInputDeviceRequest(input)
return out, req.Send()
} | func (c *MediaLive) StartInputDevice(input *StartInputDeviceInput) (*StartInputDeviceOutput, error) {
req, out := c.StartInputDeviceRequest(input)
return out, req.Send()
} | 0.821008 | aws/aws-sdk-go | service/medialive/api.go | aws/aws-sdk-go | service/medialive/api.go | Apache-2.0 | go |
TransferInputDevice API operation for AWS Elemental MediaLive.
Start an input device transfer to another AWS account. After you make the
request, the other account must accept or reject the transfer.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Elemental MediaLive's
API operation TransferInputDevice for usage and error information.
Returned Error Types:
- BadRequestException
- UnprocessableEntityException
- InternalServerErrorException
- ForbiddenException
- BadGatewayException
- NotFoundException
- GatewayTimeoutException
- TooManyRequestsException
- ConflictException
See also, https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/TransferInputDevice | func (c *MediaLive) TransferInputDevice(input *TransferInputDeviceInput) (*TransferInputDeviceOutput, error) {
req, out := c.TransferInputDeviceRequest(input)
return out, req.Send()
} | func (c *MediaLive) ListInputDeviceTransfers(input *ListInputDeviceTransfersInput) (*ListInputDeviceTransfersOutput, error) {
req, out := c.ListInputDeviceTransfersRequest(input)
return out, req.Send()
} | 0.819634 | aws/aws-sdk-go | service/medialive/api.go | aws/aws-sdk-go | service/medialive/api.go | Apache-2.0 | go |
TransferInputDevice API operation for AWS Elemental MediaLive.
Start an input device transfer to another AWS account. After you make the
request, the other account must accept or reject the transfer.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Elemental MediaLive's
API operation TransferInputDevice for usage and error information.
Returned Error Types:
- BadRequestException
- UnprocessableEntityException
- InternalServerErrorException
- ForbiddenException
- BadGatewayException
- NotFoundException
- GatewayTimeoutException
- TooManyRequestsException
- ConflictException
See also, https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/TransferInputDevice | func (c *MediaLive) TransferInputDevice(input *TransferInputDeviceInput) (*TransferInputDeviceOutput, error) {
req, out := c.TransferInputDeviceRequest(input)
return out, req.Send()
} | func (c *MediaLive) CancelInputDeviceTransfer(input *CancelInputDeviceTransferInput) (*CancelInputDeviceTransferOutput, error) {
req, out := c.CancelInputDeviceTransferRequest(input)
return out, req.Send()
} | 0.757054 | aws/aws-sdk-go | service/medialive/api.go | aws/aws-sdk-go | service/medialive/api.go | Apache-2.0 | go |
TransferInputDevice API operation for AWS Elemental MediaLive.
Start an input device transfer to another AWS account. After you make the
request, the other account must accept or reject the transfer.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Elemental MediaLive's
API operation TransferInputDevice for usage and error information.
Returned Error Types:
- BadRequestException
- UnprocessableEntityException
- InternalServerErrorException
- ForbiddenException
- BadGatewayException
- NotFoundException
- GatewayTimeoutException
- TooManyRequestsException
- ConflictException
See also, https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/TransferInputDevice | func (c *MediaLive) TransferInputDevice(input *TransferInputDeviceInput) (*TransferInputDeviceOutput, error) {
req, out := c.TransferInputDeviceRequest(input)
return out, req.Send()
} | func (c *MediaLive) RejectInputDeviceTransfer(input *RejectInputDeviceTransferInput) (*RejectInputDeviceTransferOutput, error) {
req, out := c.RejectInputDeviceTransferRequest(input)
return out, req.Send()
} | 0.741105 | aws/aws-sdk-go | service/medialive/api.go | aws/aws-sdk-go | service/medialive/api.go | Apache-2.0 | go |
DescribeTemplatePermissionsRequest generates a "aws/request.Request" representing the
client's request for the DescribeTemplatePermissions operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See DescribeTemplatePermissions for more information on using the DescribeTemplatePermissions
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the DescribeTemplatePermissionsRequest method.
req, resp := client.DescribeTemplatePermissionsRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/quicksight-2018-04-01/DescribeTemplatePermissions | func (c *QuickSight) DescribeTemplatePermissionsRequest(input *DescribeTemplatePermissionsInput) (req *request.Request, output *DescribeTemplatePermissionsOutput) {
op := &request.Operation{
Name: opDescribeTemplatePermissions,
HTTPMethod: "GET",
HTTPPath: "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions",
}
if input == nil {
input = &DescribeTemplatePermissionsInput{}
}
output = &DescribeTemplatePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *QuickSight) UpdateTemplatePermissionsRequest(input *UpdateTemplatePermissionsInput) (req *request.Request, output *UpdateTemplatePermissionsOutput) {
op := &request.Operation{
Name: opUpdateTemplatePermissions,
HTTPMethod: "PUT",
HTTPPath: "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions",
}
if input == nil {
input = &UpdateTemplatePermissionsInput{}
}
output = &UpdateTemplatePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | 0.85561 | aws/aws-sdk-go | service/quicksight/api.go | aws/aws-sdk-go | service/quicksight/api.go | Apache-2.0 | go |
DescribeTemplatePermissionsRequest generates a "aws/request.Request" representing the
client's request for the DescribeTemplatePermissions operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See DescribeTemplatePermissions for more information on using the DescribeTemplatePermissions
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the DescribeTemplatePermissionsRequest method.
req, resp := client.DescribeTemplatePermissionsRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/quicksight-2018-04-01/DescribeTemplatePermissions | func (c *QuickSight) DescribeTemplatePermissionsRequest(input *DescribeTemplatePermissionsInput) (req *request.Request, output *DescribeTemplatePermissionsOutput) {
op := &request.Operation{
Name: opDescribeTemplatePermissions,
HTTPMethod: "GET",
HTTPPath: "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions",
}
if input == nil {
input = &DescribeTemplatePermissionsInput{}
}
output = &DescribeTemplatePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *OpsWorks) DescribePermissionsRequest(input *DescribePermissionsInput) (req *request.Request, output *DescribePermissionsOutput) {
op := &request.Operation{
Name: opDescribePermissions,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DescribePermissionsInput{}
}
output = &DescribePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | 0.825239 | aws/aws-sdk-go | service/quicksight/api.go | aws/aws-sdk-go | service/opsworks/api.go | Apache-2.0 | go |
DescribeTemplatePermissionsRequest generates a "aws/request.Request" representing the
client's request for the DescribeTemplatePermissions operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See DescribeTemplatePermissions for more information on using the DescribeTemplatePermissions
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the DescribeTemplatePermissionsRequest method.
req, resp := client.DescribeTemplatePermissionsRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/quicksight-2018-04-01/DescribeTemplatePermissions | func (c *QuickSight) DescribeTemplatePermissionsRequest(input *DescribeTemplatePermissionsInput) (req *request.Request, output *DescribeTemplatePermissionsOutput) {
op := &request.Operation{
Name: opDescribeTemplatePermissions,
HTTPMethod: "GET",
HTTPPath: "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions",
}
if input == nil {
input = &DescribeTemplatePermissionsInput{}
}
output = &DescribeTemplatePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *QuickSight) DescribeTemplatePermissionsWithContext(ctx aws.Context, input *DescribeTemplatePermissionsInput, opts ...request.Option) (*DescribeTemplatePermissionsOutput, error) {
req, out := c.DescribeTemplatePermissionsRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.812558 | aws/aws-sdk-go | service/quicksight/api.go | aws/aws-sdk-go | service/quicksight/api.go | Apache-2.0 | go |
DescribeTemplatePermissionsRequest generates a "aws/request.Request" representing the
client's request for the DescribeTemplatePermissions operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See DescribeTemplatePermissions for more information on using the DescribeTemplatePermissions
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the DescribeTemplatePermissionsRequest method.
req, resp := client.DescribeTemplatePermissionsRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/quicksight-2018-04-01/DescribeTemplatePermissions | func (c *QuickSight) DescribeTemplatePermissionsRequest(input *DescribeTemplatePermissionsInput) (req *request.Request, output *DescribeTemplatePermissionsOutput) {
op := &request.Operation{
Name: opDescribeTemplatePermissions,
HTTPMethod: "GET",
HTTPPath: "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions",
}
if input == nil {
input = &DescribeTemplatePermissionsInput{}
}
output = &DescribeTemplatePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *WorkDocs) DescribeResourcePermissionsRequest(input *DescribeResourcePermissionsInput) (req *request.Request, output *DescribeResourcePermissionsOutput) {
op := &request.Operation{
Name: opDescribeResourcePermissions,
HTTPMethod: "GET",
HTTPPath: "/api/v1/resources/{ResourceId}/permissions",
Paginator: &request.Paginator{
InputTokens: []string{"Marker"},
OutputTokens: []string{"Marker"},
LimitToken: "Limit",
TruncationToken: "",
},
}
if input == nil {
input = &DescribeResourcePermissionsInput{}
}
output = &DescribeResourcePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | 0.785706 | aws/aws-sdk-go | service/quicksight/api.go | aws/aws-sdk-go | service/workdocs/api.go | Apache-2.0 | go |
DescribeTemplatePermissionsRequest generates a "aws/request.Request" representing the
client's request for the DescribeTemplatePermissions operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See DescribeTemplatePermissions for more information on using the DescribeTemplatePermissions
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the DescribeTemplatePermissionsRequest method.
req, resp := client.DescribeTemplatePermissionsRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/quicksight-2018-04-01/DescribeTemplatePermissions | func (c *QuickSight) DescribeTemplatePermissionsRequest(input *DescribeTemplatePermissionsInput) (req *request.Request, output *DescribeTemplatePermissionsOutput) {
op := &request.Operation{
Name: opDescribeTemplatePermissions,
HTTPMethod: "GET",
HTTPPath: "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions",
}
if input == nil {
input = &DescribeTemplatePermissionsInput{}
}
output = &DescribeTemplatePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | func (c *AppStream) DescribeImagePermissionsRequest(input *DescribeImagePermissionsInput) (req *request.Request, output *DescribeImagePermissionsOutput) {
op := &request.Operation{
Name: opDescribeImagePermissions,
HTTPMethod: "POST",
HTTPPath: "/",
Paginator: &request.Paginator{
InputTokens: []string{"NextToken"},
OutputTokens: []string{"NextToken"},
LimitToken: "MaxResults",
TruncationToken: "",
},
}
if input == nil {
input = &DescribeImagePermissionsInput{}
}
output = &DescribeImagePermissionsOutput{}
req = c.newRequest(op, input, output)
return
} | 0.758565 | aws/aws-sdk-go | service/quicksight/api.go | aws/aws-sdk-go | service/appstream/api.go | Apache-2.0 | go |
C documentation
/*
** The xUpdate method for rtree module virtual tables.
*/ | func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var bHaveRowid, ii, jj, nn, rc, rc2, steprc int32
var pRtree, pUp uintptr
var _ /* cell at bp+0 */ TRtreeCell
var _ /* pLeaf at bp+48 */ uintptr
_, _, _, _, _, _, _, _, _ = bHaveRowid, ii, jj, nn, pRtree, pUp, rc, rc2, steprc
pRtree = pVtab
rc = SQLITE_OK /* New cell to insert if nData>1 */
bHaveRowid = 0 /* Set to 1 after new rowid is determined */
if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 {
/* Unable to write to the btree while another cursor is reading from it,
** since the write might do a rebalance which would disrupt the read
** cursor. */
return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<<libc.Int32FromInt32(8)
}
_rtreeReference(tls, pRtree)
libc.Xmemset(tls, bp, 0, uint64(48))
/* Constraint handling. A write operation on an r-tree table may return
** SQLITE_CONSTRAINT for two reasons:
**
** 1. A duplicate rowid value, or
** 2. The supplied data violates the "x2>=x1" constraint.
**
** In the first case, if the conflict-handling mode is REPLACE, then
** the conflicting row can be removed before proceeding. In the second
** case, SQLITE_CONSTRAINT must be returned regardless of the
** conflict-handling mode specified by the user.
*/
if nData > int32(1) {
nn = nData - int32(4)
if nn > libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) {
nn = libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)
}
/* Populate the cell.aCoord[] array. The first coordinate is aData[3].
**
** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared
** with "column" that are interpreted as table constraints.
** Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5));
** This problem was discovered after years of use, so we silently ignore
** these kinds of misdeclared tables to avoid breaking any legacy.
*/
if libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 {
ii = 0
for {
if !(ii < nn) {
break
}
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = _rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = _rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _1
_1:
;
ii += int32(2)
}
} else {
ii = 0
for {
if !(ii < nn) {
break
}
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _2
_2:
;
ii += int32(2)
}
}
/* If a rowid value was supplied, check if it is already present in
** the table. If so, the constraint has failed. */
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != int32(SQLITE_NULL) {
(*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8)))
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == int32(SQLITE_NULL) || Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid {
Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
if int32(SQLITE_ROW) == steprc {
if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) {
rc = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
} else {
rc = _rtreeConstraintError(tls, pRtree, 0)
goto constraint
}
}
}
bHaveRowid = int32(1)
}
}
/* If aData[0] is not an SQL NULL value, it is the rowid of a
** record to delete from the r-tree table. The following block does
** just that.
*/
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL) {
rc = _rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))))
}
/* If the aData[] array contains more than one element, elements
** (aData[2]..aData[argc-1]) contain a new record to insert into
** the r-tree structure.
*/
if rc == SQLITE_OK && nData > int32(1) {
/* Insert the new record into the r-tree */
*(*uintptr)(unsafe.Pointer(bp + 48)) = uintptr(0)
/* Figure out the rowid of the new row. */
if bHaveRowid == 0 {
rc = _rtreeNewRowid(tls, pRtree, bp)
}
*(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid
if rc == SQLITE_OK {
rc = _ChooseLeaf(tls, pRtree, bp, 0, bp+48)
}
if rc == SQLITE_OK {
rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)), bp, 0)
rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)))
if rc == SQLITE_OK {
rc = rc2
}
}
if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 {
pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux
Xsqlite3_bind_int64(tls, pUp, int32(1), *(*Tsqlite_int64)(unsafe.Pointer(pRowid)))
jj = 0
for {
if !(jj < libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) {
break
}
Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8)))
goto _3
_3:
;
jj++
}
Xsqlite3_step(tls, pUp)
rc = Xsqlite3_reset(tls, pUp)
}
}
goto constraint
constraint:
;
_rtreeRelease(tls, pRtree)
return rc
} | func _geopolyUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var coordChange, jj, nChange, newRowidValid, oldRowidValid, rc2, steprc int32
var newRowid, oldRowid Ti64
var p, pRtree, pUp, v3 uintptr
var v1, v2 int64
var v4 bool
var _ /* cell at bp+8 */ TRtreeCell
var _ /* pLeaf at bp+56 */ uintptr
var _ /* rc at bp+0 */ int32
_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = coordChange, jj, nChange, newRowid, newRowidValid, oldRowid, oldRowidValid, p, pRtree, pUp, rc2, steprc, v1, v2, v3, v4
pRtree = pVtab
*(*int32)(unsafe.Pointer(bp)) = SQLITE_OK /* True if newRowid is valid */
coordChange = 0 /* Change in coordinates */
if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 {
/* Unable to write to the btree while another cursor is reading from it,
** since the write might do a rebalance which would disrupt the read
** cursor. */
return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<<libc.Int32FromInt32(8)
}
_rtreeReference(tls, pRtree)
oldRowidValid = libc.BoolInt32(Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL))
if oldRowidValid != 0 {
v1 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData)))
} else {
v1 = 0
}
oldRowid = v1
newRowidValid = libc.BoolInt32(nData > int32(1) && Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 1*8))) != int32(SQLITE_NULL))
if newRowidValid != 0 {
v2 = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 1*8)))
} else {
v2 = 0
}
newRowid = v2
(*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid = newRowid
if nData > int32(1) && (!(oldRowidValid != 0) || !(Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0) || oldRowid != newRowid) {
_geopolyBBox(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp+8+8, bp)
if *(*int32)(unsafe.Pointer(bp)) != 0 {
if *(*int32)(unsafe.Pointer(bp)) == int32(SQLITE_ERROR) {
(*Tsqlite3_vtab)(unsafe.Pointer(pVtab)).FzErrMsg = Xsqlite3_mprintf(tls, __ccgo_ts+28546, 0)
}
goto geopoly_update_end
}
coordChange = int32(1)
/* If a rowid value was supplied, check if it is already present in
** the table. If so, the constraint has failed. */
if newRowidValid != 0 && (!(oldRowidValid != 0) || oldRowid != newRowid) {
Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid)
steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
*(*int32)(unsafe.Pointer(bp)) = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
if int32(SQLITE_ROW) == steprc {
if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) {
*(*int32)(unsafe.Pointer(bp)) = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid)
} else {
*(*int32)(unsafe.Pointer(bp)) = _rtreeConstraintError(tls, pRtree, 0)
}
}
}
}
/* If aData[0] is not an SQL NULL value, it is the rowid of a
** record to delete from the r-tree table. The following block does
** just that.
*/
if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && (nData == int32(1) || coordChange != 0 && oldRowidValid != 0) {
*(*int32)(unsafe.Pointer(bp)) = _rtreeDeleteRowid(tls, pRtree, oldRowid)
}
/* If the aData[] array contains more than one element, elements
** (aData[2]..aData[argc-1]) contain a new record to insert into
** the r-tree structure.
*/
if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nData > int32(1) && coordChange != 0 {
/* Insert the new record into the r-tree */
*(*uintptr)(unsafe.Pointer(bp + 56)) = uintptr(0)
if !(newRowidValid != 0) {
*(*int32)(unsafe.Pointer(bp)) = _rtreeNewRowid(tls, pRtree, bp+8)
}
*(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid
if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK {
*(*int32)(unsafe.Pointer(bp)) = _ChooseLeaf(tls, pRtree, bp+8, 0, bp+56)
}
if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK {
*(*int32)(unsafe.Pointer(bp)) = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 56)), bp+8, 0)
rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 56)))
if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK {
*(*int32)(unsafe.Pointer(bp)) = rc2
}
}
}
/* Change the data */
if *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK && nData > int32(1) {
pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux
nChange = 0
Xsqlite3_bind_int64(tls, pUp, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp + 8))).FiRowid)
if Xsqlite3_value_nochange(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != 0 {
Xsqlite3_bind_null(tls, pUp, int32(2))
} else {
p = uintptr(0)
if v4 = Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) == int32(SQLITE_TEXT); v4 {
v3 = _geopolyFuncParam(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(aData + 2*8)), bp)
p = v3
}
if v4 && v3 != uintptr(0) && *(*int32)(unsafe.Pointer(bp)) == SQLITE_OK {
Xsqlite3_bind_blob(tls, pUp, int32(2), p+4, int32(4)+int32(8)*(*TGeoPoly)(unsafe.Pointer(p)).FnVertex, uintptr(-libc.Int32FromInt32(1)))
} else {
Xsqlite3_bind_value(tls, pUp, int32(2), *(*uintptr)(unsafe.Pointer(aData + 2*8)))
}
Xsqlite3_free(tls, p)
nChange = int32(1)
}
jj = int32(1)
for {
if !(jj < nData-int32(2)) {
break
}
nChange++
Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(jj+int32(2))*8)))
goto _5
_5:
;
jj++
}
if nChange != 0 {
Xsqlite3_step(tls, pUp)
*(*int32)(unsafe.Pointer(bp)) = Xsqlite3_reset(tls, pUp)
}
}
goto geopoly_update_end
geopoly_update_end:
;
_rtreeRelease(tls, pRtree)
return *(*int32)(unsafe.Pointer(bp))
} | 0.760466 | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | MIT | go |
C documentation
/*
** The xUpdate method for rtree module virtual tables.
*/ | func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var bHaveRowid, ii, jj, nn, rc, rc2, steprc int32
var pRtree, pUp uintptr
var _ /* cell at bp+0 */ TRtreeCell
var _ /* pLeaf at bp+48 */ uintptr
_, _, _, _, _, _, _, _, _ = bHaveRowid, ii, jj, nn, pRtree, pUp, rc, rc2, steprc
pRtree = pVtab
rc = SQLITE_OK /* New cell to insert if nData>1 */
bHaveRowid = 0 /* Set to 1 after new rowid is determined */
if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 {
/* Unable to write to the btree while another cursor is reading from it,
** since the write might do a rebalance which would disrupt the read
** cursor. */
return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<<libc.Int32FromInt32(8)
}
_rtreeReference(tls, pRtree)
libc.Xmemset(tls, bp, 0, uint64(48))
/* Constraint handling. A write operation on an r-tree table may return
** SQLITE_CONSTRAINT for two reasons:
**
** 1. A duplicate rowid value, or
** 2. The supplied data violates the "x2>=x1" constraint.
**
** In the first case, if the conflict-handling mode is REPLACE, then
** the conflicting row can be removed before proceeding. In the second
** case, SQLITE_CONSTRAINT must be returned regardless of the
** conflict-handling mode specified by the user.
*/
if nData > int32(1) {
nn = nData - int32(4)
if nn > libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) {
nn = libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)
}
/* Populate the cell.aCoord[] array. The first coordinate is aData[3].
**
** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared
** with "column" that are interpreted as table constraints.
** Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5));
** This problem was discovered after years of use, so we silently ignore
** these kinds of misdeclared tables to avoid breaking any legacy.
*/
if libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 {
ii = 0
for {
if !(ii < nn) {
break
}
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = _rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = _rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _1
_1:
;
ii += int32(2)
}
} else {
ii = 0
for {
if !(ii < nn) {
break
}
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _2
_2:
;
ii += int32(2)
}
}
/* If a rowid value was supplied, check if it is already present in
** the table. If so, the constraint has failed. */
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != int32(SQLITE_NULL) {
(*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8)))
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == int32(SQLITE_NULL) || Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid {
Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
if int32(SQLITE_ROW) == steprc {
if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) {
rc = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
} else {
rc = _rtreeConstraintError(tls, pRtree, 0)
goto constraint
}
}
}
bHaveRowid = int32(1)
}
}
/* If aData[0] is not an SQL NULL value, it is the rowid of a
** record to delete from the r-tree table. The following block does
** just that.
*/
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL) {
rc = _rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))))
}
/* If the aData[] array contains more than one element, elements
** (aData[2]..aData[argc-1]) contain a new record to insert into
** the r-tree structure.
*/
if rc == SQLITE_OK && nData > int32(1) {
/* Insert the new record into the r-tree */
*(*uintptr)(unsafe.Pointer(bp + 48)) = uintptr(0)
/* Figure out the rowid of the new row. */
if bHaveRowid == 0 {
rc = _rtreeNewRowid(tls, pRtree, bp)
}
*(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid
if rc == SQLITE_OK {
rc = _ChooseLeaf(tls, pRtree, bp, 0, bp+48)
}
if rc == SQLITE_OK {
rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)), bp, 0)
rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)))
if rc == SQLITE_OK {
rc = rc2
}
}
if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 {
pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux
Xsqlite3_bind_int64(tls, pUp, int32(1), *(*Tsqlite_int64)(unsafe.Pointer(pRowid)))
jj = 0
for {
if !(jj < libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) {
break
}
Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8)))
goto _3
_3:
;
jj++
}
Xsqlite3_step(tls, pUp)
rc = Xsqlite3_reset(tls, pUp)
}
}
goto constraint
constraint:
;
_rtreeRelease(tls, pRtree)
return rc
} | func _rtreeCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) {
return _rtreeInit(tls, db, pAux, argc, argv, ppVtab, pzErr, int32(1))
} | 0.739401 | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | MIT | go |
C documentation
/*
** The xUpdate method for rtree module virtual tables.
*/ | func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var bHaveRowid, ii, jj, nn, rc, rc2, steprc int32
var pRtree, pUp uintptr
var _ /* cell at bp+0 */ TRtreeCell
var _ /* pLeaf at bp+48 */ uintptr
_, _, _, _, _, _, _, _, _ = bHaveRowid, ii, jj, nn, pRtree, pUp, rc, rc2, steprc
pRtree = pVtab
rc = SQLITE_OK /* New cell to insert if nData>1 */
bHaveRowid = 0 /* Set to 1 after new rowid is determined */
if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 {
/* Unable to write to the btree while another cursor is reading from it,
** since the write might do a rebalance which would disrupt the read
** cursor. */
return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<<libc.Int32FromInt32(8)
}
_rtreeReference(tls, pRtree)
libc.Xmemset(tls, bp, 0, uint64(48))
/* Constraint handling. A write operation on an r-tree table may return
** SQLITE_CONSTRAINT for two reasons:
**
** 1. A duplicate rowid value, or
** 2. The supplied data violates the "x2>=x1" constraint.
**
** In the first case, if the conflict-handling mode is REPLACE, then
** the conflicting row can be removed before proceeding. In the second
** case, SQLITE_CONSTRAINT must be returned regardless of the
** conflict-handling mode specified by the user.
*/
if nData > int32(1) {
nn = nData - int32(4)
if nn > libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) {
nn = libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)
}
/* Populate the cell.aCoord[] array. The first coordinate is aData[3].
**
** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared
** with "column" that are interpreted as table constraints.
** Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5));
** This problem was discovered after years of use, so we silently ignore
** these kinds of misdeclared tables to avoid breaking any legacy.
*/
if libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 {
ii = 0
for {
if !(ii < nn) {
break
}
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = _rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = _rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _1
_1:
;
ii += int32(2)
}
} else {
ii = 0
for {
if !(ii < nn) {
break
}
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _2
_2:
;
ii += int32(2)
}
}
/* If a rowid value was supplied, check if it is already present in
** the table. If so, the constraint has failed. */
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != int32(SQLITE_NULL) {
(*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8)))
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == int32(SQLITE_NULL) || Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid {
Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
if int32(SQLITE_ROW) == steprc {
if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) {
rc = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
} else {
rc = _rtreeConstraintError(tls, pRtree, 0)
goto constraint
}
}
}
bHaveRowid = int32(1)
}
}
/* If aData[0] is not an SQL NULL value, it is the rowid of a
** record to delete from the r-tree table. The following block does
** just that.
*/
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL) {
rc = _rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))))
}
/* If the aData[] array contains more than one element, elements
** (aData[2]..aData[argc-1]) contain a new record to insert into
** the r-tree structure.
*/
if rc == SQLITE_OK && nData > int32(1) {
/* Insert the new record into the r-tree */
*(*uintptr)(unsafe.Pointer(bp + 48)) = uintptr(0)
/* Figure out the rowid of the new row. */
if bHaveRowid == 0 {
rc = _rtreeNewRowid(tls, pRtree, bp)
}
*(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid
if rc == SQLITE_OK {
rc = _ChooseLeaf(tls, pRtree, bp, 0, bp+48)
}
if rc == SQLITE_OK {
rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)), bp, 0)
rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)))
if rc == SQLITE_OK {
rc = rc2
}
}
if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 {
pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux
Xsqlite3_bind_int64(tls, pUp, int32(1), *(*Tsqlite_int64)(unsafe.Pointer(pRowid)))
jj = 0
for {
if !(jj < libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) {
break
}
Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8)))
goto _3
_3:
;
jj++
}
Xsqlite3_step(tls, pUp)
rc = Xsqlite3_reset(tls, pUp)
}
}
goto constraint
constraint:
;
_rtreeRelease(tls, pRtree)
return rc
} | func _rtreeRename(tls *libc.TLS, pVtab uintptr, zNewName uintptr) (r int32) {
bp := tls.Alloc(80)
defer tls.Free(80)
var pRtree, zSql uintptr
var rc int32
_, _, _ = pRtree, rc, zSql
pRtree = pVtab
rc = int32(SQLITE_NOMEM)
zSql = Xsqlite3_mprintf(tls, __ccgo_ts+26191, libc.VaList(bp+8, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName, (*TRtree)(unsafe.Pointer(pRtree)).FzDb, (*TRtree)(unsafe.Pointer(pRtree)).FzName, zNewName))
if zSql != 0 {
_nodeBlobReset(tls, pRtree)
rc = Xsqlite3_exec(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0))
Xsqlite3_free(tls, zSql)
}
return rc
} | 0.717563 | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | MIT | go |
C documentation
/*
** The xUpdate method for rtree module virtual tables.
*/ | func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var bHaveRowid, ii, jj, nn, rc, rc2, steprc int32
var pRtree, pUp uintptr
var _ /* cell at bp+0 */ TRtreeCell
var _ /* pLeaf at bp+48 */ uintptr
_, _, _, _, _, _, _, _, _ = bHaveRowid, ii, jj, nn, pRtree, pUp, rc, rc2, steprc
pRtree = pVtab
rc = SQLITE_OK /* New cell to insert if nData>1 */
bHaveRowid = 0 /* Set to 1 after new rowid is determined */
if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 {
/* Unable to write to the btree while another cursor is reading from it,
** since the write might do a rebalance which would disrupt the read
** cursor. */
return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<<libc.Int32FromInt32(8)
}
_rtreeReference(tls, pRtree)
libc.Xmemset(tls, bp, 0, uint64(48))
/* Constraint handling. A write operation on an r-tree table may return
** SQLITE_CONSTRAINT for two reasons:
**
** 1. A duplicate rowid value, or
** 2. The supplied data violates the "x2>=x1" constraint.
**
** In the first case, if the conflict-handling mode is REPLACE, then
** the conflicting row can be removed before proceeding. In the second
** case, SQLITE_CONSTRAINT must be returned regardless of the
** conflict-handling mode specified by the user.
*/
if nData > int32(1) {
nn = nData - int32(4)
if nn > libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) {
nn = libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)
}
/* Populate the cell.aCoord[] array. The first coordinate is aData[3].
**
** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared
** with "column" that are interpreted as table constraints.
** Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5));
** This problem was discovered after years of use, so we silently ignore
** these kinds of misdeclared tables to avoid breaking any legacy.
*/
if libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 {
ii = 0
for {
if !(ii < nn) {
break
}
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = _rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = _rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _1
_1:
;
ii += int32(2)
}
} else {
ii = 0
for {
if !(ii < nn) {
break
}
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _2
_2:
;
ii += int32(2)
}
}
/* If a rowid value was supplied, check if it is already present in
** the table. If so, the constraint has failed. */
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != int32(SQLITE_NULL) {
(*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8)))
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == int32(SQLITE_NULL) || Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid {
Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
if int32(SQLITE_ROW) == steprc {
if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) {
rc = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
} else {
rc = _rtreeConstraintError(tls, pRtree, 0)
goto constraint
}
}
}
bHaveRowid = int32(1)
}
}
/* If aData[0] is not an SQL NULL value, it is the rowid of a
** record to delete from the r-tree table. The following block does
** just that.
*/
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL) {
rc = _rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))))
}
/* If the aData[] array contains more than one element, elements
** (aData[2]..aData[argc-1]) contain a new record to insert into
** the r-tree structure.
*/
if rc == SQLITE_OK && nData > int32(1) {
/* Insert the new record into the r-tree */
*(*uintptr)(unsafe.Pointer(bp + 48)) = uintptr(0)
/* Figure out the rowid of the new row. */
if bHaveRowid == 0 {
rc = _rtreeNewRowid(tls, pRtree, bp)
}
*(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid
if rc == SQLITE_OK {
rc = _ChooseLeaf(tls, pRtree, bp, 0, bp+48)
}
if rc == SQLITE_OK {
rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)), bp, 0)
rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)))
if rc == SQLITE_OK {
rc = rc2
}
}
if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 {
pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux
Xsqlite3_bind_int64(tls, pUp, int32(1), *(*Tsqlite_int64)(unsafe.Pointer(pRowid)))
jj = 0
for {
if !(jj < libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) {
break
}
Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8)))
goto _3
_3:
;
jj++
}
Xsqlite3_step(tls, pUp)
rc = Xsqlite3_reset(tls, pUp)
}
}
goto constraint
constraint:
;
_rtreeRelease(tls, pRtree)
return rc
} | func _rtreeConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) (r int32) {
return _rtreeInit(tls, db, pAux, argc, argv, ppVtab, pzErr, 0)
} | 0.71588 | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | MIT | go |
C documentation
/*
** The xUpdate method for rtree module virtual tables.
*/ | func _rtreeUpdate(tls *libc.TLS, pVtab uintptr, nData int32, aData uintptr, pRowid uintptr) (r int32) {
bp := tls.Alloc(64)
defer tls.Free(64)
var bHaveRowid, ii, jj, nn, rc, rc2, steprc int32
var pRtree, pUp uintptr
var _ /* cell at bp+0 */ TRtreeCell
var _ /* pLeaf at bp+48 */ uintptr
_, _, _, _, _, _, _, _, _ = bHaveRowid, ii, jj, nn, pRtree, pUp, rc, rc2, steprc
pRtree = pVtab
rc = SQLITE_OK /* New cell to insert if nData>1 */
bHaveRowid = 0 /* Set to 1 after new rowid is determined */
if (*TRtree)(unsafe.Pointer(pRtree)).FnNodeRef != 0 {
/* Unable to write to the btree while another cursor is reading from it,
** since the write might do a rebalance which would disrupt the read
** cursor. */
return libc.Int32FromInt32(SQLITE_LOCKED) | libc.Int32FromInt32(2)<<libc.Int32FromInt32(8)
}
_rtreeReference(tls, pRtree)
libc.Xmemset(tls, bp, 0, uint64(48))
/* Constraint handling. A write operation on an r-tree table may return
** SQLITE_CONSTRAINT for two reasons:
**
** 1. A duplicate rowid value, or
** 2. The supplied data violates the "x2>=x1" constraint.
**
** In the first case, if the conflict-handling mode is REPLACE, then
** the conflicting row can be removed before proceeding. In the second
** case, SQLITE_CONSTRAINT must be returned regardless of the
** conflict-handling mode specified by the user.
*/
if nData > int32(1) {
nn = nData - int32(4)
if nn > libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2) {
nn = libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)
}
/* Populate the cell.aCoord[] array. The first coordinate is aData[3].
**
** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared
** with "column" that are interpreted as table constraints.
** Example: CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5));
** This problem was discovered after years of use, so we silently ignore
** these kinds of misdeclared tables to avoid breaking any legacy.
*/
if libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FeCoordType) == RTREE_COORD_REAL32 {
ii = 0
for {
if !(ii < nn) {
break
}
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = _rtreeValueDown(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = _rtreeValueUp(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*TRtreeValue)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _1
_1:
;
ii += int32(2)
}
} else {
ii = 0
for {
if !(ii < nn) {
break
}
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(3))*8)))
*(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) = Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(aData + uintptr(ii+int32(4))*8)))
if *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii)*4)) > *(*int32)(unsafe.Pointer(bp + 8 + uintptr(ii+int32(1))*4)) {
rc = _rtreeConstraintError(tls, pRtree, ii+int32(1))
goto constraint
}
goto _2
_2:
;
ii += int32(2)
}
}
/* If a rowid value was supplied, check if it is already present in
** the table. If so, the constraint has failed. */
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8))) != int32(SQLITE_NULL) {
(*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid = Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData + 2*8)))
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) == int32(SQLITE_NULL) || Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))) != (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid {
Xsqlite3_bind_int64(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid, int32(1), (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
steprc = Xsqlite3_step(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
rc = Xsqlite3_reset(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpReadRowid)
if int32(SQLITE_ROW) == steprc {
if Xsqlite3_vtab_on_conflict(tls, (*TRtree)(unsafe.Pointer(pRtree)).Fdb) == int32(SQLITE_REPLACE) {
rc = _rtreeDeleteRowid(tls, pRtree, (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid)
} else {
rc = _rtreeConstraintError(tls, pRtree, 0)
goto constraint
}
}
}
bHaveRowid = int32(1)
}
}
/* If aData[0] is not an SQL NULL value, it is the rowid of a
** record to delete from the r-tree table. The following block does
** just that.
*/
if Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(aData))) != int32(SQLITE_NULL) {
rc = _rtreeDeleteRowid(tls, pRtree, Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(aData))))
}
/* If the aData[] array contains more than one element, elements
** (aData[2]..aData[argc-1]) contain a new record to insert into
** the r-tree structure.
*/
if rc == SQLITE_OK && nData > int32(1) {
/* Insert the new record into the r-tree */
*(*uintptr)(unsafe.Pointer(bp + 48)) = uintptr(0)
/* Figure out the rowid of the new row. */
if bHaveRowid == 0 {
rc = _rtreeNewRowid(tls, pRtree, bp)
}
*(*Tsqlite_int64)(unsafe.Pointer(pRowid)) = (*(*TRtreeCell)(unsafe.Pointer(bp))).FiRowid
if rc == SQLITE_OK {
rc = _ChooseLeaf(tls, pRtree, bp, 0, bp+48)
}
if rc == SQLITE_OK {
rc = _rtreeInsertCell(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)), bp, 0)
rc2 = _nodeRelease(tls, pRtree, *(*uintptr)(unsafe.Pointer(bp + 48)))
if rc == SQLITE_OK {
rc = rc2
}
}
if rc == SQLITE_OK && (*TRtree)(unsafe.Pointer(pRtree)).FnAux != 0 {
pUp = (*TRtree)(unsafe.Pointer(pRtree)).FpWriteAux
Xsqlite3_bind_int64(tls, pUp, int32(1), *(*Tsqlite_int64)(unsafe.Pointer(pRowid)))
jj = 0
for {
if !(jj < libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnAux)) {
break
}
Xsqlite3_bind_value(tls, pUp, jj+int32(2), *(*uintptr)(unsafe.Pointer(aData + uintptr(libc.Int32FromUint8((*TRtree)(unsafe.Pointer(pRtree)).FnDim2)+int32(3)+jj)*8)))
goto _3
_3:
;
jj++
}
Xsqlite3_step(tls, pUp)
rc = Xsqlite3_reset(tls, pUp)
}
}
goto constraint
constraint:
;
_rtreeRelease(tls, pRtree)
return rc
} | func _rtreeNext(tls *libc.TLS, pVtabCursor uintptr) (r int32) {
var pCsr uintptr
var rc int32
_, _ = pCsr, rc
pCsr = pVtabCursor
rc = SQLITE_OK
/* Move to the next entry that matches the configured constraints. */
if (*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid != 0 {
(*TRtreeCursor)(unsafe.Pointer(pCsr)).FbAuxValid = uint8(0)
Xsqlite3_reset(tls, (*TRtreeCursor)(unsafe.Pointer(pCsr)).FpReadAux)
}
_rtreeSearchPointPop(tls, pCsr)
rc = _rtreeStepToLeaf(tls, pCsr)
return rc
} | 0.704721 | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | umputun/spot | vendor/modernc.org/sqlite/lib/sqlite_freebsd_amd64.go | MIT | go |
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable
for use in a grpc.NewServer call.
Deprecated: Use [NewServerHandler] instead. | func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
cfg := newConfig(opts, "server")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
i := &InterceptorInfo{
UnaryServerInfo: info,
Type: UnaryServer,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return handler(ctx, req)
}
ctx = extract(ctx, cfg.Propagators)
name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx))
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)),
name,
startOpts...,
)
defer span.End()
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, req)
}
before := time.Now()
resp, err := handler(ctx, req)
s, _ := status.FromError(err)
if err != nil {
statusCode, msg := serverStatus(s)
span.SetStatus(statusCode, msg)
if cfg.SentEvent {
messageSent.Event(ctx, 1, s.Proto())
}
} else {
if cfg.SentEvent {
messageSent.Event(ctx, 1, resp)
}
}
grpcStatusCodeAttr := statusCodeAttr(s.Code())
span.SetAttributes(grpcStatusCodeAttr)
elapsedTime := time.Since(before).Milliseconds()
metricAttrs = append(metricAttrs, grpcStatusCodeAttr)
cfg.rpcDuration.Record(ctx, float64(elapsedTime), metric.WithAttributes(metricAttrs...))
return resp, err
}
} | func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor {
cfg := newConfig(opts, "server")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
srv interface{},
ss grpc.ServerStream,
info *grpc.StreamServerInfo,
handler grpc.StreamHandler,
) error {
ctx := ss.Context()
i := &InterceptorInfo{
StreamServerInfo: info,
Type: StreamServer,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return handler(srv, wrapServerStream(ctx, ss, cfg))
}
ctx = extract(ctx, cfg.Propagators)
name, attr, _ := telemetryAttributes(info.FullMethod, peerFromCtx(ctx))
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)),
name,
startOpts...,
)
defer span.End()
err := handler(srv, wrapServerStream(ctx, ss, cfg))
if err != nil {
s, _ := status.FromError(err)
statusCode, msg := serverStatus(s)
span.SetStatus(statusCode, msg)
span.SetAttributes(statusCodeAttr(s.Code()))
} else {
span.SetAttributes(statusCodeAttr(grpc_codes.OK))
}
return err
}
} | 0.942034 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | Apache-2.0 | go |
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable
for use in a grpc.NewServer call.
Deprecated: Use [NewServerHandler] instead. | func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
cfg := newConfig(opts, "server")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
i := &InterceptorInfo{
UnaryServerInfo: info,
Type: UnaryServer,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return handler(ctx, req)
}
ctx = extract(ctx, cfg.Propagators)
name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx))
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)),
name,
startOpts...,
)
defer span.End()
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, req)
}
before := time.Now()
resp, err := handler(ctx, req)
s, _ := status.FromError(err)
if err != nil {
statusCode, msg := serverStatus(s)
span.SetStatus(statusCode, msg)
if cfg.SentEvent {
messageSent.Event(ctx, 1, s.Proto())
}
} else {
if cfg.SentEvent {
messageSent.Event(ctx, 1, resp)
}
}
grpcStatusCodeAttr := statusCodeAttr(s.Code())
span.SetAttributes(grpcStatusCodeAttr)
elapsedTime := time.Since(before).Milliseconds()
metricAttrs = append(metricAttrs, grpcStatusCodeAttr)
cfg.rpcDuration.Record(ctx, float64(elapsedTime), metric.WithAttributes(metricAttrs...))
return resp, err
}
} | func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor {
cfg := newConfig(opts, "client")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
method string,
req, reply interface{},
cc *grpc.ClientConn,
invoker grpc.UnaryInvoker,
callOpts ...grpc.CallOption,
) error {
i := &InterceptorInfo{
Method: method,
Type: UnaryClient,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return invoker(ctx, method, req, reply, cc, callOpts...)
}
name, attr, _ := telemetryAttributes(method, cc.Target())
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindClient),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
ctx,
name,
startOpts...,
)
defer span.End()
ctx = inject(ctx, cfg.Propagators)
if cfg.SentEvent {
messageSent.Event(ctx, 1, req)
}
err := invoker(ctx, method, req, reply, cc, callOpts...)
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, reply)
}
if err != nil {
s, _ := status.FromError(err)
span.SetStatus(codes.Error, s.Message())
span.SetAttributes(statusCodeAttr(s.Code()))
} else {
span.SetAttributes(statusCodeAttr(grpc_codes.OK))
}
return err
}
} | 0.866395 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | Apache-2.0 | go |
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable
for use in a grpc.NewServer call.
Deprecated: Use [NewServerHandler] instead. | func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
cfg := newConfig(opts, "server")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
i := &InterceptorInfo{
UnaryServerInfo: info,
Type: UnaryServer,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return handler(ctx, req)
}
ctx = extract(ctx, cfg.Propagators)
name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx))
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)),
name,
startOpts...,
)
defer span.End()
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, req)
}
before := time.Now()
resp, err := handler(ctx, req)
s, _ := status.FromError(err)
if err != nil {
statusCode, msg := serverStatus(s)
span.SetStatus(statusCode, msg)
if cfg.SentEvent {
messageSent.Event(ctx, 1, s.Proto())
}
} else {
if cfg.SentEvent {
messageSent.Event(ctx, 1, resp)
}
}
grpcStatusCodeAttr := statusCodeAttr(s.Code())
span.SetAttributes(grpcStatusCodeAttr)
elapsedTime := time.Since(before).Milliseconds()
metricAttrs = append(metricAttrs, grpcStatusCodeAttr)
cfg.rpcDuration.Record(ctx, float64(elapsedTime), metric.WithAttributes(metricAttrs...))
return resp, err
}
} | func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor {
cfg := newConfig(opts, "client")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
method string,
req, reply interface{},
cc *grpc.ClientConn,
invoker grpc.UnaryInvoker,
callOpts ...grpc.CallOption,
) error {
i := &InterceptorInfo{
Method: method,
Type: UnaryClient,
}
if cfg.InterceptorFilter != nil && !cfg.InterceptorFilter(i) {
return invoker(ctx, method, req, reply, cc, callOpts...)
}
name, attr, _ := telemetryAttributes(method, cc.Target())
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindClient),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
ctx,
name,
startOpts...,
)
defer span.End()
ctx = inject(ctx, cfg.Propagators)
if cfg.SentEvent {
messageSent.Event(ctx, 1, req)
}
err := invoker(ctx, method, req, reply, cc, callOpts...)
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, reply)
}
if err != nil {
s, _ := status.FromError(err)
span.SetStatus(codes.Error, s.Message())
span.SetAttributes(statusCodeAttr(s.Code()))
} else {
span.SetAttributes(statusCodeAttr(grpc_codes.OK))
}
return err
}
} | 0.861348 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | kubernetes-sigs/cri-tools | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | Apache-2.0 | go |
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable
for use in a grpc.NewServer call.
Deprecated: Use [NewServerHandler] instead. | func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
cfg := newConfig(opts, "server")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
i := &InterceptorInfo{
UnaryServerInfo: info,
Type: UnaryServer,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return handler(ctx, req)
}
ctx = extract(ctx, cfg.Propagators)
name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx))
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)),
name,
startOpts...,
)
defer span.End()
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, req)
}
before := time.Now()
resp, err := handler(ctx, req)
s, _ := status.FromError(err)
if err != nil {
statusCode, msg := serverStatus(s)
span.SetStatus(statusCode, msg)
if cfg.SentEvent {
messageSent.Event(ctx, 1, s.Proto())
}
} else {
if cfg.SentEvent {
messageSent.Event(ctx, 1, resp)
}
}
grpcStatusCodeAttr := statusCodeAttr(s.Code())
span.SetAttributes(grpcStatusCodeAttr)
elapsedTime := time.Since(before).Milliseconds()
metricAttrs = append(metricAttrs, grpcStatusCodeAttr)
cfg.rpcDuration.Record(ctx, float64(elapsedTime), metric.WithAttributes(metricAttrs...))
return resp, err
}
} | func OpenTracingServerInterceptor(tracer opentracing.Tracer, optFuncs ...Option) grpc.UnaryServerInterceptor {
otgrpcOpts := newOptions()
otgrpcOpts.apply(optFuncs...)
return func(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (resp interface{}, err error) {
spanContext, err := extractSpanContext(ctx, tracer)
if err != nil && err != opentracing.ErrSpanContextNotFound {
// TODO: establish some sort of error reporting mechanism here. We
// don't know where to put such an error and must rely on Tracer
// implementations to do something appropriate for the time being.
}
if otgrpcOpts.inclusionFunc != nil &&
!otgrpcOpts.inclusionFunc(spanContext, info.FullMethod, req, nil) {
return handler(ctx, req)
}
serverSpan := tracer.StartSpan(
info.FullMethod,
ext.RPCServerOption(spanContext),
gRPCComponentTag,
)
defer serverSpan.Finish()
ctx = opentracing.ContextWithSpan(ctx, serverSpan)
if otgrpcOpts.logPayloads {
serverSpan.LogFields(log.Object("gRPC request", req))
}
resp, err = handler(ctx, req)
if err == nil {
if otgrpcOpts.logPayloads {
serverSpan.LogFields(log.Object("gRPC response", resp))
}
} else {
SetSpanTags(serverSpan, err, false)
serverSpan.LogFields(log.String("event", "error"), log.String("message", err.Error()))
}
if otgrpcOpts.decorator != nil {
otgrpcOpts.decorator(serverSpan, info.FullMethod, req, resp, err)
}
return resp, err
}
} | 0.795458 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | docker/app | vendor/github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc/server.go | Apache-2.0 | go |
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable
for use in a grpc.NewServer call.
Deprecated: Use [NewServerHandler] instead. | func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
cfg := newConfig(opts, "server")
tracer := cfg.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
)
return func(
ctx context.Context,
req interface{},
info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler,
) (interface{}, error) {
i := &InterceptorInfo{
UnaryServerInfo: info,
Type: UnaryServer,
}
if cfg.Filter != nil && !cfg.Filter(i) {
return handler(ctx, req)
}
ctx = extract(ctx, cfg.Propagators)
name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx))
startOpts := append([]trace.SpanStartOption{
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(attr...),
},
cfg.SpanStartOptions...,
)
ctx, span := tracer.Start(
trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)),
name,
startOpts...,
)
defer span.End()
if cfg.ReceivedEvent {
messageReceived.Event(ctx, 1, req)
}
before := time.Now()
resp, err := handler(ctx, req)
s, _ := status.FromError(err)
if err != nil {
statusCode, msg := serverStatus(s)
span.SetStatus(statusCode, msg)
if cfg.SentEvent {
messageSent.Event(ctx, 1, s.Proto())
}
} else {
if cfg.SentEvent {
messageSent.Event(ctx, 1, resp)
}
}
grpcStatusCodeAttr := statusCodeAttr(s.Code())
span.SetAttributes(grpcStatusCodeAttr)
elapsedTime := time.Since(before).Milliseconds()
metricAttrs = append(metricAttrs, grpcStatusCodeAttr)
cfg.rpcDuration.Record(ctx, float64(elapsedTime), metric.WithAttributes(metricAttrs...))
return resp, err
}
} | func UnaryInterceptor(i UnaryServerInterceptor) ServerOption {
return newFuncServerOption(func(o *serverOptions) {
if o.unaryInt != nil {
panic("The unary server interceptor was already set and may not be reset.")
}
o.unaryInt = i
})
} | 0.781081 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go | docker/cli | vendor/google.golang.org/grpc/server.go | Apache-2.0 | go |
VGATHERPF0QPS performs "Sparse Prefetch Packed Single-Precision Floating-Point Data Values with Signed Quadword Indices Using T0 Hint".
Mnemonic : VGATHERPF0QPS
Supported forms : (1 form)
* VGATHERPF0QPS vm64z{k} [AVX512PF] | func (self *Program) VGATHERPF0QPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0QPS", 1, Operands { v0 })
// VGATHERPF0QPS vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(1, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0QPS")
}
return p
} | func (self *Program) VGATHERPF1QPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF1QPS", 1, Operands { v0 })
// VGATHERPF1QPS vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(2, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF1QPS")
}
return p
} | 0.980223 | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Apache-2.0 | go |
VGATHERPF0QPS performs "Sparse Prefetch Packed Single-Precision Floating-Point Data Values with Signed Quadword Indices Using T0 Hint".
Mnemonic : VGATHERPF0QPS
Supported forms : (1 form)
* VGATHERPF0QPS vm64z{k} [AVX512PF] | func (self *Program) VGATHERPF0QPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0QPS", 1, Operands { v0 })
// VGATHERPF0QPS vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(1, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0QPS")
}
return p
} | func (self *Program) VGATHERPF0QPD(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0QPD", 1, Operands { v0 })
// VGATHERPF0QPD vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x85, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(1, addr(v[0]), 8)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0QPD")
}
return p
} | 0.967464 | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Apache-2.0 | go |
VGATHERPF0QPS performs "Sparse Prefetch Packed Single-Precision Floating-Point Data Values with Signed Quadword Indices Using T0 Hint".
Mnemonic : VGATHERPF0QPS
Supported forms : (1 form)
* VGATHERPF0QPS vm64z{k} [AVX512PF] | func (self *Program) VGATHERPF0QPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0QPS", 1, Operands { v0 })
// VGATHERPF0QPS vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(1, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0QPS")
}
return p
} | func (self *Program) VGATHERPF1DPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF1DPS", 1, Operands { v0 })
// VGATHERPF1DPS vm32z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc6)
m.mrsd(2, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF1DPS")
}
return p
} | 0.961387 | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Apache-2.0 | go |
VGATHERPF0QPS performs "Sparse Prefetch Packed Single-Precision Floating-Point Data Values with Signed Quadword Indices Using T0 Hint".
Mnemonic : VGATHERPF0QPS
Supported forms : (1 form)
* VGATHERPF0QPS vm64z{k} [AVX512PF] | func (self *Program) VGATHERPF0QPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0QPS", 1, Operands { v0 })
// VGATHERPF0QPS vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(1, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0QPS")
}
return p
} | func (self *Program) VGATHERPF0DPD(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0DPD", 1, Operands { v0 })
// VGATHERPF0DPD vm32y{k}
if isVMYk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x85, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc6)
m.mrsd(1, addr(v[0]), 8)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0DPD")
}
return p
} | 0.951892 | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Apache-2.0 | go |
VGATHERPF0QPS performs "Sparse Prefetch Packed Single-Precision Floating-Point Data Values with Signed Quadword Indices Using T0 Hint".
Mnemonic : VGATHERPF0QPS
Supported forms : (1 form)
* VGATHERPF0QPS vm64z{k} [AVX512PF] | func (self *Program) VGATHERPF0QPS(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF0QPS", 1, Operands { v0 })
// VGATHERPF0QPS vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x05, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(1, addr(v[0]), 4)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF0QPS")
}
return p
} | func (self *Program) VGATHERPF1QPD(v0 interface{}) *Instruction {
p := self.alloc("VGATHERPF1QPD", 1, Operands { v0 })
// VGATHERPF1QPD vm64z{k}
if isVMZk(v0) {
self.require(ISA_AVX512PF)
p.domain = DomainAVX
p.add(0, func(m *_Encoding, v []interface{}) {
m.evex(0b10, 0x85, 0b10, 0, addr(v[0]), 0, kcode(v[0]), 0, 0)
m.emit(0xc7)
m.mrsd(2, addr(v[0]), 8)
})
}
if p.len == 0 {
panic("invalid operands for VGATHERPF1QPD")
}
return p
} | 0.947491 | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Telefonica/prometheus-kafka-adapter | vendor/github.com/cloudwego/iasm/x86_64/instructions.go | Apache-2.0 | go |
RegisterOnPremisesInstance API operation for AWS CodeDeploy.
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the
request. You cannot use both.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS CodeDeploy's
API operation RegisterOnPremisesInstance for usage and error information.
Returned Error Types:
- InstanceNameAlreadyRegisteredException
The specified on-premises instance name is already registered.
- IamArnRequiredException
No IAM ARN was included in the request. You must use an IAM session ARN or
user ARN in the request.
- IamSessionArnAlreadyRegisteredException
The request included an IAM session ARN that has already been used to register
a different instance.
- IamUserArnAlreadyRegisteredException
The specified user ARN is already registered with an on-premises instance.
- InstanceNameRequiredException
An on-premises instance name was not specified.
- IamUserArnRequiredException
An user ARN was not specified.
- InvalidInstanceNameException
The on-premises instance name was specified in an invalid format.
- InvalidIamSessionArnException
The IAM session ARN was specified in an invalid format.
- InvalidIamUserArnException
The user ARN was specified in an invalid format.
- MultipleIamArnsProvidedException
Both an user ARN and an IAM session ARN were included in the request. Use
only one ARN type.
See also, https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterOnPremisesInstance | func (c *CodeDeploy) RegisterOnPremisesInstance(input *RegisterOnPremisesInstanceInput) (*RegisterOnPremisesInstanceOutput, error) {
req, out := c.RegisterOnPremisesInstanceRequest(input)
return out, req.Send()
} | func (c *CodeDeploy) AddTagsToOnPremisesInstances(input *AddTagsToOnPremisesInstancesInput) (*AddTagsToOnPremisesInstancesOutput, error) {
req, out := c.AddTagsToOnPremisesInstancesRequest(input)
return out, req.Send()
} | 0.794228 | aws/aws-sdk-go | service/codedeploy/api.go | aws/aws-sdk-go | service/codedeploy/api.go | Apache-2.0 | go |
RegisterOnPremisesInstance API operation for AWS CodeDeploy.
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the
request. You cannot use both.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS CodeDeploy's
API operation RegisterOnPremisesInstance for usage and error information.
Returned Error Types:
- InstanceNameAlreadyRegisteredException
The specified on-premises instance name is already registered.
- IamArnRequiredException
No IAM ARN was included in the request. You must use an IAM session ARN or
user ARN in the request.
- IamSessionArnAlreadyRegisteredException
The request included an IAM session ARN that has already been used to register
a different instance.
- IamUserArnAlreadyRegisteredException
The specified user ARN is already registered with an on-premises instance.
- InstanceNameRequiredException
An on-premises instance name was not specified.
- IamUserArnRequiredException
An user ARN was not specified.
- InvalidInstanceNameException
The on-premises instance name was specified in an invalid format.
- InvalidIamSessionArnException
The IAM session ARN was specified in an invalid format.
- InvalidIamUserArnException
The user ARN was specified in an invalid format.
- MultipleIamArnsProvidedException
Both an user ARN and an IAM session ARN were included in the request. Use
only one ARN type.
See also, https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterOnPremisesInstance | func (c *CodeDeploy) RegisterOnPremisesInstance(input *RegisterOnPremisesInstanceInput) (*RegisterOnPremisesInstanceOutput, error) {
req, out := c.RegisterOnPremisesInstanceRequest(input)
return out, req.Send()
} | func (c *CodeDeploy) RegisterOnPremisesInstanceRequest(input *RegisterOnPremisesInstanceInput) (req *request.Request, output *RegisterOnPremisesInstanceOutput) {
op := &request.Operation{
Name: opRegisterOnPremisesInstance,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &RegisterOnPremisesInstanceInput{}
}
output = &RegisterOnPremisesInstanceOutput{}
req = c.newRequest(op, input, output)
req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
return
} | 0.781527 | aws/aws-sdk-go | service/codedeploy/api.go | aws/aws-sdk-go | service/codedeploy/api.go | Apache-2.0 | go |
RegisterOnPremisesInstance API operation for AWS CodeDeploy.
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the
request. You cannot use both.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS CodeDeploy's
API operation RegisterOnPremisesInstance for usage and error information.
Returned Error Types:
- InstanceNameAlreadyRegisteredException
The specified on-premises instance name is already registered.
- IamArnRequiredException
No IAM ARN was included in the request. You must use an IAM session ARN or
user ARN in the request.
- IamSessionArnAlreadyRegisteredException
The request included an IAM session ARN that has already been used to register
a different instance.
- IamUserArnAlreadyRegisteredException
The specified user ARN is already registered with an on-premises instance.
- InstanceNameRequiredException
An on-premises instance name was not specified.
- IamUserArnRequiredException
An user ARN was not specified.
- InvalidInstanceNameException
The on-premises instance name was specified in an invalid format.
- InvalidIamSessionArnException
The IAM session ARN was specified in an invalid format.
- InvalidIamUserArnException
The user ARN was specified in an invalid format.
- MultipleIamArnsProvidedException
Both an user ARN and an IAM session ARN were included in the request. Use
only one ARN type.
See also, https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterOnPremisesInstance | func (c *CodeDeploy) RegisterOnPremisesInstance(input *RegisterOnPremisesInstanceInput) (*RegisterOnPremisesInstanceOutput, error) {
req, out := c.RegisterOnPremisesInstanceRequest(input)
return out, req.Send()
} | func (c *CodeDeploy) DeregisterOnPremisesInstance(input *DeregisterOnPremisesInstanceInput) (*DeregisterOnPremisesInstanceOutput, error) {
req, out := c.DeregisterOnPremisesInstanceRequest(input)
return out, req.Send()
} | 0.776405 | aws/aws-sdk-go | service/codedeploy/api.go | aws/aws-sdk-go | service/codedeploy/api.go | Apache-2.0 | go |
RegisterOnPremisesInstance API operation for AWS CodeDeploy.
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the
request. You cannot use both.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS CodeDeploy's
API operation RegisterOnPremisesInstance for usage and error information.
Returned Error Types:
- InstanceNameAlreadyRegisteredException
The specified on-premises instance name is already registered.
- IamArnRequiredException
No IAM ARN was included in the request. You must use an IAM session ARN or
user ARN in the request.
- IamSessionArnAlreadyRegisteredException
The request included an IAM session ARN that has already been used to register
a different instance.
- IamUserArnAlreadyRegisteredException
The specified user ARN is already registered with an on-premises instance.
- InstanceNameRequiredException
An on-premises instance name was not specified.
- IamUserArnRequiredException
An user ARN was not specified.
- InvalidInstanceNameException
The on-premises instance name was specified in an invalid format.
- InvalidIamSessionArnException
The IAM session ARN was specified in an invalid format.
- InvalidIamUserArnException
The user ARN was specified in an invalid format.
- MultipleIamArnsProvidedException
Both an user ARN and an IAM session ARN were included in the request. Use
only one ARN type.
See also, https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterOnPremisesInstance | func (c *CodeDeploy) RegisterOnPremisesInstance(input *RegisterOnPremisesInstanceInput) (*RegisterOnPremisesInstanceOutput, error) {
req, out := c.RegisterOnPremisesInstanceRequest(input)
return out, req.Send()
} | func (c *CodeDeploy) ListOnPremisesInstances(input *ListOnPremisesInstancesInput) (*ListOnPremisesInstancesOutput, error) {
req, out := c.ListOnPremisesInstancesRequest(input)
return out, req.Send()
} | 0.774045 | aws/aws-sdk-go | service/codedeploy/api.go | aws/aws-sdk-go | service/codedeploy/api.go | Apache-2.0 | go |
RegisterOnPremisesInstance API operation for AWS CodeDeploy.
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the
request. You cannot use both.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS CodeDeploy's
API operation RegisterOnPremisesInstance for usage and error information.
Returned Error Types:
- InstanceNameAlreadyRegisteredException
The specified on-premises instance name is already registered.
- IamArnRequiredException
No IAM ARN was included in the request. You must use an IAM session ARN or
user ARN in the request.
- IamSessionArnAlreadyRegisteredException
The request included an IAM session ARN that has already been used to register
a different instance.
- IamUserArnAlreadyRegisteredException
The specified user ARN is already registered with an on-premises instance.
- InstanceNameRequiredException
An on-premises instance name was not specified.
- IamUserArnRequiredException
An user ARN was not specified.
- InvalidInstanceNameException
The on-premises instance name was specified in an invalid format.
- InvalidIamSessionArnException
The IAM session ARN was specified in an invalid format.
- InvalidIamUserArnException
The user ARN was specified in an invalid format.
- MultipleIamArnsProvidedException
Both an user ARN and an IAM session ARN were included in the request. Use
only one ARN type.
See also, https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/RegisterOnPremisesInstance | func (c *CodeDeploy) RegisterOnPremisesInstance(input *RegisterOnPremisesInstanceInput) (*RegisterOnPremisesInstanceOutput, error) {
req, out := c.RegisterOnPremisesInstanceRequest(input)
return out, req.Send()
} | func (c *CodeDeploy) GetOnPremisesInstance(input *GetOnPremisesInstanceInput) (*GetOnPremisesInstanceOutput, error) {
req, out := c.GetOnPremisesInstanceRequest(input)
return out, req.Send()
} | 0.759546 | aws/aws-sdk-go | service/codedeploy/api.go | aws/aws-sdk-go | service/codedeploy/api.go | Apache-2.0 | go |
AssociateConnectionWithLagRequest generates a "aws/request.Request" representing the
client's request for the AssociateConnectionWithLag operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See AssociateConnectionWithLag for more information on using the AssociateConnectionWithLag
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the AssociateConnectionWithLagRequest method.
req, resp := client.AssociateConnectionWithLagRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/directconnect-2012-10-25/AssociateConnectionWithLag | func (c *DirectConnect) AssociateConnectionWithLagRequest(input *AssociateConnectionWithLagInput) (req *request.Request, output *Connection) {
op := &request.Operation{
Name: opAssociateConnectionWithLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AssociateConnectionWithLagInput{}
}
output = &Connection{}
req = c.newRequest(op, input, output)
return
} | func (c *DirectConnect) DisassociateConnectionFromLagRequest(input *DisassociateConnectionFromLagInput) (req *request.Request, output *Connection) {
op := &request.Operation{
Name: opDisassociateConnectionFromLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &DisassociateConnectionFromLagInput{}
}
output = &Connection{}
req = c.newRequest(op, input, output)
return
} | 0.840926 | aws/aws-sdk-go | service/directconnect/api.go | aws/aws-sdk-go | service/directconnect/api.go | Apache-2.0 | go |
AssociateConnectionWithLagRequest generates a "aws/request.Request" representing the
client's request for the AssociateConnectionWithLag operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See AssociateConnectionWithLag for more information on using the AssociateConnectionWithLag
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the AssociateConnectionWithLagRequest method.
req, resp := client.AssociateConnectionWithLagRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/directconnect-2012-10-25/AssociateConnectionWithLag | func (c *DirectConnect) AssociateConnectionWithLagRequest(input *AssociateConnectionWithLagInput) (req *request.Request, output *Connection) {
op := &request.Operation{
Name: opAssociateConnectionWithLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AssociateConnectionWithLagInput{}
}
output = &Connection{}
req = c.newRequest(op, input, output)
return
} | func (c *DirectConnect) AssociateConnectionWithLagWithContext(ctx aws.Context, input *AssociateConnectionWithLagInput, opts ...request.Option) (*Connection, error) {
req, out := c.AssociateConnectionWithLagRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.793025 | aws/aws-sdk-go | service/directconnect/api.go | aws/aws-sdk-go | service/directconnect/api.go | Apache-2.0 | go |
AssociateConnectionWithLagRequest generates a "aws/request.Request" representing the
client's request for the AssociateConnectionWithLag operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See AssociateConnectionWithLag for more information on using the AssociateConnectionWithLag
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the AssociateConnectionWithLagRequest method.
req, resp := client.AssociateConnectionWithLagRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/directconnect-2012-10-25/AssociateConnectionWithLag | func (c *DirectConnect) AssociateConnectionWithLagRequest(input *AssociateConnectionWithLagInput) (req *request.Request, output *Connection) {
op := &request.Operation{
Name: opAssociateConnectionWithLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AssociateConnectionWithLagInput{}
}
output = &Connection{}
req = c.newRequest(op, input, output)
return
} | func (c *DirectConnect) CreateLagRequest(input *CreateLagInput) (req *request.Request, output *Lag) {
op := &request.Operation{
Name: opCreateLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &CreateLagInput{}
}
output = &Lag{}
req = c.newRequest(op, input, output)
return
} | 0.786631 | aws/aws-sdk-go | service/directconnect/api.go | aws/aws-sdk-go | service/directconnect/api.go | Apache-2.0 | go |
AssociateConnectionWithLagRequest generates a "aws/request.Request" representing the
client's request for the AssociateConnectionWithLag operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See AssociateConnectionWithLag for more information on using the AssociateConnectionWithLag
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the AssociateConnectionWithLagRequest method.
req, resp := client.AssociateConnectionWithLagRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/directconnect-2012-10-25/AssociateConnectionWithLag | func (c *DirectConnect) AssociateConnectionWithLagRequest(input *AssociateConnectionWithLagInput) (req *request.Request, output *Connection) {
op := &request.Operation{
Name: opAssociateConnectionWithLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AssociateConnectionWithLagInput{}
}
output = &Connection{}
req = c.newRequest(op, input, output)
return
} | func (c *DirectConnect) UpdateLagRequest(input *UpdateLagInput) (req *request.Request, output *Lag) {
op := &request.Operation{
Name: opUpdateLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &UpdateLagInput{}
}
output = &Lag{}
req = c.newRequest(op, input, output)
return
} | 0.764591 | aws/aws-sdk-go | service/directconnect/api.go | aws/aws-sdk-go | service/directconnect/api.go | Apache-2.0 | go |
AssociateConnectionWithLagRequest generates a "aws/request.Request" representing the
client's request for the AssociateConnectionWithLag operation. The "output" return
value will be populated with the request's response once the request completes
successfully.
Use "Send" method on the returned Request to send the API call to the service.
the "output" return value is not valid until after Send returns without error.
See AssociateConnectionWithLag for more information on using the AssociateConnectionWithLag
API call, and error handling.
This method is useful when you want to inject custom logic or configuration
into the SDK's request lifecycle. Such as custom headers, or retry logic.
// Example sending a request using the AssociateConnectionWithLagRequest method.
req, resp := client.AssociateConnectionWithLagRequest(params)
err := req.Send()
if err == nil { // resp is now filled
fmt.Println(resp)
}
See also, https://docs.aws.amazon.com/goto/WebAPI/directconnect-2012-10-25/AssociateConnectionWithLag | func (c *DirectConnect) AssociateConnectionWithLagRequest(input *AssociateConnectionWithLagInput) (req *request.Request, output *Connection) {
op := &request.Operation{
Name: opAssociateConnectionWithLag,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AssociateConnectionWithLagInput{}
}
output = &Connection{}
req = c.newRequest(op, input, output)
return
} | func (c *DirectConnect) DisassociateConnectionFromLagWithContext(ctx aws.Context, input *DisassociateConnectionFromLagInput, opts ...request.Option) (*Connection, error) {
req, out := c.DisassociateConnectionFromLagRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.724131 | aws/aws-sdk-go | service/directconnect/api.go | aws/aws-sdk-go | service/directconnect/api.go | Apache-2.0 | go |
Init initializes a new ostree repository at the given path. Returns true
if the repo exists at the location, regardless of whether it was initialized
by the function or if it already existed. Returns an error if the repo could
not be initialized | func Init(path string, options initOptions) (bool, error) {
repoMode, err := parseRepoMode(options.Mode)
if err != nil {
return false, err
}
// Create a repo struct from the path
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
pathc := C.g_file_new_for_path(cpath)
defer C.g_object_unref(C.gpointer(pathc))
repo := C.ostree_repo_new(pathc)
// If the repo exists in the filesystem, return an error but set exists to true
/* var exists C.gboolean = 0
success := glib.GoBool(glib.GBoolean(C.ostree_repo_exists(crepo, &exists, &cerr)))
if exists != 0 {
err = errors.New("repository already exists")
return true, err
} else if !success {
return false, generateError(cerr)
}*/
var cErr *C.GError
defer C.free(unsafe.Pointer(cErr))
if r := C.ostree_repo_create(repo, repoMode, nil, &cErr); !isOk(r) {
err := generateError(cErr)
if strings.Contains(err.Error(), "File exists") {
return true, err
}
return false, err
}
return true, nil
} | func NewRepositoryFromPath(path string) (*Repository, error) {
gitBin, err := findGitBin()
if err != nil {
return nil, fmt.Errorf(
"could not find 'git' executable (is it in your PATH?): %w", err,
)
}
//nolint:gosec // `gitBin` is chosen carefully, and `path` is the
// path to the repository.
cmd := exec.Command(gitBin, "-C", path, "rev-parse", "--git-dir")
out, err := cmd.Output()
if err != nil {
switch err := err.(type) {
case *exec.Error:
return nil, fmt.Errorf(
"could not run '%s': %w", gitBin, err.Err,
)
case *exec.ExitError:
return nil, fmt.Errorf(
"git rev-parse failed: %s", err.Stderr,
)
default:
return nil, err
}
} | 0.543351 | containers/podman-tui | vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go | github/git-sizer | git/git.go | MIT | go |
Init initializes a new ostree repository at the given path. Returns true
if the repo exists at the location, regardless of whether it was initialized
by the function or if it already existed. Returns an error if the repo could
not be initialized | func Init(path string, options initOptions) (bool, error) {
repoMode, err := parseRepoMode(options.Mode)
if err != nil {
return false, err
}
// Create a repo struct from the path
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
pathc := C.g_file_new_for_path(cpath)
defer C.g_object_unref(C.gpointer(pathc))
repo := C.ostree_repo_new(pathc)
// If the repo exists in the filesystem, return an error but set exists to true
/* var exists C.gboolean = 0
success := glib.GoBool(glib.GBoolean(C.ostree_repo_exists(crepo, &exists, &cerr)))
if exists != 0 {
err = errors.New("repository already exists")
return true, err
} else if !success {
return false, generateError(cerr)
}*/
var cErr *C.GError
defer C.free(unsafe.Pointer(cErr))
if r := C.ostree_repo_create(repo, repoMode, nil, &cErr); !isOk(r) {
err := generateError(cErr)
if strings.Contains(err.Error(), "File exists") {
return true, err
}
return false, err
}
return true, nil
} | func (fn *Node) detectVCSRepo(updateFiles bool) bool {
repo, _ := fn.Repo()
if repo != nil {
return false
}
path := string(fn.Filepath)
rtyp := vcs.DetectRepo(path)
if rtyp == vcs.NoVCS {
return false
}
var err error
repo, err = vcs.NewRepo("origin", path)
if err != nil {
slog.Error(err.Error())
return false
}
fn.DirRepo = repo
if updateFiles {
fn.updateRepoFiles()
}
return true
} | 0.538394 | containers/podman-tui | vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go | cogentcore/core | filetree/vcs.go | BSD-3-Clause | go |
Init initializes a new ostree repository at the given path. Returns true
if the repo exists at the location, regardless of whether it was initialized
by the function or if it already existed. Returns an error if the repo could
not be initialized | func Init(path string, options initOptions) (bool, error) {
repoMode, err := parseRepoMode(options.Mode)
if err != nil {
return false, err
}
// Create a repo struct from the path
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
pathc := C.g_file_new_for_path(cpath)
defer C.g_object_unref(C.gpointer(pathc))
repo := C.ostree_repo_new(pathc)
// If the repo exists in the filesystem, return an error but set exists to true
/* var exists C.gboolean = 0
success := glib.GoBool(glib.GBoolean(C.ostree_repo_exists(crepo, &exists, &cerr)))
if exists != 0 {
err = errors.New("repository already exists")
return true, err
} else if !success {
return false, generateError(cerr)
}*/
var cErr *C.GError
defer C.free(unsafe.Pointer(cErr))
if r := C.ostree_repo_create(repo, repoMode, nil, &cErr); !isOk(r) {
err := generateError(cErr)
if strings.Contains(err.Error(), "File exists") {
return true, err
}
return false, err
}
return true, nil
} | func (s *Service) initGitClient(logCtx *log.Entry, r *apiclient.CommitHydratedManifestsRequest) (git.Client, string, func(), error) {
dirPath, err := files.CreateTempDir("/tmp/_commit-service")
if err != nil {
return nil, "", nil, fmt.Errorf("failed to create temp dir: %w", err)
}
// Call cleanupOrLog in this function if an error occurs to ensure the temp dir is cleaned up.
cleanupOrLog := func() {
err := os.RemoveAll(dirPath)
if err != nil {
logCtx.WithError(err).Error("failed to cleanup temp dir")
}
}
gitClient, err := s.repoClientFactory.NewClient(r.Repo, dirPath)
if err != nil {
cleanupOrLog()
return nil, "", nil, fmt.Errorf("failed to create git client: %w", err)
}
logCtx.Debugf("Initializing repo %s", r.Repo.Repo)
err = gitClient.Init()
if err != nil {
cleanupOrLog()
return nil, "", nil, fmt.Errorf("failed to init git client: %w", err)
}
logCtx.Debugf("Fetching repo %s", r.Repo.Repo)
err = gitClient.Fetch("")
if err != nil {
cleanupOrLog()
return nil, "", nil, fmt.Errorf("failed to clone repo: %w", err)
}
// FIXME: make it work for GHE
// logCtx.Debugf("Getting user info for repo credentials")
// gitCreds := r.Repo.GetGitCreds(s.gitCredsStore)
// startTime := time.Now()
// authorName, authorEmail, err := gitCreds.GetUserInfo(ctx)
// s.metricsServer.ObserveUserInfoRequestDuration(r.Repo.Repo, getCredentialType(r.Repo), time.Since(startTime))
// if err != nil {
// cleanupOrLog()
// return nil, "", nil, fmt.Errorf("failed to get github app info: %w", err)
// }
var authorName, authorEmail string
if authorName == "" {
authorName = "Argo CD"
}
if authorEmail == "" {
logCtx.Warnf("Author email not available, using '[email protected]'.")
authorEmail = "[email protected]"
}
logCtx.Debugf("Setting author %s <%s>", authorName, authorEmail)
_, err = gitClient.SetAuthor(authorName, authorEmail)
if err != nil {
cleanupOrLog()
return nil, "", nil, fmt.Errorf("failed to set author: %w", err)
}
return gitClient, dirPath, cleanupOrLog, nil
} | 0.534193 | containers/podman-tui | vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go | argoproj/argo-cd | commitserver/commit/commit.go | Apache-2.0 | go |
Init initializes a new ostree repository at the given path. Returns true
if the repo exists at the location, regardless of whether it was initialized
by the function or if it already existed. Returns an error if the repo could
not be initialized | func Init(path string, options initOptions) (bool, error) {
repoMode, err := parseRepoMode(options.Mode)
if err != nil {
return false, err
}
// Create a repo struct from the path
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
pathc := C.g_file_new_for_path(cpath)
defer C.g_object_unref(C.gpointer(pathc))
repo := C.ostree_repo_new(pathc)
// If the repo exists in the filesystem, return an error but set exists to true
/* var exists C.gboolean = 0
success := glib.GoBool(glib.GBoolean(C.ostree_repo_exists(crepo, &exists, &cerr)))
if exists != 0 {
err = errors.New("repository already exists")
return true, err
} else if !success {
return false, generateError(cerr)
}*/
var cErr *C.GError
defer C.free(unsafe.Pointer(cErr))
if r := C.ostree_repo_create(repo, repoMode, nil, &cErr); !isOk(r) {
err := generateError(cErr)
if strings.Contains(err.Error(), "File exists") {
return true, err
}
return false, err
}
return true, nil
} | func NewRepo(cryptoService signed.CryptoService) *Repo {
return &Repo{
Targets: make(map[data.RoleName]*data.SignedTargets),
cryptoService: cryptoService,
}
} | 0.521298 | containers/podman-tui | vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go | docker/cli | vendor/github.com/theupdateframework/notary/tuf/tuf.go | Apache-2.0 | go |
Init initializes a new ostree repository at the given path. Returns true
if the repo exists at the location, regardless of whether it was initialized
by the function or if it already existed. Returns an error if the repo could
not be initialized | func Init(path string, options initOptions) (bool, error) {
repoMode, err := parseRepoMode(options.Mode)
if err != nil {
return false, err
}
// Create a repo struct from the path
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
pathc := C.g_file_new_for_path(cpath)
defer C.g_object_unref(C.gpointer(pathc))
repo := C.ostree_repo_new(pathc)
// If the repo exists in the filesystem, return an error but set exists to true
/* var exists C.gboolean = 0
success := glib.GoBool(glib.GBoolean(C.ostree_repo_exists(crepo, &exists, &cerr)))
if exists != 0 {
err = errors.New("repository already exists")
return true, err
} else if !success {
return false, generateError(cerr)
}*/
var cErr *C.GError
defer C.free(unsafe.Pointer(cErr))
if r := C.ostree_repo_create(repo, repoMode, nil, &cErr); !isOk(r) {
err := generateError(cErr)
if strings.Contains(err.Error(), "File exists") {
return true, err
}
return false, err
}
return true, nil
} | func (e *Executor) install(ctx context.Context, path string, replace bool, repo *filerepo.Repository) (reflow.Fileset, error) {
w := new(walker.Walker)
w.Init(path)
g, ctx := errgroup.WithContext(ctx)
var (
mu sync.Mutex
val = reflow.Fileset{Map: map[string]reflow.File{}}
)
for w.Scan() {
if w.Info().IsDir() {
continue
}
path, relpath, size := w.Path(), w.Relpath(), w.Info().Size()
g.Go(func() error {
file, err := repo.Install(path)
if err != nil {
return err
}
mu.Lock()
val.Map[relpath] = reflow.File{ID: file.ID, Size: size}
mu.Unlock()
return err
})
}
if err := g.Wait(); err != nil {
return reflow.Fileset{}, err
}
if err := w.Err(); err != nil {
return reflow.Fileset{}, err
}
// We remove files only after digesting has completed; if the
// directory tree has any symlinks, we may otherwise end up removing
// a file before it is (re)digested.
if replace {
for k, v := range val.Map {
objPath := filepath.Join(path, k)
os.Remove(objPath)
os.Symlink(v.ID.String(), objPath)
}
}
return val, nil
} | 0.490167 | containers/podman-tui | vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go | grailbio/reflow | local/executor.go | Apache-2.0 | go |
GetVoiceConnectorEmergencyCallingConfigurationWithContext is the same as GetVoiceConnectorEmergencyCallingConfiguration with the addition of
the ability to pass a context and additional request options.
See GetVoiceConnectorEmergencyCallingConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *ChimeSDKVoice) GetVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *GetVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*GetVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.GetVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *Chime) GetVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *GetVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*GetVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.GetVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.986674 | aws/aws-sdk-go | service/chimesdkvoice/api.go | aws/aws-sdk-go | service/chime/api.go | Apache-2.0 | go |
GetVoiceConnectorEmergencyCallingConfigurationWithContext is the same as GetVoiceConnectorEmergencyCallingConfiguration with the addition of
the ability to pass a context and additional request options.
See GetVoiceConnectorEmergencyCallingConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *ChimeSDKVoice) GetVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *GetVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*GetVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.GetVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *ChimeSDKVoice) DeleteVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *DeleteVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*DeleteVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.DeleteVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.95632 | aws/aws-sdk-go | service/chimesdkvoice/api.go | aws/aws-sdk-go | service/chimesdkvoice/api.go | Apache-2.0 | go |
GetVoiceConnectorEmergencyCallingConfigurationWithContext is the same as GetVoiceConnectorEmergencyCallingConfiguration with the addition of
the ability to pass a context and additional request options.
See GetVoiceConnectorEmergencyCallingConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *ChimeSDKVoice) GetVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *GetVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*GetVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.GetVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *Chime) PutVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *PutVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*PutVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.PutVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.947091 | aws/aws-sdk-go | service/chimesdkvoice/api.go | aws/aws-sdk-go | service/chime/api.go | Apache-2.0 | go |
GetVoiceConnectorEmergencyCallingConfigurationWithContext is the same as GetVoiceConnectorEmergencyCallingConfiguration with the addition of
the ability to pass a context and additional request options.
See GetVoiceConnectorEmergencyCallingConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *ChimeSDKVoice) GetVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *GetVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*GetVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.GetVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *Chime) DeleteVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *DeleteVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*DeleteVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.DeleteVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.945375 | aws/aws-sdk-go | service/chimesdkvoice/api.go | aws/aws-sdk-go | service/chime/api.go | Apache-2.0 | go |
GetVoiceConnectorEmergencyCallingConfigurationWithContext is the same as GetVoiceConnectorEmergencyCallingConfiguration with the addition of
the ability to pass a context and additional request options.
See GetVoiceConnectorEmergencyCallingConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *ChimeSDKVoice) GetVoiceConnectorEmergencyCallingConfigurationWithContext(ctx aws.Context, input *GetVoiceConnectorEmergencyCallingConfigurationInput, opts ...request.Option) (*GetVoiceConnectorEmergencyCallingConfigurationOutput, error) {
req, out := c.GetVoiceConnectorEmergencyCallingConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *ChimeSDKVoice) GetVoiceConnectorEmergencyCallingConfigurationRequest(input *GetVoiceConnectorEmergencyCallingConfigurationInput) (req *request.Request, output *GetVoiceConnectorEmergencyCallingConfigurationOutput) {
op := &request.Operation{
Name: opGetVoiceConnectorEmergencyCallingConfiguration,
HTTPMethod: "GET",
HTTPPath: "/voice-connectors/{voiceConnectorId}/emergency-calling-configuration",
}
if input == nil {
input = &GetVoiceConnectorEmergencyCallingConfigurationInput{}
}
output = &GetVoiceConnectorEmergencyCallingConfigurationOutput{}
req = c.newRequest(op, input, output)
return
} | 0.854044 | aws/aws-sdk-go | service/chimesdkvoice/api.go | aws/aws-sdk-go | service/chimesdkvoice/api.go | Apache-2.0 | go |
GetCertOptionsFromExistingCert parses cert and generates a CertOptions
that contains information about the cert. This is the reverse operation of
genCertTemplateFromOptions(), and only called by a self-signed Citadel. | func GetCertOptionsFromExistingCert(certBytes []byte) (opts CertOptions, err error) {
cert, certErr := ParsePemEncodedCertificate(certBytes)
if certErr != nil {
return opts, certErr
}
orgs := cert.Subject.Organization
if len(orgs) > 0 {
opts.Org = orgs[0]
}
// TODO(JimmyCYJ): parse other fields from certificate, e.g. CommonName.
return opts, nil
} | func MustGenerateCertPEMFormat(opts ...SelfSignedCertificateOption) (cert []byte, key []byte) {
return CertToPEMFormat(MustGenerateCert(opts...))
} | 0.652708 | istio/istio | security/pkg/pki/util/generate_cert.go | Kong/kubernetes-ingress-controller | test/helpers/certificate/certificate.go | Apache-2.0 | go |
GetCertOptionsFromExistingCert parses cert and generates a CertOptions
that contains information about the cert. This is the reverse operation of
genCertTemplateFromOptions(), and only called by a self-signed Citadel. | func GetCertOptionsFromExistingCert(certBytes []byte) (opts CertOptions, err error) {
cert, certErr := ParsePemEncodedCertificate(certBytes)
if certErr != nil {
return opts, certErr
}
orgs := cert.Subject.Organization
if len(orgs) > 0 {
opts.Org = orgs[0]
}
// TODO(JimmyCYJ): parse other fields from certificate, e.g. CommonName.
return opts, nil
} | func getCert(options Options) ([]tls.Certificate, error) {
if options.CertFile == "" && options.KeyFile == "" {
return nil, nil
}
cert, err := os.ReadFile(options.CertFile)
if err != nil {
return nil, err
}
prKeyBytes, err := os.ReadFile(options.KeyFile)
if err != nil {
return nil, err
}
prKeyBytes, err = getPrivateKey(prKeyBytes, options.Passphrase)
if err != nil {
return nil, err
}
tlsCert, err := tls.X509KeyPair(cert, prKeyBytes)
if err != nil {
return nil, err
}
return []tls.Certificate{tlsCert}, nil
} | 0.64457 | istio/istio | security/pkg/pki/util/generate_cert.go | umputun/tg-spam | vendor/github.com/docker/go-connections/tlsconfig/config.go | MIT | go |
GetCertOptionsFromExistingCert parses cert and generates a CertOptions
that contains information about the cert. This is the reverse operation of
genCertTemplateFromOptions(), and only called by a self-signed Citadel. | func GetCertOptionsFromExistingCert(certBytes []byte) (opts CertOptions, err error) {
cert, certErr := ParsePemEncodedCertificate(certBytes)
if certErr != nil {
return opts, certErr
}
orgs := cert.Subject.Organization
if len(orgs) > 0 {
opts.Org = orgs[0]
}
// TODO(JimmyCYJ): parse other fields from certificate, e.g. CommonName.
return opts, nil
} | func generateCert(host string, ca *x509.Certificate, caKey *rsa.PrivateKey, notAfter time.Time, dnsNames ...string) (*x509.Certificate, *rsa.PrivateKey, error) {
template, err := newCertificate(notAfter)
if err != nil {
return nil, nil, err
}
template.IPAddresses = append(template.IPAddresses, net.ParseIP(helpers.IPV4Localhost))
// Only use SANs to keep golang happy, https://go-review.googlesource.com/c/go/+/231379
if ip := net.ParseIP(host); ip != nil {
template.IPAddresses = append(template.IPAddresses, ip)
} else {
template.DNSNames = append(template.DNSNames, host)
template.DNSNames = append(template.DNSNames, dnsNames...)
}
template.Subject.CommonName = host
privateKey, err := newPrivateKey()
if err != nil {
return nil, nil, err
}
derBytes, err := x509.CreateCertificate(rand.Reader, template, ca, privateKey.Public(), caKey)
if err != nil {
return nil, nil, err
}
cert, err := x509.ParseCertificate(derBytes)
if err != nil {
return nil, nil, err
}
return cert, privateKey, nil
} | 0.61921 | istio/istio | security/pkg/pki/util/generate_cert.go | zarf-dev/zarf | src/pkg/pki/pki.go | Apache-2.0 | go |
GetCertOptionsFromExistingCert parses cert and generates a CertOptions
that contains information about the cert. This is the reverse operation of
genCertTemplateFromOptions(), and only called by a self-signed Citadel. | func GetCertOptionsFromExistingCert(certBytes []byte) (opts CertOptions, err error) {
cert, certErr := ParsePemEncodedCertificate(certBytes)
if certErr != nil {
return opts, certErr
}
orgs := cert.Subject.Organization
if len(orgs) > 0 {
opts.Org = orgs[0]
}
// TODO(JimmyCYJ): parse other fields from certificate, e.g. CommonName.
return opts, nil
} | func GenerateTrustCert(key crypto.PublicKey, parentKey crypto.PrivateKey, parent *x509.Certificate) (*x509.Certificate, error) {
cert := &x509.Certificate{
SerialNumber: big.NewInt(0),
Subject: pkix.Name{
CommonName: "Trust Cert",
},
NotBefore: time.Now().Add(-time.Second),
NotAfter: time.Now().Add(time.Hour),
IsCA: true,
KeyUsage: x509.KeyUsageDigitalSignature,
BasicConstraintsValid: true,
}
certDER, err := x509.CreateCertificate(rand.Reader, cert, parent, key, parentKey)
if err != nil {
return nil, err
}
cert, err = x509.ParseCertificate(certDER)
if err != nil {
return nil, err
}
return cert, nil
} | 0.605417 | istio/istio | security/pkg/pki/util/generate_cert.go | genuinetools/binctr | vendor/github.com/docker/libtrust/testutil/certificates.go | MIT | go |
GetCertOptionsFromExistingCert parses cert and generates a CertOptions
that contains information about the cert. This is the reverse operation of
genCertTemplateFromOptions(), and only called by a self-signed Citadel. | func GetCertOptionsFromExistingCert(certBytes []byte) (opts CertOptions, err error) {
cert, certErr := ParsePemEncodedCertificate(certBytes)
if certErr != nil {
return opts, certErr
}
orgs := cert.Subject.Organization
if len(orgs) > 0 {
opts.Org = orgs[0]
}
// TODO(JimmyCYJ): parse other fields from certificate, e.g. CommonName.
return opts, nil
} | func (cp *SelfSignedCertGenerator) Generate(commonName string) (*Artifacts, error) {
var signingKey *rsa.PrivateKey
var signingCert *x509.Certificate
var valid bool
var err error
valid, signingKey, signingCert = cp.validCACert()
if !valid {
signingKey, err = NewPrivateKey()
if err != nil {
return nil, fmt.Errorf("failed to create the CA private key: %v", err)
}
signingCert, err = cert.NewSelfSignedCACert(cert.Config{CommonName: commonName}, signingKey)
if err != nil {
return nil, fmt.Errorf("failed to create the CA cert: %v", err)
}
}
hostIP := net.ParseIP(commonName)
var altIPs []net.IP
DNSNames := []string{"localhost"}
if hostIP.To4() != nil {
altIPs = append(altIPs, hostIP.To4())
} else {
DNSNames = append(DNSNames, commonName)
}
key, err := NewPrivateKey()
if err != nil {
return nil, fmt.Errorf("failed to create the private key: %v", err)
}
signedCert, err := NewSignedCert(
cert.Config{
CommonName: commonName,
Usages: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},
AltNames: cert.AltNames{IPs: altIPs, DNSNames: DNSNames},
},
key, signingCert, signingKey,
)
if err != nil {
return nil, fmt.Errorf("failed to create the cert: %v", err)
}
return &Artifacts{
Key: EncodePrivateKeyPEM(key),
Cert: EncodeCertPEM(signedCert),
CAKey: EncodePrivateKeyPEM(signingKey),
CACert: EncodeCertPEM(signingCert),
}, nil
} | 0.603885 | istio/istio | security/pkg/pki/util/generate_cert.go | fatedier/frp | test/e2e/pkg/cert/selfsigned.go | Apache-2.0 | go |
CreateMissionProfile API operation for AWS Ground Station.
Creates a mission profile.
dataflowEdges is a list of lists of strings. Each lower level list of strings
has two elements: a from ARN and a to ARN.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Ground Station's
API operation CreateMissionProfile for usage and error information.
Returned Error Types:
- InvalidParameterException
One or more parameters are not valid.
- DependencyException
Dependency encountered an error.
- ResourceNotFoundException
Resource was not found.
See also, https://docs.aws.amazon.com/goto/WebAPI/groundstation-2019-05-23/CreateMissionProfile | func (c *GroundStation) CreateMissionProfile(input *CreateMissionProfileInput) (*CreateMissionProfileOutput, error) {
req, out := c.CreateMissionProfileRequest(input)
return out, req.Send()
} | func (c *GroundStation) DeleteMissionProfile(input *DeleteMissionProfileInput) (*DeleteMissionProfileOutput, error) {
req, out := c.DeleteMissionProfileRequest(input)
return out, req.Send()
} | 0.796555 | aws/aws-sdk-go | service/groundstation/api.go | aws/aws-sdk-go | service/groundstation/api.go | Apache-2.0 | go |
CreateMissionProfile API operation for AWS Ground Station.
Creates a mission profile.
dataflowEdges is a list of lists of strings. Each lower level list of strings
has two elements: a from ARN and a to ARN.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Ground Station's
API operation CreateMissionProfile for usage and error information.
Returned Error Types:
- InvalidParameterException
One or more parameters are not valid.
- DependencyException
Dependency encountered an error.
- ResourceNotFoundException
Resource was not found.
See also, https://docs.aws.amazon.com/goto/WebAPI/groundstation-2019-05-23/CreateMissionProfile | func (c *GroundStation) CreateMissionProfile(input *CreateMissionProfileInput) (*CreateMissionProfileOutput, error) {
req, out := c.CreateMissionProfileRequest(input)
return out, req.Send()
} | func (c *GroundStation) GetMissionProfile(input *GetMissionProfileInput) (*GetMissionProfileOutput, error) {
req, out := c.GetMissionProfileRequest(input)
return out, req.Send()
} | 0.796455 | aws/aws-sdk-go | service/groundstation/api.go | aws/aws-sdk-go | service/groundstation/api.go | Apache-2.0 | go |
CreateMissionProfile API operation for AWS Ground Station.
Creates a mission profile.
dataflowEdges is a list of lists of strings. Each lower level list of strings
has two elements: a from ARN and a to ARN.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Ground Station's
API operation CreateMissionProfile for usage and error information.
Returned Error Types:
- InvalidParameterException
One or more parameters are not valid.
- DependencyException
Dependency encountered an error.
- ResourceNotFoundException
Resource was not found.
See also, https://docs.aws.amazon.com/goto/WebAPI/groundstation-2019-05-23/CreateMissionProfile | func (c *GroundStation) CreateMissionProfile(input *CreateMissionProfileInput) (*CreateMissionProfileOutput, error) {
req, out := c.CreateMissionProfileRequest(input)
return out, req.Send()
} | func (c *GroundStation) UpdateMissionProfile(input *UpdateMissionProfileInput) (*UpdateMissionProfileOutput, error) {
req, out := c.UpdateMissionProfileRequest(input)
return out, req.Send()
} | 0.792585 | aws/aws-sdk-go | service/groundstation/api.go | aws/aws-sdk-go | service/groundstation/api.go | Apache-2.0 | go |
CreateMissionProfile API operation for AWS Ground Station.
Creates a mission profile.
dataflowEdges is a list of lists of strings. Each lower level list of strings
has two elements: a from ARN and a to ARN.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Ground Station's
API operation CreateMissionProfile for usage and error information.
Returned Error Types:
- InvalidParameterException
One or more parameters are not valid.
- DependencyException
Dependency encountered an error.
- ResourceNotFoundException
Resource was not found.
See also, https://docs.aws.amazon.com/goto/WebAPI/groundstation-2019-05-23/CreateMissionProfile | func (c *GroundStation) CreateMissionProfile(input *CreateMissionProfileInput) (*CreateMissionProfileOutput, error) {
req, out := c.CreateMissionProfileRequest(input)
return out, req.Send()
} | func (c *GroundStation) ListMissionProfiles(input *ListMissionProfilesInput) (*ListMissionProfilesOutput, error) {
req, out := c.ListMissionProfilesRequest(input)
return out, req.Send()
} | 0.707166 | aws/aws-sdk-go | service/groundstation/api.go | aws/aws-sdk-go | service/groundstation/api.go | Apache-2.0 | go |
CreateMissionProfile API operation for AWS Ground Station.
Creates a mission profile.
dataflowEdges is a list of lists of strings. Each lower level list of strings
has two elements: a from ARN and a to ARN.
Returns awserr.Error for service API and SDK errors. Use runtime type assertions
with awserr.Error's Code and Message methods to get detailed information about
the error.
See the AWS API reference guide for AWS Ground Station's
API operation CreateMissionProfile for usage and error information.
Returned Error Types:
- InvalidParameterException
One or more parameters are not valid.
- DependencyException
Dependency encountered an error.
- ResourceNotFoundException
Resource was not found.
See also, https://docs.aws.amazon.com/goto/WebAPI/groundstation-2019-05-23/CreateMissionProfile | func (c *GroundStation) CreateMissionProfile(input *CreateMissionProfileInput) (*CreateMissionProfileOutput, error) {
req, out := c.CreateMissionProfileRequest(input)
return out, req.Send()
} | func (c *GroundStation) CreateMissionProfileRequest(input *CreateMissionProfileInput) (req *request.Request, output *CreateMissionProfileOutput) {
op := &request.Operation{
Name: opCreateMissionProfile,
HTTPMethod: "POST",
HTTPPath: "/missionprofile",
}
if input == nil {
input = &CreateMissionProfileInput{}
}
output = &CreateMissionProfileOutput{}
req = c.newRequest(op, input, output)
return
} | 0.657097 | aws/aws-sdk-go | service/groundstation/api.go | aws/aws-sdk-go | service/groundstation/api.go | Apache-2.0 | go |
osRelease builds a string describing the operating system release based on the
properties of the os-release file. If no os-release file is found, or if the
required properties to build the release description string are missing, an empty
string is returned instead. For more information about os-release files, see:
https://www.freedesktop.org/software/systemd/man/os-release.html | func osRelease() string {
file, err := getOSReleaseFile()
if err != nil {
return ""
}
defer file.Close()
values := parseOSReleaseFile(file)
return buildOSRelease(values)
} | func osRelease() string {
file, err := getPlistFile()
if err != nil {
return ""
}
defer file.Close()
values, err := parsePlistFile(file)
if err != nil {
return ""
}
return buildOSRelease(values)
} | 0.907934 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go | Apache-2.0 | go |
osRelease builds a string describing the operating system release based on the
properties of the os-release file. If no os-release file is found, or if the
required properties to build the release description string are missing, an empty
string is returned instead. For more information about os-release files, see:
https://www.freedesktop.org/software/systemd/man/os-release.html | func osRelease() string {
file, err := getOSReleaseFile()
if err != nil {
return ""
}
defer file.Close()
values := parseOSReleaseFile(file)
return buildOSRelease(values)
} | func buildOSRelease(values map[string]string) string {
var osRelease string
name := values["NAME"]
version := values["VERSION"]
if version == "" {
version = values["VERSION_ID"]
}
if name != "" && version != "" {
osRelease = fmt.Sprintf("%s %s", name, version)
} else {
osRelease = values["PRETTY_NAME"]
}
return osRelease
} | 0.771936 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Apache-2.0 | go |
osRelease builds a string describing the operating system release based on the
properties of the os-release file. If no os-release file is found, or if the
required properties to build the release description string are missing, an empty
string is returned instead. For more information about os-release files, see:
https://www.freedesktop.org/software/systemd/man/os-release.html | func osRelease() string {
file, err := getOSReleaseFile()
if err != nil {
return ""
}
defer file.Close()
values := parseOSReleaseFile(file)
return buildOSRelease(values)
} | func buildOSRelease(properties map[string]string) string {
productName := properties["ProductName"]
productVersion := properties["ProductVersion"]
productBuildVersion := properties["ProductBuildVersion"]
if productName == "" || productVersion == "" || productBuildVersion == "" {
return ""
}
return fmt.Sprintf("%s %s (%s)", productName, productVersion, productBuildVersion)
} | 0.768595 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go | Apache-2.0 | go |
osRelease builds a string describing the operating system release based on the
properties of the os-release file. If no os-release file is found, or if the
required properties to build the release description string are missing, an empty
string is returned instead. For more information about os-release files, see:
https://www.freedesktop.org/software/systemd/man/os-release.html | func osRelease() string {
file, err := getOSReleaseFile()
if err != nil {
return ""
}
defer file.Close()
values := parseOSReleaseFile(file)
return buildOSRelease(values)
} | func platformOSDescription() (string, error) {
uname, err := uname()
if err != nil {
return "", err
}
osRelease := osRelease()
if osRelease != "" {
return fmt.Sprintf("%s (%s)", osRelease, uname), nil
}
return uname, nil
} | 0.715838 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go | Apache-2.0 | go |
osRelease builds a string describing the operating system release based on the
properties of the os-release file. If no os-release file is found, or if the
required properties to build the release description string are missing, an empty
string is returned instead. For more information about os-release files, see:
https://www.freedesktop.org/software/systemd/man/os-release.html | func osRelease() string {
file, err := getOSReleaseFile()
if err != nil {
return ""
}
defer file.Close()
values := parseOSReleaseFile(file)
return buildOSRelease(values)
} | func getOSReleaseFile() (*os.File, error) {
return getFirstAvailableFile([]string{"/etc/os-release", "/usr/lib/os-release"})
} | 0.715333 | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Mirantis/cri-dockerd | vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go | Apache-2.0 | go |
ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation,
calling the "fn" function with the response data for each page. To stop
iterating, return false from the fn function.
See ListJobsByStatus method for more information on how to use this operation.
Note: This operation can generate multiple requests to a service.
// Example iterating over at most 3 pages of a ListJobsByStatus operation.
pageNum := 0
err := client.ListJobsByStatusPages(params,
func(page *elastictranscoder.ListJobsByStatusOutput, lastPage bool) bool {
pageNum++
fmt.Println(page)
return pageNum <= 3
}) | func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error {
return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn)
} | func (c *GlueDataBrew) ListJobsPages(input *ListJobsInput, fn func(*ListJobsOutput, bool) bool) error {
return c.ListJobsPagesWithContext(aws.BackgroundContext(), input, fn)
} | 0.881418 | aws/aws-sdk-go | service/elastictranscoder/api.go | aws/aws-sdk-go | service/gluedatabrew/api.go | Apache-2.0 | go |
ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation,
calling the "fn" function with the response data for each page. To stop
iterating, return false from the fn function.
See ListJobsByStatus method for more information on how to use this operation.
Note: This operation can generate multiple requests to a service.
// Example iterating over at most 3 pages of a ListJobsByStatus operation.
pageNum := 0
err := client.ListJobsByStatusPages(params,
func(page *elastictranscoder.ListJobsByStatusOutput, lastPage bool) bool {
pageNum++
fmt.Println(page)
return pageNum <= 3
}) | func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error {
return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn)
} | func (c *Snowball) ListJobsPages(input *ListJobsInput, fn func(*ListJobsOutput, bool) bool) error {
return c.ListJobsPagesWithContext(aws.BackgroundContext(), input, fn)
} | 0.878534 | aws/aws-sdk-go | service/elastictranscoder/api.go | aws/aws-sdk-go | service/snowball/api.go | Apache-2.0 | go |
ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation,
calling the "fn" function with the response data for each page. To stop
iterating, return false from the fn function.
See ListJobsByStatus method for more information on how to use this operation.
Note: This operation can generate multiple requests to a service.
// Example iterating over at most 3 pages of a ListJobsByStatus operation.
pageNum := 0
err := client.ListJobsByStatusPages(params,
func(page *elastictranscoder.ListJobsByStatusOutput, lastPage bool) bool {
pageNum++
fmt.Println(page)
return pageNum <= 3
}) | func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error {
return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn)
} | func (c *Amplify) ListJobsPages(input *ListJobsInput, fn func(*ListJobsOutput, bool) bool) error {
return c.ListJobsPagesWithContext(aws.BackgroundContext(), input, fn)
} | 0.876879 | aws/aws-sdk-go | service/elastictranscoder/api.go | aws/aws-sdk-go | service/amplify/api.go | Apache-2.0 | go |
ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation,
calling the "fn" function with the response data for each page. To stop
iterating, return false from the fn function.
See ListJobsByStatus method for more information on how to use this operation.
Note: This operation can generate multiple requests to a service.
// Example iterating over at most 3 pages of a ListJobsByStatus operation.
pageNum := 0
err := client.ListJobsByStatusPages(params,
func(page *elastictranscoder.ListJobsByStatusOutput, lastPage bool) bool {
pageNum++
fmt.Println(page)
return pageNum <= 3
}) | func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error {
return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn)
} | func (c *IoT) ListJobsPages(input *ListJobsInput, fn func(*ListJobsOutput, bool) bool) error {
return c.ListJobsPagesWithContext(aws.BackgroundContext(), input, fn)
} | 0.875062 | aws/aws-sdk-go | service/elastictranscoder/api.go | aws/aws-sdk-go | service/iot/api.go | Apache-2.0 | go |
ListJobsByStatusPages iterates over the pages of a ListJobsByStatus operation,
calling the "fn" function with the response data for each page. To stop
iterating, return false from the fn function.
See ListJobsByStatus method for more information on how to use this operation.
Note: This operation can generate multiple requests to a service.
// Example iterating over at most 3 pages of a ListJobsByStatus operation.
pageNum := 0
err := client.ListJobsByStatusPages(params,
func(page *elastictranscoder.ListJobsByStatusOutput, lastPage bool) bool {
pageNum++
fmt.Println(page)
return pageNum <= 3
}) | func (c *ElasticTranscoder) ListJobsByStatusPages(input *ListJobsByStatusInput, fn func(*ListJobsByStatusOutput, bool) bool) error {
return c.ListJobsByStatusPagesWithContext(aws.BackgroundContext(), input, fn)
} | func (c *Glacier) ListJobsPages(input *ListJobsInput, fn func(*ListJobsOutput, bool) bool) error {
return c.ListJobsPagesWithContext(aws.BackgroundContext(), input, fn)
} | 0.874983 | aws/aws-sdk-go | service/elastictranscoder/api.go | aws/aws-sdk-go | service/glacier/api.go | Apache-2.0 | go |
RecoveryActions returns actions that service controller performs when service fails.
The service control manager counts the number of times service s has failed since the system booted.
The count is reset to 0 if the service has not failed for ResetPeriod seconds.
When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of returned slice.
If N is greater than slice length, the service controller repeats the last action in the slice. | func (s *Service) RecoveryActions() ([]RecoveryAction, error) {
b, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_FAILURE_ACTIONS)
if err != nil {
return nil, err
}
p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0]))
if p.Actions == nil {
return nil, err
}
var recoveryActions []RecoveryAction
actions := (*[1024]windows.SC_ACTION)(unsafe.Pointer(p.Actions))[:p.ActionsCount]
for _, action := range actions {
recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond})
}
return recoveryActions, nil
} | func (s *Service) SetRecoveryActions(recoveryActions []RecoveryAction, resetPeriod uint32) error {
if recoveryActions == nil {
return errors.New("recoveryActions cannot be nil")
}
actions := []windows.SC_ACTION{}
for _, a := range recoveryActions {
action := windows.SC_ACTION{
Type: uint32(a.Type),
Delay: uint32(a.Delay.Nanoseconds() / 1000000),
}
actions = append(actions, action)
}
rActions := windows.SERVICE_FAILURE_ACTIONS{
ActionsCount: uint32(len(actions)),
Actions: &actions[0],
ResetPeriod: resetPeriod,
}
return windows.ChangeServiceConfig2(s.Handle, windows.SERVICE_CONFIG_FAILURE_ACTIONS, (*byte)(unsafe.Pointer(&rActions)))
} | 0.753752 | genuinetools/binctr | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | genuinetools/binctr | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | MIT | go |
RecoveryActions returns actions that service controller performs when service fails.
The service control manager counts the number of times service s has failed since the system booted.
The count is reset to 0 if the service has not failed for ResetPeriod seconds.
When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of returned slice.
If N is greater than slice length, the service controller repeats the last action in the slice. | func (s *Service) RecoveryActions() ([]RecoveryAction, error) {
b, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_FAILURE_ACTIONS)
if err != nil {
return nil, err
}
p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0]))
if p.Actions == nil {
return nil, err
}
var recoveryActions []RecoveryAction
actions := (*[1024]windows.SC_ACTION)(unsafe.Pointer(p.Actions))[:p.ActionsCount]
for _, action := range actions {
recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond})
}
return recoveryActions, nil
} | func (s *Service) RecoveryActionsOnNonCrashFailures() (bool, error) {
b, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_FAILURE_ACTIONS_FLAG)
if err != nil {
return false, err
}
p := (*windows.SERVICE_FAILURE_ACTIONS_FLAG)(unsafe.Pointer(&b[0]))
return p.FailureActionsOnNonCrashFailures != 0, nil
} | 0.691267 | genuinetools/binctr | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | moby/buildkit | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | Apache-2.0 | go |
RecoveryActions returns actions that service controller performs when service fails.
The service control manager counts the number of times service s has failed since the system booted.
The count is reset to 0 if the service has not failed for ResetPeriod seconds.
When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of returned slice.
If N is greater than slice length, the service controller repeats the last action in the slice. | func (s *Service) RecoveryActions() ([]RecoveryAction, error) {
b, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_FAILURE_ACTIONS)
if err != nil {
return nil, err
}
p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0]))
if p.Actions == nil {
return nil, err
}
var recoveryActions []RecoveryAction
actions := (*[1024]windows.SC_ACTION)(unsafe.Pointer(p.Actions))[:p.ActionsCount]
for _, action := range actions {
recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond})
}
return recoveryActions, nil
} | func (s *Service) SetRecoveryActionsOnNonCrashFailures(flag bool) error {
var setting windows.SERVICE_FAILURE_ACTIONS_FLAG
if flag {
setting.FailureActionsOnNonCrashFailures = 1
}
return windows.ChangeServiceConfig2(s.Handle, windows.SERVICE_CONFIG_FAILURE_ACTIONS_FLAG, (*byte)(unsafe.Pointer(&setting)))
} | 0.626158 | genuinetools/binctr | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | moby/buildkit | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | Apache-2.0 | go |
RecoveryActions returns actions that service controller performs when service fails.
The service control manager counts the number of times service s has failed since the system booted.
The count is reset to 0 if the service has not failed for ResetPeriod seconds.
When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of returned slice.
If N is greater than slice length, the service controller repeats the last action in the slice. | func (s *Service) RecoveryActions() ([]RecoveryAction, error) {
b, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_FAILURE_ACTIONS)
if err != nil {
return nil, err
}
p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0]))
if p.Actions == nil {
return nil, err
}
var recoveryActions []RecoveryAction
actions := (*[1024]windows.SC_ACTION)(unsafe.Pointer(p.Actions))[:p.ActionsCount]
for _, action := range actions {
recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond})
}
return recoveryActions, nil
} | func (s *Service) HandleFailedActions() {
errChan := make(chan error, len(s.WebHook)+len(s.Command))
errored := false
retryAll := s.shouldRetryAll()
potentialErrors := 0
// Send the WebHook(s).
if len(s.WebHook) != 0 {
potentialErrors += len(s.WebHook)
for key, wh := range s.WebHook {
if retryAll || util.DereferenceOrNilValue(s.Status.Fails.WebHook.Get(key), true) {
// Skip if before NextRunnable.
if !wh.IsRunnable() {
potentialErrors--
continue
}
// Send.
go func(wh *webhook.WebHook) {
err := wh.Send(s.ServiceInfo(), false)
errChan <- err
}(wh)
// Space out WebHooks.
//#nosec G404 -- sleep does not need cryptographic security.
time.Sleep(time.Duration(100+rand.Intn(150)) * time.Millisecond)
} else {
potentialErrors--
}
}
}
// Run the Command(s).
if len(s.Command) != 0 {
potentialErrors += len(s.Command)
logFrom := logutil.LogFrom{Primary: "Command", Secondary: s.ID}
for key := range s.Command {
if retryAll || util.DereferenceOrNilValue(s.Status.Fails.Command.Get(key), true) {
// Skip if before NextRunnable.
if !s.CommandController.IsRunnable(key) {
potentialErrors--
continue
}
// Run.
go func(key int) {
err := s.CommandController.ExecIndex(logFrom, key)
errChan <- err
}(key)
// Space out Commands.
//#nosec G404 -- sleep does not need cryptographic security.
time.Sleep(time.Duration(100+rand.Intn(150)) * time.Millisecond)
} else {
potentialErrors--
}
}
}
for potentialErrors != 0 {
if err := <-errChan; err != nil {
errored = true
}
potentialErrors--
}
if !errored {
s.UpdatedVersion(true)
}
} | 0.56207 | genuinetools/binctr | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | release-argus/Argus | service/handlers.go | Apache-2.0 | go |
RecoveryActions returns actions that service controller performs when service fails.
The service control manager counts the number of times service s has failed since the system booted.
The count is reset to 0 if the service has not failed for ResetPeriod seconds.
When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of returned slice.
If N is greater than slice length, the service controller repeats the last action in the slice. | func (s *Service) RecoveryActions() ([]RecoveryAction, error) {
b, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_FAILURE_ACTIONS)
if err != nil {
return nil, err
}
p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0]))
if p.Actions == nil {
return nil, err
}
var recoveryActions []RecoveryAction
actions := (*[1024]windows.SC_ACTION)(unsafe.Pointer(p.Actions))[:p.ActionsCount]
for _, action := range actions {
recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond})
}
return recoveryActions, nil
} | func ControllerDumpOnFail(ctx context.Context, kubectlCli *kubectl.Cli, outLog io.Writer,
outDir string, namespaces []string) func() {
return func() {
for _, ns := range namespaces {
controllerPodNames, err := kubectlCli.GetPodsInNsWithLabel(ctx, ns, "kgateway=kgateway")
if err != nil {
fmt.Printf("error fetching controller pod names: %f\n", err)
continue
}
if len(controllerPodNames) == 0 {
fmt.Printf("no kgateway=kgateway pods found in namespace %s\n", ns)
continue
}
fmt.Printf("found controller pods: %s\n", strings.Join(controllerPodNames, ", "))
namespaceOutDir := filepath.Join(outDir, ns)
setupOutDir(namespaceOutDir)
for _, podName := range controllerPodNames {
writeControllerLog(ctx, namespaceOutDir, ns, podName, kubectlCli)
writeMetricsLog(ctx, namespaceOutDir, ns, podName, kubectlCli)
// Open a port-forward to the controller pod's admin port
portForwarder, err := kubectlCli.StartPortForward(ctx,
portforward.WithPod(podName, ns),
portforward.WithPorts(int(wellknown.KgatewayAdminPort), int(wellknown.KgatewayAdminPort)),
)
if err != nil {
fmt.Printf("error starting port forward to controller admin port: %f\n", err)
}
defer func() {
portForwarder.Close()
portForwarder.WaitForStop()
}()
adminClient := kgatewayAdminCli.NewClient().
WithReceiver(io.Discard).
WithCurlOptions(
curl.WithRetries(3, 0, 10),
curl.WithPort(int(wellknown.KgatewayAdminPort)),
)
krtSnapshotFile := fileAtPath(filepath.Join(namespaceOutDir, fmt.Sprintf("%s.krt_snapshot.log", podName)))
err = adminClient.KrtSnapshotCmd(ctx).WithStdout(krtSnapshotFile).Run().Cause()
if err != nil {
fmt.Printf("error running krt snapshot command: %f\n", err)
}
xdsSnapshotFile := fileAtPath(filepath.Join(namespaceOutDir, fmt.Sprintf("%s.xds_snapshot.log", podName)))
err = adminClient.XdsSnapshotCmd(ctx).WithStdout(xdsSnapshotFile).Run().Cause()
if err != nil {
fmt.Printf("error running xds snapshot command: %f\n", err)
}
fmt.Printf("finished dumping controller state\n")
}
}
}
} | 0.472035 | genuinetools/binctr | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | kgateway-dev/kgateway | test/helpers/kube_dump.go | Apache-2.0 | go |
GetStatic returns the home directory for the current user without calling
os/user.Current(). This is useful for static-linked binary on glibc-based
system, because a call to os/user.Current() in a static binary leads to
segfault due to a glibc issue that won't be fixed in a short term.
(#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) | func GetStatic() (string, error) {
uid := os.Getuid()
usr, err := idtools.LookupUID(uid)
if err != nil {
return "", err
}
return usr.Home, nil
} | func getHomeDir() string {
homeDir := os.Getenv("HOME")
if homeDir != "" {
return homeDir
}
if u, err := user.Current(); err == nil {
return u.HomeDir
}
return "/"
} | 0.680567 | genuinetools/binctr | vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go | Mirantis/cri-dockerd | vendor/github.com/godbus/dbus/v5/homedir.go | Apache-2.0 | go |
GetStatic returns the home directory for the current user without calling
os/user.Current(). This is useful for static-linked binary on glibc-based
system, because a call to os/user.Current() in a static binary leads to
segfault due to a glibc issue that won't be fixed in a short term.
(#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) | func GetStatic() (string, error) {
uid := os.Getuid()
usr, err := idtools.LookupUID(uid)
if err != nil {
return "", err
}
return usr.Home, nil
} | func Get() string {
homedir, _ := unshare.HomeDir()
return homedir
} | 0.675578 | genuinetools/binctr | vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go | containers/podman-tui | vendor/github.com/containers/storage/pkg/homedir/homedir_unix.go | Apache-2.0 | go |
GetStatic returns the home directory for the current user without calling
os/user.Current(). This is useful for static-linked binary on glibc-based
system, because a call to os/user.Current() in a static binary leads to
segfault due to a glibc issue that won't be fixed in a short term.
(#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) | func GetStatic() (string, error) {
uid := os.Getuid()
usr, err := idtools.LookupUID(uid)
if err != nil {
return "", err
}
return usr.Home, nil
} | func Get() string {
home, _ := os.UserHomeDir()
if home == "" && runtime.GOOS != "windows" {
if u, err := user.Current(); err == nil {
return u.HomeDir
}
}
return home
} | 0.672564 | genuinetools/binctr | vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go | containers/podman-tui | vendor/github.com/docker/docker/pkg/homedir/homedir.go | Apache-2.0 | go |
GetStatic returns the home directory for the current user without calling
os/user.Current(). This is useful for static-linked binary on glibc-based
system, because a call to os/user.Current() in a static binary leads to
segfault due to a glibc issue that won't be fixed in a short term.
(#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) | func GetStatic() (string, error) {
uid := os.Getuid()
usr, err := idtools.LookupUID(uid)
if err != nil {
return "", err
}
return usr.Home, nil
} | func Get() string {
home := os.Getenv(Key())
if home != "" {
return home
}
home, _ = os.UserHomeDir()
return home
} | 0.657401 | genuinetools/binctr | vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go | containers/podman-tui | vendor/github.com/containers/storage/pkg/homedir/homedir_windows.go | Apache-2.0 | go |
GetStatic returns the home directory for the current user without calling
os/user.Current(). This is useful for static-linked binary on glibc-based
system, because a call to os/user.Current() in a static binary leads to
segfault due to a glibc issue that won't be fixed in a short term.
(#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) | func GetStatic() (string, error) {
uid := os.Getuid()
usr, err := idtools.LookupUID(uid)
if err != nil {
return "", err
}
return usr.Home, nil
} | func Dir() (string, error) {
if !DisableCache {
cacheLock.RLock()
cached := homedirCache
cacheLock.RUnlock()
if cached != "" {
return cached, nil
}
}
cacheLock.Lock()
defer cacheLock.Unlock()
var result string
var err error
if runtime.GOOS == "windows" {
result, err = dirWindows()
} else {
// Unix-like system, so just assume Unix
result, err = dirUnix()
}
if err != nil {
return "", err
}
homedirCache = result
return result, nil
} | 0.628694 | genuinetools/binctr | vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go | tektoncd/cli | vendor/github.com/mitchellh/go-homedir/homedir.go | Apache-2.0 | go |
NewModelGardenRESTClient creates a new model garden service rest client.
The interface of Model Garden Service. | func NewModelGardenRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelGardenClient, error) {
clientOpts := append(defaultModelGardenRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelGardenRESTCallOptions()
c := &modelGardenRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelGardenClient{internalClient: c, CallOptions: callOpts}, nil
} | func NewModelRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelClient, error) {
clientOpts := append(defaultModelRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelRESTCallOptions()
c := &modelRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelClient{internalClient: c, CallOptions: callOpts}, nil
} | 0.78499 | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_garden_client.go | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_client.go | Apache-2.0 | go |
NewModelGardenRESTClient creates a new model garden service rest client.
The interface of Model Garden Service. | func NewModelGardenRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelGardenClient, error) {
clientOpts := append(defaultModelGardenRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelGardenRESTCallOptions()
c := &modelGardenRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelGardenClient{internalClient: c, CallOptions: callOpts}, nil
} | func NewModelRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelClient, error) {
clientOpts := append(defaultModelRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelRESTCallOptions()
c := &modelRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
return &ModelClient{internalClient: c, CallOptions: callOpts}, nil
} | 0.775776 | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_garden_client.go | googleapis/google-cloud-go | ai/generativelanguage/apiv1beta2/model_client.go | Apache-2.0 | go |
NewModelGardenRESTClient creates a new model garden service rest client.
The interface of Model Garden Service. | func NewModelGardenRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelGardenClient, error) {
clientOpts := append(defaultModelGardenRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelGardenRESTCallOptions()
c := &modelGardenRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelGardenClient{internalClient: c, CallOptions: callOpts}, nil
} | func NewModelGardenClient(ctx context.Context, opts ...option.ClientOption) (*ModelGardenClient, error) {
clientOpts := defaultModelGardenGRPCClientOptions()
if newModelGardenClientHook != nil {
hookOpts, err := newModelGardenClientHook(ctx, clientHookParams{})
if err != nil {
return nil, err
}
clientOpts = append(clientOpts, hookOpts...)
}
connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
if err != nil {
return nil, err
}
client := ModelGardenClient{CallOptions: defaultModelGardenCallOptions()}
c := &modelGardenGRPCClient{
connPool: connPool,
modelGardenClient: aiplatformpb.NewModelGardenServiceClient(connPool),
CallOptions: &client.CallOptions,
logger: internaloption.GetLogger(opts),
operationsClient: longrunningpb.NewOperationsClient(connPool),
iamPolicyClient: iampb.NewIAMPolicyClient(connPool),
locationsClient: locationpb.NewLocationsClient(connPool),
}
c.setGoogleClientInfo()
client.internalClient = c
return &client, nil
} | 0.7422 | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_garden_client.go | googleapis/google-cloud-go | aiplatform/apiv1/model_garden_client.go | Apache-2.0 | go |
NewModelGardenRESTClient creates a new model garden service rest client.
The interface of Model Garden Service. | func NewModelGardenRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelGardenClient, error) {
clientOpts := append(defaultModelGardenRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelGardenRESTCallOptions()
c := &modelGardenRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelGardenClient{internalClient: c, CallOptions: callOpts}, nil
} | func NewUserRESTClient(ctx context.Context, opts ...option.ClientOption) (*UserClient, error) {
clientOpts := append(defaultUserRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultUserRESTCallOptions()
c := &userRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
return &UserClient{internalClient: c, CallOptions: callOpts}, nil
} | 0.726358 | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_garden_client.go | googleapis/google-cloud-go | shopping/merchant/accounts/apiv1beta/user_client.go | Apache-2.0 | go |
NewModelGardenRESTClient creates a new model garden service rest client.
The interface of Model Garden Service. | func NewModelGardenRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelGardenClient, error) {
clientOpts := append(defaultModelGardenRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelGardenRESTCallOptions()
c := &modelGardenRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelGardenClient{internalClient: c, CallOptions: callOpts}, nil
} | func NewModelMonitoringRESTClient(ctx context.Context, opts ...option.ClientOption) (*ModelMonitoringClient, error) {
clientOpts := append(defaultModelMonitoringRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultModelMonitoringRESTCallOptions()
c := &modelMonitoringRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
logger: internaloption.GetLogger(opts),
}
c.setGoogleClientInfo()
lroOpts := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...)
if err != nil {
return nil, err
}
c.LROClient = &opClient
return &ModelMonitoringClient{internalClient: c, CallOptions: callOpts}, nil
} | 0.70808 | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_garden_client.go | googleapis/google-cloud-go | aiplatform/apiv1beta1/model_monitoring_client.go | Apache-2.0 | go |
DeleteAccessControlConfigurationWithContext is the same as DeleteAccessControlConfiguration with the addition of
the ability to pass a context and additional request options.
See DeleteAccessControlConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *Kendra) DeleteAccessControlConfigurationWithContext(ctx aws.Context, input *DeleteAccessControlConfigurationInput, opts ...request.Option) (*DeleteAccessControlConfigurationOutput, error) {
req, out := c.DeleteAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *Kendra) UpdateAccessControlConfigurationWithContext(ctx aws.Context, input *UpdateAccessControlConfigurationInput, opts ...request.Option) (*UpdateAccessControlConfigurationOutput, error) {
req, out := c.UpdateAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.848435 | aws/aws-sdk-go | service/kendra/api.go | aws/aws-sdk-go | service/kendra/api.go | Apache-2.0 | go |
DeleteAccessControlConfigurationWithContext is the same as DeleteAccessControlConfiguration with the addition of
the ability to pass a context and additional request options.
See DeleteAccessControlConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *Kendra) DeleteAccessControlConfigurationWithContext(ctx aws.Context, input *DeleteAccessControlConfigurationInput, opts ...request.Option) (*DeleteAccessControlConfigurationOutput, error) {
req, out := c.DeleteAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *Kendra) CreateAccessControlConfigurationWithContext(ctx aws.Context, input *CreateAccessControlConfigurationInput, opts ...request.Option) (*CreateAccessControlConfigurationOutput, error) {
req, out := c.CreateAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.835472 | aws/aws-sdk-go | service/kendra/api.go | aws/aws-sdk-go | service/kendra/api.go | Apache-2.0 | go |
DeleteAccessControlConfigurationWithContext is the same as DeleteAccessControlConfiguration with the addition of
the ability to pass a context and additional request options.
See DeleteAccessControlConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *Kendra) DeleteAccessControlConfigurationWithContext(ctx aws.Context, input *DeleteAccessControlConfigurationInput, opts ...request.Option) (*DeleteAccessControlConfigurationOutput, error) {
req, out := c.DeleteAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *WorkMail) DeleteAccessControlRuleWithContext(ctx aws.Context, input *DeleteAccessControlRuleInput, opts ...request.Option) (*DeleteAccessControlRuleOutput, error) {
req, out := c.DeleteAccessControlRuleRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.831203 | aws/aws-sdk-go | service/kendra/api.go | aws/aws-sdk-go | service/workmail/api.go | Apache-2.0 | go |
DeleteAccessControlConfigurationWithContext is the same as DeleteAccessControlConfiguration with the addition of
the ability to pass a context and additional request options.
See DeleteAccessControlConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *Kendra) DeleteAccessControlConfigurationWithContext(ctx aws.Context, input *DeleteAccessControlConfigurationInput, opts ...request.Option) (*DeleteAccessControlConfigurationOutput, error) {
req, out := c.DeleteAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *SSOAdmin) DeleteInstanceAccessControlAttributeConfigurationWithContext(ctx aws.Context, input *DeleteInstanceAccessControlAttributeConfigurationInput, opts ...request.Option) (*DeleteInstanceAccessControlAttributeConfigurationOutput, error) {
req, out := c.DeleteInstanceAccessControlAttributeConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.82946 | aws/aws-sdk-go | service/kendra/api.go | aws/aws-sdk-go | service/ssoadmin/api.go | Apache-2.0 | go |
DeleteAccessControlConfigurationWithContext is the same as DeleteAccessControlConfiguration with the addition of
the ability to pass a context and additional request options.
See DeleteAccessControlConfiguration for details on how to use this API operation.
The context must be non-nil and will be used for request cancellation. If
the context is nil a panic will occur. In the future the SDK may create
sub-contexts for http.Requests. See https://golang.org/pkg/context/
for more information on using Contexts. | func (c *Kendra) DeleteAccessControlConfigurationWithContext(ctx aws.Context, input *DeleteAccessControlConfigurationInput, opts ...request.Option) (*DeleteAccessControlConfigurationOutput, error) {
req, out := c.DeleteAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | func (c *Kendra) DescribeAccessControlConfigurationWithContext(ctx aws.Context, input *DescribeAccessControlConfigurationInput, opts ...request.Option) (*DescribeAccessControlConfigurationOutput, error) {
req, out := c.DescribeAccessControlConfigurationRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
} | 0.824397 | aws/aws-sdk-go | service/kendra/api.go | aws/aws-sdk-go | service/kendra/api.go | Apache-2.0 | go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.