github.com/newrelic/newrelic-client-go@v1.1.0/pkg/installevents/installevents_api.go (about)

     1  // Code generated by tutone: DO NOT EDIT
     2  package installevents
     3  
     4  import "context"
     5  
     6  // Creates a new install status.
     7  // An install status is created on behalf of the newrelic-cli whenever the CLI has started an installation and completed an installation.
     8  //
     9  // Guided install: https://docs.newrelic.com/docs/full-stack-observability/observe-everything/get-started/new-relic-guided-install-overview/
    10  // newrelic-cli: https://github.com/newrelic/newrelic-cli
    11  func (a *Installevents) InstallationCreateInstallStatus(
    12  	accountID int,
    13  	installStatus InstallationInstallStatusInput,
    14  ) (*InstallationInstallStatus, error) {
    15  	return a.InstallationCreateInstallStatusWithContext(context.Background(),
    16  		accountID,
    17  		installStatus,
    18  	)
    19  }
    20  
    21  // Creates a new install status.
    22  // An install status is created on behalf of the newrelic-cli whenever the CLI has started an installation and completed an installation.
    23  //
    24  // Guided install: https://docs.newrelic.com/docs/full-stack-observability/observe-everything/get-started/new-relic-guided-install-overview/
    25  // newrelic-cli: https://github.com/newrelic/newrelic-cli
    26  func (a *Installevents) InstallationCreateInstallStatusWithContext(
    27  	ctx context.Context,
    28  	accountID int,
    29  	installStatus InstallationInstallStatusInput,
    30  ) (*InstallationInstallStatus, error) {
    31  
    32  	resp := InstallationCreateInstallStatusQueryResponse{}
    33  	vars := map[string]interface{}{
    34  		"accountId":     accountID,
    35  		"installStatus": installStatus,
    36  	}
    37  
    38  	if err := a.client.NerdGraphQueryWithContext(ctx, InstallationCreateInstallStatusMutation, vars, &resp); err != nil {
    39  		return nil, err
    40  	}
    41  
    42  	return &resp.InstallationInstallStatus, nil
    43  }
    44  
    45  type InstallationCreateInstallStatusQueryResponse struct {
    46  	InstallationInstallStatus InstallationInstallStatus `json:"InstallationCreateInstallStatus"`
    47  }
    48  
    49  const InstallationCreateInstallStatusMutation = `mutation(
    50  	$accountId: Int!,
    51  	$installStatus: InstallationInstallStatusInput!,
    52  ) { installationCreateInstallStatus(
    53  	accountId: $accountId,
    54  	installStatus: $installStatus,
    55  ) {
    56  	cliVersion
    57  	enabledProxy
    58  	error {
    59  		details
    60  		message
    61  	}
    62  	hostName
    63  	installId
    64  	installLibraryVersion
    65  	isUnsupported
    66  	kernelArch
    67  	kernelVersion
    68  	logFilePath
    69  	os
    70  	platform
    71  	platformFamily
    72  	platformVersion
    73  	redirectUrl
    74  	state
    75  	targetedInstall
    76  } }`
    77  
    78  // Creates a new recipe event.
    79  // - A recipe event is created on behalf of the newrelic-cli whenever the CLI attempts to install the infrastructure-agent, for example.
    80  // - A recipe event is appended to any existing recipe events, if there are any present in the cache.
    81  //
    82  // Guided install: https://docs.newrelic.com/docs/full-stack-observability/observe-everything/get-started/new-relic-guided-install-overview/
    83  // newrelic-cli: https://github.com/newrelic/newrelic-cli
    84  func (a *Installevents) InstallationCreateRecipeEvent(
    85  	accountID int,
    86  	status InstallationRecipeStatus,
    87  ) (*InstallationRecipeEvent, error) {
    88  	return a.InstallationCreateRecipeEventWithContext(context.Background(),
    89  		accountID,
    90  		status,
    91  	)
    92  }
    93  
    94  // Creates a new recipe event.
    95  // - A recipe event is created on behalf of the newrelic-cli whenever the CLI attempts to install the infrastructure-agent, for example.
    96  // - A recipe event is appended to any existing recipe events, if there are any present in the cache.
    97  //
    98  // Guided install: https://docs.newrelic.com/docs/full-stack-observability/observe-everything/get-started/new-relic-guided-install-overview/
    99  // newrelic-cli: https://github.com/newrelic/newrelic-cli
   100  func (a *Installevents) InstallationCreateRecipeEventWithContext(
   101  	ctx context.Context,
   102  	accountID int,
   103  	status InstallationRecipeStatus,
   104  ) (*InstallationRecipeEvent, error) {
   105  
   106  	resp := InstallationCreateRecipeEventQueryResponse{}
   107  	vars := map[string]interface{}{
   108  		"accountId": accountID,
   109  		"status":    status,
   110  	}
   111  
   112  	if err := a.client.NerdGraphQueryWithContext(ctx, InstallationCreateRecipeEventMutation, vars, &resp); err != nil {
   113  		return nil, err
   114  	}
   115  
   116  	return &resp.InstallationRecipeEvent, nil
   117  }
   118  
   119  type InstallationCreateRecipeEventQueryResponse struct {
   120  	InstallationRecipeEvent InstallationRecipeEvent `json:"InstallationCreateRecipeEvent"`
   121  }
   122  
   123  const InstallationCreateRecipeEventMutation = `mutation(
   124  	$accountId: Int!,
   125  	$status: InstallationRecipeStatus!,
   126  ) { installationCreateRecipeEvent(
   127  	accountId: $accountId,
   128  	status: $status,
   129  ) {
   130  	cliVersion
   131  	complete
   132  	displayName
   133  	entityGuid
   134  	error {
   135  		details
   136  		message
   137  	}
   138  	hostName
   139  	installId
   140  	installLibraryVersion
   141  	kernelArch
   142  	kernelVersion
   143  	logFilePath
   144  	metadata
   145  	name
   146  	os
   147  	platform
   148  	platformFamily
   149  	platformVersion
   150  	redirectUrl
   151  	status
   152  	targetedInstall
   153  	taskPath
   154  	timestamp
   155  	validationDurationMilliseconds
   156  } }`